Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
feat(contracts): add Local models contracts
Dongdong Chen6a2550595377
diff --git a/apps/computer/local-daemon/internal/linger/transport/gateway.go b/apps/computer/local-daemon/internal/linger/transport/gateway.goindex d410ae74..2795ec30 100644--- a/apps/computer/local-daemon/internal/linger/transport/gateway.go+++ b/apps/computer/local-daemon/internal/linger/transport/gateway.go@@ -142,6 +142,7 @@ var agentShapes = map[string]func() wire.Shape{"CapabilitySkillsScan": func() wire.Shape { return &wire.CapabilitySkillsScan{} },"CapabilityBrowserConnect": func() wire.Shape { return &wire.CapabilityBrowserConnect{} },"CapabilityComputerPermission": func() wire.Shape { return &wire.CapabilityComputerPermission{} },+ "CapabilityLocalModelsExecute": func() wire.Shape { return &wire.CapabilityLocalModelsExecute{} },"OperationPrepare": func() wire.Shape { return &wire.OperationPrepare{} },"ProviderPrepare": func() wire.Shape { return &wire.ProviderPrepare{} },"SessionCompact": func() wire.Shape { return &wire.SessionCompact{} },@@ -268,7 +269,7 @@ func decodeGatewayCommand(encoded []byte) (protocol.Command, error) {protocol.CommandSessionCompact, protocol.CommandModelInvoke, protocol.CommandComputerToolCall,protocol.CommandDebugInspect, protocol.CommandAgentCLICredentialPut,protocol.CommandCapabilitySkillsScan, protocol.CommandCapabilityBrowserConnect,- protocol.CommandCapabilityComputerPermission:+ protocol.CommandCapabilityComputerPermission, protocol.CommandCapabilityLocalModels:// Their handlers decode the generated shape from the frame itself.command.Payload = append(json.RawMessage(nil), encoded...)}@@ -424,6 +425,8 @@ func (s *gatewayStream) Send(ctx context.Context, event protocol.Event) error {case event.Type == protocol.EventCapabilitySkillsScanned || event.Type == protocol.EventCapabilitySkillsFailed ||event.Type == protocol.EventCapabilityBrowserConnected || event.Type == protocol.EventCapabilityBrowserFailed ||event.Type == protocol.EventCapabilityComputerPermissionSucceeded || event.Type == protocol.EventCapabilityComputerPermissionFailed ||+ event.Type == protocol.EventCapabilityLocalModelsAccepted || event.Type == protocol.EventCapabilityLocalModelsRefused ||+ event.Type == protocol.EventLocalModels ||event.Type == protocol.EventProviderPrepared || event.Type == protocol.EventSessionCompacted ||event.Type == protocol.EventModelInvoked || event.Type == protocol.EventComputerToolResult:// Their handlers already encode the generated wire shape.diff --git a/apps/computer/local-daemon/internal/linger/transport/runner_wire_contract_test.go b/apps/computer/local-daemon/internal/linger/transport/runner_wire_contract_test.goindex 9164ec48..068c9c3a 100644--- a/apps/computer/local-daemon/internal/linger/transport/runner_wire_contract_test.go+++ b/apps/computer/local-daemon/internal/linger/transport/runner_wire_contract_test.go@@ -118,7 +118,7 @@ func TestRunnerWireContractFixtures(t *testing.T) {for _, kind := range []string{protocol.CommandRunnerWelcome, protocol.CommandRunnerReconciled, protocol.CommandRegistrationSnapshot,protocol.CommandAgentRunnerEnsure, protocol.CommandAgentRunnerRemove, protocol.CommandAgentCLICredentialPut,protocol.CommandDebugInspect, protocol.CommandCapabilitySkillsScan, protocol.CommandCapabilityBrowserConnect,- protocol.CommandCapabilityComputerPermission, protocol.CommandOperationPrepare, protocol.CommandOperationStart, protocol.CommandOperationInput,+ protocol.CommandCapabilityComputerPermission, protocol.CommandCapabilityLocalModels, protocol.CommandOperationPrepare, protocol.CommandOperationStart, protocol.CommandOperationInput,protocol.CommandOperationCancel, protocol.CommandOperationAck, protocol.CommandProviderPrepare,protocol.CommandSessionCompact, protocol.CommandModelInvoke, protocol.CommandComputerToolCall} {if !seen[kind] {@@ -233,6 +233,9 @@ func runnerWireDaemonEvents(t *testing.T) []protocol.Event {}}}}capability(protocol.EventCapabilityComputerPermissionSucceeded, "computer_permission", "succeeded", map[string]any{"action": "prompt", "status": permissionStatus})capability(protocol.EventCapabilityComputerPermissionFailed, "computer_permission", "failed", map[string]any{"action": "relaunch", "error": failure})+ capability(protocol.EventCapabilityLocalModelsAccepted, "local_models", "accepted", map[string]any{"action": "download", "model_id": "qwen3-4b:Q4_K_M"})+ capability(protocol.EventCapabilityLocalModelsRefused, "local_models", "refused", map[string]any{"action": "refresh", "refusal": map[string]any{"code": "TOOL_NOT_INSTALLED"}})+ appendEvent(protocol.EventLocalModels, map[string]any{"type": "runner.local_models", "protocol_version": "2", "runner_id": "computer-1", "sent_at": "2026-10-28T00:00:00Z", "revision": 1, "local_models": map[string]any{"available": false, "reason": map[string]any{"code": "TOOL_NOT_INSTALLED"}, "observed_at": "2026-10-28T00:00:00Z", "pools": []any{}, "models": []any{}}})appendEvent(protocol.EventOperationPrepared, map[string]any{"prepare_command_id": "prepare-1", "prepared": true, "outcome": "ready", "duration_ms": 1})appendEvent(protocol.EventOperationAccepted, map[string]any{"runner_pid": 123})appendEvent(protocol.EventOperationEvent, map[string]any{"type": "status.changed", "status": "working"})diff --git a/apps/computer/local-daemon/internal/protocol/types.go b/apps/computer/local-daemon/internal/protocol/types.goindex 1806e876..b77bf1ee 100644--- a/apps/computer/local-daemon/internal/protocol/types.go+++ b/apps/computer/local-daemon/internal/protocol/types.go@@ -123,6 +123,7 @@ const (CommandCapabilitySkillsScan = wire.TypeExecute + ":" + wire.KindSkillsScanCommandCapabilityBrowserConnect = wire.TypeExecute + ":" + wire.KindBrowserConnectCommandCapabilityComputerPermission = wire.TypeExecute + ":" + wire.KindComputerPermission+ CommandCapabilityLocalModels = wire.TypeExecute + ":" + wire.KindLocalModelsCommandSessionCompact = wire.TypeExecute + ":" + wire.KindSessionCompactCommandModelInvoke = wire.TypeExecute + ":" + wire.KindModelInvokeCommandComputerToolCall = wire.TypeExecute + ":" + wire.KindComputerTool@@ -140,6 +141,7 @@ const (EventRunnerHeartbeat = wire.TypeRunnerHeartbeatEventRuntimeObserved = wire.TypeRuntimeRegistrationObservedEventRuntimeDiagnostics = wire.TypeRunnerRuntimeDiagnostics+ EventLocalModels = wire.TypeRunnerLocalModelsEventAgentRunnerReady = wire.TypeAgentRunnerState + ":" + wire.StateReadyEventAgentRunnerRemoved = wire.TypeAgentRunnerState + ":" + wire.StateRemovedEventAgentRunnerFailed = wire.TypeAgentRunnerState + ":" + wire.StateFailed@@ -152,6 +154,8 @@ const (EventCapabilityBrowserFailed = wire.TypeExecuted + ":" + wire.KindBrowserConnect + ":" + wire.OutcomeFailedEventCapabilityComputerPermissionSucceeded = wire.TypeExecuted + ":" + wire.KindComputerPermission + ":" + wire.OutcomeSucceededEventCapabilityComputerPermissionFailed = wire.TypeExecuted + ":" + wire.KindComputerPermission + ":" + wire.OutcomeFailed+ EventCapabilityLocalModelsAccepted = wire.TypeExecuted + ":" + wire.KindLocalModels + ":" + wire.OutcomeAccepted+ EventCapabilityLocalModelsRefused = wire.TypeExecuted + ":" + wire.KindLocalModels + ":" + wire.OutcomeRefusedEventSessionCompacted = wire.TypeExecuted + ":" + wire.KindSessionCompactEventModelInvoked = wire.TypeExecuted + ":" + wire.KindModelInvokeEventComputerToolResult = wire.TypeExecuted + ":" + wire.KindComputerTooldiff --git a/apps/computer/tests/runner-wire-contract.test.ts b/apps/computer/tests/runner-wire-contract.test.tsindex 3f1fb873..0a3566b3 100644--- a/apps/computer/tests/runner-wire-contract.test.ts+++ b/apps/computer/tests/runner-wire-contract.test.ts@@ -146,6 +146,14 @@ const agentFrames = [subject: "linger",permission: "screen_recording",},+ {+ type: "execute",+ kind: "local_models",+ ...localCapability,+ action: "load",+ model_id: "qwen3-4b:Q4_K_M",+ unload_first: ["gemma3-4b:Q4_K_M"],+ },{type: "prepare",target: "operation",diff --git a/apps/node-services/src/agent/runner-gateway/runner-connections.ts b/apps/node-services/src/agent/runner-gateway/runner-connections.tsindex 674645a0..b043bc18 100644--- a/apps/node-services/src/agent/runner-gateway/runner-connections.ts+++ b/apps/node-services/src/agent/runner-gateway/runner-connections.ts@@ -661,6 +661,18 @@ export class RunnerConnections {this.owners.capabilities().receiveLocalSkillOutcome(envelope);return;}+ if (+ envelope.type === "runner.local_models" ||+ (envelope.type === "executed" && envelope.kind === "local_models")+ ) {+ // Agent Service does not relay local models to TeamHub yet; dropping the+ // frame keeps a Computer that already reports them connected.+ logAgentEvent("info", "runner.local_models.ignored", {+ runnerId: connection.runnerId,+ frameType: envelope.type,+ });+ return;+ }if (envelope.type === "prepared" && envelope.target === "provider") {// Advisory: a prepare outcome carries no Operation identity or state.logAgentEvent("info", "runner.provider.prepared", {diff --git a/apps/teamhub/internal/app/handlers_local_models.go b/apps/teamhub/internal/app/handlers_local_models.gonew file mode 100644index 00000000..6903b297--- /dev/null+++ b/apps/teamhub/internal/app/handlers_local_models.go@@ -0,0 +1,27 @@+package app++import (+ "net/http"++ "github.com/gin-gonic/gin"+)++// The Local models endpoints are mounted so the route table matches the+// contracts; they answer NOT_IMPLEMENTED until TeamHub stores snapshots and+// forwards actions.++func (a *App) getLocalComputerModels(c *gin.Context) {+ a.writeLocalModelsNotImplemented(c)+}++func (a *App) actOnLocalComputerModel(c *gin.Context) {+ a.writeLocalModelsNotImplemented(c)+}++func (a *App) recordAgentRuntimeLocalModels(c *gin.Context) {+ a.writeLocalModelsNotImplemented(c)+}++func (a *App) writeLocalModelsNotImplemented(c *gin.Context) {+ a.writeError(c, http.StatusNotImplemented, "NOT_IMPLEMENTED", "Local models are not available yet")+}diff --git a/apps/teamhub/internal/app/routes_internal.go b/apps/teamhub/internal/app/routes_internal.goindex 69aa06d8..3169d359 100644--- a/apps/teamhub/internal/app/routes_internal.go+++ b/apps/teamhub/internal/app/routes_internal.go@@ -29,6 +29,7 @@ func (a *App) agentServiceRoutes() []contractRoute {route(http.MethodPost, "/v0/agent-runtime/inputs/accept-trusted-notification", nil, agentService, a.acceptAgentRuntimeTrustedNotification),route(http.MethodGet, "/v0/agent-runtime/local-computer", teamhubinternal.GetAgentRuntimeLocalComputerParams{}, agentService, a.getAgentRuntimeLocalComputer),route(http.MethodPost, "/v0/agent-runtime/local-computers/connect", nil, agentService, a.connectAgentRuntimeLocalComputer),+ route(http.MethodPost, "/v0/agent-runtime/local-computers/local-models", nil, agentService, a.recordAgentRuntimeLocalModels),route(http.MethodPost, "/v0/agent-runtime/local-computers/remove", nil, agentService, a.removeAgentRuntimeLocalComputer),route(http.MethodPost, "/v0/agent-runtime/local-computers/touch", nil, agentService, a.touchAgentRuntimeLocalComputer),route(http.MethodPost, "/v0/agent-runtime/permission-reviews", nil, agentService, a.createRuntimePermissionReview),diff --git a/apps/teamhub/internal/app/routes_public.go b/apps/teamhub/internal/app/routes_public.goindex 8da3ceca..1f4b07a5 100644--- a/apps/teamhub/internal/app/routes_public.go+++ b/apps/teamhub/internal/app/routes_public.go@@ -171,6 +171,8 @@ func (a *App) publicRoutes() []contractRoute {route(http.MethodDelete, "/v0/tenants/:tenantId/local-computers/:computerId/browser-connection", nil, session, a.deleteLocalComputerBrowserConnection),route(http.MethodGet, "/v0/tenants/:tenantId/local-computers/:computerId/browser-connection", nil, session, a.getLocalComputerBrowserConnection),route(http.MethodPut, "/v0/tenants/:tenantId/local-computers/:computerId/browser-connection", nil, session, a.putLocalComputerBrowserConnection),+ route(http.MethodGet, "/v0/tenants/:tenantId/local-computers/:computerId/local-models", nil, session, a.getLocalComputerModels),+ route(http.MethodPost, "/v0/tenants/:tenantId/local-computers/:computerId/local-models/:modelId/actions", nil, session, a.actOnLocalComputerModel),route(http.MethodGet, "/v0/tenants/:tenantId/local-computers/:computerId/permissions", nil, session, a.getLocalComputerPermissions),route(http.MethodPost, "/v0/tenants/:tenantId/local-computers/:computerId/permissions", nil, session, a.actOnLocalComputerPermission),route(http.MethodPost, "/v0/tenants/:tenantId/local-computers/:computerId/skill-scans", nil, session, a.scanLocalSkills),diff --git a/contracts/README.md b/contracts/README.mdindex 5463b3f6..662fdc3a 100644--- a/contracts/README.md+++ b/contracts/README.md@@ -71,3 +71,41 @@ test edit is needed.JSON Schema and AsyncAPI directories are introduced only when a second realprotocol needs them.++## Local models flow++A Computer's model library is the `localmodels` tool's, reached through the+same chain as Skill scans. Schemas live in `openapi/components/local-models.yaml`+and the `LocalModel*` definitions of `runner-gateway/envelope.schema.json`.++Actions go Web → TeamHub → Agent Service → Computer → `localmodels`:++1. Web posts `actOnLocalComputerModel`+ (`POST /v0/tenants/{tenantId}/local-computers/{computerId}/local-models/{modelId}/actions`).+ Only the Computer owner may act.+2. TeamHub calls Node Services `actOnLocalComputerModels`+ (`POST /v1/tenants/{tenantId}/owners/{ownerActorId}/local-computers/{computerId}/local-model-actions`).+3. Agent Service sends `execute` with kind `local_models` (download, cancel,+ load with `unload_first`, unload, remove, or refresh). The Daemon answers+ `executed` with outcome `accepted` or `refused` at once and runs the+ `localmodels library` job itself. The ack returns to TeamHub as+ `LocalModelActionAck`; a refusal becomes a `LocalModelsErrorCode`.++Progress and outcomes travel back only as snapshots:++1. The Daemon sends `runner.local_models` with a `LocalModelsSnapshot` mapped+ from `localmodels.library-status/v1`: after `runner.hello`, after every+ library change, and at most every 2 seconds while a download or load runs.+ A Computer without the tool reports `available: false` with+ `TOOL_NOT_INSTALLED`.+2. Agent Service records it through TeamHub `recordAgentRuntimeLocalModels`+ (`POST /v0/agent-runtime/local-computers/local-models`). TeamHub keeps the+ latest snapshot per Computer, so an offline Computer shows what it last+ reported, and publishes a `local-models` invalidation hint whose id is the+ Computer ID.+3. Web reads `getLocalComputerModels`+ (`GET /v0/tenants/{tenantId}/local-computers/{computerId}/local-models`),+ where TeamHub adds each model's `used_by`: active Agents on that Computer+ with runtime `pi` whose runtime model is the model's `pi_model`. localmodels+ reports `pi_model` for every model on the Computer, loaded or not, so an+ idle model still lists the Agents that will run on it.diff --git a/contracts/generated/go/nodeservicesinternal/openapi.gen.go b/contracts/generated/go/nodeservicesinternal/openapi.gen.goindex a1108725..2e3941eb 100644--- a/contracts/generated/go/nodeservicesinternal/openapi.gen.go+++ b/contracts/generated/go/nodeservicesinternal/openapi.gen.go@@ -728,6 +728,120 @@ func (e LocalComputerToolCallServer) Valid() bool {}}+// Defines values for LocalModelActionAckOutcome.+const (+ LocalModelActionAccepted LocalModelActionAckOutcome = "accepted"+ LocalModelActionRefused LocalModelActionAckOutcome = "refused"+)++// Valid indicates whether the value is a known member of the LocalModelActionAckOutcome enum.+func (e LocalModelActionAckOutcome) Valid() bool {+ switch e {+ case LocalModelActionAccepted:+ return true+ case LocalModelActionRefused:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelActionKind.+const (+ LocalModelActionKindCancel LocalModelActionKind = "cancel"+ LocalModelActionKindDownload LocalModelActionKind = "download"+ LocalModelActionKindLoad LocalModelActionKind = "load"+ LocalModelActionKindRefresh LocalModelActionKind = "refresh"+ LocalModelActionKindRemove LocalModelActionKind = "remove"+ LocalModelActionKindUnload LocalModelActionKind = "unload"+)++// Valid indicates whether the value is a known member of the LocalModelActionKind enum.+func (e LocalModelActionKind) Valid() bool {+ switch e {+ case LocalModelActionKindCancel:+ return true+ case LocalModelActionKindDownload:+ return true+ case LocalModelActionKindLoad:+ return true+ case LocalModelActionKindRefresh:+ return true+ case LocalModelActionKindRemove:+ return true+ case LocalModelActionKindUnload:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelActionRefusalCode.+const (+ CANCELLED LocalModelActionRefusalCode = "CANCELLED"+ CHECKSUMMISMATCH LocalModelActionRefusalCode = "CHECKSUM_MISMATCH"+ DISKINSUFFICIENT LocalModelActionRefusalCode = "DISK_INSUFFICIENT"+ DOWNLOADFAILED LocalModelActionRefusalCode = "DOWNLOAD_FAILED"+ ENGINESTARTFAILED LocalModelActionRefusalCode = "ENGINE_START_FAILED"+ GATEWAYREGISTRATIONFAILED LocalModelActionRefusalCode = "GATEWAY_REGISTRATION_FAILED"+ HEALTHCHECKFAILED LocalModelActionRefusalCode = "HEALTH_CHECK_FAILED"+ INVALIDSTATE LocalModelActionRefusalCode = "INVALID_STATE"+ JOBRUNNING LocalModelActionRefusalCode = "JOB_RUNNING"+ LOADNOROOM LocalModelActionRefusalCode = "LOAD_NO_ROOM"+ MEMORYINSUFFICIENT LocalModelActionRefusalCode = "MEMORY_INSUFFICIENT"+ MODELFILESMISSING LocalModelActionRefusalCode = "MODEL_FILES_MISSING"+ MODELUNKNOWN LocalModelActionRefusalCode = "MODEL_UNKNOWN"+ NETWORKUNAVAILABLE LocalModelActionRefusalCode = "NETWORK_UNAVAILABLE"+ OUTOFMEMORY LocalModelActionRefusalCode = "OUT_OF_MEMORY"+ PLATFORMUNSUPPORTED LocalModelActionRefusalCode = "PLATFORM_UNSUPPORTED"+ TOOLFAILED LocalModelActionRefusalCode = "TOOL_FAILED"+ TOOLNOTINSTALLED LocalModelActionRefusalCode = "TOOL_NOT_INSTALLED"+)++// Valid indicates whether the value is a known member of the LocalModelActionRefusalCode enum.+func (e LocalModelActionRefusalCode) Valid() bool {+ switch e {+ case CANCELLED:+ return true+ case CHECKSUMMISMATCH:+ return true+ case DISKINSUFFICIENT:+ return true+ case DOWNLOADFAILED:+ return true+ case ENGINESTARTFAILED:+ return true+ case GATEWAYREGISTRATIONFAILED:+ return true+ case HEALTHCHECKFAILED:+ return true+ case INVALIDSTATE:+ return true+ case JOBRUNNING:+ return true+ case LOADNOROOM:+ return true+ case MEMORYINSUFFICIENT:+ return true+ case MODELFILESMISSING:+ return true+ case MODELUNKNOWN:+ return true+ case NETWORKUNAVAILABLE:+ return true+ case OUTOFMEMORY:+ return true+ case PLATFORMUNSUPPORTED:+ return true+ case TOOLFAILED:+ return true+ case TOOLNOTINSTALLED:+ return true+ default:+ return false+ }+}+// Defines values for LocalSkillCandidateImportability.const (LocalSkillCandidateReady LocalSkillCandidateImportability = "ready"@@ -1630,6 +1744,60 @@ type LocalComputerToolResult struct {Result map[string]interface{} `json:"result"`}+// LocalModelActionAck The Computer's immediate answer. accepted means the job started (or a snapshot is coming for refresh); refused means nothing changed. Progress and outcomes arrive only as snapshots.+type LocalModelActionAck struct {+ Outcome LocalModelActionAckOutcome `json:"outcome"`+ Refusal *LocalModelActionRefusal `json:"refusal,omitempty"`++ // RequestId Opaque, case-sensitive identifier. Clients must not infer type or time from it.+ RequestId Id `json:"request_id"`+}++// LocalModelActionAckOutcome defines model for LocalModelActionAck.Outcome.+type LocalModelActionAckOutcome string++// LocalModelActionCommand TeamHub asks Agent Service to send one execute local_models frame to an owned Computer. model_id is required except for refresh; unload_first only with load.+type LocalModelActionCommand struct {+ // Action refresh asks the Computer to reread its library and send a snapshot; it names no model.+ Action LocalModelActionKind `json:"action"`++ // ExpiresAt UTC timestamp in RFC 3339 format with an explicit offset.+ ExpiresAt Timestamp `json:"expires_at"`++ // ModelId Stable localmodels library id: catalog id and variant, such as qwen3-4b:Q4_K_M.+ ModelId *LocalModelId `json:"model_id,omitempty"`++ // RequestId Opaque, case-sensitive identifier. Clients must not infer type or time from it.+ RequestId Id `json:"request_id"`+ UnloadFirst *[]LocalModelId `json:"unload_first,omitempty"`+}++// LocalModelActionKind refresh asks the Computer to reread its library and send a snapshot; it names no model.+type LocalModelActionKind string++// LocalModelActionRefusal defines model for LocalModelActionRefusal.+type LocalModelActionRefusal struct {+ // Code Why the Computer refused an action before starting it: a localmodels library error or a reason the library is unavailable.+ Code LocalModelActionRefusalCode `json:"code"`++ // Detail Diagnostic text for display; never matched on.+ Detail *string `json:"detail,omitempty"`+ FreeBytes *int64 `json:"free_bytes,omitempty"`+ NeedBytes *int64 `json:"need_bytes,omitempty"`++ // Pool A place a model can live: gpu:<index>, system (RAM beside GPUs), or unified (RAM of a host without discrete GPUs).+ Pool *LocalModelPoolId `json:"pool,omitempty"`+}++// LocalModelActionRefusalCode Why the Computer refused an action before starting it: a localmodels library error or a reason the library is unavailable.+type LocalModelActionRefusalCode string++// LocalModelId Stable localmodels library id: catalog id and variant, such as qwen3-4b:Q4_K_M.+type LocalModelId = string++// LocalModelPoolId A place a model can live: gpu:<index>, system (RAM beside GPUs), or unified (RAM of a host without discrete GPUs).+type LocalModelPoolId = string+// LocalSkillCandidate defines model for LocalSkillCandidate.type LocalSkillCandidate struct {// CandidateRef Opaque, case-sensitive identifier. Clients must not infer type or time from it.@@ -2588,6 +2756,9 @@ type JudgeProactiveEventJSONRequestBody = ProactiveEventJudgeRequest// ConfigureLocalComputerBrowserConnectionJSONRequestBody defines body for ConfigureLocalComputerBrowserConnection for application/json ContentType.type ConfigureLocalComputerBrowserConnectionJSONRequestBody = BrowserConnectionConfigureCommand+// ActOnLocalComputerModelsJSONRequestBody defines body for ActOnLocalComputerModels for application/json ContentType.+type ActOnLocalComputerModelsJSONRequestBody = LocalModelActionCommand+// ActOnLocalComputerPermissionJSONRequestBody defines body for ActOnLocalComputerPermission for application/json ContentType.type ActOnLocalComputerPermissionJSONRequestBody = ComputerPermissionAction@@ -3596,6 +3767,11 @@ type ClientInterface interface {ConfigureLocalComputerBrowserConnection(ctx context.Context, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, body ConfigureLocalComputerBrowserConnectionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)+ // ActOnLocalComputerModelsWithBody request with any body+ ActOnLocalComputerModelsWithBody(ctx context.Context, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)++ ActOnLocalComputerModels(ctx context.Context, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, body ActOnLocalComputerModelsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)+// GetLocalComputerPermissions requestGetLocalComputerPermissions(ctx context.Context, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, reqEditors ...RequestEditorFn) (*http.Response, error)@@ -4201,6 +4377,30 @@ func (c *Client) ConfigureLocalComputerBrowserConnection(ctx context.Context, tereturn c.Client.Do(req)}+func (c *Client) ActOnLocalComputerModelsWithBody(ctx context.Context, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {+ req, err := NewActOnLocalComputerModelsRequestWithBody(c.Server, tenantId, ownerActorId, computerId, contentType, body)+ if err != nil {+ return nil, err+ }+ req = req.WithContext(ctx)+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {+ return nil, err+ }+ return c.Client.Do(req)+}++func (c *Client) ActOnLocalComputerModels(ctx context.Context, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, body ActOnLocalComputerModelsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {+ req, err := NewActOnLocalComputerModelsRequest(c.Server, tenantId, ownerActorId, computerId, body)+ if err != nil {+ return nil, err+ }+ req = req.WithContext(ctx)+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {+ return nil, err+ }+ return c.Client.Do(req)+}+func (c *Client) GetLocalComputerPermissions(ctx context.Context, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, reqEditors ...RequestEditorFn) (*http.Response, error) {req, err := NewGetLocalComputerPermissionsRequest(c.Server, tenantId, ownerActorId, computerId)if err != nil {@@ -5628,6 +5828,67 @@ func NewConfigureLocalComputerBrowserConnectionRequestWithBody(server string, tereturn req, nil}+// NewActOnLocalComputerModelsRequest calls the generic ActOnLocalComputerModels builder with application/json body+func NewActOnLocalComputerModelsRequest(server string, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, body ActOnLocalComputerModelsJSONRequestBody) (*http.Request, error) {+ var bodyReader io.Reader+ buf, err := json.Marshal(body)+ if err != nil {+ return nil, err+ }+ bodyReader = bytes.NewReader(buf)+ return NewActOnLocalComputerModelsRequestWithBody(server, tenantId, ownerActorId, computerId, "application/json", bodyReader)+}++// NewActOnLocalComputerModelsRequestWithBody generates requests for ActOnLocalComputerModels with any type of body+func NewActOnLocalComputerModelsRequestWithBody(server string, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, contentType string, body io.Reader) (*http.Request, error) {+ var err error++ var pathParam0 string++ pathParam0, err = runtime.StyleParamWithOptions("simple", false, "tenantId", tenantId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""})+ if err != nil {+ return nil, err+ }++ var pathParam1 string++ pathParam1, err = runtime.StyleParamWithOptions("simple", false, "ownerActorId", ownerActorId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""})+ if err != nil {+ return nil, err+ }++ var pathParam2 string++ pathParam2, err = runtime.StyleParamWithOptions("simple", false, "computerId", computerId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""})+ if err != nil {+ return nil, err+ }++ serverURL, err := url.Parse(server)+ if err != nil {+ return nil, err+ }++ operationPath := fmt.Sprintf("/v1/tenants/%s/owners/%s/local-computers/%s/local-model-actions", pathParam0, pathParam1, pathParam2)+ if operationPath[0] == '/' {+ operationPath = "." + operationPath+ }++ queryURL, err := serverURL.Parse(operationPath)+ if err != nil {+ return nil, err+ }++ req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)+ if err != nil {+ return nil, err+ }++ req.Header.Add("Content-Type", contentType)++ return req, nil+}+// NewGetLocalComputerPermissionsRequest generates requests for GetLocalComputerPermissionsfunc NewGetLocalComputerPermissionsRequest(server string, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId) (*http.Request, error) {var err error@@ -5996,6 +6257,11 @@ type ClientWithResponsesInterface interface {ConfigureLocalComputerBrowserConnectionWithResponse(ctx context.Context, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, body ConfigureLocalComputerBrowserConnectionJSONRequestBody, reqEditors ...RequestEditorFn) (*ConfigureLocalComputerBrowserConnectionResponse, error)+ // ActOnLocalComputerModelsWithBodyWithResponse request with any body+ ActOnLocalComputerModelsWithBodyWithResponse(ctx context.Context, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ActOnLocalComputerModelsResponse, error)++ ActOnLocalComputerModelsWithResponse(ctx context.Context, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, body ActOnLocalComputerModelsJSONRequestBody, reqEditors ...RequestEditorFn) (*ActOnLocalComputerModelsResponse, error)+// GetLocalComputerPermissionsWithResponse requestGetLocalComputerPermissionsWithResponse(ctx context.Context, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, reqEditors ...RequestEditorFn) (*GetLocalComputerPermissionsResponse, error)@@ -7012,6 +7278,42 @@ func (r ConfigureLocalComputerBrowserConnectionResponse) ContentType() string {return ""}+type ActOnLocalComputerModelsResponse struct {+ Body []byte+ HTTPResponse *http.Response+ JSON200 *LocalModelActionAck+ JSON400 *BadRequest+ JSON401 *Unauthenticated+ JSON404 *NotFound+ JSON409 *Conflict+ JSON502 *BadGateway+ JSON503 *ServiceUnavailable+}++// Status returns HTTPResponse.Status+func (r ActOnLocalComputerModelsResponse) Status() string {+ if r.HTTPResponse != nil {+ return r.HTTPResponse.Status+ }+ return http.StatusText(0)+}++// StatusCode returns HTTPResponse.StatusCode+func (r ActOnLocalComputerModelsResponse) StatusCode() int {+ if r.HTTPResponse != nil {+ return r.HTTPResponse.StatusCode+ }+ return 0+}++// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers+func (r ActOnLocalComputerModelsResponse) ContentType() string {+ if r.HTTPResponse != nil {+ return r.HTTPResponse.Header.Get("Content-Type")+ }+ return ""+}+type GetLocalComputerPermissionsResponse struct {Body []byteHTTPResponse *http.Response@@ -7571,6 +7873,23 @@ func (c *ClientWithResponses) ConfigureLocalComputerBrowserConnectionWithResponsreturn ParseConfigureLocalComputerBrowserConnectionResponse(rsp)}+// ActOnLocalComputerModelsWithBodyWithResponse request with arbitrary body returning *ActOnLocalComputerModelsResponse+func (c *ClientWithResponses) ActOnLocalComputerModelsWithBodyWithResponse(ctx context.Context, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ActOnLocalComputerModelsResponse, error) {+ rsp, err := c.ActOnLocalComputerModelsWithBody(ctx, tenantId, ownerActorId, computerId, contentType, body, reqEditors...)+ if err != nil {+ return nil, err+ }+ return ParseActOnLocalComputerModelsResponse(rsp)+}++func (c *ClientWithResponses) ActOnLocalComputerModelsWithResponse(ctx context.Context, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, body ActOnLocalComputerModelsJSONRequestBody, reqEditors ...RequestEditorFn) (*ActOnLocalComputerModelsResponse, error) {+ rsp, err := c.ActOnLocalComputerModels(ctx, tenantId, ownerActorId, computerId, body, reqEditors...)+ if err != nil {+ return nil, err+ }+ return ParseActOnLocalComputerModelsResponse(rsp)+}+// GetLocalComputerPermissionsWithResponse request returning *GetLocalComputerPermissionsResponsefunc (c *ClientWithResponses) GetLocalComputerPermissionsWithResponse(ctx context.Context, tenantId TenantId, ownerActorId OwnerActorId, computerId ComputerId, reqEditors ...RequestEditorFn) (*GetLocalComputerPermissionsResponse, error) {rsp, err := c.GetLocalComputerPermissions(ctx, tenantId, ownerActorId, computerId, reqEditors...)@@ -9057,6 +9376,74 @@ func ParseConfigureLocalComputerBrowserConnectionResponse(rsp *http.Response) (*return response, nil}+// ParseActOnLocalComputerModelsResponse parses an HTTP response from a ActOnLocalComputerModelsWithResponse call+func ParseActOnLocalComputerModelsResponse(rsp *http.Response) (*ActOnLocalComputerModelsResponse, error) {+ bodyBytes, err := io.ReadAll(rsp.Body)+ defer func() { _ = rsp.Body.Close() }()+ if err != nil {+ return nil, err+ }++ response := &ActOnLocalComputerModelsResponse{+ Body: bodyBytes,+ HTTPResponse: rsp,+ }++ switch {+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:+ var dest LocalModelActionAck+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON200 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:+ var dest BadRequest+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON400 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:+ var dest Unauthenticated+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON401 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:+ var dest NotFound+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON404 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409:+ var dest Conflict+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON409 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 502:+ var dest BadGateway+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON502 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 503:+ var dest ServiceUnavailable+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON503 = &dest++ }++ return response, nil+}+// ParseGetLocalComputerPermissionsResponse parses an HTTP response from a GetLocalComputerPermissionsWithResponse callfunc ParseGetLocalComputerPermissionsResponse(rsp *http.Response) (*GetLocalComputerPermissionsResponse, error) {bodyBytes, err := io.ReadAll(rsp.Body)diff --git a/contracts/generated/go/runnergateway/wire.gen.go b/contracts/generated/go/runnergateway/wire.gen.goindex 5ce59174..e46b82a8 100644--- a/contracts/generated/go/runnergateway/wire.gen.go+++ b/contracts/generated/go/runnergateway/wire.gen.go@@ -35,6 +35,7 @@ const (TypeRunnerHello = "runner.hello"TypeRunnerHeartbeat = "runner.heartbeat"TypeRunnerRuntimeDiagnostics = "runner.runtime_diagnostics"+ TypeRunnerLocalModels = "runner.local_models"TypeRuntimeRegistrationObserved = "runtime.registration.observed"TypeAgentRunnerState = "agent_runner.state"TypeExecuted = "executed"@@ -54,6 +55,7 @@ const (KindSkillsScan = "skills_scan"KindBrowserConnect = "browser_connect"KindComputerPermission = "computer_permission"+ KindLocalModels = "local_models"TargetOperation = "operation"TargetProvider = "provider"KindSessionCompact = "session_compact"@@ -65,6 +67,7 @@ const (OutcomeSucceeded = "succeeded"OutcomeFailed = "failed"OutcomeAccepted = "accepted"+ OutcomeRefused = "refused"OutcomeRejected = "rejected"OutcomeClosed = "closed")@@ -89,6 +92,7 @@ var AgentToDaemonMessages = []Message{{Name: "CapabilitySkillsScan", Type: "execute", Match: map[string]string{"kind": "skills_scan"}},{Name: "CapabilityBrowserConnect", Type: "execute", Match: map[string]string{"kind": "browser_connect"}},{Name: "CapabilityComputerPermission", Type: "execute", Match: map[string]string{"kind": "computer_permission"}},+ {Name: "CapabilityLocalModelsExecute", Type: "execute", Match: map[string]string{"kind": "local_models"}},{Name: "OperationPrepare", Type: "prepare", Match: map[string]string{"target": "operation"}},{Name: "ProviderPrepare", Type: "prepare", Match: map[string]string{"target": "provider"}},{Name: "SessionCompact", Type: "execute", Match: map[string]string{"kind": "session_compact"}},@@ -105,6 +109,7 @@ var DaemonToAgentMessages = []Message{{Name: "RunnerHello", Type: "runner.hello", Match: nil},{Name: "RunnerHeartbeat", Type: "runner.heartbeat", Match: nil},{Name: "RunnerRuntimeDiagnostics", Type: "runner.runtime_diagnostics", Match: nil},+ {Name: "RunnerLocalModels", Type: "runner.local_models", Match: nil},{Name: "RuntimeRegistrationObserved", Type: "runtime.registration.observed", Match: nil},{Name: "AgentRunnerReady", Type: "agent_runner.state", Match: map[string]string{"state": "ready"}},{Name: "AgentRunnerRemoved", Type: "agent_runner.state", Match: map[string]string{"state": "removed"}},@@ -118,6 +123,8 @@ var DaemonToAgentMessages = []Message{{Name: "CapabilityBrowserFailed", Type: "executed", Match: map[string]string{"kind": "browser_connect", "outcome": "failed"}},{Name: "CapabilityComputerPermissionSucceeded", Type: "executed", Match: map[string]string{"kind": "computer_permission", "outcome": "succeeded"}},{Name: "CapabilityComputerPermissionFailed", Type: "executed", Match: map[string]string{"kind": "computer_permission", "outcome": "failed"}},+ {Name: "CapabilityLocalModelsAccepted", Type: "executed", Match: map[string]string{"kind": "local_models", "outcome": "accepted"}},+ {Name: "CapabilityLocalModelsRefused", Type: "executed", Match: map[string]string{"kind": "local_models", "outcome": "refused"}},{Name: "OperationPrepared", Type: "prepared", Match: map[string]string{"target": "operation"}},{Name: "ProviderPrepared", Type: "prepared", Match: map[string]string{"target": "provider"}},{Name: "SessionCompacted", Type: "executed", Match: map[string]string{"kind": "session_compact"}},@@ -1005,6 +1012,325 @@ func (CapabilitySkillsFailed) RequiredFields() []string {return []string{"protocol_version", "command_id", "runner_id", "tenant_id", "owner_actor_id", "connection_epoch", "expires_at", "type", "stage", "error", "kind", "outcome"}}+// LocalModelGpu mirrors the LocalModelGpu schema shape.+type LocalModelGpu struct {+ Index uint64 `json:"index"`+ Uuid string `json:"uuid,omitempty"`+ Name string `json:"name"`+ TotalBytes uint64 `json:"total_bytes"`+ FreeBytes uint64 `json:"free_bytes"`+}++// FixedFields lists the keys whose value the schema fixes for a LocalModelGpu.+func (LocalModelGpu) FixedFields() map[string]string { return nil }++// RequiredFields lists the keys a LocalModelGpu must carry.+func (LocalModelGpu) RequiredFields() []string {+ return []string{"index", "name", "total_bytes", "free_bytes"}+}++// LocalModelHost mirrors the LocalModelHost schema shape.+type LocalModelHost struct {+ Platform string `json:"platform"`+ Arch string `json:"arch"`+ OsLabel string `json:"os_label"`+ EngineLabel string `json:"engine_label"`+ RamTotalBytes uint64 `json:"ram_total_bytes"`+ DiskFreeBytes uint64 `json:"disk_free_bytes"`+ Gpus []LocalModelGpu `json:"gpus"`+}++// FixedFields lists the keys whose value the schema fixes for a LocalModelHost.+func (LocalModelHost) FixedFields() map[string]string { return nil }++// RequiredFields lists the keys a LocalModelHost must carry.+func (LocalModelHost) RequiredFields() []string {+ return []string{"platform", "arch", "os_label", "engine_label", "ram_total_bytes", "disk_free_bytes", "gpus"}+}++// LocalModelPoolHolder mirrors the LocalModelPoolHolder schema shape.+type LocalModelPoolHolder struct {+ Kind string `json:"kind"`+ ID string `json:"id"`+ Name string `json:"name"`+ Bytes uint64 `json:"bytes"`+}++// FixedFields lists the keys whose value the schema fixes for a LocalModelPoolHolder.+func (LocalModelPoolHolder) FixedFields() map[string]string { return nil }++// RequiredFields lists the keys a LocalModelPoolHolder must carry.+func (LocalModelPoolHolder) RequiredFields() []string { return []string{"kind", "id", "name", "bytes"} }++// LocalModelPool mirrors the LocalModelPool schema shape.+type LocalModelPool struct {+ ID string `json:"id"`+ Kind string `json:"kind"`+ GpuIndex *uint64 `json:"gpu_index,omitempty"`+ TotalBytes uint64 `json:"total_bytes"`+ UsedBytes uint64 `json:"used_bytes"`+ Holders []LocalModelPoolHolder `json:"holders"`+}++// FixedFields lists the keys whose value the schema fixes for a LocalModelPool.+func (LocalModelPool) FixedFields() map[string]string { return nil }++// RequiredFields lists the keys a LocalModelPool must carry.+func (LocalModelPool) RequiredFields() []string {+ return []string{"id", "kind", "total_bytes", "used_bytes", "holders"}+}++// LocalModelAvailabilityReason mirrors the LocalModelAvailabilityReason schema shape.+type LocalModelAvailabilityReason struct {+ Code string `json:"code"`+ NeedBytes *uint64 `json:"need_bytes,omitempty"`+ HaveBytes *uint64 `json:"have_bytes,omitempty"`+}++// FixedFields lists the keys whose value the schema fixes for a LocalModelAvailabilityReason.+func (LocalModelAvailabilityReason) FixedFields() map[string]string { return nil }++// RequiredFields lists the keys a LocalModelAvailabilityReason must carry.+func (LocalModelAvailabilityReason) RequiredFields() []string { return []string{"code"} }++// LocalModelAvailability mirrors the LocalModelAvailability schema shape.+type LocalModelAvailability struct {+ Downloadable bool `json:"downloadable"`+ Reason *LocalModelAvailabilityReason `json:"reason,omitempty"`+}++// FixedFields lists the keys whose value the schema fixes for a LocalModelAvailability.+func (LocalModelAvailability) FixedFields() map[string]string { return nil }++// RequiredFields lists the keys a LocalModelAvailability must carry.+func (LocalModelAvailability) RequiredFields() []string { return []string{"downloadable"} }++// LocalModelDownloadProgress mirrors the LocalModelDownloadProgress schema shape.+type LocalModelDownloadProgress struct {+ Step string `json:"step"`+ DoneBytes uint64 `json:"done_bytes"`+ TotalBytes uint64 `json:"total_bytes"`+ BytesPerSecond *uint64 `json:"bytes_per_second,omitempty"`+}++// FixedFields lists the keys whose value the schema fixes for a LocalModelDownloadProgress.+func (LocalModelDownloadProgress) FixedFields() map[string]string { return nil }++// RequiredFields lists the keys a LocalModelDownloadProgress must carry.+func (LocalModelDownloadProgress) RequiredFields() []string {+ return []string{"step", "done_bytes", "total_bytes"}+}++// LocalModelEndpoint mirrors the LocalModelEndpoint schema shape.+type LocalModelEndpoint struct {+ BaseURL string `json:"base_url"`+}++// FixedFields lists the keys whose value the schema fixes for a LocalModelEndpoint.+func (LocalModelEndpoint) FixedFields() map[string]string { return nil }++// RequiredFields lists the keys a LocalModelEndpoint must carry.+func (LocalModelEndpoint) RequiredFields() []string { return []string{"base_url"} }++// LocalModelError mirrors the LocalModelError schema shape.+type LocalModelError struct {+ Code string `json:"code"`+ Detail string `json:"detail,omitempty"`+}++// FixedFields lists the keys whose value the schema fixes for a LocalModelError.+func (LocalModelError) FixedFields() map[string]string { return nil }++// RequiredFields lists the keys a LocalModelError must carry.+func (LocalModelError) RequiredFields() []string { return []string{"code"} }++// LocalModelNote mirrors the LocalModelNote schema shape.+type LocalModelNote struct {+ Code string `json:"code"`+}++// FixedFields lists the keys whose value the schema fixes for a LocalModelNote.+func (LocalModelNote) FixedFields() map[string]string { return nil }++// RequiredFields lists the keys a LocalModelNote must carry.+func (LocalModelNote) RequiredFields() []string { return []string{"code"} }++// LocalModel mirrors the LocalModel schema shape.+type LocalModel struct {+ ID string `json:"id"`+ Name string `json:"name"`+ Description string `json:"description"`+ Quant string `json:"quant"`+ ContextTokens uint64 `json:"context_tokens"`+ Vision bool `json:"vision"`+ DownloadBytes uint64 `json:"download_bytes"`+ MemoryBytes uint64 `json:"memory_bytes"`+ Fit string `json:"fit"`+ Recommended bool `json:"recommended"`+ Availability LocalModelAvailability `json:"availability"`+ Pool string `json:"pool,omitempty"`+ State string `json:"state"`+ Download *LocalModelDownloadProgress `json:"download,omitempty"`+ Endpoint *LocalModelEndpoint `json:"endpoint,omitempty"`+ PiModel string `json:"pi_model,omitempty"`+ TokensPerSecond *float64 `json:"tokens_per_second,omitempty"`+ Error *LocalModelError `json:"error,omitempty"`+ Note *LocalModelNote `json:"note,omitempty"`+}++// FixedFields lists the keys whose value the schema fixes for a LocalModel.+func (LocalModel) FixedFields() map[string]string { return nil }++// RequiredFields lists the keys a LocalModel must carry.+func (LocalModel) RequiredFields() []string {+ return []string{"id", "name", "description", "quant", "context_tokens", "vision", "download_bytes", "memory_bytes", "fit", "recommended", "availability", "state"}+}++// LocalModelsUnavailableReason mirrors the LocalModelsUnavailableReason schema shape.+type LocalModelsUnavailableReason struct {+ Code string `json:"code"`+ Detail string `json:"detail,omitempty"`+}++// FixedFields lists the keys whose value the schema fixes for a LocalModelsUnavailableReason.+func (LocalModelsUnavailableReason) FixedFields() map[string]string { return nil }++// RequiredFields lists the keys a LocalModelsUnavailableReason must carry.+func (LocalModelsUnavailableReason) RequiredFields() []string { return []string{"code"} }++// LocalModelsSnapshot mirrors the LocalModelsSnapshot schema shape.+type LocalModelsSnapshot struct {+ Available bool `json:"available"`+ Reason *LocalModelsUnavailableReason `json:"reason,omitempty"`+ ObservedAt string `json:"observed_at"`+ ToolVersion string `json:"tool_version,omitempty"`+ Host *LocalModelHost `json:"host,omitempty"`+ Pools []LocalModelPool `json:"pools"`+ Models []LocalModel `json:"models"`+}++// FixedFields lists the keys whose value the schema fixes for a LocalModelsSnapshot.+func (LocalModelsSnapshot) FixedFields() map[string]string { return nil }++// RequiredFields lists the keys a LocalModelsSnapshot must carry.+func (LocalModelsSnapshot) RequiredFields() []string {+ return []string{"available", "observed_at", "pools", "models"}+}++// CapabilityLocalModelsExecute mirrors the CapabilityLocalModelsExecute schema shape.+type CapabilityLocalModelsExecute struct {+ ProtocolVersion string `json:"protocol_version"`+ CommandID string `json:"command_id"`+ RunnerID string `json:"runner_id"`+ TenantID string `json:"tenant_id"`+ OwnerActorID string `json:"owner_actor_id"`+ ConnectionEpoch uint64 `json:"connection_epoch"`+ ExpiresAt string `json:"expires_at"`+ Type string `json:"type"`+ Kind string `json:"kind"`+ Action string `json:"action"`+ ModelID string `json:"model_id,omitempty"`+ UnloadFirst []string `json:"unload_first,omitempty"`+}++// FixedFields lists the keys whose value the schema fixes for a CapabilityLocalModelsExecute.+func (CapabilityLocalModelsExecute) FixedFields() map[string]string {+ return map[string]string{"protocol_version": "2", "type": "execute", "kind": "local_models"}+}++// RequiredFields lists the keys a CapabilityLocalModelsExecute must carry.+func (CapabilityLocalModelsExecute) RequiredFields() []string {+ return []string{"protocol_version", "command_id", "runner_id", "tenant_id", "owner_actor_id", "connection_epoch", "expires_at", "type", "kind", "action"}+}++// CapabilityLocalModelsAccepted mirrors the CapabilityLocalModelsAccepted schema shape.+type CapabilityLocalModelsAccepted struct {+ ProtocolVersion string `json:"protocol_version"`+ CommandID string `json:"command_id"`+ RunnerID string `json:"runner_id"`+ TenantID string `json:"tenant_id"`+ OwnerActorID string `json:"owner_actor_id"`+ ConnectionEpoch uint64 `json:"connection_epoch"`+ ExpiresAt string `json:"expires_at"`+ Type string `json:"type"`+ Kind string `json:"kind"`+ Action string `json:"action"`+ ModelID string `json:"model_id,omitempty"`+ Outcome string `json:"outcome"`+}++// FixedFields lists the keys whose value the schema fixes for a CapabilityLocalModelsAccepted.+func (CapabilityLocalModelsAccepted) FixedFields() map[string]string {+ return map[string]string{"protocol_version": "2", "type": "executed", "kind": "local_models", "outcome": "accepted"}+}++// RequiredFields lists the keys a CapabilityLocalModelsAccepted must carry.+func (CapabilityLocalModelsAccepted) RequiredFields() []string {+ return []string{"protocol_version", "command_id", "runner_id", "tenant_id", "owner_actor_id", "connection_epoch", "expires_at", "type", "kind", "action", "outcome"}+}++// LocalModelActionRefusal mirrors the LocalModelActionRefusal schema shape.+type LocalModelActionRefusal struct {+ Code string `json:"code"`+ Detail string `json:"detail,omitempty"`+ Pool string `json:"pool,omitempty"`+ NeedBytes *uint64 `json:"need_bytes,omitempty"`+ FreeBytes *uint64 `json:"free_bytes,omitempty"`+}++// FixedFields lists the keys whose value the schema fixes for a LocalModelActionRefusal.+func (LocalModelActionRefusal) FixedFields() map[string]string { return nil }++// RequiredFields lists the keys a LocalModelActionRefusal must carry.+func (LocalModelActionRefusal) RequiredFields() []string { return []string{"code"} }++// CapabilityLocalModelsRefused mirrors the CapabilityLocalModelsRefused schema shape.+type CapabilityLocalModelsRefused struct {+ ProtocolVersion string `json:"protocol_version"`+ CommandID string `json:"command_id"`+ RunnerID string `json:"runner_id"`+ TenantID string `json:"tenant_id"`+ OwnerActorID string `json:"owner_actor_id"`+ ConnectionEpoch uint64 `json:"connection_epoch"`+ ExpiresAt string `json:"expires_at"`+ Type string `json:"type"`+ Kind string `json:"kind"`+ Action string `json:"action"`+ ModelID string `json:"model_id,omitempty"`+ Refusal LocalModelActionRefusal `json:"refusal"`+ Outcome string `json:"outcome"`+}++// FixedFields lists the keys whose value the schema fixes for a CapabilityLocalModelsRefused.+func (CapabilityLocalModelsRefused) FixedFields() map[string]string {+ return map[string]string{"protocol_version": "2", "type": "executed", "kind": "local_models", "outcome": "refused"}+}++// RequiredFields lists the keys a CapabilityLocalModelsRefused must carry.+func (CapabilityLocalModelsRefused) RequiredFields() []string {+ return []string{"protocol_version", "command_id", "runner_id", "tenant_id", "owner_actor_id", "connection_epoch", "expires_at", "type", "kind", "action", "refusal", "outcome"}+}++// RunnerLocalModels mirrors the RunnerLocalModels schema shape.+type RunnerLocalModels struct {+ Type string `json:"type"`+ ProtocolVersion string `json:"protocol_version"`+ RunnerID string `json:"runner_id"`+ SentAt string `json:"sent_at"`+ Revision uint64 `json:"revision"`+ LocalModels LocalModelsSnapshot `json:"local_models"`+}++// FixedFields lists the keys whose value the schema fixes for a RunnerLocalModels.+func (RunnerLocalModels) FixedFields() map[string]string {+ return map[string]string{"type": "runner.local_models", "protocol_version": "2"}+}++// RequiredFields lists the keys a RunnerLocalModels must carry.+func (RunnerLocalModels) RequiredFields() []string {+ return []string{"type", "protocol_version", "runner_id", "sent_at", "revision", "local_models"}+}+// RunnerHelloDaemonIdentity mirrors the RunnerHelloDaemonIdentity schema shape.type RunnerHelloDaemonIdentity struct {DaemonID string `json:"daemon_id"`diff --git a/contracts/generated/go/teamhubinternal/openapi.gen.go b/contracts/generated/go/teamhubinternal/openapi.gen.goindex a1db98c0..79c63eed 100644--- a/contracts/generated/go/teamhubinternal/openapi.gen.go+++ b/contracts/generated/go/teamhubinternal/openapi.gen.go@@ -752,6 +752,270 @@ func (e FinishAgentLocalRunRequestTerminalType) Valid() bool {}}+// Defines values for LocalModelAvailabilityReasonCode.+const (+ LocalModelAvailabilityDiskInsufficient LocalModelAvailabilityReasonCode = "DISK_INSUFFICIENT"+ LocalModelAvailabilityMemoryInsufficient LocalModelAvailabilityReasonCode = "MEMORY_INSUFFICIENT"+ LocalModelAvailabilityPlatformUnsupported LocalModelAvailabilityReasonCode = "PLATFORM_UNSUPPORTED"+)++// Valid indicates whether the value is a known member of the LocalModelAvailabilityReasonCode enum.+func (e LocalModelAvailabilityReasonCode) Valid() bool {+ switch e {+ case LocalModelAvailabilityDiskInsufficient:+ return true+ case LocalModelAvailabilityMemoryInsufficient:+ return true+ case LocalModelAvailabilityPlatformUnsupported:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelDownloadProgressStep.+const (+ LocalModelDownloadStepDownload LocalModelDownloadProgressStep = "download"+ LocalModelDownloadStepVerify LocalModelDownloadProgressStep = "verify"+)++// Valid indicates whether the value is a known member of the LocalModelDownloadProgressStep enum.+func (e LocalModelDownloadProgressStep) Valid() bool {+ switch e {+ case LocalModelDownloadStepDownload:+ return true+ case LocalModelDownloadStepVerify:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelErrorCode.+const (+ CANCELLED LocalModelErrorCode = "CANCELLED"+ CHECKSUMMISMATCH LocalModelErrorCode = "CHECKSUM_MISMATCH"+ DISKINSUFFICIENT LocalModelErrorCode = "DISK_INSUFFICIENT"+ DOWNLOADFAILED LocalModelErrorCode = "DOWNLOAD_FAILED"+ ENGINESTARTFAILED LocalModelErrorCode = "ENGINE_START_FAILED"+ GATEWAYREGISTRATIONFAILED LocalModelErrorCode = "GATEWAY_REGISTRATION_FAILED"+ HEALTHCHECKFAILED LocalModelErrorCode = "HEALTH_CHECK_FAILED"+ INVALIDSTATE LocalModelErrorCode = "INVALID_STATE"+ JOBRUNNING LocalModelErrorCode = "JOB_RUNNING"+ LOADNOROOM LocalModelErrorCode = "LOAD_NO_ROOM"+ MEMORYINSUFFICIENT LocalModelErrorCode = "MEMORY_INSUFFICIENT"+ MODELFILESMISSING LocalModelErrorCode = "MODEL_FILES_MISSING"+ MODELUNKNOWN LocalModelErrorCode = "MODEL_UNKNOWN"+ NETWORKUNAVAILABLE LocalModelErrorCode = "NETWORK_UNAVAILABLE"+ OUTOFMEMORY LocalModelErrorCode = "OUT_OF_MEMORY"+ PLATFORMUNSUPPORTED LocalModelErrorCode = "PLATFORM_UNSUPPORTED"+)++// Valid indicates whether the value is a known member of the LocalModelErrorCode enum.+func (e LocalModelErrorCode) Valid() bool {+ switch e {+ case CANCELLED:+ return true+ case CHECKSUMMISMATCH:+ return true+ case DISKINSUFFICIENT:+ return true+ case DOWNLOADFAILED:+ return true+ case ENGINESTARTFAILED:+ return true+ case GATEWAYREGISTRATIONFAILED:+ return true+ case HEALTHCHECKFAILED:+ return true+ case INVALIDSTATE:+ return true+ case JOBRUNNING:+ return true+ case LOADNOROOM:+ return true+ case MEMORYINSUFFICIENT:+ return true+ case MODELFILESMISSING:+ return true+ case MODELUNKNOWN:+ return true+ case NETWORKUNAVAILABLE:+ return true+ case OUTOFMEMORY:+ return true+ case PLATFORMUNSUPPORTED:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelFit.+const (+ LocalModelFitGpu LocalModelFit = "gpu"+ LocalModelFitNone LocalModelFit = "none"+ LocalModelFitSystem LocalModelFit = "system"+ LocalModelFitUnified LocalModelFit = "unified"+)++// Valid indicates whether the value is a known member of the LocalModelFit enum.+func (e LocalModelFit) Valid() bool {+ switch e {+ case LocalModelFitGpu:+ return true+ case LocalModelFitNone:+ return true+ case LocalModelFitSystem:+ return true+ case LocalModelFitUnified:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelHostArch.+const (+ LocalModelHostArchArm64 LocalModelHostArch = "arm64"+ LocalModelHostArchX8664 LocalModelHostArch = "x86_64"+)++// Valid indicates whether the value is a known member of the LocalModelHostArch enum.+func (e LocalModelHostArch) Valid() bool {+ switch e {+ case LocalModelHostArchArm64:+ return true+ case LocalModelHostArchX8664:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelHostPlatform.+const (+ LocalModelHostPlatformDarwin LocalModelHostPlatform = "darwin"+ LocalModelHostPlatformLinux LocalModelHostPlatform = "linux"+ LocalModelHostPlatformWindows LocalModelHostPlatform = "windows"+)++// Valid indicates whether the value is a known member of the LocalModelHostPlatform enum.+func (e LocalModelHostPlatform) Valid() bool {+ switch e {+ case LocalModelHostPlatformDarwin:+ return true+ case LocalModelHostPlatformLinux:+ return true+ case LocalModelHostPlatformWindows:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelNoteCode.+const (+ LocalModelNoteNoRoomToLoad LocalModelNoteCode = "NO_ROOM_TO_LOAD"+)++// Valid indicates whether the value is a known member of the LocalModelNoteCode enum.+func (e LocalModelNoteCode) Valid() bool {+ switch e {+ case LocalModelNoteNoRoomToLoad:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelPoolKind.+const (+ LocalModelPoolKindGpu LocalModelPoolKind = "gpu"+ LocalModelPoolKindSystem LocalModelPoolKind = "system"+ LocalModelPoolKindUnified LocalModelPoolKind = "unified"+)++// Valid indicates whether the value is a known member of the LocalModelPoolKind enum.+func (e LocalModelPoolKind) Valid() bool {+ switch e {+ case LocalModelPoolKindGpu:+ return true+ case LocalModelPoolKindSystem:+ return true+ case LocalModelPoolKindUnified:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelPoolHolderKind.+const (+ LocalModelPoolHolderKindComponent LocalModelPoolHolderKind = "component"+ LocalModelPoolHolderKindModel LocalModelPoolHolderKind = "model"+)++// Valid indicates whether the value is a known member of the LocalModelPoolHolderKind enum.+func (e LocalModelPoolHolderKind) Valid() bool {+ switch e {+ case LocalModelPoolHolderKindComponent:+ return true+ case LocalModelPoolHolderKindModel:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelState.+const (+ LocalModelStateAbsent LocalModelState = "absent"+ LocalModelStateDownloading LocalModelState = "downloading"+ LocalModelStateFailed LocalModelState = "failed"+ LocalModelStateIdle LocalModelState = "idle"+ LocalModelStateLoaded LocalModelState = "loaded"+ LocalModelStateLoading LocalModelState = "loading"+)++// Valid indicates whether the value is a known member of the LocalModelState enum.+func (e LocalModelState) Valid() bool {+ switch e {+ case LocalModelStateAbsent:+ return true+ case LocalModelStateDownloading:+ return true+ case LocalModelStateFailed:+ return true+ case LocalModelStateIdle:+ return true+ case LocalModelStateLoaded:+ return true+ case LocalModelStateLoading:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelsUnavailableCode.+const (+ TOOLFAILED LocalModelsUnavailableCode = "TOOL_FAILED"+ TOOLNOTINSTALLED LocalModelsUnavailableCode = "TOOL_NOT_INSTALLED"+)++// Valid indicates whether the value is a known member of the LocalModelsUnavailableCode enum.+func (e LocalModelsUnavailableCode) Valid() bool {+ switch e {+ case TOOLFAILED:+ return true+ case TOOLNOTINSTALLED:+ return true+ default:+ return false+ }+}+// Defines values for LocalRuntimeType.const (LocalRuntimeTypeClaude LocalRuntimeType = "claude"@@ -2751,6 +3015,193 @@ type ListRecentlyUsedAgentRuntimeContextsResult struct {Contexts []RecentlyUsedAgentRuntimeContext `json:"contexts"`}+// LocalModel One validated chat model of the catalog on this platform and its state on this Computer. Sizes are bytes; readers format them.+type LocalModel struct {+ Availability LocalModelAvailability `json:"availability"`+ ContextTokens int64 `json:"context_tokens"`+ Description string `json:"description"`+ Download *LocalModelDownloadProgress `json:"download,omitempty"`+ DownloadBytes int64 `json:"download_bytes"`+ Endpoint *LocalModelEndpoint `json:"endpoint,omitempty"`+ Error *LocalModelError `json:"error,omitempty"`++ // Fit Where the model can live, judged on total capacity so it stays stable across loads. system means localmodels can run it from RAM, slower.+ Fit LocalModelFit `json:"fit"`++ // Id Stable localmodels library id: catalog id and variant, such as qwen3-4b:Q4_K_M.+ Id LocalModelId `json:"id"`++ // MemoryBytes Footprint when loaded at its context policy, from the localmodels estimator.+ MemoryBytes int64 `json:"memory_bytes"`+ Name string `json:"name"`+ Note *LocalModelNote `json:"note,omitempty"`++ // PiModel The runtime_model an Agent on runtime pi stores for this model, <pi provider>/<pi model id>; present while the model is on the Computer.+ PiModel *string `json:"pi_model,omitempty"`++ // Pool A place a model can live: gpu:<index>, system (RAM beside GPUs), or unified (RAM of a host without discrete GPUs).+ Pool *LocalModelPoolId `json:"pool,omitempty"`+ Quant string `json:"quant"`++ // Recommended True on at most one model, an absent downloadable one.+ Recommended bool `json:"recommended"`++ // State absent: not on disk. idle: on disk, holding no memory. loading reserves its memory before it finishes; loaded is registered with the local gateway and Pi.+ State LocalModelState `json:"state"`++ // TokensPerSecond Warm speed measured at the last load; absent when unknown.+ TokensPerSecond *float32 `json:"tokens_per_second,omitempty"`+ Vision bool `json:"vision"`+}++// LocalModelAvailability defines model for LocalModelAvailability.+type LocalModelAvailability struct {+ Downloadable bool `json:"downloadable"`+ Reason *LocalModelAvailabilityReason `json:"reason,omitempty"`+}++// LocalModelAvailabilityReason defines model for LocalModelAvailabilityReason.+type LocalModelAvailabilityReason struct {+ Code LocalModelAvailabilityReasonCode `json:"code"`+ HaveBytes *int64 `json:"have_bytes,omitempty"`+ NeedBytes *int64 `json:"need_bytes,omitempty"`+}++// LocalModelAvailabilityReasonCode defines model for LocalModelAvailabilityReason.Code.+type LocalModelAvailabilityReasonCode string++// LocalModelDownloadProgress defines model for LocalModelDownloadProgress.+type LocalModelDownloadProgress struct {+ BytesPerSecond *int64 `json:"bytes_per_second,omitempty"`+ DoneBytes int64 `json:"done_bytes"`+ Step LocalModelDownloadProgressStep `json:"step"`+ TotalBytes int64 `json:"total_bytes"`+}++// LocalModelDownloadProgressStep defines model for LocalModelDownloadProgress.Step.+type LocalModelDownloadProgressStep string++// LocalModelEndpoint defines model for LocalModelEndpoint.+type LocalModelEndpoint struct {+ BaseUrl string `json:"base_url"`+}++// LocalModelError defines model for LocalModelError.+type LocalModelError struct {+ // Code Closed localmodels library error set. It is extended only together with the localmodels library contract.+ Code LocalModelErrorCode `json:"code"`++ // Detail Diagnostic text for display; never matched on.+ Detail *string `json:"detail,omitempty"`+}++// LocalModelErrorCode Closed localmodels library error set. It is extended only together with the localmodels library contract.+type LocalModelErrorCode string++// LocalModelFit Where the model can live, judged on total capacity so it stays stable across loads. system means localmodels can run it from RAM, slower.+type LocalModelFit string++// LocalModelGpu defines model for LocalModelGpu.+type LocalModelGpu struct {+ FreeBytes int64 `json:"free_bytes"`+ Index int `json:"index"`+ Name string `json:"name"`+ TotalBytes int64 `json:"total_bytes"`+ Uuid *string `json:"uuid,omitempty"`+}++// LocalModelHost Hardware and software of the Computer as localmodels reports it.+type LocalModelHost struct {+ Arch LocalModelHostArch `json:"arch"`+ DiskFreeBytes int64 `json:"disk_free_bytes"`++ // EngineLabel Display only, such as llama.cpp b11370 with CUDA.+ EngineLabel string `json:"engine_label"`+ Gpus []LocalModelGpu `json:"gpus"`++ // OsLabel Display only, such as Ubuntu 24.04.+ OsLabel string `json:"os_label"`+ Platform LocalModelHostPlatform `json:"platform"`+ RamTotalBytes int64 `json:"ram_total_bytes"`+}++// LocalModelHostArch defines model for LocalModelHost.Arch.+type LocalModelHostArch string++// LocalModelHostPlatform defines model for LocalModelHost.Platform.+type LocalModelHostPlatform string++// LocalModelId Stable localmodels library id: catalog id and variant, such as qwen3-4b:Q4_K_M.+type LocalModelId = string++// LocalModelNote defines model for LocalModelNote.+type LocalModelNote struct {+ Code LocalModelNoteCode `json:"code"`+}++// LocalModelNoteCode defines model for LocalModelNote.Code.+type LocalModelNoteCode string++// LocalModelPool One place models load into. The system and unified budgets are 80% of RAM, as localmodels computes them.+type LocalModelPool struct {+ // GpuIndex Present only for kind gpu; matches LocalModelGpu.index.+ GpuIndex *int `json:"gpu_index,omitempty"`+ Holders []LocalModelPoolHolder `json:"holders"`++ // Id A place a model can live: gpu:<index>, system (RAM beside GPUs), or unified (RAM of a host without discrete GPUs).+ Id LocalModelPoolId `json:"id"`+ Kind LocalModelPoolKind `json:"kind"`+ TotalBytes int64 `json:"total_bytes"`+ UsedBytes int64 `json:"used_bytes"`+}++// LocalModelPoolKind defines model for LocalModelPool.Kind.+type LocalModelPoolKind string++// LocalModelPoolHolder Something holding pool memory. A component is a foundation service such as an embedding, reranker, or speech model; it is never a model row.+type LocalModelPoolHolder struct {+ Bytes int64 `json:"bytes"`+ Id string `json:"id"`+ Kind LocalModelPoolHolderKind `json:"kind"`+ Name string `json:"name"`+}++// LocalModelPoolHolderKind defines model for LocalModelPoolHolder.Kind.+type LocalModelPoolHolderKind string++// LocalModelPoolId A place a model can live: gpu:<index>, system (RAM beside GPUs), or unified (RAM of a host without discrete GPUs).+type LocalModelPoolId = string++// LocalModelState absent: not on disk. idle: on disk, holding no memory. loading reserves its memory before it finishes; loaded is registered with the local gateway and Pi.+type LocalModelState string++// LocalModelsSnapshot A Computer's model library as its Daemon reported it in runner.local_models, mapped from localmodels.library-status/v1. When available is false only reason and observed_at carry meaning and the lists are empty.+type LocalModelsSnapshot struct {+ Available bool `json:"available"`++ // Host Hardware and software of the Computer as localmodels reports it.+ Host *LocalModelHost `json:"host,omitempty"`+ Models []LocalModel `json:"models"`++ // ObservedAt UTC timestamp in RFC 3339 format with an explicit offset.+ ObservedAt Timestamp `json:"observed_at"`+ Pools []LocalModelPool `json:"pools"`+ Reason *LocalModelsUnavailableReason `json:"reason,omitempty"`+ ToolVersion *string `json:"tool_version,omitempty"`+}++// LocalModelsUnavailableCode Why a Computer reports no model library. TOOL_NOT_INSTALLED: its Computer config names no localmodels tool. TOOL_FAILED: the tool did not answer library status.+type LocalModelsUnavailableCode string++// LocalModelsUnavailableReason defines model for LocalModelsUnavailableReason.+type LocalModelsUnavailableReason struct {+ // Code Why a Computer reports no model library. TOOL_NOT_INSTALLED: its Computer config names no localmodels tool. TOOL_FAILED: the tool did not answer library status.+ Code LocalModelsUnavailableCode `json:"code"`++ // Detail Diagnostic text for display; never matched on.+ Detail *string `json:"detail,omitempty"`+}+// LocalRuntimeType defines model for LocalRuntimeType.type LocalRuntimeType string@@ -3047,6 +3498,15 @@ type RecordAgentLocalRunOperationRequest struct {Usage *[]map[string]interface{} `json:"usage,omitempty"`}+// RecordLocalModelsRequest The latest runner.local_models snapshot of one Computer. TeamHub keeps only the latest per Computer, so an offline Computer still shows what it last reported.+type RecordLocalModelsRequest struct {+ // ComputerId Opaque, case-sensitive identifier. Clients must not infer type or time from it.+ ComputerId Id `json:"computer_id"`++ // Snapshot A Computer's model library as its Daemon reported it in runner.local_models, mapped from localmodels.library-status/v1. When available is false only reason and observed_at carry meaning and the lists are empty.+ Snapshot LocalModelsSnapshot `json:"snapshot"`+}+// RequeueAgentLocalRunRequest defines model for RequeueAgentLocalRunRequest.type RequeueAgentLocalRunRequest struct {ContextKey AgentRuntimeContextKey `json:"context_key"`@@ -4105,6 +4565,9 @@ type AcceptAgentRuntimeTrustedNotificationJSONRequestBody = AcceptAgentTrustedNo// ConnectAgentRuntimeLocalComputerJSONRequestBody defines body for ConnectAgentRuntimeLocalComputer for application/json ContentType.type ConnectAgentRuntimeLocalComputerJSONRequestBody = ConnectAgentRuntimeLocalComputerRequest+// RecordAgentRuntimeLocalModelsJSONRequestBody defines body for RecordAgentRuntimeLocalModels for application/json ContentType.+type RecordAgentRuntimeLocalModelsJSONRequestBody = RecordLocalModelsRequest+// RemoveAgentRuntimeLocalComputerJSONRequestBody defines body for RemoveAgentRuntimeLocalComputer for application/json ContentType.type RemoveAgentRuntimeLocalComputerJSONRequestBody = AgentRuntimeLocalComputerCredentialRequestdiff --git a/contracts/generated/go/teamhubpublic/openapi.gen.go b/contracts/generated/go/teamhubpublic/openapi.gen.goindex b1850d5d..dcf08f27 100644--- a/contracts/generated/go/teamhubpublic/openapi.gen.go+++ b/contracts/generated/go/teamhubpublic/openapi.gen.go@@ -1961,27 +1961,417 @@ func (e LocalComputerWorkspaceGrantMode) Valid() bool {}}+// Defines values for LocalModelActionAcceptedAction.+const (+ LocalModelActionAcceptedCancel LocalModelActionAcceptedAction = "cancel"+ LocalModelActionAcceptedDownload LocalModelActionAcceptedAction = "download"+ LocalModelActionAcceptedLoad LocalModelActionAcceptedAction = "load"+ LocalModelActionAcceptedRemove LocalModelActionAcceptedAction = "remove"+ LocalModelActionAcceptedUnload LocalModelActionAcceptedAction = "unload"+)++// Valid indicates whether the value is a known member of the LocalModelActionAcceptedAction enum.+func (e LocalModelActionAcceptedAction) Valid() bool {+ switch e {+ case LocalModelActionAcceptedCancel:+ return true+ case LocalModelActionAcceptedDownload:+ return true+ case LocalModelActionAcceptedLoad:+ return true+ case LocalModelActionAcceptedRemove:+ return true+ case LocalModelActionAcceptedUnload:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelActionRequestAction.+const (+ LocalModelActionRequestCancel LocalModelActionRequestAction = "cancel"+ LocalModelActionRequestDownload LocalModelActionRequestAction = "download"+ LocalModelActionRequestLoad LocalModelActionRequestAction = "load"+ LocalModelActionRequestRemove LocalModelActionRequestAction = "remove"+ LocalModelActionRequestUnload LocalModelActionRequestAction = "unload"+)++// Valid indicates whether the value is a known member of the LocalModelActionRequestAction enum.+func (e LocalModelActionRequestAction) Valid() bool {+ switch e {+ case LocalModelActionRequestCancel:+ return true+ case LocalModelActionRequestDownload:+ return true+ case LocalModelActionRequestLoad:+ return true+ case LocalModelActionRequestRemove:+ return true+ case LocalModelActionRequestUnload:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelAvailabilityReasonCode.+const (+ LocalModelAvailabilityDiskInsufficient LocalModelAvailabilityReasonCode = "DISK_INSUFFICIENT"+ LocalModelAvailabilityMemoryInsufficient LocalModelAvailabilityReasonCode = "MEMORY_INSUFFICIENT"+ LocalModelAvailabilityPlatformUnsupported LocalModelAvailabilityReasonCode = "PLATFORM_UNSUPPORTED"+)++// Valid indicates whether the value is a known member of the LocalModelAvailabilityReasonCode enum.+func (e LocalModelAvailabilityReasonCode) Valid() bool {+ switch e {+ case LocalModelAvailabilityDiskInsufficient:+ return true+ case LocalModelAvailabilityMemoryInsufficient:+ return true+ case LocalModelAvailabilityPlatformUnsupported:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelDownloadProgressStep.+const (+ LocalModelDownloadStepDownload LocalModelDownloadProgressStep = "download"+ LocalModelDownloadStepVerify LocalModelDownloadProgressStep = "verify"+)++// Valid indicates whether the value is a known member of the LocalModelDownloadProgressStep enum.+func (e LocalModelDownloadProgressStep) Valid() bool {+ switch e {+ case LocalModelDownloadStepDownload:+ return true+ case LocalModelDownloadStepVerify:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelErrorCode.+const (+ CANCELLED LocalModelErrorCode = "CANCELLED"+ CHECKSUMMISMATCH LocalModelErrorCode = "CHECKSUM_MISMATCH"+ DISKINSUFFICIENT LocalModelErrorCode = "DISK_INSUFFICIENT"+ DOWNLOADFAILED LocalModelErrorCode = "DOWNLOAD_FAILED"+ ENGINESTARTFAILED LocalModelErrorCode = "ENGINE_START_FAILED"+ GATEWAYREGISTRATIONFAILED LocalModelErrorCode = "GATEWAY_REGISTRATION_FAILED"+ HEALTHCHECKFAILED LocalModelErrorCode = "HEALTH_CHECK_FAILED"+ INVALIDSTATE LocalModelErrorCode = "INVALID_STATE"+ JOBRUNNING LocalModelErrorCode = "JOB_RUNNING"+ LOADNOROOM LocalModelErrorCode = "LOAD_NO_ROOM"+ MEMORYINSUFFICIENT LocalModelErrorCode = "MEMORY_INSUFFICIENT"+ MODELFILESMISSING LocalModelErrorCode = "MODEL_FILES_MISSING"+ MODELUNKNOWN LocalModelErrorCode = "MODEL_UNKNOWN"+ NETWORKUNAVAILABLE LocalModelErrorCode = "NETWORK_UNAVAILABLE"+ OUTOFMEMORY LocalModelErrorCode = "OUT_OF_MEMORY"+ PLATFORMUNSUPPORTED LocalModelErrorCode = "PLATFORM_UNSUPPORTED"+)++// Valid indicates whether the value is a known member of the LocalModelErrorCode enum.+func (e LocalModelErrorCode) Valid() bool {+ switch e {+ case CANCELLED:+ return true+ case CHECKSUMMISMATCH:+ return true+ case DISKINSUFFICIENT:+ return true+ case DOWNLOADFAILED:+ return true+ case ENGINESTARTFAILED:+ return true+ case GATEWAYREGISTRATIONFAILED:+ return true+ case HEALTHCHECKFAILED:+ return true+ case INVALIDSTATE:+ return true+ case JOBRUNNING:+ return true+ case LOADNOROOM:+ return true+ case MEMORYINSUFFICIENT:+ return true+ case MODELFILESMISSING:+ return true+ case MODELUNKNOWN:+ return true+ case NETWORKUNAVAILABLE:+ return true+ case OUTOFMEMORY:+ return true+ case PLATFORMUNSUPPORTED:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelFit.+const (+ LocalModelFitGpu LocalModelFit = "gpu"+ LocalModelFitNone LocalModelFit = "none"+ LocalModelFitSystem LocalModelFit = "system"+ LocalModelFitUnified LocalModelFit = "unified"+)++// Valid indicates whether the value is a known member of the LocalModelFit enum.+func (e LocalModelFit) Valid() bool {+ switch e {+ case LocalModelFitGpu:+ return true+ case LocalModelFitNone:+ return true+ case LocalModelFitSystem:+ return true+ case LocalModelFitUnified:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelHostArch.+const (+ LocalModelHostArchArm64 LocalModelHostArch = "arm64"+ LocalModelHostArchX8664 LocalModelHostArch = "x86_64"+)++// Valid indicates whether the value is a known member of the LocalModelHostArch enum.+func (e LocalModelHostArch) Valid() bool {+ switch e {+ case LocalModelHostArchArm64:+ return true+ case LocalModelHostArchX8664:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelHostPlatform.+const (+ LocalModelHostPlatformDarwin LocalModelHostPlatform = "darwin"+ LocalModelHostPlatformLinux LocalModelHostPlatform = "linux"+ LocalModelHostPlatformWindows LocalModelHostPlatform = "windows"+)++// Valid indicates whether the value is a known member of the LocalModelHostPlatform enum.+func (e LocalModelHostPlatform) Valid() bool {+ switch e {+ case LocalModelHostPlatformDarwin:+ return true+ case LocalModelHostPlatformLinux:+ return true+ case LocalModelHostPlatformWindows:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelNoteCode.+const (+ LocalModelNoteNoRoomToLoad LocalModelNoteCode = "NO_ROOM_TO_LOAD"+)++// Valid indicates whether the value is a known member of the LocalModelNoteCode enum.+func (e LocalModelNoteCode) Valid() bool {+ switch e {+ case LocalModelNoteNoRoomToLoad:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelPoolKind.+const (+ LocalModelPoolKindGpu LocalModelPoolKind = "gpu"+ LocalModelPoolKindSystem LocalModelPoolKind = "system"+ LocalModelPoolKindUnified LocalModelPoolKind = "unified"+)++// Valid indicates whether the value is a known member of the LocalModelPoolKind enum.+func (e LocalModelPoolKind) Valid() bool {+ switch e {+ case LocalModelPoolKindGpu:+ return true+ case LocalModelPoolKindSystem:+ return true+ case LocalModelPoolKindUnified:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelPoolHolderKind.+const (+ LocalModelPoolHolderKindComponent LocalModelPoolHolderKind = "component"+ LocalModelPoolHolderKindModel LocalModelPoolHolderKind = "model"+)++// Valid indicates whether the value is a known member of the LocalModelPoolHolderKind enum.+func (e LocalModelPoolHolderKind) Valid() bool {+ switch e {+ case LocalModelPoolHolderKindComponent:+ return true+ case LocalModelPoolHolderKindModel:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelState.+const (+ LocalModelStateAbsent LocalModelState = "absent"+ LocalModelStateDownloading LocalModelState = "downloading"+ LocalModelStateFailed LocalModelState = "failed"+ LocalModelStateIdle LocalModelState = "idle"+ LocalModelStateLoaded LocalModelState = "loaded"+ LocalModelStateLoading LocalModelState = "loading"+)++// Valid indicates whether the value is a known member of the LocalModelState enum.+func (e LocalModelState) Valid() bool {+ switch e {+ case LocalModelStateAbsent:+ return true+ case LocalModelStateDownloading:+ return true+ case LocalModelStateFailed:+ return true+ case LocalModelStateIdle:+ return true+ case LocalModelStateLoaded:+ return true+ case LocalModelStateLoading:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelsComputerStatus.+const (+ LocalModelsComputerOffline LocalModelsComputerStatus = "offline"+ LocalModelsComputerOnline LocalModelsComputerStatus = "online"+)++// Valid indicates whether the value is a known member of the LocalModelsComputerStatus enum.+func (e LocalModelsComputerStatus) Valid() bool {+ switch e {+ case LocalModelsComputerOffline:+ return true+ case LocalModelsComputerOnline:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelsErrorCode.+const (+ LocalModelsErrorCodeLOCALCOMPUTEROFFLINE LocalModelsErrorCode = "LOCAL_COMPUTER_OFFLINE"+ LocalModelsErrorCodeLOCALMODELACTIONFAILED LocalModelsErrorCode = "LOCAL_MODEL_ACTION_FAILED"+ LocalModelsErrorCodeLOCALMODELACTIONFORBIDDEN LocalModelsErrorCode = "LOCAL_MODEL_ACTION_FORBIDDEN"+ LocalModelsErrorCodeLOCALMODELACTIONUNCONFIRMED LocalModelsErrorCode = "LOCAL_MODEL_ACTION_UNCONFIRMED"+ LocalModelsErrorCodeLOCALMODELDISKINSUFFICIENT LocalModelsErrorCode = "LOCAL_MODEL_DISK_INSUFFICIENT"+ LocalModelsErrorCodeLOCALMODELINVALIDSTATE LocalModelsErrorCode = "LOCAL_MODEL_INVALID_STATE"+ LocalModelsErrorCodeLOCALMODELJOBRUNNING LocalModelsErrorCode = "LOCAL_MODEL_JOB_RUNNING"+ LocalModelsErrorCodeLOCALMODELMEMORYINSUFFICIENT LocalModelsErrorCode = "LOCAL_MODEL_MEMORY_INSUFFICIENT"+ LocalModelsErrorCodeLOCALMODELNOROOM LocalModelsErrorCode = "LOCAL_MODEL_NO_ROOM"+ LocalModelsErrorCodeLOCALMODELPLATFORMUNSUPPORTED LocalModelsErrorCode = "LOCAL_MODEL_PLATFORM_UNSUPPORTED"+ LocalModelsErrorCodeLOCALMODELSSERVICEUNAVAILABLE LocalModelsErrorCode = "LOCAL_MODELS_SERVICE_UNAVAILABLE"+ LocalModelsErrorCodeLOCALMODELSUNAVAILABLE LocalModelsErrorCode = "LOCAL_MODELS_UNAVAILABLE"+ LocalModelsErrorCodeLOCALMODELUNKNOWN LocalModelsErrorCode = "LOCAL_MODEL_UNKNOWN"+)++// Valid indicates whether the value is a known member of the LocalModelsErrorCode enum.+func (e LocalModelsErrorCode) Valid() bool {+ switch e {+ case LocalModelsErrorCodeLOCALCOMPUTEROFFLINE:+ return true+ case LocalModelsErrorCodeLOCALMODELACTIONFAILED:+ return true+ case LocalModelsErrorCodeLOCALMODELACTIONFORBIDDEN:+ return true+ case LocalModelsErrorCodeLOCALMODELACTIONUNCONFIRMED:+ return true+ case LocalModelsErrorCodeLOCALMODELDISKINSUFFICIENT:+ return true+ case LocalModelsErrorCodeLOCALMODELINVALIDSTATE:+ return true+ case LocalModelsErrorCodeLOCALMODELJOBRUNNING:+ return true+ case LocalModelsErrorCodeLOCALMODELMEMORYINSUFFICIENT:+ return true+ case LocalModelsErrorCodeLOCALMODELNOROOM:+ return true+ case LocalModelsErrorCodeLOCALMODELPLATFORMUNSUPPORTED:+ return true+ case LocalModelsErrorCodeLOCALMODELSSERVICEUNAVAILABLE:+ return true+ case LocalModelsErrorCodeLOCALMODELSUNAVAILABLE:+ return true+ case LocalModelsErrorCodeLOCALMODELUNKNOWN:+ return true+ default:+ return false+ }+}++// Defines values for LocalModelsViewUnavailableReasonCode.+const (+ LocalModelsViewNotReported LocalModelsViewUnavailableReasonCode = "NOT_REPORTED"+ LocalModelsViewToolFailed LocalModelsViewUnavailableReasonCode = "TOOL_FAILED"+ LocalModelsViewToolNotInstalled LocalModelsViewUnavailableReasonCode = "TOOL_NOT_INSTALLED"+)++// Valid indicates whether the value is a known member of the LocalModelsViewUnavailableReasonCode enum.+func (e LocalModelsViewUnavailableReasonCode) Valid() bool {+ switch e {+ case LocalModelsViewNotReported:+ return true+ case LocalModelsViewToolFailed:+ return true+ case LocalModelsViewToolNotInstalled:+ return true+ default:+ return false+ }+}+// Defines values for LocalRuntimeDiagnosticErrorCode.const (- LOCALCOMPUTEROFFLINE LocalRuntimeDiagnosticErrorCode = "LOCAL_COMPUTER_OFFLINE"- RUNTIMEAUTHENTICATIONREQUIRED LocalRuntimeDiagnosticErrorCode = "RUNTIME_AUTHENTICATION_REQUIRED"- RUNTIMEDIAGNOSTICFAILED LocalRuntimeDiagnosticErrorCode = "RUNTIME_DIAGNOSTIC_FAILED"- RUNTIMEINCOMPATIBLE LocalRuntimeDiagnosticErrorCode = "RUNTIME_INCOMPATIBLE"- RUNTIMENOTINSTALLED LocalRuntimeDiagnosticErrorCode = "RUNTIME_NOT_INSTALLED"+ LocalRuntimeDiagnosticErrorCodeLOCALCOMPUTEROFFLINE LocalRuntimeDiagnosticErrorCode = "LOCAL_COMPUTER_OFFLINE"+ LocalRuntimeDiagnosticErrorCodeRUNTIMEAUTHENTICATIONREQUIRED LocalRuntimeDiagnosticErrorCode = "RUNTIME_AUTHENTICATION_REQUIRED"+ LocalRuntimeDiagnosticErrorCodeRUNTIMEDIAGNOSTICFAILED LocalRuntimeDiagnosticErrorCode = "RUNTIME_DIAGNOSTIC_FAILED"+ LocalRuntimeDiagnosticErrorCodeRUNTIMEINCOMPATIBLE LocalRuntimeDiagnosticErrorCode = "RUNTIME_INCOMPATIBLE"+ LocalRuntimeDiagnosticErrorCodeRUNTIMENOTINSTALLED LocalRuntimeDiagnosticErrorCode = "RUNTIME_NOT_INSTALLED")// Valid indicates whether the value is a known member of the LocalRuntimeDiagnosticErrorCode enum.func (e LocalRuntimeDiagnosticErrorCode) Valid() bool {switch e {- case LOCALCOMPUTEROFFLINE:+ case LocalRuntimeDiagnosticErrorCodeLOCALCOMPUTEROFFLINE:return true- case RUNTIMEAUTHENTICATIONREQUIRED:+ case LocalRuntimeDiagnosticErrorCodeRUNTIMEAUTHENTICATIONREQUIRED:return true- case RUNTIMEDIAGNOSTICFAILED:+ case LocalRuntimeDiagnosticErrorCodeRUNTIMEDIAGNOSTICFAILED:return true- case RUNTIMEINCOMPATIBLE:+ case LocalRuntimeDiagnosticErrorCodeRUNTIMEINCOMPATIBLE:return true- case RUNTIMENOTINSTALLED:+ case LocalRuntimeDiagnosticErrorCodeRUNTIMENOTINSTALLED:return truedefault:return false@@ -5718,6 +6108,271 @@ type LocalIdentityProof struct {Proof string `json:"proof"`}+// LocalModel One validated chat model of the catalog on this platform and its state on this Computer. Sizes are bytes; readers format them.+type LocalModel struct {+ Availability LocalModelAvailability `json:"availability"`+ ContextTokens int64 `json:"context_tokens"`+ Description string `json:"description"`+ Download *LocalModelDownloadProgress `json:"download,omitempty"`+ DownloadBytes int64 `json:"download_bytes"`+ Endpoint *LocalModelEndpoint `json:"endpoint,omitempty"`+ Error *LocalModelError `json:"error,omitempty"`++ // Fit Where the model can live, judged on total capacity so it stays stable across loads. system means localmodels can run it from RAM, slower.+ Fit LocalModelFit `json:"fit"`++ // Id Stable localmodels library id: catalog id and variant, such as qwen3-4b:Q4_K_M.+ Id LocalModelId `json:"id"`++ // MemoryBytes Footprint when loaded at its context policy, from the localmodels estimator.+ MemoryBytes int64 `json:"memory_bytes"`+ Name string `json:"name"`+ Note *LocalModelNote `json:"note,omitempty"`++ // PiModel The runtime_model an Agent on runtime pi stores for this model, <pi provider>/<pi model id>; present while the model is on the Computer.+ PiModel *string `json:"pi_model,omitempty"`++ // Pool A place a model can live: gpu:<index>, system (RAM beside GPUs), or unified (RAM of a host without discrete GPUs).+ Pool *LocalModelPoolId `json:"pool,omitempty"`+ Quant string `json:"quant"`++ // Recommended True on at most one model, an absent downloadable one.+ Recommended bool `json:"recommended"`++ // State absent: not on disk. idle: on disk, holding no memory. loading reserves its memory before it finishes; loaded is registered with the local gateway and Pi.+ State LocalModelState `json:"state"`++ // TokensPerSecond Warm speed measured at the last load; absent when unknown.+ TokensPerSecond *float32 `json:"tokens_per_second,omitempty"`+ Vision bool `json:"vision"`+}++// LocalModelActionAccepted defines model for LocalModelActionAccepted.+type LocalModelActionAccepted struct {+ Action LocalModelActionAcceptedAction `json:"action"`++ // ComputerId Opaque, case-sensitive identifier. Clients must not infer type or time from it.+ ComputerId Id `json:"computer_id"`++ // ModelId Stable localmodels library id: catalog id and variant, such as qwen3-4b:Q4_K_M.+ ModelId LocalModelId `json:"model_id"`+}++// LocalModelActionAcceptedAction defines model for LocalModelActionAccepted.Action.+type LocalModelActionAcceptedAction string++// LocalModelActionRequest A Human's action on one model. The click is the approval; there is no separate confirm step on the Computer. unload_first only with load.+type LocalModelActionRequest struct {+ Action LocalModelActionRequestAction `json:"action"`++ // UnloadFirst Loaded models in the same pool to unload before the load starts.+ UnloadFirst *[]LocalModelId `json:"unload_first,omitempty"`+}++// LocalModelActionRequestAction defines model for LocalModelActionRequest.Action.+type LocalModelActionRequestAction string++// LocalModelAvailability defines model for LocalModelAvailability.+type LocalModelAvailability struct {+ Downloadable bool `json:"downloadable"`+ Reason *LocalModelAvailabilityReason `json:"reason,omitempty"`+}++// LocalModelAvailabilityReason defines model for LocalModelAvailabilityReason.+type LocalModelAvailabilityReason struct {+ Code LocalModelAvailabilityReasonCode `json:"code"`+ HaveBytes *int64 `json:"have_bytes,omitempty"`+ NeedBytes *int64 `json:"need_bytes,omitempty"`+}++// LocalModelAvailabilityReasonCode defines model for LocalModelAvailabilityReason.Code.+type LocalModelAvailabilityReasonCode string++// LocalModelDownloadProgress defines model for LocalModelDownloadProgress.+type LocalModelDownloadProgress struct {+ BytesPerSecond *int64 `json:"bytes_per_second,omitempty"`+ DoneBytes int64 `json:"done_bytes"`+ Step LocalModelDownloadProgressStep `json:"step"`+ TotalBytes int64 `json:"total_bytes"`+}++// LocalModelDownloadProgressStep defines model for LocalModelDownloadProgress.Step.+type LocalModelDownloadProgressStep string++// LocalModelEndpoint defines model for LocalModelEndpoint.+type LocalModelEndpoint struct {+ BaseUrl string `json:"base_url"`+}++// LocalModelError defines model for LocalModelError.+type LocalModelError struct {+ // Code Closed localmodels library error set. It is extended only together with the localmodels library contract.+ Code LocalModelErrorCode `json:"code"`++ // Detail Diagnostic text for display; never matched on.+ Detail *string `json:"detail,omitempty"`+}++// LocalModelErrorCode Closed localmodels library error set. It is extended only together with the localmodels library contract.+type LocalModelErrorCode string++// LocalModelFit Where the model can live, judged on total capacity so it stays stable across loads. system means localmodels can run it from RAM, slower.+type LocalModelFit string++// LocalModelGpu defines model for LocalModelGpu.+type LocalModelGpu struct {+ FreeBytes int64 `json:"free_bytes"`+ Index int `json:"index"`+ Name string `json:"name"`+ TotalBytes int64 `json:"total_bytes"`+ Uuid *string `json:"uuid,omitempty"`+}++// LocalModelHost Hardware and software of the Computer as localmodels reports it.+type LocalModelHost struct {+ Arch LocalModelHostArch `json:"arch"`+ DiskFreeBytes int64 `json:"disk_free_bytes"`++ // EngineLabel Display only, such as llama.cpp b11370 with CUDA.+ EngineLabel string `json:"engine_label"`+ Gpus []LocalModelGpu `json:"gpus"`++ // OsLabel Display only, such as Ubuntu 24.04.+ OsLabel string `json:"os_label"`+ Platform LocalModelHostPlatform `json:"platform"`+ RamTotalBytes int64 `json:"ram_total_bytes"`+}++// LocalModelHostArch defines model for LocalModelHost.Arch.+type LocalModelHostArch string++// LocalModelHostPlatform defines model for LocalModelHost.Platform.+type LocalModelHostPlatform string++// LocalModelId Stable localmodels library id: catalog id and variant, such as qwen3-4b:Q4_K_M.+type LocalModelId = string++// LocalModelNote defines model for LocalModelNote.+type LocalModelNote struct {+ Code LocalModelNoteCode `json:"code"`+}++// LocalModelNoteCode defines model for LocalModelNote.Code.+type LocalModelNoteCode string++// LocalModelPool One place models load into. The system and unified budgets are 80% of RAM, as localmodels computes them.+type LocalModelPool struct {+ // GpuIndex Present only for kind gpu; matches LocalModelGpu.index.+ GpuIndex *int `json:"gpu_index,omitempty"`+ Holders []LocalModelPoolHolder `json:"holders"`++ // Id A place a model can live: gpu:<index>, system (RAM beside GPUs), or unified (RAM of a host without discrete GPUs).+ Id LocalModelPoolId `json:"id"`+ Kind LocalModelPoolKind `json:"kind"`+ TotalBytes int64 `json:"total_bytes"`+ UsedBytes int64 `json:"used_bytes"`+}++// LocalModelPoolKind defines model for LocalModelPool.Kind.+type LocalModelPoolKind string++// LocalModelPoolHolder Something holding pool memory. A component is a foundation service such as an embedding, reranker, or speech model; it is never a model row.+type LocalModelPoolHolder struct {+ Bytes int64 `json:"bytes"`+ Id string `json:"id"`+ Kind LocalModelPoolHolderKind `json:"kind"`+ Name string `json:"name"`+}++// LocalModelPoolHolderKind defines model for LocalModelPoolHolder.Kind.+type LocalModelPoolHolderKind string++// LocalModelPoolId A place a model can live: gpu:<index>, system (RAM beside GPUs), or unified (RAM of a host without discrete GPUs).+type LocalModelPoolId = string++// LocalModelState absent: not on disk. idle: on disk, holding no memory. loading reserves its memory before it finishes; loaded is registered with the local gateway and Pi.+type LocalModelState string++// LocalModelUser An Agent whose runtime model is this model on this Computer.+type LocalModelUser struct {+ // AgentId Opaque, case-sensitive identifier. Clients must not infer type or time from it.+ AgentId Id `json:"agent_id"`+ Name string `json:"name"`+}++// LocalModelView defines model for LocalModelView.+type LocalModelView struct {+ // Model One validated chat model of the catalog on this platform and its state on this Computer. Sizes are bytes; readers format them.+ Model LocalModel `json:"model"`++ // UsedBy Active Agents placed on this Computer with runtime pi whose runtime model is this model's gateway model.+ UsedBy []LocalModelUser `json:"used_by"`+}++// LocalModelsComputer defines model for LocalModelsComputer.+type LocalModelsComputer struct {+ // ComputerId Opaque, case-sensitive identifier. Clients must not infer type or time from it.+ ComputerId Id `json:"computer_id"`+ DisplayName string `json:"display_name"`++ // Host Hardware and software of the Computer as localmodels reports it.+ Host *LocalModelHost `json:"host,omitempty"`++ // LastSeenAt UTC timestamp in RFC 3339 format with an explicit offset.+ LastSeenAt *Timestamp `json:"last_seen_at,omitempty"`+ Status LocalModelsComputerStatus `json:"status"`+}++// LocalModelsComputerStatus defines model for LocalModelsComputer.Status.+type LocalModelsComputerStatus string++// LocalModelsError The common error body with error.code narrowed to LocalModelsErrorCode.+type LocalModelsError struct {+ // Code error.code of a refused local-models action (403, 409, 502, 503, 504); 400, 401, and 404 use the common codes. LOCAL_COMPUTER_OFFLINE: the Computer is not connected. LOCAL_MODEL_ACTION_FORBIDDEN: the viewer is not the Computer owner. LOCAL_MODELS_UNAVAILABLE: the Computer has no usable localmodels tool. LOCAL_MODEL_ACTION_FAILED: the Computer refused with a library error that has no code of its own here (502). LOCAL_MODELS_SERVICE_UNAVAILABLE: Agent Service could not be reached (503). LOCAL_MODEL_ACTION_UNCONFIRMED: the connected Computer had not decided by the action's deadline; it may still run the action, and the library snapshots show the outcome (504). The other LOCAL_MODEL_ codes are the Computer's refusal codes of the same name (409).+ Code LocalModelsErrorCode `json:"code"`+ Details *[]ErrorDetail `json:"details,omitempty"`++ // Message Human-readable summary safe to display; clients branch on code, not message.+ Message string `json:"message"`+ RequestId string `json:"request_id"`+ Retryable *bool `json:"retryable,omitempty"`+}++// LocalModelsErrorCode error.code of a refused local-models action (403, 409, 502, 503, 504); 400, 401, and 404 use the common codes. LOCAL_COMPUTER_OFFLINE: the Computer is not connected. LOCAL_MODEL_ACTION_FORBIDDEN: the viewer is not the Computer owner. LOCAL_MODELS_UNAVAILABLE: the Computer has no usable localmodels tool. LOCAL_MODEL_ACTION_FAILED: the Computer refused with a library error that has no code of its own here (502). LOCAL_MODELS_SERVICE_UNAVAILABLE: Agent Service could not be reached (503). LOCAL_MODEL_ACTION_UNCONFIRMED: the connected Computer had not decided by the action's deadline; it may still run the action, and the library snapshots show the outcome (504). The other LOCAL_MODEL_ codes are the Computer's refusal codes of the same name (409).+type LocalModelsErrorCode string++// LocalModelsErrorResponse defines model for LocalModelsErrorResponse.+type LocalModelsErrorResponse struct {+ // Error The common error body with error.code narrowed to LocalModelsErrorCode.+ Error LocalModelsError `json:"error"`+}++// LocalModelsView One Computer's model library as last reported. Only the Computer owner can act (viewer_is_owner); other Tenant members who can see the Computer read it.+type LocalModelsView struct {+ Available bool `json:"available"`+ Computer LocalModelsComputer `json:"computer"`+ Models []LocalModelView `json:"models"`++ // ObservedAt UTC timestamp in RFC 3339 format with an explicit offset.+ ObservedAt *Timestamp `json:"observed_at,omitempty"`+ Pools []LocalModelPool `json:"pools"`+ Reason *LocalModelsViewUnavailableReason `json:"reason,omitempty"`+ ToolVersion *string `json:"tool_version,omitempty"`+ ViewerIsOwner bool `json:"viewer_is_owner"`+}++// LocalModelsViewUnavailableReason defines model for LocalModelsViewUnavailableReason.+type LocalModelsViewUnavailableReason struct {+ // Code NOT_REPORTED: the Computer never sent a snapshot. Otherwise the reason from its last snapshot.+ Code LocalModelsViewUnavailableReasonCode `json:"code"`++ // Detail Diagnostic text for display; never matched on.+ Detail *string `json:"detail,omitempty"`+}++// LocalModelsViewUnavailableReasonCode NOT_REPORTED: the Computer never sent a snapshot. Otherwise the reason from its last snapshot.+type LocalModelsViewUnavailableReasonCode string+// LocalRuntimeDiagnosticErrorCode defines model for LocalRuntimeDiagnosticErrorCode.type LocalRuntimeDiagnosticErrorCode string@@ -8397,6 +9052,9 @@ type Gone = ErrorResponse// InternalError defines model for InternalError.type InternalError = ErrorResponse+// LocalModelsRefused defines model for LocalModelsRefused.+type LocalModelsRefused = LocalModelsErrorResponse+// NotFound defines model for NotFound.type NotFound = ErrorResponse@@ -9015,6 +9673,9 @@ type CreateLocalComputerEnrollmentJSONRequestBody = LocalComputerEnrollmentCreat// PutLocalComputerBrowserConnectionJSONRequestBody defines body for PutLocalComputerBrowserConnection for application/json ContentType.type PutLocalComputerBrowserConnectionJSONRequestBody = BrowserConnectionConfigureRequest+// ActOnLocalComputerModelJSONRequestBody defines body for ActOnLocalComputerModel for application/json ContentType.+type ActOnLocalComputerModelJSONRequestBody = LocalModelActionRequest+// ActOnLocalComputerPermissionJSONRequestBody defines body for ActOnLocalComputerPermission for application/json ContentType.type ActOnLocalComputerPermissionJSONRequestBody = ComputerPermissionActiondiff --git a/contracts/generated/typescript/src/generated/linger-installer/types.ts b/contracts/generated/typescript/src/generated/linger-installer/types.tsindex fd720faa..706eb89a 100644--- a/contracts/generated/typescript/src/generated/linger-installer/types.ts+++ b/contracts/generated/typescript/src/generated/linger-installer/types.ts@@ -601,7 +601,7 @@ export interface components {SetupChoice: "local-models" | "codex" | "claude" | "pi";InstanceRuntime: {setupChoice?: components["schemas"]["SetupChoice"];- /** @description Absolute paths only, never credentials. LINGER_CODEX_PATH, LINGER_CLAUDE_PATH and LINGER_PI_PATH name the executable; CODEX_HOME, CLAUDE_CONFIG_DIR and PI_CODING_AGENT_DIR its profile when it is not the user's default. */+ /** @description Absolute paths only, never credentials. LINGER_CODEX_PATH, LINGER_CLAUDE_PATH and LINGER_PI_PATH name the executable; CODEX_HOME, CLAUDE_CONFIG_DIR and PI_CODING_AGENT_DIR its profile when it is not the user's default. LINGER_LOCALMODELS_PYTHON, LINGER_LOCALMODELS_MODULE_DIR, LINGER_LOCALMODELS_STATE and LINGER_LOCALMODELS_BASE_DIR, all four or none, name the localmodels tool the Computer runs for its model library. */environment: {[key: string]: string;};diff --git a/contracts/generated/typescript/src/generated/node-services-internal/types.ts b/contracts/generated/typescript/src/generated/node-services-internal/types.tsindex 3da57011..33159fd4 100644--- a/contracts/generated/typescript/src/generated/node-services-internal/types.ts+++ b/contracts/generated/typescript/src/generated/node-services-internal/types.ts@@ -103,6 +103,30 @@ export interface paths {patch?: never;trace?: never;};+ "/v1/tenants/{tenantId}/owners/{ownerActorId}/local-computers/{computerId}/local-model-actions": {+ parameters: {+ query?: never;+ header?: never;+ path: {+ tenantId: components["parameters"]["TenantId"];+ ownerActorId: components["parameters"]["OwnerActorId"];+ computerId: components["parameters"]["ComputerId"];+ };+ cookie?: never;+ };+ get?: never;+ put?: never;+ /**+ * Send one local-models action to an owned Local Computer+ * @description Agent Service sends execute with kind local_models and returns the Computer's immediate accepted or refused answer. The Computer supervises the job and reports progress only through runner.local_models snapshots, which Agent Service records in TeamHub.+ */+ post: operations["actOnLocalComputerModels"];+ delete?: never;+ options?: never;+ head?: never;+ patch?: never;+ trace?: never;+ };"/v1/tenants/{tenantId}/owners/{ownerActorId}/local-computers/{computerId}/browser-connection": {parameters: {query?: never;@@ -1407,6 +1431,71 @@ export interface components {expires_at: components["schemas"]["Timestamp"];items: components["schemas"]["LocalSkillCandidate"][];};+ /**+ * @description refresh asks the Computer to reread its library and send a snapshot; it names no model.+ * @enum {string}+ */+ LocalModelActionKind:+ | "download"+ | "cancel"+ | "load"+ | "unload"+ | "remove"+ | "refresh";+ /** @description Stable localmodels library id: catalog id and variant, such as qwen3-4b:Q4_K_M. */+ LocalModelId: string;+ /** @description TeamHub asks Agent Service to send one execute local_models frame to an owned Computer. model_id is required except for refresh; unload_first only with load. */+ LocalModelActionCommand: {+ request_id: components["schemas"]["Id"];+ action: components["schemas"]["LocalModelActionKind"];+ model_id?: components["schemas"]["LocalModelId"];+ unload_first?: components["schemas"]["LocalModelId"][];+ expires_at: components["schemas"]["Timestamp"];+ };+ /**+ * @description Why the Computer refused an action before starting it: a localmodels library error or a reason the library is unavailable.+ * @enum {string}+ */+ LocalModelActionRefusalCode:+ | "MODEL_UNKNOWN"+ | "INVALID_STATE"+ | "JOB_RUNNING"+ | "MEMORY_INSUFFICIENT"+ | "DISK_INSUFFICIENT"+ | "PLATFORM_UNSUPPORTED"+ | "LOAD_NO_ROOM"+ | "DOWNLOAD_FAILED"+ | "CHECKSUM_MISMATCH"+ | "NETWORK_UNAVAILABLE"+ | "ENGINE_START_FAILED"+ | "HEALTH_CHECK_FAILED"+ | "OUT_OF_MEMORY"+ | "MODEL_FILES_MISSING"+ | "GATEWAY_REGISTRATION_FAILED"+ | "CANCELLED"+ | "TOOL_NOT_INSTALLED"+ | "TOOL_FAILED";+ /** @description A place a model can live: gpu:<index>, system (RAM beside GPUs), or unified (RAM of a host without discrete GPUs). */+ LocalModelPoolId: string;+ LocalModelActionRefusal: {+ code: components["schemas"]["LocalModelActionRefusalCode"];+ /** @description Diagnostic text for display; never matched on. */+ detail?: string;+ /** @description With LOAD_NO_ROOM. */+ pool?: components["schemas"]["LocalModelPoolId"];+ /** Format: int64 */+ need_bytes?: number;+ /** Format: int64 */+ free_bytes?: number;+ };+ /** @description The Computer's immediate answer. accepted means the job started (or a snapshot is coming for refresh); refused means nothing changed. Progress and outcomes arrive only as snapshots. */+ LocalModelActionAck: {+ request_id: components["schemas"]["Id"];+ /** @enum {string} */+ outcome: "accepted" | "refused";+ /** @description Present only when refused. */+ refusal?: components["schemas"]["LocalModelActionRefusal"];+ };/** @description A Chrome profile directory name inside the user's Chrome data directory. */BrowserProfile: string;/** @description The browser that browser tools of this owner's Agents drive on one Local Computer. It never contains the Playwright Extension token. */@@ -2112,6 +2201,40 @@ export interface operations {503: components["responses"]["ServiceUnavailable"];};};+ actOnLocalComputerModels: {+ parameters: {+ query?: never;+ header?: never;+ path: {+ tenantId: components["parameters"]["TenantId"];+ ownerActorId: components["parameters"]["OwnerActorId"];+ computerId: components["parameters"]["ComputerId"];+ };+ cookie?: never;+ };+ requestBody: {+ content: {+ "application/json": components["schemas"]["LocalModelActionCommand"];+ };+ };+ responses: {+ /** @description The Computer's answer. */+ 200: {+ headers: {+ [name: string]: unknown;+ };+ content: {+ "application/json": components["schemas"]["LocalModelActionAck"];+ };+ };+ 400: components["responses"]["BadRequest"];+ 401: components["responses"]["Unauthenticated"];+ 404: components["responses"]["NotFound"];+ 409: components["responses"]["Conflict"];+ 502: components["responses"]["BadGateway"];+ 503: components["responses"]["ServiceUnavailable"];+ };+ };getLocalComputerBrowserConnection: {parameters: {query?: never;diff --git a/contracts/generated/typescript/src/generated/runner-gateway/schema.ts b/contracts/generated/typescript/src/generated/runner-gateway/schema.tsindex a243204c..6114ab3d 100644--- a/contracts/generated/typescript/src/generated/runner-gateway/schema.ts+++ b/contracts/generated/typescript/src/generated/runner-gateway/schema.ts@@ -45,6 +45,9 @@ export const runnerGatewayEnvelopeSchema = {{$ref: "#/$defs/CapabilityComputerPermission",},+ {+ $ref: "#/$defs/CapabilityLocalModelsExecute",+ },{$ref: "#/$defs/OperationPrepare",},@@ -85,6 +88,9 @@ export const runnerGatewayEnvelopeSchema = {{$ref: "#/$defs/RunnerRuntimeDiagnostics",},+ {+ $ref: "#/$defs/RunnerLocalModels",+ },{$ref: "#/$defs/RuntimeRegistrationObserved",},@@ -124,6 +130,12 @@ export const runnerGatewayEnvelopeSchema = {{$ref: "#/$defs/CapabilityComputerPermissionFailed",},+ {+ $ref: "#/$defs/CapabilityLocalModelsAccepted",+ },+ {+ $ref: "#/$defs/CapabilityLocalModelsRefused",+ },{$ref: "#/$defs/OperationPrepared",},@@ -1847,6 +1859,677 @@ export const runnerGatewayEnvelopeSchema = {},],},+ LocalModelId: {+ description:+ "Stable localmodels library id: catalog id and variant, such as qwen3-4b:Q4_K_M.",+ type: "string",+ pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$",+ },+ LocalModelPoolId: {+ description:+ "A place a model can live: gpu:<index>, system (RAM beside GPUs) or unified (RAM of a GPU-less or Apple silicon host).",+ type: "string",+ pattern: "^(gpu:(0|[1-9][0-9]{0,2})|system|unified)$",+ },+ LocalModelErrorCode: {+ description:+ "Closed localmodels library error set. Extend it only together with the localmodels library contract.",+ enum: [+ "MODEL_UNKNOWN",+ "INVALID_STATE",+ "JOB_RUNNING",+ "MEMORY_INSUFFICIENT",+ "DISK_INSUFFICIENT",+ "PLATFORM_UNSUPPORTED",+ "LOAD_NO_ROOM",+ "DOWNLOAD_FAILED",+ "CHECKSUM_MISMATCH",+ "NETWORK_UNAVAILABLE",+ "ENGINE_START_FAILED",+ "HEALTH_CHECK_FAILED",+ "OUT_OF_MEMORY",+ "MODEL_FILES_MISSING",+ "GATEWAY_REGISTRATION_FAILED",+ "CANCELLED",+ ],+ },+ LocalModelsUnavailableCode: {+ description:+ "Why a Computer reports no model library: TOOL_NOT_INSTALLED when the Computer config names no localmodels tool, TOOL_FAILED when the tool did not answer library status.",+ enum: ["TOOL_NOT_INSTALLED", "TOOL_FAILED"],+ },+ LocalModelActionRefusalCode: {+ description:+ "Why the Computer refused an action before it started: a localmodels library error or a reason the library is unavailable.",+ enum: [+ "MODEL_UNKNOWN",+ "INVALID_STATE",+ "JOB_RUNNING",+ "MEMORY_INSUFFICIENT",+ "DISK_INSUFFICIENT",+ "PLATFORM_UNSUPPORTED",+ "LOAD_NO_ROOM",+ "DOWNLOAD_FAILED",+ "CHECKSUM_MISMATCH",+ "NETWORK_UNAVAILABLE",+ "ENGINE_START_FAILED",+ "HEALTH_CHECK_FAILED",+ "OUT_OF_MEMORY",+ "MODEL_FILES_MISSING",+ "GATEWAY_REGISTRATION_FAILED",+ "CANCELLED",+ "TOOL_NOT_INSTALLED",+ "TOOL_FAILED",+ ],+ },+ LocalModelGpu: {+ type: "object",+ additionalProperties: false,+ required: ["index", "name", "total_bytes", "free_bytes"],+ properties: {+ index: {+ $ref: "#/$defs/NonNegativeInteger",+ },+ uuid: {+ type: "string",+ minLength: 1,+ maxLength: 128,+ },+ name: {+ type: "string",+ minLength: 1,+ maxLength: 200,+ },+ total_bytes: {+ $ref: "#/$defs/NonNegativeInteger",+ },+ free_bytes: {+ $ref: "#/$defs/NonNegativeInteger",+ },+ },+ },+ LocalModelHost: {+ type: "object",+ additionalProperties: false,+ required: [+ "platform",+ "arch",+ "os_label",+ "engine_label",+ "ram_total_bytes",+ "disk_free_bytes",+ "gpus",+ ],+ properties: {+ platform: {+ enum: ["linux", "darwin", "windows"],+ },+ arch: {+ enum: ["x86_64", "arm64"],+ },+ os_label: {+ description: "Display only.",+ type: "string",+ maxLength: 200,+ },+ engine_label: {+ description: "Display only.",+ type: "string",+ maxLength: 200,+ },+ ram_total_bytes: {+ $ref: "#/$defs/NonNegativeInteger",+ },+ disk_free_bytes: {+ $ref: "#/$defs/NonNegativeInteger",+ },+ gpus: {+ type: "array",+ maxItems: 64,+ items: {+ $ref: "#/$defs/LocalModelGpu",+ },+ },+ },+ },+ LocalModelPoolHolder: {+ description:+ "Something holding pool memory. A component is a foundation service (embedding, reranker, speech) that is never a model row.",+ type: "object",+ additionalProperties: false,+ required: ["kind", "id", "name", "bytes"],+ properties: {+ kind: {+ enum: ["model", "component"],+ },+ id: {+ type: "string",+ minLength: 1,+ maxLength: 160,+ },+ name: {+ type: "string",+ minLength: 1,+ maxLength: 200,+ },+ bytes: {+ $ref: "#/$defs/NonNegativeInteger",+ },+ },+ },+ LocalModelPool: {+ description:+ "One place models load into. The system and unified budgets are 80% of RAM, as localmodels computes them.",+ type: "object",+ additionalProperties: false,+ required: ["id", "kind", "total_bytes", "used_bytes", "holders"],+ properties: {+ id: {+ $ref: "#/$defs/LocalModelPoolId",+ },+ kind: {+ enum: ["gpu", "system", "unified"],+ },+ gpu_index: {+ description:+ "Present only for kind gpu; matches LocalModelGpu.index.",+ $ref: "#/$defs/NonNegativeInteger",+ },+ total_bytes: {+ $ref: "#/$defs/NonNegativeInteger",+ },+ used_bytes: {+ $ref: "#/$defs/NonNegativeInteger",+ },+ holders: {+ type: "array",+ maxItems: 256,+ items: {+ $ref: "#/$defs/LocalModelPoolHolder",+ },+ },+ },+ },+ LocalModelAvailabilityReason: {+ type: "object",+ additionalProperties: false,+ required: ["code"],+ properties: {+ code: {+ enum: [+ "MEMORY_INSUFFICIENT",+ "DISK_INSUFFICIENT",+ "PLATFORM_UNSUPPORTED",+ ],+ },+ need_bytes: {+ $ref: "#/$defs/NonNegativeInteger",+ },+ have_bytes: {+ $ref: "#/$defs/NonNegativeInteger",+ },+ },+ },+ LocalModelAvailability: {+ type: "object",+ additionalProperties: false,+ required: ["downloadable"],+ properties: {+ downloadable: {+ type: "boolean",+ },+ reason: {+ description: "Present only when downloadable is false.",+ $ref: "#/$defs/LocalModelAvailabilityReason",+ },+ },+ },+ LocalModelDownloadProgress: {+ type: "object",+ additionalProperties: false,+ required: ["step", "done_bytes", "total_bytes"],+ properties: {+ step: {+ enum: ["download", "verify"],+ },+ done_bytes: {+ $ref: "#/$defs/NonNegativeInteger",+ },+ total_bytes: {+ $ref: "#/$defs/NonNegativeInteger",+ },+ bytes_per_second: {+ $ref: "#/$defs/NonNegativeInteger",+ },+ },+ },+ LocalModelEndpoint: {+ type: "object",+ additionalProperties: false,+ required: ["base_url"],+ properties: {+ base_url: {+ type: "string",+ minLength: 1,+ maxLength: 2048,+ },+ },+ },+ LocalModelError: {+ type: "object",+ additionalProperties: false,+ required: ["code"],+ properties: {+ code: {+ $ref: "#/$defs/LocalModelErrorCode",+ },+ detail: {+ description: "Diagnostic text for display; never matched on.",+ type: "string",+ maxLength: 4000,+ },+ },+ },+ LocalModelNote: {+ type: "object",+ additionalProperties: false,+ required: ["code"],+ properties: {+ code: {+ enum: ["NO_ROOM_TO_LOAD"],+ },+ },+ },+ LocalModel: {+ description:+ "One validated chat model of the catalog on this platform, with its state on this Computer. Bytes everywhere; the reader formats them.",+ type: "object",+ additionalProperties: false,+ required: [+ "id",+ "name",+ "description",+ "quant",+ "context_tokens",+ "vision",+ "download_bytes",+ "memory_bytes",+ "fit",+ "recommended",+ "availability",+ "state",+ ],+ properties: {+ id: {+ $ref: "#/$defs/LocalModelId",+ },+ name: {+ type: "string",+ minLength: 1,+ maxLength: 200,+ },+ description: {+ type: "string",+ maxLength: 2000,+ },+ quant: {+ type: "string",+ minLength: 1,+ maxLength: 64,+ },+ context_tokens: {+ $ref: "#/$defs/NonNegativeInteger",+ },+ vision: {+ type: "boolean",+ },+ download_bytes: {+ $ref: "#/$defs/NonNegativeInteger",+ },+ memory_bytes: {+ description:+ "Footprint when loaded at its context policy, from the localmodels estimator.",+ $ref: "#/$defs/NonNegativeInteger",+ },+ fit: {+ description:+ "Where the model can live judged on total capacity; stable across loads. system means localmodels can run it from RAM, slower.",+ enum: ["gpu", "unified", "system", "none"],+ },+ recommended: {+ description: "At most one model, only an absent downloadable one.",+ type: "boolean",+ },+ availability: {+ $ref: "#/$defs/LocalModelAvailability",+ },+ pool: {+ description:+ "Planned placement while absent, actual placement afterwards; absent when fit is none.",+ $ref: "#/$defs/LocalModelPoolId",+ },+ state: {+ enum: [+ "absent",+ "downloading",+ "idle",+ "loading",+ "loaded",+ "failed",+ ],+ },+ download: {+ description: "Present only while downloading.",+ $ref: "#/$defs/LocalModelDownloadProgress",+ },+ endpoint: {+ description: "Present only while loaded.",+ $ref: "#/$defs/LocalModelEndpoint",+ },+ pi_model: {+ description:+ "The runtime_model an Agent on runtime pi stores for this model, <pi provider>/<pi model id>; present while the model is on the Computer.",+ type: "string",+ minLength: 1,+ maxLength: 200,+ },+ tokens_per_second: {+ description:+ "Warm speed measured at the last load; absent when unknown.",+ type: "number",+ minimum: 0,+ },+ error: {+ description: "Present only when failed.",+ $ref: "#/$defs/LocalModelError",+ },+ note: {+ description:+ "Present only when idle and the automatic load after download was skipped.",+ $ref: "#/$defs/LocalModelNote",+ },+ },+ },+ LocalModelsUnavailableReason: {+ type: "object",+ additionalProperties: false,+ required: ["code"],+ properties: {+ code: {+ $ref: "#/$defs/LocalModelsUnavailableCode",+ },+ detail: {+ description: "Diagnostic text for display; never matched on.",+ type: "string",+ maxLength: 4000,+ },+ },+ },+ LocalModelsSnapshot: {+ description:+ "The Computer's model library, mapped from localmodels.library-status/v1. When available is false only reason and observed_at are meaningful and the lists are empty.",+ type: "object",+ additionalProperties: false,+ required: ["available", "observed_at", "pools", "models"],+ properties: {+ available: {+ type: "boolean",+ },+ reason: {+ description: "Present only when available is false.",+ $ref: "#/$defs/LocalModelsUnavailableReason",+ },+ observed_at: {+ $ref: "#/$defs/Timestamp",+ },+ tool_version: {+ type: "string",+ minLength: 1,+ maxLength: 64,+ },+ host: {+ description: "Present when available.",+ $ref: "#/$defs/LocalModelHost",+ },+ pools: {+ type: "array",+ maxItems: 65,+ items: {+ $ref: "#/$defs/LocalModelPool",+ },+ },+ models: {+ type: "array",+ maxItems: 256,+ items: {+ $ref: "#/$defs/LocalModel",+ },+ },+ },+ },+ CapabilityLocalModelsExecute: {+ description:+ "Ask the Computer to act on its model library. The Computer answers at once with accepted or refused and supervises the localmodels job itself; progress and the outcome arrive as runner.local_models snapshots. refresh rereads the library and needs no model_id; every other action names one. unload_first is only for load.",+ type: "object",+ unevaluatedProperties: false,+ allOf: [+ {+ $ref: "#/$defs/LocalSkillCommandIdentity",+ },+ {+ type: "object",+ required: ["type", "kind", "action"],+ properties: {+ type: {+ const: "execute",+ },+ kind: {+ const: "local_models",+ },+ action: {+ enum: [+ "download",+ "cancel",+ "load",+ "unload",+ "remove",+ "refresh",+ ],+ },+ model_id: {+ $ref: "#/$defs/LocalModelId",+ },+ unload_first: {+ type: "array",+ maxItems: 64,+ uniqueItems: true,+ items: {+ $ref: "#/$defs/LocalModelId",+ },+ },+ },+ if: {+ properties: {+ action: {+ const: "refresh",+ },+ },+ },+ then: {+ properties: {+ model_id: false,+ unload_first: false,+ },+ },+ else: {+ properties: {+ model_id: {+ $ref: "#/$defs/LocalModelId",+ },+ },+ required: ["model_id"],+ },+ },+ {+ if: {+ properties: {+ action: {+ const: "load",+ },+ },+ },+ else: {+ properties: {+ unload_first: false,+ },+ },+ },+ ],+ },+ CapabilityLocalModelsAccepted: {+ description:+ "The Computer started the action, or for refresh queued a fresh snapshot.",+ type: "object",+ unevaluatedProperties: false,+ allOf: [+ {+ $ref: "#/$defs/LocalSkillCommandIdentity",+ },+ {+ type: "object",+ required: ["type", "kind", "action", "outcome"],+ properties: {+ type: {+ const: "executed",+ },+ kind: {+ const: "local_models",+ },+ action: {+ enum: [+ "download",+ "cancel",+ "load",+ "unload",+ "remove",+ "refresh",+ ],+ },+ model_id: {+ $ref: "#/$defs/LocalModelId",+ },+ outcome: {+ const: "accepted",+ },+ },+ },+ ],+ },+ LocalModelActionRefusal: {+ type: "object",+ additionalProperties: false,+ required: ["code"],+ properties: {+ code: {+ $ref: "#/$defs/LocalModelActionRefusalCode",+ },+ detail: {+ description: "Diagnostic text for display; never matched on.",+ type: "string",+ maxLength: 4000,+ },+ pool: {+ description: "With LOAD_NO_ROOM.",+ $ref: "#/$defs/LocalModelPoolId",+ },+ need_bytes: {+ description:+ "With LOAD_NO_ROOM, MEMORY_INSUFFICIENT or DISK_INSUFFICIENT.",+ $ref: "#/$defs/NonNegativeInteger",+ },+ free_bytes: {+ description:+ "With LOAD_NO_ROOM, MEMORY_INSUFFICIENT or DISK_INSUFFICIENT.",+ $ref: "#/$defs/NonNegativeInteger",+ },+ },+ },+ CapabilityLocalModelsRefused: {+ description:+ "The Computer did not start the action; nothing changed on it.",+ type: "object",+ unevaluatedProperties: false,+ allOf: [+ {+ $ref: "#/$defs/LocalSkillCommandIdentity",+ },+ {+ type: "object",+ required: ["type", "kind", "action", "refusal", "outcome"],+ properties: {+ type: {+ const: "executed",+ },+ kind: {+ const: "local_models",+ },+ action: {+ enum: [+ "download",+ "cancel",+ "load",+ "unload",+ "remove",+ "refresh",+ ],+ },+ model_id: {+ $ref: "#/$defs/LocalModelId",+ },+ refusal: {+ $ref: "#/$defs/LocalModelActionRefusal",+ },+ outcome: {+ const: "refused",+ },+ },+ },+ ],+ },+ RunnerLocalModels: {+ description:+ "The Computer's model library. Sent after runner.hello, after every library change, and at most every 2 seconds while a download or load runs. revision grows within one connection.",+ type: "object",+ additionalProperties: false,+ required: [+ "type",+ "protocol_version",+ "runner_id",+ "sent_at",+ "revision",+ "local_models",+ ],+ properties: {+ type: {+ const: "runner.local_models",+ },+ protocol_version: {+ $ref: "#/$defs/ProtocolVersion",+ },+ runner_id: {+ $ref: "#/$defs/Id",+ },+ sent_at: {+ $ref: "#/$defs/Timestamp",+ },+ revision: {+ $ref: "#/$defs/PositiveInteger",+ },+ local_models: {+ $ref: "#/$defs/LocalModelsSnapshot",+ },+ },+ },RunnerHello: {type: "object",additionalProperties: false,diff --git a/contracts/generated/typescript/src/generated/runner-gateway/types.ts b/contracts/generated/typescript/src/generated/runner-gateway/types.tsindex 61e66296..4be9b5d1 100644--- a/contracts/generated/typescript/src/generated/runner-gateway/types.ts+++ b/contracts/generated/typescript/src/generated/runner-gateway/types.ts@@ -14,6 +14,7 @@ export type AgentToDaemonEnvelope =| CapabilitySkillsScan| CapabilityBrowserConnect| CapabilityComputerPermission+ | CapabilityLocalModelsExecute| OperationPrepare| ProviderPrepare| SessionCompact@@ -89,6 +90,25 @@ export type CapabilityComputerPermission = LocalSkillCommandIdentity & {permission?: "screen_recording" | "accessibility";kind: "computer_permission";};+/**+ * Ask the Computer to act on its model library. The Computer answers at once with accepted or refused and supervises the localmodels job itself; progress and the outcome arrive as runner.local_models snapshots. refresh rereads the library and needs no model_id; every other action names one. unload_first is only for load.+ */+export type CapabilityLocalModelsExecute = LocalSkillCommandIdentity & {+ type: "execute";+ kind: "local_models";+ action: "download" | "cancel" | "load" | "unload" | "remove" | "refresh";+ model_id?: LocalModelId;+ /**+ * @maxItems 64+ */+ unload_first?: LocalModelId[];+} & {+ [k: string]: unknown;+};+/**+ * Stable localmodels library id: catalog id and variant, such as qwen3-4b:Q4_K_M.+ */+export type LocalModelId = string;export type OperationPrepare = OperationIdentity & {type: "prepare";command_id: Id;@@ -166,6 +186,7 @@ export type DaemonToAgentEnvelope =| RunnerHello| RunnerHeartbeat| RunnerRuntimeDiagnostics+ | RunnerLocalModels| RuntimeRegistrationObserved| AgentRunnerReady| AgentRunnerRemoved@@ -179,6 +200,8 @@ export type DaemonToAgentEnvelope =| CapabilityBrowserFailed| CapabilityComputerPermissionSucceeded| CapabilityComputerPermissionFailed+ | CapabilityLocalModelsAccepted+ | CapabilityLocalModelsRefused| OperationPrepared| ProviderPrepared| SessionCompacted@@ -265,6 +288,34 @@ export type ActiveOperation = OperationScope & {last_acked_seq: NonNegativeInteger;};export type NonNegativeInteger = number;+/**+ * Why a Computer reports no model library: TOOL_NOT_INSTALLED when the Computer config names no localmodels tool, TOOL_FAILED when the tool did not answer library status.+ */+export type LocalModelsUnavailableCode = "TOOL_NOT_INSTALLED" | "TOOL_FAILED";+/**+ * A place a model can live: gpu:<index>, system (RAM beside GPUs) or unified (RAM of a GPU-less or Apple silicon host).+ */+export type LocalModelPoolId = string;+/**+ * Closed localmodels library error set. Extend it only together with the localmodels library contract.+ */+export type LocalModelErrorCode =+ | "MODEL_UNKNOWN"+ | "INVALID_STATE"+ | "JOB_RUNNING"+ | "MEMORY_INSUFFICIENT"+ | "DISK_INSUFFICIENT"+ | "PLATFORM_UNSUPPORTED"+ | "LOAD_NO_ROOM"+ | "DOWNLOAD_FAILED"+ | "CHECKSUM_MISMATCH"+ | "NETWORK_UNAVAILABLE"+ | "ENGINE_START_FAILED"+ | "HEALTH_CHECK_FAILED"+ | "OUT_OF_MEMORY"+ | "MODEL_FILES_MISSING"+ | "GATEWAY_REGISTRATION_FAILED"+ | "CANCELLED";export type AgentRunnerReady = AgentRunnerWireIdentity & {type: "agent_runner.state";runner_pid: PositiveInteger;@@ -350,6 +401,49 @@ export type CapabilityComputerPermissionFailed = LocalSkillCommandIdentity & {kind: "computer_permission";outcome: "failed";};+/**+ * The Computer started the action, or for refresh queued a fresh snapshot.+ */+export type CapabilityLocalModelsAccepted = LocalSkillCommandIdentity & {+ type: "executed";+ kind: "local_models";+ action: "download" | "cancel" | "load" | "unload" | "remove" | "refresh";+ model_id?: LocalModelId;+ outcome: "accepted";+};+/**+ * The Computer did not start the action; nothing changed on it.+ */+export type CapabilityLocalModelsRefused = LocalSkillCommandIdentity & {+ type: "executed";+ kind: "local_models";+ action: "download" | "cancel" | "load" | "unload" | "remove" | "refresh";+ model_id?: LocalModelId;+ refusal: LocalModelActionRefusal;+ outcome: "refused";+};+/**+ * Why the Computer refused an action before it started: a localmodels library error or a reason the library is unavailable.+ */+export type LocalModelActionRefusalCode =+ | "MODEL_UNKNOWN"+ | "INVALID_STATE"+ | "JOB_RUNNING"+ | "MEMORY_INSUFFICIENT"+ | "DISK_INSUFFICIENT"+ | "PLATFORM_UNSUPPORTED"+ | "LOAD_NO_ROOM"+ | "DOWNLOAD_FAILED"+ | "CHECKSUM_MISMATCH"+ | "NETWORK_UNAVAILABLE"+ | "ENGINE_START_FAILED"+ | "HEALTH_CHECK_FAILED"+ | "OUT_OF_MEMORY"+ | "MODEL_FILES_MISSING"+ | "GATEWAY_REGISTRATION_FAILED"+ | "CANCELLED"+ | "TOOL_NOT_INSTALLED"+ | "TOOL_FAILED";export type OperationPrepared = OperationIdentity & {type: "prepared";command_id: Id;@@ -1078,6 +1172,184 @@ export interface RunnerRuntimeDiagnostics {revision: PositiveInteger;runtime_diagnostics: RuntimeDiagnostics;}+/**+ * The Computer's model library. Sent after runner.hello, after every library change, and at most every 2 seconds while a download or load runs. revision grows within one connection.+ */+export interface RunnerLocalModels {+ type: "runner.local_models";+ protocol_version: ProtocolVersion;+ runner_id: Id;+ sent_at: Timestamp;+ revision: PositiveInteger;+ local_models: LocalModelsSnapshot;+}+/**+ * The Computer's model library, mapped from localmodels.library-status/v1. When available is false only reason and observed_at are meaningful and the lists are empty.+ */+export interface LocalModelsSnapshot {+ available: boolean;+ reason?: LocalModelsUnavailableReason;+ observed_at: Timestamp;+ tool_version?: string;+ host?: LocalModelHost;+ /**+ * @maxItems 65+ */+ pools: LocalModelPool[];+ /**+ * @maxItems 256+ */+ models: LocalModel[];+}+/**+ * Present only when available is false.+ */+export interface LocalModelsUnavailableReason {+ code: LocalModelsUnavailableCode;+ /**+ * Diagnostic text for display; never matched on.+ */+ detail?: string;+}+/**+ * Present when available.+ */+export interface LocalModelHost {+ platform: "linux" | "darwin" | "windows";+ arch: "x86_64" | "arm64";+ /**+ * Display only.+ */+ os_label: string;+ /**+ * Display only.+ */+ engine_label: string;+ ram_total_bytes: NonNegativeInteger;+ disk_free_bytes: NonNegativeInteger;+ /**+ * @maxItems 64+ */+ gpus: LocalModelGpu[];+}+export interface LocalModelGpu {+ index: NonNegativeInteger;+ uuid?: string;+ name: string;+ total_bytes: NonNegativeInteger;+ free_bytes: NonNegativeInteger;+}+/**+ * One place models load into. The system and unified budgets are 80% of RAM, as localmodels computes them.+ */+export interface LocalModelPool {+ id: LocalModelPoolId;+ kind: "gpu" | "system" | "unified";+ /**+ * Present only for kind gpu; matches LocalModelGpu.index.+ */+ gpu_index?: number;+ total_bytes: NonNegativeInteger;+ used_bytes: NonNegativeInteger;+ /**+ * @maxItems 256+ */+ holders: LocalModelPoolHolder[];+}+/**+ * Something holding pool memory. A component is a foundation service (embedding, reranker, speech) that is never a model row.+ */+export interface LocalModelPoolHolder {+ kind: "model" | "component";+ id: string;+ name: string;+ bytes: NonNegativeInteger;+}+/**+ * One validated chat model of the catalog on this platform, with its state on this Computer. Bytes everywhere; the reader formats them.+ */+export interface LocalModel {+ id: LocalModelId;+ name: string;+ description: string;+ quant: string;+ context_tokens: NonNegativeInteger;+ vision: boolean;+ download_bytes: NonNegativeInteger;+ /**+ * Footprint when loaded at its context policy, from the localmodels estimator.+ */+ memory_bytes: number;+ /**+ * Where the model can live judged on total capacity; stable across loads. system means localmodels can run it from RAM, slower.+ */+ fit: "gpu" | "unified" | "system" | "none";+ /**+ * At most one model, only an absent downloadable one.+ */+ recommended: boolean;+ availability: LocalModelAvailability;+ /**+ * A place a model can live: gpu:<index>, system (RAM beside GPUs) or unified (RAM of a GPU-less or Apple silicon host).+ */+ pool?: string;+ state: "absent" | "downloading" | "idle" | "loading" | "loaded" | "failed";+ download?: LocalModelDownloadProgress;+ endpoint?: LocalModelEndpoint;+ /**+ * The runtime_model an Agent on runtime pi stores for this model, <pi provider>/<pi model id>; present while the model is on the Computer.+ */+ pi_model?: string;+ /**+ * Warm speed measured at the last load; absent when unknown.+ */+ tokens_per_second?: number;+ error?: LocalModelError;+ note?: LocalModelNote;+}+export interface LocalModelAvailability {+ downloadable: boolean;+ reason?: LocalModelAvailabilityReason;+}+/**+ * Present only when downloadable is false.+ */+export interface LocalModelAvailabilityReason {+ code: "MEMORY_INSUFFICIENT" | "DISK_INSUFFICIENT" | "PLATFORM_UNSUPPORTED";+ need_bytes?: NonNegativeInteger;+ have_bytes?: NonNegativeInteger;+}+/**+ * Present only while downloading.+ */+export interface LocalModelDownloadProgress {+ step: "download" | "verify";+ done_bytes: NonNegativeInteger;+ total_bytes: NonNegativeInteger;+ bytes_per_second?: NonNegativeInteger;+}+/**+ * Present only while loaded.+ */+export interface LocalModelEndpoint {+ base_url: string;+}+/**+ * Present only when failed.+ */+export interface LocalModelError {+ code: LocalModelErrorCode;+ /**+ * Diagnostic text for display; never matched on.+ */+ detail?: string;+}+/**+ * Present only when idle and the automatic load after download was skipped.+ */+export interface LocalModelNote {+ code: "NO_ROOM_TO_LOAD";+}export interface RuntimeRegistrationObserved {type: "runtime.registration.observed";protocol_version: ProtocolVersion;@@ -1459,6 +1731,25 @@ export interface ComputerPermissionStatus {},];}+export interface LocalModelActionRefusal {+ code: LocalModelActionRefusalCode;+ /**+ * Diagnostic text for display; never matched on.+ */+ detail?: string;+ /**+ * A place a model can live: gpu:<index>, system (RAM beside GPUs) or unified (RAM of a GPU-less or Apple silicon host).+ */+ pool?: string;+ /**+ * With LOAD_NO_ROOM, MEMORY_INSUFFICIENT or DISK_INSUFFICIENT.+ */+ need_bytes?: number;+ /**+ * With LOAD_NO_ROOM, MEMORY_INSUFFICIENT or DISK_INSUFFICIENT.+ */+ free_bytes?: number;+}export interface NativeResumeMeasurement {duration_ms: NonNegativeInteger;result: "success" | "error" | "canceled";diff --git a/contracts/generated/typescript/src/generated/teamhub-internal/types.ts b/contracts/generated/typescript/src/generated/teamhub-internal/types.tsindex f4d432ce..742c80bc 100644--- a/contracts/generated/typescript/src/generated/teamhub-internal/types.ts+++ b/contracts/generated/typescript/src/generated/teamhub-internal/types.ts@@ -722,6 +722,26 @@ export interface paths {patch?: never;trace?: never;};+ "/v0/agent-runtime/local-computers/local-models": {+ parameters: {+ query?: never;+ header?: never;+ path?: never;+ cookie?: never;+ };+ get?: never;+ put?: never;+ /**+ * Store the latest model library snapshot a Computer reported.+ * @description Agent Service forwards every runner.local_models snapshot. TeamHub replaces the Computer's stored snapshot, keeps it while the Computer is offline, and publishes a local-models invalidation hint with the Computer ID.+ */+ post: operations["recordAgentRuntimeLocalModels"];+ delete?: never;+ options?: never;+ head?: never;+ patch?: never;+ trace?: never;+ };"/v0/agents/{agentId}/identity": {parameters: {query?: never;@@ -2454,6 +2474,201 @@ export interface components {/** @enum {string} */status: "removed" | "already_removed" | "not_found" | "has_agents";};+ /**+ * @description Why a Computer reports no model library. TOOL_NOT_INSTALLED: its Computer config names no localmodels tool. TOOL_FAILED: the tool did not answer library status.+ * @enum {string}+ */+ LocalModelsUnavailableCode: "TOOL_NOT_INSTALLED" | "TOOL_FAILED";+ LocalModelsUnavailableReason: {+ code: components["schemas"]["LocalModelsUnavailableCode"];+ /** @description Diagnostic text for display; never matched on. */+ detail?: string;+ };+ /**+ * Format: date-time+ * @description UTC timestamp in RFC 3339 format with an explicit offset.+ * @example 2026-07-21T10:15:30Z+ */+ Timestamp: string;+ LocalModelGpu: {+ index: number;+ uuid?: string;+ name: string;+ /** Format: int64 */+ total_bytes: number;+ /** Format: int64 */+ free_bytes: number;+ };+ /** @description Hardware and software of the Computer as localmodels reports it. */+ LocalModelHost: {+ /** @enum {string} */+ platform: "linux" | "darwin" | "windows";+ /** @enum {string} */+ arch: "x86_64" | "arm64";+ /** @description Display only, such as Ubuntu 24.04. */+ os_label: string;+ /** @description Display only, such as llama.cpp b11370 with CUDA. */+ engine_label: string;+ /** Format: int64 */+ ram_total_bytes: number;+ /** Format: int64 */+ disk_free_bytes: number;+ gpus: components["schemas"]["LocalModelGpu"][];+ };+ /** @description A place a model can live: gpu:<index>, system (RAM beside GPUs), or unified (RAM of a host without discrete GPUs). */+ LocalModelPoolId: string;+ /** @description Something holding pool memory. A component is a foundation service such as an embedding, reranker, or speech model; it is never a model row. */+ LocalModelPoolHolder: {+ /** @enum {string} */+ kind: "model" | "component";+ id: string;+ name: string;+ /** Format: int64 */+ bytes: number;+ };+ /** @description One place models load into. The system and unified budgets are 80% of RAM, as localmodels computes them. */+ LocalModelPool: {+ id: components["schemas"]["LocalModelPoolId"];+ /** @enum {string} */+ kind: "gpu" | "system" | "unified";+ /** @description Present only for kind gpu; matches LocalModelGpu.index. */+ gpu_index?: number;+ /** Format: int64 */+ total_bytes: number;+ /** Format: int64 */+ used_bytes: number;+ holders: components["schemas"]["LocalModelPoolHolder"][];+ };+ /** @description Stable localmodels library id: catalog id and variant, such as qwen3-4b:Q4_K_M. */+ LocalModelId: string;+ /**+ * @description Where the model can live, judged on total capacity so it stays stable across loads. system means localmodels can run it from RAM, slower.+ * @enum {string}+ */+ LocalModelFit: "gpu" | "unified" | "system" | "none";+ LocalModelAvailabilityReason: {+ /** @enum {string} */+ code:+ | "MEMORY_INSUFFICIENT"+ | "DISK_INSUFFICIENT"+ | "PLATFORM_UNSUPPORTED";+ /** Format: int64 */+ need_bytes?: number;+ /** Format: int64 */+ have_bytes?: number;+ };+ LocalModelAvailability: {+ downloadable: boolean;+ /** @description Present only when downloadable is false. */+ reason?: components["schemas"]["LocalModelAvailabilityReason"];+ };+ /**+ * @description absent: not on disk. idle: on disk, holding no memory. loading reserves its memory before it finishes; loaded is registered with the local gateway and Pi.+ * @enum {string}+ */+ LocalModelState:+ | "absent"+ | "downloading"+ | "idle"+ | "loading"+ | "loaded"+ | "failed";+ LocalModelDownloadProgress: {+ /** @enum {string} */+ step: "download" | "verify";+ /** Format: int64 */+ done_bytes: number;+ /** Format: int64 */+ total_bytes: number;+ /** Format: int64 */+ bytes_per_second?: number;+ };+ LocalModelEndpoint: {+ base_url: string;+ };+ /**+ * @description Closed localmodels library error set. It is extended only together with the localmodels library contract.+ * @enum {string}+ */+ LocalModelErrorCode:+ | "MODEL_UNKNOWN"+ | "INVALID_STATE"+ | "JOB_RUNNING"+ | "MEMORY_INSUFFICIENT"+ | "DISK_INSUFFICIENT"+ | "PLATFORM_UNSUPPORTED"+ | "LOAD_NO_ROOM"+ | "DOWNLOAD_FAILED"+ | "CHECKSUM_MISMATCH"+ | "NETWORK_UNAVAILABLE"+ | "ENGINE_START_FAILED"+ | "HEALTH_CHECK_FAILED"+ | "OUT_OF_MEMORY"+ | "MODEL_FILES_MISSING"+ | "GATEWAY_REGISTRATION_FAILED"+ | "CANCELLED";+ LocalModelError: {+ code: components["schemas"]["LocalModelErrorCode"];+ /** @description Diagnostic text for display; never matched on. */+ detail?: string;+ };+ LocalModelNote: {+ /** @enum {string} */+ code: "NO_ROOM_TO_LOAD";+ };+ /** @description One validated chat model of the catalog on this platform and its state on this Computer. Sizes are bytes; readers format them. */+ LocalModel: {+ id: components["schemas"]["LocalModelId"];+ name: string;+ description: string;+ quant: string;+ /** Format: int64 */+ context_tokens: number;+ vision: boolean;+ /** Format: int64 */+ download_bytes: number;+ /**+ * Format: int64+ * @description Footprint when loaded at its context policy, from the localmodels estimator.+ */+ memory_bytes: number;+ fit: components["schemas"]["LocalModelFit"];+ /** @description True on at most one model, an absent downloadable one. */+ recommended: boolean;+ availability: components["schemas"]["LocalModelAvailability"];+ /** @description Planned placement while absent, actual placement afterwards; absent when fit is none. */+ pool?: components["schemas"]["LocalModelPoolId"];+ state: components["schemas"]["LocalModelState"];+ /** @description Present only while downloading. */+ download?: components["schemas"]["LocalModelDownloadProgress"];+ /** @description Present only while loaded. */+ endpoint?: components["schemas"]["LocalModelEndpoint"];+ /** @description The runtime_model an Agent on runtime pi stores for this model, <pi provider>/<pi model id>; present while the model is on the Computer. */+ pi_model?: string;+ /** @description Warm speed measured at the last load; absent when unknown. */+ tokens_per_second?: number;+ /** @description Present only when failed. */+ error?: components["schemas"]["LocalModelError"];+ /** @description Present only when idle and the automatic load after download was skipped. */+ note?: components["schemas"]["LocalModelNote"];+ };+ /** @description A Computer's model library as its Daemon reported it in runner.local_models, mapped from localmodels.library-status/v1. When available is false only reason and observed_at carry meaning and the lists are empty. */+ LocalModelsSnapshot: {+ available: boolean;+ /** @description Present only when available is false. */+ reason?: components["schemas"]["LocalModelsUnavailableReason"];+ observed_at: components["schemas"]["Timestamp"];+ tool_version?: string;+ /** @description Present when available. */+ host?: components["schemas"]["LocalModelHost"];+ pools: components["schemas"]["LocalModelPool"][];+ models: components["schemas"]["LocalModel"][];+ };+ /** @description The latest runner.local_models snapshot of one Computer. TeamHub keeps only the latest per Computer, so an offline Computer still shows what it last reported. */+ RecordLocalModelsRequest: {+ computer_id: components["schemas"]["Id"];+ snapshot: components["schemas"]["LocalModelsSnapshot"];+ };/*** @description Persisted Agent runtime type.* @enum {string}@@ -2605,12 +2820,6 @@ export interface components {WorkItemPriority: "low" | "medium" | "high" | "urgent";/** @enum {string} */WorkItemResolution: "completed" | "failed" | "not_planned" | "duplicate";- /**- * Format: date-time- * @description UTC timestamp in RFC 3339 format with an explicit offset.- * @example 2026-07-21T10:15:30Z- */- Timestamp: string;AgentWorkItemAssignment: {actor: components["schemas"]["AgentActorRef"];assigned_by: components["schemas"]["AgentActorRef"];@@ -4403,6 +4612,32 @@ export interface operations {500: components["responses"]["InternalError"];};};+ recordAgentRuntimeLocalModels: {+ parameters: {+ query?: never;+ header?: never;+ path?: never;+ cookie?: never;+ };+ requestBody: {+ content: {+ "application/json": components["schemas"]["RecordLocalModelsRequest"];+ };+ };+ responses: {+ /** @description Stored. */+ 204: {+ headers: {+ [name: string]: unknown;+ };+ content?: never;+ };+ 400: components["responses"]["BadRequest"];+ 401: components["responses"]["Unauthenticated"];+ 404: components["responses"]["NotFound"];+ 500: components["responses"]["InternalError"];+ };+ };getAgentIdentity: {parameters: {query?: never;diff --git a/contracts/generated/typescript/src/generated/teamhub-public/types.ts b/contracts/generated/typescript/src/generated/teamhub-public/types.tsindex 43c5a314..e6cab50c 100644--- a/contracts/generated/typescript/src/generated/teamhub-public/types.ts+++ b/contracts/generated/typescript/src/generated/teamhub-public/types.ts@@ -447,6 +447,53 @@ export interface paths {patch?: never;trace?: never;};+ "/v0/tenants/{tenantId}/local-computers/{computerId}/local-models": {+ parameters: {+ query?: never;+ header?: never;+ path: {+ tenantId: components["parameters"]["TenantId"];+ computerId: components["parameters"]["ComputerId"];+ };+ cookie?: never;+ };+ /**+ * Read the model library one Local Computer last reported.+ * @description TeamHub answers from the latest snapshot the Computer sent, so an offline Computer shows what it last reported. Each model lists the Agents that use it. Tenant members who can see the Computer may read; only its owner may act. A local-models invalidation hint with the Computer ID follows every stored snapshot.+ */+ get: operations["getLocalComputerModels"];+ put?: never;+ post?: never;+ delete?: never;+ options?: never;+ head?: never;+ patch?: never;+ trace?: never;+ };+ "/v0/tenants/{tenantId}/local-computers/{computerId}/local-models/{modelId}/actions": {+ parameters: {+ query?: never;+ header?: never;+ path: {+ tenantId: components["parameters"]["TenantId"];+ computerId: components["parameters"]["ComputerId"];+ modelId: components["parameters"]["LocalModelId"];+ };+ cookie?: never;+ };+ get?: never;+ put?: never;+ /**+ * Download, cancel, load, unload, or remove one model on an owned Local Computer.+ * @description The click is the approval. TeamHub forwards the action to the Computer, which answers at once; 202 means the Computer started it. Progress and the outcome arrive as new snapshots, announced by local-models invalidation hints. A retried request sends the action again.+ */+ post: operations["actOnLocalComputerModel"];+ delete?: never;+ options?: never;+ head?: never;+ patch?: never;+ trace?: never;+ };"/v0/tenants/{tenantId}/local-computers/{computerId}/permissions": {parameters: {query?: never;@@ -4393,6 +4440,253 @@ export interface components {extension_token: string;profile?: components["schemas"]["BrowserProfile"];};+ LocalModelGpu: {+ index: number;+ uuid?: string;+ name: string;+ /** Format: int64 */+ total_bytes: number;+ /** Format: int64 */+ free_bytes: number;+ };+ /** @description Hardware and software of the Computer as localmodels reports it. */+ LocalModelHost: {+ /** @enum {string} */+ platform: "linux" | "darwin" | "windows";+ /** @enum {string} */+ arch: "x86_64" | "arm64";+ /** @description Display only, such as Ubuntu 24.04. */+ os_label: string;+ /** @description Display only, such as llama.cpp b11370 with CUDA. */+ engine_label: string;+ /** Format: int64 */+ ram_total_bytes: number;+ /** Format: int64 */+ disk_free_bytes: number;+ gpus: components["schemas"]["LocalModelGpu"][];+ };+ LocalModelsComputer: {+ computer_id: components["schemas"]["Id"];+ display_name: string;+ /** @enum {string} */+ status: "online" | "offline";+ last_seen_at?: components["schemas"]["Timestamp"];+ /** @description From the last snapshot that carried one. */+ host?: components["schemas"]["LocalModelHost"];+ };+ LocalModelsViewUnavailableReason: {+ /**+ * @description NOT_REPORTED: the Computer never sent a snapshot. Otherwise the reason from its last snapshot.+ * @enum {string}+ */+ code: "TOOL_NOT_INSTALLED" | "TOOL_FAILED" | "NOT_REPORTED";+ /** @description Diagnostic text for display; never matched on. */+ detail?: string;+ };+ /** @description A place a model can live: gpu:<index>, system (RAM beside GPUs), or unified (RAM of a host without discrete GPUs). */+ LocalModelPoolId: string;+ /** @description Something holding pool memory. A component is a foundation service such as an embedding, reranker, or speech model; it is never a model row. */+ LocalModelPoolHolder: {+ /** @enum {string} */+ kind: "model" | "component";+ id: string;+ name: string;+ /** Format: int64 */+ bytes: number;+ };+ /** @description One place models load into. The system and unified budgets are 80% of RAM, as localmodels computes them. */+ LocalModelPool: {+ id: components["schemas"]["LocalModelPoolId"];+ /** @enum {string} */+ kind: "gpu" | "system" | "unified";+ /** @description Present only for kind gpu; matches LocalModelGpu.index. */+ gpu_index?: number;+ /** Format: int64 */+ total_bytes: number;+ /** Format: int64 */+ used_bytes: number;+ holders: components["schemas"]["LocalModelPoolHolder"][];+ };+ /** @description Stable localmodels library id: catalog id and variant, such as qwen3-4b:Q4_K_M. */+ LocalModelId: string;+ /**+ * @description Where the model can live, judged on total capacity so it stays stable across loads. system means localmodels can run it from RAM, slower.+ * @enum {string}+ */+ LocalModelFit: "gpu" | "unified" | "system" | "none";+ LocalModelAvailabilityReason: {+ /** @enum {string} */+ code:+ | "MEMORY_INSUFFICIENT"+ | "DISK_INSUFFICIENT"+ | "PLATFORM_UNSUPPORTED";+ /** Format: int64 */+ need_bytes?: number;+ /** Format: int64 */+ have_bytes?: number;+ };+ LocalModelAvailability: {+ downloadable: boolean;+ /** @description Present only when downloadable is false. */+ reason?: components["schemas"]["LocalModelAvailabilityReason"];+ };+ /**+ * @description absent: not on disk. idle: on disk, holding no memory. loading reserves its memory before it finishes; loaded is registered with the local gateway and Pi.+ * @enum {string}+ */+ LocalModelState:+ | "absent"+ | "downloading"+ | "idle"+ | "loading"+ | "loaded"+ | "failed";+ LocalModelDownloadProgress: {+ /** @enum {string} */+ step: "download" | "verify";+ /** Format: int64 */+ done_bytes: number;+ /** Format: int64 */+ total_bytes: number;+ /** Format: int64 */+ bytes_per_second?: number;+ };+ LocalModelEndpoint: {+ base_url: string;+ };+ /**+ * @description Closed localmodels library error set. It is extended only together with the localmodels library contract.+ * @enum {string}+ */+ LocalModelErrorCode:+ | "MODEL_UNKNOWN"+ | "INVALID_STATE"+ | "JOB_RUNNING"+ | "MEMORY_INSUFFICIENT"+ | "DISK_INSUFFICIENT"+ | "PLATFORM_UNSUPPORTED"+ | "LOAD_NO_ROOM"+ | "DOWNLOAD_FAILED"+ | "CHECKSUM_MISMATCH"+ | "NETWORK_UNAVAILABLE"+ | "ENGINE_START_FAILED"+ | "HEALTH_CHECK_FAILED"+ | "OUT_OF_MEMORY"+ | "MODEL_FILES_MISSING"+ | "GATEWAY_REGISTRATION_FAILED"+ | "CANCELLED";+ LocalModelError: {+ code: components["schemas"]["LocalModelErrorCode"];+ /** @description Diagnostic text for display; never matched on. */+ detail?: string;+ };+ LocalModelNote: {+ /** @enum {string} */+ code: "NO_ROOM_TO_LOAD";+ };+ /** @description One validated chat model of the catalog on this platform and its state on this Computer. Sizes are bytes; readers format them. */+ LocalModel: {+ id: components["schemas"]["LocalModelId"];+ name: string;+ description: string;+ quant: string;+ /** Format: int64 */+ context_tokens: number;+ vision: boolean;+ /** Format: int64 */+ download_bytes: number;+ /**+ * Format: int64+ * @description Footprint when loaded at its context policy, from the localmodels estimator.+ */+ memory_bytes: number;+ fit: components["schemas"]["LocalModelFit"];+ /** @description True on at most one model, an absent downloadable one. */+ recommended: boolean;+ availability: components["schemas"]["LocalModelAvailability"];+ /** @description Planned placement while absent, actual placement afterwards; absent when fit is none. */+ pool?: components["schemas"]["LocalModelPoolId"];+ state: components["schemas"]["LocalModelState"];+ /** @description Present only while downloading. */+ download?: components["schemas"]["LocalModelDownloadProgress"];+ /** @description Present only while loaded. */+ endpoint?: components["schemas"]["LocalModelEndpoint"];+ /** @description The runtime_model an Agent on runtime pi stores for this model, <pi provider>/<pi model id>; present while the model is on the Computer. */+ pi_model?: string;+ /** @description Warm speed measured at the last load; absent when unknown. */+ tokens_per_second?: number;+ /** @description Present only when failed. */+ error?: components["schemas"]["LocalModelError"];+ /** @description Present only when idle and the automatic load after download was skipped. */+ note?: components["schemas"]["LocalModelNote"];+ };+ /** @description An Agent whose runtime model is this model on this Computer. */+ LocalModelUser: {+ agent_id: components["schemas"]["Id"];+ name: string;+ };+ LocalModelView: {+ model: components["schemas"]["LocalModel"];+ /** @description Active Agents placed on this Computer with runtime pi whose runtime model is this model's gateway model. */+ used_by: components["schemas"]["LocalModelUser"][];+ };+ /** @description One Computer's model library as last reported. Only the Computer owner can act (viewer_is_owner); other Tenant members who can see the Computer read it. */+ LocalModelsView: {+ computer: components["schemas"]["LocalModelsComputer"];+ viewer_is_owner: boolean;+ available: boolean;+ /** @description Present only when available is false. */+ reason?: components["schemas"]["LocalModelsViewUnavailableReason"];+ /** @description When the Computer observed the snapshot; absent when it never sent one. */+ observed_at?: components["schemas"]["Timestamp"];+ tool_version?: string;+ pools: components["schemas"]["LocalModelPool"][];+ models: components["schemas"]["LocalModelView"][];+ };+ /** @description A Human's action on one model. The click is the approval; there is no separate confirm step on the Computer. unload_first only with load. */+ LocalModelActionRequest: {+ /** @enum {string} */+ action: "download" | "cancel" | "load" | "unload" | "remove";+ /** @description Loaded models in the same pool to unload before the load starts. */+ unload_first?: components["schemas"]["LocalModelId"][];+ };+ LocalModelActionAccepted: {+ computer_id: components["schemas"]["Id"];+ model_id: components["schemas"]["LocalModelId"];+ /** @enum {string} */+ action: "download" | "cancel" | "load" | "unload" | "remove";+ };+ /**+ * @description error.code of a refused local-models action (403, 409, 502, 503, 504); 400, 401, and 404 use the common codes. LOCAL_COMPUTER_OFFLINE: the Computer is not connected. LOCAL_MODEL_ACTION_FORBIDDEN: the viewer is not the Computer owner. LOCAL_MODELS_UNAVAILABLE: the Computer has no usable localmodels tool. LOCAL_MODEL_ACTION_FAILED: the Computer refused with a library error that has no code of its own here (502). LOCAL_MODELS_SERVICE_UNAVAILABLE: Agent Service could not be reached (503). LOCAL_MODEL_ACTION_UNCONFIRMED: the connected Computer had not decided by the action's deadline; it may still run the action, and the library snapshots show the outcome (504). The other LOCAL_MODEL_ codes are the Computer's refusal codes of the same name (409).+ * @enum {string}+ */+ LocalModelsErrorCode:+ | "LOCAL_COMPUTER_OFFLINE"+ | "LOCAL_MODEL_ACTION_FORBIDDEN"+ | "LOCAL_MODELS_UNAVAILABLE"+ | "LOCAL_MODEL_UNKNOWN"+ | "LOCAL_MODEL_INVALID_STATE"+ | "LOCAL_MODEL_JOB_RUNNING"+ | "LOCAL_MODEL_NO_ROOM"+ | "LOCAL_MODEL_MEMORY_INSUFFICIENT"+ | "LOCAL_MODEL_DISK_INSUFFICIENT"+ | "LOCAL_MODEL_PLATFORM_UNSUPPORTED"+ | "LOCAL_MODEL_ACTION_FAILED"+ | "LOCAL_MODEL_ACTION_UNCONFIRMED"+ | "LOCAL_MODELS_SERVICE_UNAVAILABLE";+ /** @description The common error body with error.code narrowed to LocalModelsErrorCode. */+ LocalModelsError: {+ code: components["schemas"]["LocalModelsErrorCode"];+ /** @description Human-readable summary safe to display; clients branch on code, not message. */+ message: string;+ request_id: string;+ details?: components["schemas"]["ErrorDetail"][];+ /** @default false */+ retryable: boolean;+ };+ LocalModelsErrorResponse: {+ error: components["schemas"]["LocalModelsError"];+ };/*** @description The app macOS grants the permission to. linger is the Linger desktop app, which owns shell commands such as screencapture; computer_use is CuaDriver, which owns the computer-use tools.* @enum {string}@@ -7681,6 +7975,15 @@ export interface components {"application/json": components["schemas"]["ErrorResponse"];};};+ /** @description The Computer or TeamHub refused the local-models request; error.code is one of LocalModelsErrorCode. */+ LocalModelsRefused: {+ headers: {+ [name: string]: unknown;+ };+ content: {+ "application/json": components["schemas"]["LocalModelsErrorResponse"];+ };+ };/** @description The resource existed but was explicitly removed and cannot be reused. */Gone: {headers: {@@ -7728,6 +8031,7 @@ export interface components {parameters: {DecisionId: components["schemas"]["Id"];ComputerId: components["schemas"]["Id"];+ LocalModelId: components["schemas"]["LocalModelId"];TenantId: components["schemas"]["Id"];ActorId: components["schemas"]["Id"];AgentId: components["schemas"]["Id"];@@ -8469,6 +8773,67 @@ export interface operations {503: components["responses"]["ServiceUnavailable"];};};+ getLocalComputerModels: {+ parameters: {+ query?: never;+ header?: never;+ path: {+ tenantId: components["parameters"]["TenantId"];+ computerId: components["parameters"]["ComputerId"];+ };+ cookie?: never;+ };+ requestBody?: never;+ responses: {+ /** @description The Computer and its model library. */+ 200: {+ headers: {+ [name: string]: unknown;+ };+ content: {+ "application/json": components["schemas"]["LocalModelsView"];+ };+ };+ 401: components["responses"]["Unauthenticated"];+ 404: components["responses"]["NotFound"];+ };+ };+ actOnLocalComputerModel: {+ parameters: {+ query?: never;+ header?: never;+ path: {+ tenantId: components["parameters"]["TenantId"];+ computerId: components["parameters"]["ComputerId"];+ modelId: components["parameters"]["LocalModelId"];+ };+ cookie?: never;+ };+ requestBody: {+ content: {+ "application/json": components["schemas"]["LocalModelActionRequest"];+ };+ };+ responses: {+ /** @description The Computer started the action. */+ 202: {+ headers: {+ [name: string]: unknown;+ };+ content: {+ "application/json": components["schemas"]["LocalModelActionAccepted"];+ };+ };+ 400: components["responses"]["BadRequest"];+ 401: components["responses"]["Unauthenticated"];+ 403: components["responses"]["LocalModelsRefused"];+ 404: components["responses"]["NotFound"];+ 409: components["responses"]["LocalModelsRefused"];+ 502: components["responses"]["LocalModelsRefused"];+ 503: components["responses"]["LocalModelsRefused"];+ 504: components["responses"]["LocalModelsRefused"];+ };+ };getLocalComputerPermissions: {parameters: {query?: never;diff --git a/contracts/generated/typescript/src/teamhub-internal/client.ts b/contracts/generated/typescript/src/teamhub-internal/client.tsindex 64d63155..b14cd00f 100644--- a/contracts/generated/typescript/src/teamhub-internal/client.ts+++ b/contracts/generated/typescript/src/teamhub-internal/client.ts@@ -392,6 +392,10 @@ export function createTeamHubAgentRuntimeStateClient(options: {body: RemoveAgentRuntimeLocalComputerRequest,signal?: AbortSignal,) => post("local-computers/remove", body, signal),+ recordLocalModels: (+ body: Schemas["RecordLocalModelsRequest"],+ signal?: AbortSignal,+ ) => post("local-computers/local-models", body, signal),recordRunOperation: (body: RecordAgentLocalRunOperationRequest,signal?: AbortSignal,diff --git a/contracts/openapi/components/human-events.yaml b/contracts/openapi/components/human-events.yamlindex 312f2a00..840dbeb3 100644--- a/contracts/openapi/components/human-events.yaml+++ b/contracts/openapi/components/human-events.yaml@@ -8,7 +8,8 @@ components:(id is the Document ID). document-access: the same, and the Document's access may have beenrevoked, so cached Document bytes must be dropped (id is the Document ID). directory, agents (availability, status, and activity),another-me, computers, connections, and work-items name a Tenant collection (id is the- Tenant ID). Producers add a value here when they start publishing a new resource type.+ Tenant ID). local-models: a Local Computer's model library (id is the Computer ID).+ Producers add a value here when they start publishing a new resource type.enum:[room,@@ -20,6 +21,7 @@ components:work-items,document,document-access,+ local-models,]ResourceInvalidatedSseEvent:type: objectdiff --git a/contracts/openapi/components/local-models.yaml b/contracts/openapi/components/local-models.yamlnew file mode 100644index 00000000..f759e30d--- /dev/null+++ b/contracts/openapi/components/local-models.yaml@@ -0,0 +1,752 @@+components:+ responses:+ LocalModelsRefused:+ description: >-+ The Computer or TeamHub refused the local-models request; error.code is+ one of LocalModelsErrorCode.+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/LocalModelsErrorResponse"+ schemas:+ LocalModelId:+ description: >-+ Stable localmodels library id: catalog id and variant, such as+ qwen3-4b:Q4_K_M.+ type: string+ pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"+ LocalModelPoolId:+ description: >-+ A place a model can live: gpu:<index>, system (RAM beside GPUs), or+ unified (RAM of a host without discrete GPUs).+ type: string+ pattern: "^(gpu:(0|[1-9][0-9]{0,2})|system|unified)$"+ LocalModelErrorCode:+ description: >-+ Closed localmodels library error set. It is extended only together with+ the localmodels library contract.+ type: string+ enum:+ - MODEL_UNKNOWN+ - INVALID_STATE+ - JOB_RUNNING+ - MEMORY_INSUFFICIENT+ - DISK_INSUFFICIENT+ - PLATFORM_UNSUPPORTED+ - LOAD_NO_ROOM+ - DOWNLOAD_FAILED+ - CHECKSUM_MISMATCH+ - NETWORK_UNAVAILABLE+ - ENGINE_START_FAILED+ - HEALTH_CHECK_FAILED+ - OUT_OF_MEMORY+ - MODEL_FILES_MISSING+ - GATEWAY_REGISTRATION_FAILED+ - CANCELLED+ LocalModelsUnavailableCode:+ description: >-+ Why a Computer reports no model library. TOOL_NOT_INSTALLED: its+ Computer config names no localmodels tool. TOOL_FAILED: the tool did+ not answer library status.+ type: string+ enum: [TOOL_NOT_INSTALLED, TOOL_FAILED]+ LocalModelActionRefusalCode:+ description: >-+ Why the Computer refused an action before starting it: a localmodels+ library error or a reason the library is unavailable.+ type: string+ enum:+ - MODEL_UNKNOWN+ - INVALID_STATE+ - JOB_RUNNING+ - MEMORY_INSUFFICIENT+ - DISK_INSUFFICIENT+ - PLATFORM_UNSUPPORTED+ - LOAD_NO_ROOM+ - DOWNLOAD_FAILED+ - CHECKSUM_MISMATCH+ - NETWORK_UNAVAILABLE+ - ENGINE_START_FAILED+ - HEALTH_CHECK_FAILED+ - OUT_OF_MEMORY+ - MODEL_FILES_MISSING+ - GATEWAY_REGISTRATION_FAILED+ - CANCELLED+ - TOOL_NOT_INSTALLED+ - TOOL_FAILED+ LocalModelGpu:+ type: object+ additionalProperties: false+ required: [index, name, total_bytes, free_bytes]+ properties:+ index:+ type: integer+ minimum: 0+ uuid:+ type: string+ minLength: 1+ maxLength: 128+ name:+ type: string+ minLength: 1+ maxLength: 200+ total_bytes:+ type: integer+ format: int64+ minimum: 0+ free_bytes:+ type: integer+ format: int64+ minimum: 0+ LocalModelHost:+ description: Hardware and software of the Computer as localmodels reports it.+ type: object+ additionalProperties: false+ required:+ [+ platform,+ arch,+ os_label,+ engine_label,+ ram_total_bytes,+ disk_free_bytes,+ gpus,+ ]+ properties:+ platform:+ type: string+ enum: [linux, darwin, windows]+ x-enum-varnames:+ [+ LocalModelHostPlatformLinux,+ LocalModelHostPlatformDarwin,+ LocalModelHostPlatformWindows,+ ]+ arch:+ type: string+ enum: [x86_64, arm64]+ x-enum-varnames: [LocalModelHostArchX8664, LocalModelHostArchArm64]+ os_label:+ description: Display only, such as Ubuntu 24.04.+ type: string+ maxLength: 200+ engine_label:+ description: Display only, such as llama.cpp b11370 with CUDA.+ type: string+ maxLength: 200+ ram_total_bytes:+ type: integer+ format: int64+ minimum: 0+ disk_free_bytes:+ type: integer+ format: int64+ minimum: 0+ gpus:+ type: array+ maxItems: 64+ items:+ $ref: "#/components/schemas/LocalModelGpu"+ LocalModelPoolHolder:+ description: >-+ Something holding pool memory. A component is a foundation service such+ as an embedding, reranker, or speech model; it is never a model row.+ type: object+ additionalProperties: false+ required: [kind, id, name, bytes]+ properties:+ kind:+ type: string+ enum: [model, component]+ x-enum-varnames:+ [LocalModelPoolHolderKindModel, LocalModelPoolHolderKindComponent]+ id:+ type: string+ minLength: 1+ maxLength: 160+ name:+ type: string+ minLength: 1+ maxLength: 200+ bytes:+ type: integer+ format: int64+ minimum: 0+ LocalModelPool:+ description: >-+ One place models load into. The system and unified budgets are 80% of+ RAM, as localmodels computes them.+ type: object+ additionalProperties: false+ required: [id, kind, total_bytes, used_bytes, holders]+ properties:+ id:+ $ref: "#/components/schemas/LocalModelPoolId"+ kind:+ type: string+ enum: [gpu, system, unified]+ x-enum-varnames:+ [+ LocalModelPoolKindGpu,+ LocalModelPoolKindSystem,+ LocalModelPoolKindUnified,+ ]+ gpu_index:+ description: Present only for kind gpu; matches LocalModelGpu.index.+ type: integer+ minimum: 0+ total_bytes:+ type: integer+ format: int64+ minimum: 0+ used_bytes:+ type: integer+ format: int64+ minimum: 0+ holders:+ type: array+ maxItems: 256+ items:+ $ref: "#/components/schemas/LocalModelPoolHolder"+ LocalModelAvailability:+ type: object+ additionalProperties: false+ required: [downloadable]+ properties:+ downloadable:+ type: boolean+ reason:+ $ref: "#/components/schemas/LocalModelAvailabilityReason"+ description: Present only when downloadable is false.+ LocalModelAvailabilityReason:+ type: object+ additionalProperties: false+ required: [code]+ properties:+ code:+ type: string+ enum: [MEMORY_INSUFFICIENT, DISK_INSUFFICIENT, PLATFORM_UNSUPPORTED]+ x-enum-varnames:+ [+ LocalModelAvailabilityMemoryInsufficient,+ LocalModelAvailabilityDiskInsufficient,+ LocalModelAvailabilityPlatformUnsupported,+ ]+ need_bytes:+ type: integer+ format: int64+ minimum: 0+ have_bytes:+ type: integer+ format: int64+ minimum: 0+ LocalModelDownloadProgress:+ type: object+ additionalProperties: false+ required: [step, done_bytes, total_bytes]+ properties:+ step:+ type: string+ enum: [download, verify]+ x-enum-varnames:+ [LocalModelDownloadStepDownload, LocalModelDownloadStepVerify]+ done_bytes:+ type: integer+ format: int64+ minimum: 0+ total_bytes:+ type: integer+ format: int64+ minimum: 0+ bytes_per_second:+ type: integer+ format: int64+ minimum: 0+ LocalModelEndpoint:+ type: object+ additionalProperties: false+ required: [base_url]+ properties:+ base_url:+ type: string+ minLength: 1+ maxLength: 2048+ LocalModelError:+ type: object+ additionalProperties: false+ required: [code]+ properties:+ code:+ $ref: "#/components/schemas/LocalModelErrorCode"+ detail:+ description: Diagnostic text for display; never matched on.+ type: string+ maxLength: 4000+ LocalModelNote:+ type: object+ additionalProperties: false+ required: [code]+ properties:+ code:+ type: string+ enum: [NO_ROOM_TO_LOAD]+ x-enum-varnames: [LocalModelNoteNoRoomToLoad]+ LocalModelState:+ description: >-+ absent: not on disk. idle: on disk, holding no memory. loading reserves+ its memory before it finishes; loaded is registered with the local+ gateway and Pi.+ type: string+ enum: [absent, downloading, idle, loading, loaded, failed]+ x-enum-varnames:+ [+ LocalModelStateAbsent,+ LocalModelStateDownloading,+ LocalModelStateIdle,+ LocalModelStateLoading,+ LocalModelStateLoaded,+ LocalModelStateFailed,+ ]+ LocalModelFit:+ description: >-+ Where the model can live, judged on total capacity so it stays stable+ across loads. system means localmodels can run it from RAM, slower.+ type: string+ enum: [gpu, unified, system, none]+ x-enum-varnames:+ [+ LocalModelFitGpu,+ LocalModelFitUnified,+ LocalModelFitSystem,+ LocalModelFitNone,+ ]+ LocalModel:+ description: >-+ One validated chat model of the catalog on this platform and its state+ on this Computer. Sizes are bytes; readers format them.+ type: object+ additionalProperties: false+ required:+ [+ id,+ name,+ description,+ quant,+ context_tokens,+ vision,+ download_bytes,+ memory_bytes,+ fit,+ recommended,+ availability,+ state,+ ]+ properties:+ id:+ $ref: "#/components/schemas/LocalModelId"+ name:+ type: string+ minLength: 1+ maxLength: 200+ description:+ type: string+ maxLength: 2000+ quant:+ type: string+ minLength: 1+ maxLength: 64+ context_tokens:+ type: integer+ format: int64+ minimum: 0+ vision:+ type: boolean+ download_bytes:+ type: integer+ format: int64+ minimum: 0+ memory_bytes:+ description: Footprint when loaded at its context policy, from the localmodels estimator.+ type: integer+ format: int64+ minimum: 0+ fit:+ $ref: "#/components/schemas/LocalModelFit"+ recommended:+ description: True on at most one model, an absent downloadable one.+ type: boolean+ availability:+ $ref: "#/components/schemas/LocalModelAvailability"+ pool:+ $ref: "#/components/schemas/LocalModelPoolId"+ description: Planned placement while absent, actual placement afterwards; absent when fit is none.+ state:+ $ref: "#/components/schemas/LocalModelState"+ download:+ $ref: "#/components/schemas/LocalModelDownloadProgress"+ description: Present only while downloading.+ endpoint:+ $ref: "#/components/schemas/LocalModelEndpoint"+ description: Present only while loaded.+ pi_model:+ description: >-+ The runtime_model an Agent on runtime pi stores for this model,+ <pi provider>/<pi model id>; present while the model is on the+ Computer.+ type: string+ minLength: 1+ maxLength: 200+ tokens_per_second:+ description: Warm speed measured at the last load; absent when unknown.+ type: number+ minimum: 0+ error:+ $ref: "#/components/schemas/LocalModelError"+ description: Present only when failed.+ note:+ $ref: "#/components/schemas/LocalModelNote"+ description: Present only when idle and the automatic load after download was skipped.+ LocalModelsUnavailableReason:+ type: object+ additionalProperties: false+ required: [code]+ properties:+ code:+ $ref: "#/components/schemas/LocalModelsUnavailableCode"+ detail:+ description: Diagnostic text for display; never matched on.+ type: string+ maxLength: 4000+ LocalModelsSnapshot:+ description: >-+ A Computer's model library as its Daemon reported it in+ runner.local_models, mapped from localmodels.library-status/v1. When+ available is false only reason and observed_at carry meaning and the+ lists are empty.+ type: object+ additionalProperties: false+ required: [available, observed_at, pools, models]+ properties:+ available:+ type: boolean+ reason:+ $ref: "#/components/schemas/LocalModelsUnavailableReason"+ description: Present only when available is false.+ observed_at:+ $ref: "./common.yaml#/components/schemas/Timestamp"+ tool_version:+ type: string+ minLength: 1+ maxLength: 64+ host:+ $ref: "#/components/schemas/LocalModelHost"+ description: Present when available.+ pools:+ type: array+ maxItems: 65+ items:+ $ref: "#/components/schemas/LocalModelPool"+ models:+ type: array+ maxItems: 256+ items:+ $ref: "#/components/schemas/LocalModel"+ RecordLocalModelsRequest:+ description: >-+ The latest runner.local_models snapshot of one Computer. TeamHub keeps+ only the latest per Computer, so an offline Computer still shows what it+ last reported.+ type: object+ additionalProperties: false+ required: [computer_id, snapshot]+ properties:+ computer_id:+ $ref: "./common.yaml#/components/schemas/Id"+ snapshot:+ $ref: "#/components/schemas/LocalModelsSnapshot"+ LocalModelActionKind:+ description: >-+ refresh asks the Computer to reread its library and send a snapshot; it+ names no model.+ type: string+ enum: [download, cancel, load, unload, remove, refresh]+ x-enum-varnames:+ [+ LocalModelActionKindDownload,+ LocalModelActionKindCancel,+ LocalModelActionKindLoad,+ LocalModelActionKindUnload,+ LocalModelActionKindRemove,+ LocalModelActionKindRefresh,+ ]+ LocalModelActionCommand:+ description: >-+ TeamHub asks Agent Service to send one execute local_models frame to an+ owned Computer. model_id is required except for refresh; unload_first+ only with load.+ type: object+ additionalProperties: false+ required: [request_id, action, expires_at]+ properties:+ request_id:+ $ref: "./common.yaml#/components/schemas/Id"+ action:+ $ref: "#/components/schemas/LocalModelActionKind"+ model_id:+ $ref: "#/components/schemas/LocalModelId"+ unload_first:+ type: array+ maxItems: 64+ uniqueItems: true+ items:+ $ref: "#/components/schemas/LocalModelId"+ expires_at:+ $ref: "./common.yaml#/components/schemas/Timestamp"+ LocalModelActionRefusal:+ type: object+ additionalProperties: false+ required: [code]+ properties:+ code:+ $ref: "#/components/schemas/LocalModelActionRefusalCode"+ detail:+ description: Diagnostic text for display; never matched on.+ type: string+ maxLength: 4000+ pool:+ $ref: "#/components/schemas/LocalModelPoolId"+ description: With LOAD_NO_ROOM.+ need_bytes:+ type: integer+ format: int64+ minimum: 0+ free_bytes:+ type: integer+ format: int64+ minimum: 0+ LocalModelActionAck:+ description: >-+ The Computer's immediate answer. accepted means the job started (or a+ snapshot is coming for refresh); refused means nothing changed.+ Progress and outcomes arrive only as snapshots.+ type: object+ additionalProperties: false+ required: [request_id, outcome]+ properties:+ request_id:+ $ref: "./common.yaml#/components/schemas/Id"+ outcome:+ type: string+ enum: [accepted, refused]+ x-enum-varnames: [LocalModelActionAccepted, LocalModelActionRefused]+ refusal:+ $ref: "#/components/schemas/LocalModelActionRefusal"+ description: Present only when refused.+ LocalModelActionRequest:+ description: >-+ A Human's action on one model. The click is the approval; there is no+ separate confirm step on the Computer. unload_first only with load.+ type: object+ additionalProperties: false+ required: [action]+ properties:+ action:+ type: string+ enum: [download, cancel, load, unload, remove]+ x-enum-varnames:+ [+ LocalModelActionRequestDownload,+ LocalModelActionRequestCancel,+ LocalModelActionRequestLoad,+ LocalModelActionRequestUnload,+ LocalModelActionRequestRemove,+ ]+ unload_first:+ description: Loaded models in the same pool to unload before the load starts.+ type: array+ maxItems: 64+ uniqueItems: true+ items:+ $ref: "#/components/schemas/LocalModelId"+ LocalModelActionAccepted:+ type: object+ additionalProperties: false+ required: [computer_id, model_id, action]+ properties:+ computer_id:+ $ref: "./common.yaml#/components/schemas/Id"+ model_id:+ $ref: "#/components/schemas/LocalModelId"+ action:+ type: string+ enum: [download, cancel, load, unload, remove]+ x-enum-varnames:+ [+ LocalModelActionAcceptedDownload,+ LocalModelActionAcceptedCancel,+ LocalModelActionAcceptedLoad,+ LocalModelActionAcceptedUnload,+ LocalModelActionAcceptedRemove,+ ]+ LocalModelsErrorCode:+ description: >-+ error.code of a refused local-models action (403, 409, 502, 503, 504);+ 400, 401, and 404 use the common codes. LOCAL_COMPUTER_OFFLINE: the+ Computer is not connected. LOCAL_MODEL_ACTION_FORBIDDEN: the viewer is not the Computer owner.+ LOCAL_MODELS_UNAVAILABLE: the Computer has no usable localmodels tool.+ LOCAL_MODEL_ACTION_FAILED: the Computer refused with a library error+ that has no code of its own here (502). LOCAL_MODELS_SERVICE_UNAVAILABLE:+ Agent Service could not be reached (503). LOCAL_MODEL_ACTION_UNCONFIRMED:+ the connected Computer had not decided by the action's deadline; it may+ still run the action, and the library snapshots show the outcome (504).+ The other LOCAL_MODEL_ codes+ are the Computer's refusal codes of the same name (409).+ type: string+ enum:+ - LOCAL_COMPUTER_OFFLINE+ - LOCAL_MODEL_ACTION_FORBIDDEN+ - LOCAL_MODELS_UNAVAILABLE+ - LOCAL_MODEL_UNKNOWN+ - LOCAL_MODEL_INVALID_STATE+ - LOCAL_MODEL_JOB_RUNNING+ - LOCAL_MODEL_NO_ROOM+ - LOCAL_MODEL_MEMORY_INSUFFICIENT+ - LOCAL_MODEL_DISK_INSUFFICIENT+ - LOCAL_MODEL_PLATFORM_UNSUPPORTED+ - LOCAL_MODEL_ACTION_FAILED+ - LOCAL_MODEL_ACTION_UNCONFIRMED+ - LOCAL_MODELS_SERVICE_UNAVAILABLE+ LocalModelsError:+ description: The common error body with error.code narrowed to LocalModelsErrorCode.+ type: object+ additionalProperties: false+ required: [code, message, request_id]+ properties:+ code:+ $ref: "#/components/schemas/LocalModelsErrorCode"+ message:+ type: string+ minLength: 1+ description: Human-readable summary safe to display; clients branch on code, not message.+ request_id:+ type: string+ minLength: 1+ maxLength: 128+ details:+ type: array+ items:+ $ref: "./common.yaml#/components/schemas/ErrorDetail"+ retryable:+ type: boolean+ default: false+ LocalModelsErrorResponse:+ type: object+ additionalProperties: false+ required: [error]+ properties:+ error:+ $ref: "#/components/schemas/LocalModelsError"+ LocalModelUser:+ description: An Agent whose runtime model is this model on this Computer.+ type: object+ additionalProperties: false+ required: [agent_id, name]+ properties:+ agent_id:+ $ref: "./common.yaml#/components/schemas/Id"+ name:+ type: string+ minLength: 1+ maxLength: 120+ LocalModelView:+ type: object+ additionalProperties: false+ required: [model, used_by]+ properties:+ model:+ $ref: "#/components/schemas/LocalModel"+ used_by:+ description: >-+ Active Agents placed on this Computer with runtime pi whose runtime+ model is this model's gateway model.+ type: array+ maxItems: 1000+ items:+ $ref: "#/components/schemas/LocalModelUser"+ LocalModelsComputer:+ type: object+ additionalProperties: false+ required: [computer_id, display_name, status]+ properties:+ computer_id:+ $ref: "./common.yaml#/components/schemas/Id"+ display_name:+ type: string+ minLength: 1+ maxLength: 120+ status:+ type: string+ enum: [online, offline]+ x-enum-varnames:+ [LocalModelsComputerOnline, LocalModelsComputerOffline]+ last_seen_at:+ $ref: "./common.yaml#/components/schemas/Timestamp"+ host:+ $ref: "#/components/schemas/LocalModelHost"+ description: From the last snapshot that carried one.+ LocalModelsViewUnavailableReason:+ type: object+ additionalProperties: false+ required: [code]+ properties:+ code:+ description: >-+ NOT_REPORTED: the Computer never sent a snapshot. Otherwise the+ reason from its last snapshot.+ type: string+ enum: [TOOL_NOT_INSTALLED, TOOL_FAILED, NOT_REPORTED]+ x-enum-varnames:+ [+ LocalModelsViewToolNotInstalled,+ LocalModelsViewToolFailed,+ LocalModelsViewNotReported,+ ]+ detail:+ description: Diagnostic text for display; never matched on.+ type: string+ maxLength: 4000+ LocalModelsView:+ description: >-+ One Computer's model library as last reported. Only the Computer owner+ can act (viewer_is_owner); other Tenant members who can see the+ Computer read it.+ type: object+ additionalProperties: false+ required: [computer, viewer_is_owner, available, pools, models]+ properties:+ computer:+ $ref: "#/components/schemas/LocalModelsComputer"+ viewer_is_owner:+ type: boolean+ available:+ type: boolean+ reason:+ $ref: "#/components/schemas/LocalModelsViewUnavailableReason"+ description: Present only when available is false.+ observed_at:+ $ref: "./common.yaml#/components/schemas/Timestamp"+ description: When the Computer observed the snapshot; absent when it never sent one.+ tool_version:+ type: string+ minLength: 1+ maxLength: 64+ pools:+ type: array+ maxItems: 65+ items:+ $ref: "#/components/schemas/LocalModelPool"+ models:+ type: array+ maxItems: 256+ items:+ $ref: "#/components/schemas/LocalModelView"diff --git a/contracts/openapi/linger-installer/openapi.yaml b/contracts/openapi/linger-installer/openapi.yamlindex 9813fb2b..aad31af5 100644--- a/contracts/openapi/linger-installer/openapi.yaml+++ b/contracts/openapi/linger-installer/openapi.yaml@@ -1070,7 +1070,10 @@ components:Absolute paths only, never credentials. LINGER_CODEX_PATH,LINGER_CLAUDE_PATH and LINGER_PI_PATH name the executable;CODEX_HOME, CLAUDE_CONFIG_DIR and PI_CODING_AGENT_DIR its profile- when it is not the user's default.+ when it is not the user's default. LINGER_LOCALMODELS_PYTHON,+ LINGER_LOCALMODELS_MODULE_DIR, LINGER_LOCALMODELS_STATE and+ LINGER_LOCALMODELS_BASE_DIR, all four or none, name the+ localmodels tool the Computer runs for its model library.additionalProperties:type: stringSetupReport:diff --git a/contracts/openapi/node-services-internal/openapi.yaml b/contracts/openapi/node-services-internal/openapi.yamlindex d89774ee..aaf8aa68 100644--- a/contracts/openapi/node-services-internal/openapi.yaml+++ b/contracts/openapi/node-services-internal/openapi.yaml@@ -204,6 +204,46 @@ paths:$ref: ../components/common.yaml#/components/responses/ServiceUnavailablesecurity:- agentManagementBearer: []+ /v1/tenants/{tenantId}/owners/{ownerActorId}/local-computers/{computerId}/local-model-actions:+ parameters:+ - $ref: "#/components/parameters/TenantId"+ - $ref: "#/components/parameters/OwnerActorId"+ - $ref: "#/components/parameters/ComputerId"+ post:+ summary: Send one local-models action to an owned Local Computer+ description:+ Agent Service sends execute with kind local_models and returns the+ Computer's immediate accepted or refused answer. The Computer+ supervises the job and reports progress only through runner.local_models+ snapshots, which Agent Service records in TeamHub.+ operationId: actOnLocalComputerModels+ requestBody:+ required: true+ content:+ application/json:+ schema:+ $ref: ../components/local-models.yaml#/components/schemas/LocalModelActionCommand+ responses:+ "200":+ description: The Computer's answer.+ content:+ application/json:+ schema:+ $ref: ../components/local-models.yaml#/components/schemas/LocalModelActionAck+ "400":+ $ref: ../components/common.yaml#/components/responses/BadRequest+ "401":+ $ref: ../components/common.yaml#/components/responses/Unauthenticated+ "404":+ $ref: ../components/common.yaml#/components/responses/NotFound+ "409":+ $ref: ../components/common.yaml#/components/responses/Conflict+ "502":+ $ref: ../components/common.yaml#/components/responses/BadGateway+ "503":+ $ref: ../components/common.yaml#/components/responses/ServiceUnavailable+ security:+ - agentManagementBearer: []/v1/tenants/{tenantId}/owners/{ownerActorId}/local-computers/{computerId}/browser-connection:parameters:- $ref: "#/components/parameters/TenantId"diff --git a/contracts/openapi/teamhub-internal/openapi.yaml b/contracts/openapi/teamhub-internal/openapi.yamlindex 0a93aaa2..b8512277 100644--- a/contracts/openapi/teamhub-internal/openapi.yaml+++ b/contracts/openapi/teamhub-internal/openapi.yaml@@ -226,6 +226,32 @@ paths:$ref: ../paths/teamhub-agent-runtime-state.yaml#/touchLocalComputer/v0/agent-runtime/local-computers/remove:$ref: ../paths/teamhub-agent-runtime-state.yaml#/removeLocalComputer+ /v0/agent-runtime/local-computers/local-models:+ post:+ tags: [Local Computers]+ operationId: recordAgentRuntimeLocalModels+ summary: Store the latest model library snapshot a Computer reported.+ description: >-+ Agent Service forwards every runner.local_models snapshot. TeamHub replaces the+ Computer's stored snapshot, keeps it while the Computer is offline, and publishes a+ local-models invalidation hint with the Computer ID.+ requestBody:+ required: true+ content:+ application/json:+ schema:+ $ref: "../components/local-models.yaml#/components/schemas/RecordLocalModelsRequest"+ responses:+ "204":+ description: Stored.+ "400":+ $ref: "../components/common.yaml#/components/responses/BadRequest"+ "401":+ $ref: "../components/common.yaml#/components/responses/Unauthenticated"+ "404":+ $ref: "../components/common.yaml#/components/responses/NotFound"+ "500":+ $ref: "../components/common.yaml#/components/responses/InternalError"/v0/agents/{agentId}/identity:parameters:- $ref: "#/components/parameters/AgentId"diff --git a/contracts/openapi/teamhub-public/teamhub-api.openapi.yaml b/contracts/openapi/teamhub-public/teamhub-api.openapi.yamlindex 8cb7519c..31ccd04c 100644--- a/contracts/openapi/teamhub-public/teamhub-api.openapi.yaml+++ b/contracts/openapi/teamhub-public/teamhub-api.openapi.yaml@@ -744,6 +744,72 @@ paths:$ref: '../components/common.yaml#/components/responses/BadGateway''503':$ref: '../components/common.yaml#/components/responses/ServiceUnavailable'+ /v0/tenants/{tenantId}/local-computers/{computerId}/local-models:+ parameters:+ - $ref: '#/components/parameters/TenantId'+ - $ref: '#/components/parameters/ComputerId'+ get:+ tags: [Local Computers]+ operationId: getLocalComputerModels+ summary: Read the model library one Local Computer last reported.+ description: >-+ TeamHub answers from the latest snapshot the Computer sent, so an offline Computer shows+ what it last reported. Each model lists the Agents that use it. Tenant members who can see+ the Computer may read; only its owner may act. A local-models invalidation hint with the+ Computer ID follows every stored snapshot.+ responses:+ '200':+ description: The Computer and its model library.+ content:+ application/json:+ schema:+ $ref: '../components/local-models.yaml#/components/schemas/LocalModelsView'+ '401':+ $ref: '../components/common.yaml#/components/responses/Unauthenticated'+ '404':+ $ref: '../components/common.yaml#/components/responses/NotFound'+ /v0/tenants/{tenantId}/local-computers/{computerId}/local-models/{modelId}/actions:+ parameters:+ - $ref: '#/components/parameters/TenantId'+ - $ref: '#/components/parameters/ComputerId'+ - $ref: '#/components/parameters/LocalModelId'+ post:+ tags: [Local Computers]+ operationId: actOnLocalComputerModel+ summary: Download, cancel, load, unload, or remove one model on an owned Local Computer.+ description: >-+ The click is the approval. TeamHub forwards the action to the Computer, which answers at+ once; 202 means the Computer started it. Progress and the outcome arrive as new snapshots,+ announced by local-models invalidation hints. A retried request sends the action again.+ requestBody:+ required: true+ content:+ application/json:+ schema:+ $ref: '../components/local-models.yaml#/components/schemas/LocalModelActionRequest'+ responses:+ '202':+ description: The Computer started the action.+ content:+ application/json:+ schema:+ $ref: '../components/local-models.yaml#/components/schemas/LocalModelActionAccepted'+ '400':+ $ref: '../components/common.yaml#/components/responses/BadRequest'+ '401':+ $ref: '../components/common.yaml#/components/responses/Unauthenticated'+ '403':+ $ref: '../components/local-models.yaml#/components/responses/LocalModelsRefused'+ '404':+ $ref: '../components/common.yaml#/components/responses/NotFound'+ '409':+ $ref: '../components/local-models.yaml#/components/responses/LocalModelsRefused'+ '502':+ $ref: '../components/local-models.yaml#/components/responses/LocalModelsRefused'+ '503':+ $ref: '../components/local-models.yaml#/components/responses/LocalModelsRefused'+ '504':+ $ref: '../components/local-models.yaml#/components/responses/LocalModelsRefused'/v0/tenants/{tenantId}/local-computers/{computerId}/permissions:parameters:- $ref: '#/components/parameters/TenantId'@@ -4995,6 +5061,12 @@ components:required: trueschema:$ref: '../components/common.yaml#/components/schemas/Id'+ LocalModelId:+ name: modelId+ in: path+ required: true+ schema:+ $ref: '../components/local-models.yaml#/components/schemas/LocalModelId'TenantId:name: tenantIdin: pathdiff --git a/contracts/runner-gateway/asyncapi.yaml b/contracts/runner-gateway/asyncapi.yamlindex 2f10ef9e..28ef3d24 100644--- a/contracts/runner-gateway/asyncapi.yaml+++ b/contracts/runner-gateway/asyncapi.yaml@@ -17,7 +17,7 @@ info:prepared (target operation or provider), cancel (target operation orprovider), execute and executed (kind session_compact, model_invoke,computer_tool, skills_scan, browser_connect, computer_permission,- debug_history or+ local_models, debug_history orcli_credential), agent_runner.state (state ready, removed or failed) andoperation.input_result (outcome accepted, rejected or closed); theOperation family carries operation.start, operation.input, operation.ack,@@ -49,6 +49,13 @@ info:started. Responses carry the same owner and connection epoch.Disconnect/timeout means an unknown outcome; the caller must inspecteffects and must not automatically replay actions.+ execute with kind local_models acts on the Computer's localmodels+ library (download, cancel, load with unload_first, unload, remove, or+ refresh). The Computer answers executed with outcome accepted or refused+ at once and supervises the long-running localmodels job itself; progress+ and outcomes reach the service only as runner.local_models snapshots,+ which the Computer sends after runner.hello, after every library change,+ and at most every 2 seconds while a download or load runs.x-frame-limits:maxBytes: 4194304maxDepth: 32diff --git a/contracts/runner-gateway/envelope.schema.json b/contracts/runner-gateway/envelope.schema.jsonindex 14ce8fe8..cea18c48 100644--- a/contracts/runner-gateway/envelope.schema.json+++ b/contracts/runner-gateway/envelope.schema.json@@ -44,6 +44,9 @@{"$ref": "#/$defs/CapabilityComputerPermission"},+ {+ "$ref": "#/$defs/CapabilityLocalModelsExecute"+ },{"$ref": "#/$defs/OperationPrepare"},@@ -84,6 +87,9 @@{"$ref": "#/$defs/RunnerRuntimeDiagnostics"},+ {+ "$ref": "#/$defs/RunnerLocalModels"+ },{"$ref": "#/$defs/RuntimeRegistrationObserved"},@@ -123,6 +129,12 @@{"$ref": "#/$defs/CapabilityComputerPermissionFailed"},+ {+ "$ref": "#/$defs/CapabilityLocalModelsAccepted"+ },+ {+ "$ref": "#/$defs/CapabilityLocalModelsRefused"+ },{"$ref": "#/$defs/OperationPrepared"},@@ -1837,6 +1849,655 @@}]},+ "LocalModelId": {+ "description": "Stable localmodels library id: catalog id and variant, such as qwen3-4b:Q4_K_M.",+ "type": "string",+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"+ },+ "LocalModelPoolId": {+ "description": "A place a model can live: gpu:<index>, system (RAM beside GPUs) or unified (RAM of a GPU-less or Apple silicon host).",+ "type": "string",+ "pattern": "^(gpu:(0|[1-9][0-9]{0,2})|system|unified)$"+ },+ "LocalModelErrorCode": {+ "description": "Closed localmodels library error set. Extend it only together with the localmodels library contract.",+ "enum": [+ "MODEL_UNKNOWN",+ "INVALID_STATE",+ "JOB_RUNNING",+ "MEMORY_INSUFFICIENT",+ "DISK_INSUFFICIENT",+ "PLATFORM_UNSUPPORTED",+ "LOAD_NO_ROOM",+ "DOWNLOAD_FAILED",+ "CHECKSUM_MISMATCH",+ "NETWORK_UNAVAILABLE",+ "ENGINE_START_FAILED",+ "HEALTH_CHECK_FAILED",+ "OUT_OF_MEMORY",+ "MODEL_FILES_MISSING",+ "GATEWAY_REGISTRATION_FAILED",+ "CANCELLED"+ ]+ },+ "LocalModelsUnavailableCode": {+ "description": "Why a Computer reports no model library: TOOL_NOT_INSTALLED when the Computer config names no localmodels tool, TOOL_FAILED when the tool did not answer library status.",+ "enum": ["TOOL_NOT_INSTALLED", "TOOL_FAILED"]+ },+ "LocalModelActionRefusalCode": {+ "description": "Why the Computer refused an action before it started: a localmodels library error or a reason the library is unavailable.",+ "enum": [+ "MODEL_UNKNOWN",+ "INVALID_STATE",+ "JOB_RUNNING",+ "MEMORY_INSUFFICIENT",+ "DISK_INSUFFICIENT",+ "PLATFORM_UNSUPPORTED",+ "LOAD_NO_ROOM",+ "DOWNLOAD_FAILED",+ "CHECKSUM_MISMATCH",+ "NETWORK_UNAVAILABLE",+ "ENGINE_START_FAILED",+ "HEALTH_CHECK_FAILED",+ "OUT_OF_MEMORY",+ "MODEL_FILES_MISSING",+ "GATEWAY_REGISTRATION_FAILED",+ "CANCELLED",+ "TOOL_NOT_INSTALLED",+ "TOOL_FAILED"+ ]+ },+ "LocalModelGpu": {+ "type": "object",+ "additionalProperties": false,+ "required": ["index", "name", "total_bytes", "free_bytes"],+ "properties": {+ "index": {+ "$ref": "#/$defs/NonNegativeInteger"+ },+ "uuid": {+ "type": "string",+ "minLength": 1,+ "maxLength": 128+ },+ "name": {+ "type": "string",+ "minLength": 1,+ "maxLength": 200+ },+ "total_bytes": {+ "$ref": "#/$defs/NonNegativeInteger"+ },+ "free_bytes": {+ "$ref": "#/$defs/NonNegativeInteger"+ }+ }+ },+ "LocalModelHost": {+ "type": "object",+ "additionalProperties": false,+ "required": [+ "platform",+ "arch",+ "os_label",+ "engine_label",+ "ram_total_bytes",+ "disk_free_bytes",+ "gpus"+ ],+ "properties": {+ "platform": {+ "enum": ["linux", "darwin", "windows"]+ },+ "arch": {+ "enum": ["x86_64", "arm64"]+ },+ "os_label": {+ "description": "Display only.",+ "type": "string",+ "maxLength": 200+ },+ "engine_label": {+ "description": "Display only.",+ "type": "string",+ "maxLength": 200+ },+ "ram_total_bytes": {+ "$ref": "#/$defs/NonNegativeInteger"+ },+ "disk_free_bytes": {+ "$ref": "#/$defs/NonNegativeInteger"+ },+ "gpus": {+ "type": "array",+ "maxItems": 64,+ "items": {+ "$ref": "#/$defs/LocalModelGpu"+ }+ }+ }+ },+ "LocalModelPoolHolder": {+ "description": "Something holding pool memory. A component is a foundation service (embedding, reranker, speech) that is never a model row.",+ "type": "object",+ "additionalProperties": false,+ "required": ["kind", "id", "name", "bytes"],+ "properties": {+ "kind": {+ "enum": ["model", "component"]+ },+ "id": {+ "type": "string",+ "minLength": 1,+ "maxLength": 160+ },+ "name": {+ "type": "string",+ "minLength": 1,+ "maxLength": 200+ },+ "bytes": {+ "$ref": "#/$defs/NonNegativeInteger"+ }+ }+ },+ "LocalModelPool": {+ "description": "One place models load into. The system and unified budgets are 80% of RAM, as localmodels computes them.",+ "type": "object",+ "additionalProperties": false,+ "required": ["id", "kind", "total_bytes", "used_bytes", "holders"],+ "properties": {+ "id": {+ "$ref": "#/$defs/LocalModelPoolId"+ },+ "kind": {+ "enum": ["gpu", "system", "unified"]+ },+ "gpu_index": {+ "description": "Present only for kind gpu; matches LocalModelGpu.index.",+ "$ref": "#/$defs/NonNegativeInteger"+ },+ "total_bytes": {+ "$ref": "#/$defs/NonNegativeInteger"+ },+ "used_bytes": {+ "$ref": "#/$defs/NonNegativeInteger"+ },+ "holders": {+ "type": "array",+ "maxItems": 256,+ "items": {+ "$ref": "#/$defs/LocalModelPoolHolder"+ }+ }+ }+ },+ "LocalModelAvailabilityReason": {+ "type": "object",+ "additionalProperties": false,+ "required": ["code"],+ "properties": {+ "code": {+ "enum": [+ "MEMORY_INSUFFICIENT",+ "DISK_INSUFFICIENT",+ "PLATFORM_UNSUPPORTED"+ ]+ },+ "need_bytes": {+ "$ref": "#/$defs/NonNegativeInteger"+ },+ "have_bytes": {+ "$ref": "#/$defs/NonNegativeInteger"+ }+ }+ },+ "LocalModelAvailability": {+ "type": "object",+ "additionalProperties": false,+ "required": ["downloadable"],+ "properties": {+ "downloadable": {+ "type": "boolean"+ },+ "reason": {+ "description": "Present only when downloadable is false.",+ "$ref": "#/$defs/LocalModelAvailabilityReason"+ }+ }+ },+ "LocalModelDownloadProgress": {+ "type": "object",+ "additionalProperties": false,+ "required": ["step", "done_bytes", "total_bytes"],+ "properties": {+ "step": {+ "enum": ["download", "verify"]+ },+ "done_bytes": {+ "$ref": "#/$defs/NonNegativeInteger"+ },+ "total_bytes": {+ "$ref": "#/$defs/NonNegativeInteger"+ },+ "bytes_per_second": {+ "$ref": "#/$defs/NonNegativeInteger"+ }+ }+ },+ "LocalModelEndpoint": {+ "type": "object",+ "additionalProperties": false,+ "required": ["base_url"],+ "properties": {+ "base_url": {+ "type": "string",+ "minLength": 1,+ "maxLength": 2048+ }+ }+ },+ "LocalModelError": {+ "type": "object",+ "additionalProperties": false,+ "required": ["code"],+ "properties": {+ "code": {+ "$ref": "#/$defs/LocalModelErrorCode"+ },+ "detail": {+ "description": "Diagnostic text for display; never matched on.",+ "type": "string",+ "maxLength": 4000+ }+ }+ },+ "LocalModelNote": {+ "type": "object",+ "additionalProperties": false,+ "required": ["code"],+ "properties": {+ "code": {+ "enum": ["NO_ROOM_TO_LOAD"]+ }+ }+ },+ "LocalModel": {+ "description": "One validated chat model of the catalog on this platform, with its state on this Computer. Bytes everywhere; the reader formats them.",+ "type": "object",+ "additionalProperties": false,+ "required": [+ "id",+ "name",+ "description",+ "quant",+ "context_tokens",+ "vision",+ "download_bytes",+ "memory_bytes",+ "fit",+ "recommended",+ "availability",+ "state"+ ],+ "properties": {+ "id": {+ "$ref": "#/$defs/LocalModelId"+ },+ "name": {+ "type": "string",+ "minLength": 1,+ "maxLength": 200+ },+ "description": {+ "type": "string",+ "maxLength": 2000+ },+ "quant": {+ "type": "string",+ "minLength": 1,+ "maxLength": 64+ },+ "context_tokens": {+ "$ref": "#/$defs/NonNegativeInteger"+ },+ "vision": {+ "type": "boolean"+ },+ "download_bytes": {+ "$ref": "#/$defs/NonNegativeInteger"+ },+ "memory_bytes": {+ "description": "Footprint when loaded at its context policy, from the localmodels estimator.",+ "$ref": "#/$defs/NonNegativeInteger"+ },+ "fit": {+ "description": "Where the model can live judged on total capacity; stable across loads. system means localmodels can run it from RAM, slower.",+ "enum": ["gpu", "unified", "system", "none"]+ },+ "recommended": {+ "description": "At most one model, only an absent downloadable one.",+ "type": "boolean"+ },+ "availability": {+ "$ref": "#/$defs/LocalModelAvailability"+ },+ "pool": {+ "description": "Planned placement while absent, actual placement afterwards; absent when fit is none.",+ "$ref": "#/$defs/LocalModelPoolId"+ },+ "state": {+ "enum": [+ "absent",+ "downloading",+ "idle",+ "loading",+ "loaded",+ "failed"+ ]+ },+ "download": {+ "description": "Present only while downloading.",+ "$ref": "#/$defs/LocalModelDownloadProgress"+ },+ "endpoint": {+ "description": "Present only while loaded.",+ "$ref": "#/$defs/LocalModelEndpoint"+ },+ "pi_model": {+ "description": "The runtime_model an Agent on runtime pi stores for this model, <pi provider>/<pi model id>; present while the model is on the Computer.",+ "type": "string",+ "minLength": 1,+ "maxLength": 200+ },+ "tokens_per_second": {+ "description": "Warm speed measured at the last load; absent when unknown.",+ "type": "number",+ "minimum": 0+ },+ "error": {+ "description": "Present only when failed.",+ "$ref": "#/$defs/LocalModelError"+ },+ "note": {+ "description": "Present only when idle and the automatic load after download was skipped.",+ "$ref": "#/$defs/LocalModelNote"+ }+ }+ },+ "LocalModelsUnavailableReason": {+ "type": "object",+ "additionalProperties": false,+ "required": ["code"],+ "properties": {+ "code": {+ "$ref": "#/$defs/LocalModelsUnavailableCode"+ },+ "detail": {+ "description": "Diagnostic text for display; never matched on.",+ "type": "string",+ "maxLength": 4000+ }+ }+ },+ "LocalModelsSnapshot": {+ "description": "The Computer's model library, mapped from localmodels.library-status/v1. When available is false only reason and observed_at are meaningful and the lists are empty.",+ "type": "object",+ "additionalProperties": false,+ "required": ["available", "observed_at", "pools", "models"],+ "properties": {+ "available": {+ "type": "boolean"+ },+ "reason": {+ "description": "Present only when available is false.",+ "$ref": "#/$defs/LocalModelsUnavailableReason"+ },+ "observed_at": {+ "$ref": "#/$defs/Timestamp"+ },+ "tool_version": {+ "type": "string",+ "minLength": 1,+ "maxLength": 64+ },+ "host": {+ "description": "Present when available.",+ "$ref": "#/$defs/LocalModelHost"+ },+ "pools": {+ "type": "array",+ "maxItems": 65,+ "items": {+ "$ref": "#/$defs/LocalModelPool"+ }+ },+ "models": {+ "type": "array",+ "maxItems": 256,+ "items": {+ "$ref": "#/$defs/LocalModel"+ }+ }+ }+ },+ "CapabilityLocalModelsExecute": {+ "description": "Ask the Computer to act on its model library. The Computer answers at once with accepted or refused and supervises the localmodels job itself; progress and the outcome arrive as runner.local_models snapshots. refresh rereads the library and needs no model_id; every other action names one. unload_first is only for load.",+ "type": "object",+ "unevaluatedProperties": false,+ "allOf": [+ {+ "$ref": "#/$defs/LocalSkillCommandIdentity"+ },+ {+ "type": "object",+ "required": ["type", "kind", "action"],+ "properties": {+ "type": {+ "const": "execute"+ },+ "kind": {+ "const": "local_models"+ },+ "action": {+ "enum": [+ "download",+ "cancel",+ "load",+ "unload",+ "remove",+ "refresh"+ ]+ },+ "model_id": {+ "$ref": "#/$defs/LocalModelId"+ },+ "unload_first": {+ "type": "array",+ "maxItems": 64,+ "uniqueItems": true,+ "items": {+ "$ref": "#/$defs/LocalModelId"+ }+ }+ },+ "if": {+ "properties": {+ "action": {+ "const": "refresh"+ }+ }+ },+ "then": {+ "properties": {+ "model_id": false,+ "unload_first": false+ }+ },+ "else": {+ "properties": {+ "model_id": {+ "$ref": "#/$defs/LocalModelId"+ }+ },+ "required": ["model_id"]+ }+ },+ {+ "if": {+ "properties": {+ "action": {+ "const": "load"+ }+ }+ },+ "else": {+ "properties": {+ "unload_first": false+ }+ }+ }+ ]+ },+ "CapabilityLocalModelsAccepted": {+ "description": "The Computer started the action, or for refresh queued a fresh snapshot.",+ "type": "object",+ "unevaluatedProperties": false,+ "allOf": [+ {+ "$ref": "#/$defs/LocalSkillCommandIdentity"+ },+ {+ "type": "object",+ "required": ["type", "kind", "action", "outcome"],+ "properties": {+ "type": {+ "const": "executed"+ },+ "kind": {+ "const": "local_models"+ },+ "action": {+ "enum": [+ "download",+ "cancel",+ "load",+ "unload",+ "remove",+ "refresh"+ ]+ },+ "model_id": {+ "$ref": "#/$defs/LocalModelId"+ },+ "outcome": {+ "const": "accepted"+ }+ }+ }+ ]+ },+ "LocalModelActionRefusal": {+ "type": "object",+ "additionalProperties": false,+ "required": ["code"],+ "properties": {+ "code": {+ "$ref": "#/$defs/LocalModelActionRefusalCode"+ },+ "detail": {+ "description": "Diagnostic text for display; never matched on.",+ "type": "string",+ "maxLength": 4000+ },+ "pool": {+ "description": "With LOAD_NO_ROOM.",+ "$ref": "#/$defs/LocalModelPoolId"+ },+ "need_bytes": {+ "description": "With LOAD_NO_ROOM, MEMORY_INSUFFICIENT or DISK_INSUFFICIENT.",+ "$ref": "#/$defs/NonNegativeInteger"+ },+ "free_bytes": {+ "description": "With LOAD_NO_ROOM, MEMORY_INSUFFICIENT or DISK_INSUFFICIENT.",+ "$ref": "#/$defs/NonNegativeInteger"+ }+ }+ },+ "CapabilityLocalModelsRefused": {+ "description": "The Computer did not start the action; nothing changed on it.",+ "type": "object",+ "unevaluatedProperties": false,+ "allOf": [+ {+ "$ref": "#/$defs/LocalSkillCommandIdentity"+ },+ {+ "type": "object",+ "required": ["type", "kind", "action", "refusal", "outcome"],+ "properties": {+ "type": {+ "const": "executed"+ },+ "kind": {+ "const": "local_models"+ },+ "action": {+ "enum": [+ "download",+ "cancel",+ "load",+ "unload",+ "remove",+ "refresh"+ ]+ },+ "model_id": {+ "$ref": "#/$defs/LocalModelId"+ },+ "refusal": {+ "$ref": "#/$defs/LocalModelActionRefusal"+ },+ "outcome": {+ "const": "refused"+ }+ }+ }+ ]+ },+ "RunnerLocalModels": {+ "description": "The Computer's model library. Sent after runner.hello, after every library change, and at most every 2 seconds while a download or load runs. revision grows within one connection.",+ "type": "object",+ "additionalProperties": false,+ "required": [+ "type",+ "protocol_version",+ "runner_id",+ "sent_at",+ "revision",+ "local_models"+ ],+ "properties": {+ "type": {+ "const": "runner.local_models"+ },+ "protocol_version": {+ "$ref": "#/$defs/ProtocolVersion"+ },+ "runner_id": {+ "$ref": "#/$defs/Id"+ },+ "sent_at": {+ "$ref": "#/$defs/Timestamp"+ },+ "revision": {+ "$ref": "#/$defs/PositiveInteger"+ },+ "local_models": {+ "$ref": "#/$defs/LocalModelsSnapshot"+ }+ }+ },"RunnerHello": {"type": "object","additionalProperties": false,diff --git a/scripts/runner-gateway-contract.test.ts b/scripts/runner-gateway-contract.test.tsindex 0cb60878..0c2533bd 100644--- a/scripts/runner-gateway-contract.test.ts+++ b/scripts/runner-gateway-contract.test.ts@@ -328,6 +328,204 @@ const computerPermissionOutcomes = [},] as const;+const localModelsIdentity = {+ ...computerPermissionIdentity,+ command_id: "command-local-models",+} as const;+const localModelsActions = [+ {+ type: "execute",+ kind: "local_models",+ ...localModelsIdentity,+ action: "load",+ model_id: "qwen3-4b:Q4_K_M",+ unload_first: ["gemma3-4b:Q4_K_M"],+ },+ {+ type: "execute",+ kind: "local_models",+ ...localModelsIdentity,+ action: "refresh",+ },+] as const;+const localModelsSnapshot = {+ type: "runner.local_models",+ protocol_version: "2",+ runner_id: "runner-local",+ sent_at: "2026-07-27T00:00:03.000Z",+ revision: 1,+ local_models: {+ available: true,+ observed_at: "2026-07-27T00:00:03.000Z",+ tool_version: "0.9.0",+ host: {+ platform: "linux",+ arch: "x86_64",+ os_label: "Ubuntu 24.04",+ engine_label: "llama.cpp b11370 CUDA",+ ram_total_bytes: 68_719_476_736,+ disk_free_bytes: 500_000_000_000,+ gpus: [+ {+ index: 0,+ uuid: "GPU-1",+ name: "RTX 4090",+ total_bytes: 25_757_220_864,+ free_bytes: 20_000_000_000,+ },+ ],+ },+ pools: [+ {+ id: "gpu:0",+ kind: "gpu",+ gpu_index: 0,+ total_bytes: 25_757_220_864,+ used_bytes: 4_000_000_000,+ holders: [+ {+ kind: "model",+ id: "qwen3-4b:Q4_K_M",+ name: "Qwen3 4B",+ bytes: 4_000_000_000,+ },+ ],+ },+ {+ id: "system",+ kind: "system",+ total_bytes: 54_975_581_388,+ used_bytes: 0,+ holders: [],+ },+ ],+ models: [+ {+ id: "qwen3-4b:Q4_K_M",+ name: "Qwen3 4B",+ description: "Small chat model",+ quant: "Q4_K_M",+ context_tokens: 32_768,+ vision: false,+ download_bytes: 2_500_000_000,+ memory_bytes: 4_000_000_000,+ fit: "gpu",+ recommended: false,+ availability: { downloadable: true },+ pool: "gpu:0",+ state: "loaded",+ endpoint: { base_url: "http://127.0.0.1:18100/v1" },+ pi_model: "localmodels-library/qwen3-4b",+ tokens_per_second: 142.5,+ },+ {+ id: "qwen3-235b:Q4_K_M",+ name: "Qwen3 235B",+ description: "Too large for this Computer",+ quant: "Q4_K_M",+ context_tokens: 131_072,+ vision: false,+ download_bytes: 140_000_000_000,+ memory_bytes: 150_000_000_000,+ fit: "none",+ recommended: false,+ availability: {+ downloadable: false,+ reason: {+ code: "MEMORY_INSUFFICIENT",+ need_bytes: 150_000_000_000,+ have_bytes: 54_975_581_388,+ },+ },+ state: "absent",+ },+ {+ id: "gemma3-4b:Q4_K_M",+ name: "Gemma 3 4B",+ description: "Loaded without a resolved Pi catalog key",+ quant: "Q4_K_M",+ context_tokens: 32_768,+ vision: true,+ download_bytes: 2_500_000_000,+ memory_bytes: 4_000_000_000,+ fit: "gpu",+ recommended: false,+ availability: { downloadable: true },+ pool: "gpu:0",+ state: "loaded",+ endpoint: { base_url: "http://127.0.0.1:18101/v1" },+ },+ {+ id: "qwen3-32b:Q4_K_M",+ name: "Qwen3 32B",+ description: "Large chat model",+ quant: "Q4_K_M",+ context_tokens: 131_072,+ vision: false,+ download_bytes: 20_000_000_000,+ memory_bytes: 24_000_000_000,+ fit: "gpu",+ recommended: false,+ availability: { downloadable: true },+ pool: "gpu:0",+ state: "downloading",+ download: {+ step: "download",+ done_bytes: 1_000_000_000,+ total_bytes: 20_000_000_000,+ bytes_per_second: 50_000_000,+ },+ },+ ],+ },+} as const;+const localModelsAnswers = [+ {+ type: "executed",+ kind: "local_models",+ outcome: "accepted",+ ...localModelsIdentity,+ action: "load",+ model_id: "qwen3-4b:Q4_K_M",+ },+ {+ type: "executed",+ kind: "local_models",+ outcome: "refused",+ ...localModelsIdentity,+ action: "load",+ model_id: "qwen3-4b:Q4_K_M",+ refusal: {+ code: "LOAD_NO_ROOM",+ pool: "gpu:0",+ need_bytes: 4_000_000_000,+ free_bytes: 1_000_000_000,+ },+ },+ {+ type: "executed",+ kind: "local_models",+ outcome: "refused",+ ...localModelsIdentity,+ action: "refresh",+ refusal: { code: "TOOL_NOT_INSTALLED" },+ },+ {+ type: "runner.local_models",+ protocol_version: "2",+ runner_id: "runner-local",+ sent_at: "2026-07-27T00:00:04.000Z",+ revision: 2,+ local_models: {+ available: false,+ reason: { code: "TOOL_NOT_INSTALLED" },+ observed_at: "2026-07-27T00:00:04.000Z",+ pools: [],+ models: [],+ },+ },+] as const;+const operationStart = (request: object, suffix: string) => ({type: "operation.start",...identity,@@ -434,6 +632,7 @@ const agentToDaemonFixtures = [sessionCompact,modelInvoke,computerPermission,+ ...localModelsActions,] as const;const runEventFixtures = [@@ -616,6 +815,8 @@ const daemonToAgentFixtures = [sessionCompacted,modelInvoked,...computerPermissionOutcomes,+ localModelsSnapshot,+ ...localModelsAnswers,] as const;const withoutProperty = (@@ -949,6 +1150,34 @@ describe("Runner Gateway contract", () => {}});+ it("ties local_models model_id and unload_first to the action", () => {+ const [load, refresh] = localModelsActions;+ const invalid = [+ { ...refresh, model_id: "qwen3-4b:Q4_K_M" },+ { ...load, action: "download" },+ { ...refresh, action: "download" },+ { ...load, model_id: "../escape" },+ {+ ...localModelsAnswers[1],+ refusal: { code: "SOMETHING_ELSE" },+ },+ {+ ...localModelsSnapshot,+ local_models: {+ ...localModelsSnapshot.local_models,+ pools: [+ { ...localModelsSnapshot.local_models.pools[0], id: "gpu-0" },+ ],+ },+ },+ ];+ for (const envelope of invalid) {+ expect(() => parseRunnerGatewayEnvelope(envelope)).toThrow(+ "Invalid Runner Gateway envelope",+ );+ }+ });+it("rejects unknown versions, arbitrary paths, invalid identities, and sequences", () => {const invalid = [{