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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bridge/contracts/contract.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export const DashboardSession = z.object({ id, session_id: id, title: z.string()
export const DashboardGroup = z.object({ key: z.string().max(4096), label: z.string().max(4096), total: counter, listed: counter }).strict().meta({ id: 'DashboardGroup' });
export const DashboardSnapshot = z.object({ dashboard_id: id, captured_at: counter, terminal_title: z.string().max(4096), filter: z.string().max(4096), view: z.enum(['status', 'directory']), partial: z.boolean(), sessions: z.array(DashboardSession).max(1000), groups: z.array(DashboardGroup).max(1000) }).strict().meta({ id: 'DashboardSnapshot' });
export const SnapshotTrace = z.object({ read_at: counter, read_source: z.enum(['desktop', 'connector']), desktop_generated_at: counter.optional(), desktop_session_count: counter.optional(), desktop_publish_result: z.enum(['ok', 'no_state_directory', 'mkdir_failed', 'serialize_failed', 'oversized', 'write_failed', 'rename_failed']).optional(), read_result: z.enum(['accepted', 'missing', 'expired', 'invalid', 'oversized', 'clock_ahead', 'read_error', 'refresh_failed']), previous_upload_at: counter.optional(), previous_upload_result: z.enum(['ok', 'failed', 'legacy_retry']).optional() }).strict().meta({ id: 'SnapshotTrace' });
export const RuntimeSnapshot = z.object({ available: z.boolean(), partial: z.boolean(), truncated: z.boolean().default(false), statuses: z.array(RuntimeStatus).max(limits.snapshotStatuses), dashboard: DashboardSnapshot.optional(), snapshot_trace: SnapshotTrace.optional() }).strict().meta({ id: 'RuntimeSnapshot' });
export const OwnerScope = z.enum(['paired_owner']).meta({ id: 'OwnerScope' });
export const OwnerSession = DashboardSession.omit({ group_key: true, listed: true }).meta({ id: 'OwnerSession' });
export const OwnerView = z.object({ scope: OwnerScope, version: z.literal(1), capture_id: id, captured_at: counter, partial: z.boolean(), sessions: z.array(OwnerSession).max(1000) }).strict().meta({ id: 'OwnerView' });
export const RuntimeSnapshot = z.object({ available: z.boolean(), partial: z.boolean(), truncated: z.boolean().default(false), statuses: z.array(RuntimeStatus).max(limits.snapshotStatuses), dashboard: DashboardSnapshot.optional(), snapshot_trace: SnapshotTrace.optional(), owner_view: OwnerView.optional() }).strict().meta({ id: 'RuntimeSnapshot' });
export const ObservedRuntimeSnapshot = RuntimeSnapshot.extend({ checked_at: counter.nullable().default(null) }).strip().meta({ id: 'ObservedRuntimeSnapshot' });
export const Role = z.enum(['user', 'assistant']).meta({ id: 'Role' });
export const BatchKind = z.enum(['baseline', 'delta', 'replace']).meta({ id: 'BatchKind' });
Expand Down
5 changes: 4 additions & 1 deletion bridge/contracts/contract.mts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export const DashboardSession=z.object({id,session_id:id,title:z.string().max(10
export const DashboardGroup=z.object({key:z.string().max(4096),label:z.string().max(4096),total:counter,listed:counter}).strict().meta({id:'DashboardGroup'});
export const DashboardSnapshot=z.object({dashboard_id:id,captured_at:counter,terminal_title:z.string().max(4096),filter:z.string().max(4096),view:z.enum(['status','directory']),partial:z.boolean(),sessions:z.array(DashboardSession).max(1000),groups:z.array(DashboardGroup).max(1000)}).strict().meta({id:'DashboardSnapshot'});
export const SnapshotTrace=z.object({read_at:counter,read_source:z.enum(['desktop','connector']),desktop_generated_at:counter.optional(),desktop_session_count:counter.optional(),desktop_publish_result:z.enum(['ok','no_state_directory','mkdir_failed','serialize_failed','oversized','write_failed','rename_failed']).optional(),read_result:z.enum(['accepted','missing','expired','invalid','oversized','clock_ahead','read_error','refresh_failed']),previous_upload_at:counter.optional(),previous_upload_result:z.enum(['ok','failed','legacy_retry']).optional()}).strict().meta({id:'SnapshotTrace'});
export const RuntimeSnapshot=z.object({available:z.boolean(),partial:z.boolean(),truncated:z.boolean().default(false),statuses:z.array(RuntimeStatus).max(limits.snapshotStatuses),dashboard:DashboardSnapshot.optional(),snapshot_trace:SnapshotTrace.optional()}).strict().meta({id:'RuntimeSnapshot'});
export const OwnerScope=z.enum(['paired_owner']).meta({id:'OwnerScope'});
export const OwnerSession=DashboardSession.omit({group_key:true,listed:true}).meta({id:'OwnerSession'});
export const OwnerView=z.object({scope:OwnerScope,version:z.literal(1),capture_id:id,captured_at:counter,partial:z.boolean(),sessions:z.array(OwnerSession).max(1000)}).strict().meta({id:'OwnerView'});
export const RuntimeSnapshot=z.object({available:z.boolean(),partial:z.boolean(),truncated:z.boolean().default(false),statuses:z.array(RuntimeStatus).max(limits.snapshotStatuses),dashboard:DashboardSnapshot.optional(),snapshot_trace:SnapshotTrace.optional(),owner_view:OwnerView.optional()}).strict().meta({id:'RuntimeSnapshot'});
export type RuntimeStatus=z.output<typeof RuntimeStatus>;
export type RuntimeSnapshot=z.output<typeof RuntimeSnapshot>;
export const ObservedRuntimeSnapshot=RuntimeSnapshot.extend({checked_at:counter.nullable().default(null)}).strip().meta({id:'ObservedRuntimeSnapshot'});
Expand Down
108 changes: 108 additions & 0 deletions bridge/contracts/contract.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@
"$ref": "#/definitions/SnapshotTrace"
}
]
},
"owner_view": {
"allOf": [
{
"$ref": "#/definitions/OwnerView"
}
]
}
},
"required": [
Expand Down Expand Up @@ -596,6 +603,107 @@
],
"additionalProperties": false
},
"OwnerView": {
"type": "object",
"properties": {
"scope": {
"$ref": "#/definitions/OwnerScope"
},
"version": {
"type": "integer",
"const": 1
},
"capture_id": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"captured_at": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"partial": {
"type": "boolean"
},
"sessions": {
"maxItems": 1000,
"type": "array",
"items": {
"$ref": "#/definitions/OwnerSession"
}
}
},
"required": [
"scope",
"version",
"capture_id",
"captured_at",
"partial",
"sessions"
],
"additionalProperties": false
},
"OwnerScope": {
"type": "string",
"enum": [
"paired_owner"
]
},
"OwnerSession": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"session_id": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"title": {
"type": "string",
"maxLength": 1000
},
"provider": {
"type": "string",
"maxLength": 100
},
"directory": {
"type": "string",
"maxLength": 4096
},
"directory_id": {
"type": "string",
"maxLength": 4100
},
"directory_path": {
"type": "string",
"maxLength": 4096
},
"directory_label": {
"type": "string",
"maxLength": 4096
},
"category": {
"$ref": "#/definitions/DashboardCategory"
}
},
"required": [
"id",
"session_id",
"title",
"provider",
"directory",
"directory_id",
"directory_path",
"directory_label",
"category"
],
"additionalProperties": false
},
"Message": {
"type": "object",
"properties": {
Expand Down
88 changes: 2 additions & 86 deletions bridge/contracts/mcp-outputs.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,16 +348,6 @@
"type": "null"
}
]
},
"connector": {
"anyOf": [
{
"$ref": "#/definitions/SnapshotTrace"
},
{
"type": "null"
}
]
}
},
"required": [
Expand All @@ -368,83 +358,9 @@
"last_mac_seen_at",
"snapshot_captured_at",
"snapshot_stored_at",
"session_count",
"connector"
"session_count"
],
"additionalProperties": false,
"definitions": {
"SnapshotTrace": {
"type": "object",
"properties": {
"read_at": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"read_source": {
"type": "string",
"enum": [
"desktop",
"connector"
]
},
"desktop_generated_at": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"desktop_session_count": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"desktop_publish_result": {
"type": "string",
"enum": [
"ok",
"no_state_directory",
"mkdir_failed",
"serialize_failed",
"oversized",
"write_failed",
"rename_failed"
]
},
"read_result": {
"type": "string",
"enum": [
"accepted",
"missing",
"expired",
"invalid",
"oversized",
"clock_ahead",
"read_error",
"refresh_failed"
]
},
"previous_upload_at": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"previous_upload_result": {
"type": "string",
"enum": [
"ok",
"failed",
"legacy_retry"
]
}
},
"required": [
"read_at",
"read_source",
"read_result"
],
"additionalProperties": false
}
}
"additionalProperties": false
},
"list_artifacts": {
"$schema": "http://json-schema.org/draft-07/schema#",
Expand Down
4 changes: 2 additions & 2 deletions bridge/contracts/responses.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Generated. Edit the .mts source, not this file.
import { z } from 'zod';
import { ReadContext, SnapshotTrace, Status, Health, Reason, DashboardCategory, VisibilityAction, routes } from './contract.mjs';
import { ReadContext, Status, Health, Reason, DashboardCategory, VisibilityAction, routes } from './contract.mjs';
const id = z.string().min(1).max(200), counter = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
// Consumers tolerate additive response fields, but known fields never change type.
const object = (shape) => z.object(shape);
Expand Down Expand Up @@ -46,7 +46,7 @@ const voiceSession = z.object({ id, title: z.string(), status: DashboardCategory
const directoryGroup = z.object({ path: z.string(), label: z.string(), counts: categoryCounts, sessions: z.array(voiceSession), working: z.array(voiceSession) }).strict();
export const toolOutputs = {
list_visible_sessions: z.object({ counts: categoryCounts.nullable(), directories: z.array(directoryGroup), warning: z.string().optional() }).strict(),
snapshot_diagnostics: z.object({ state: z.enum(['fresh', 'stale', 'unavailable']), reasons: z.array(z.string()), checked_at: counter, runtime_stored_at: counter.nullable(), last_mac_seen_at: counter.nullable(), snapshot_captured_at: counter.nullable(), snapshot_stored_at: counter.nullable(), session_count: counter.nullable(), connector: SnapshotTrace.nullable() }).strict(),
snapshot_diagnostics: z.object({ state: z.enum(['fresh', 'stale', 'unavailable']), reasons: z.array(z.string()), checked_at: counter, runtime_stored_at: counter.nullable(), last_mac_seen_at: counter.nullable(), snapshot_captured_at: counter.nullable(), snapshot_stored_at: counter.nullable(), session_count: counter.nullable() }).strict(),
list_artifacts: extensible({ artifacts: z.array(artifactMetadata) }),
mac_presence: extensible({ bridge: z.enum(['online', 'offline', 'unknown']), internet: z.enum(['reachable', 'unknown']), history_sync: z.enum(['fresh', 'stale', 'partial', 'unknown']), last_heartbeat_at: counter.nullable(), last_successful_sync_at: counter.nullable() }),
new_since_last_check: extensible({ available: z.boolean(), changes: z.array(extensible({ session_id: id, change: z.enum(['needs_you', 'finished']), reason: Reason.nullable() })), note: z.string() }),
Expand Down
4 changes: 2 additions & 2 deletions bridge/contracts/responses.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {z} from 'zod';
import {ReadContext,SnapshotTrace,Status,Health,Reason,DashboardCategory,VisibilityAction,routes} from './contract.mjs';
import {ReadContext,Status,Health,Reason,DashboardCategory,VisibilityAction,routes} from './contract.mjs';
const id=z.string().min(1).max(200),counter=z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
// Consumers tolerate additive response fields, but known fields never change type.
const object=<T extends z.ZodRawShape>(shape:T)=>z.object(shape);
Expand Down Expand Up @@ -45,7 +45,7 @@ const voiceSession=z.object({id,title:z.string(),status:DashboardCategory,user:z
const directoryGroup=z.object({path:z.string(),label:z.string(),counts:categoryCounts,sessions:z.array(voiceSession),working:z.array(voiceSession)}).strict();
export const toolOutputs={
list_visible_sessions:z.object({counts:categoryCounts.nullable(),directories:z.array(directoryGroup),warning:z.string().optional()}).strict(),
snapshot_diagnostics:z.object({state:z.enum(['fresh','stale','unavailable']),reasons:z.array(z.string()),checked_at:counter,runtime_stored_at:counter.nullable(),last_mac_seen_at:counter.nullable(),snapshot_captured_at:counter.nullable(),snapshot_stored_at:counter.nullable(),session_count:counter.nullable(),connector:SnapshotTrace.nullable()}).strict(),
snapshot_diagnostics:z.object({state:z.enum(['fresh','stale','unavailable']),reasons:z.array(z.string()),checked_at:counter,runtime_stored_at:counter.nullable(),last_mac_seen_at:counter.nullable(),snapshot_captured_at:counter.nullable(),snapshot_stored_at:counter.nullable(),session_count:counter.nullable()}).strict(),
list_artifacts:extensible({artifacts:z.array(artifactMetadata)}),
mac_presence:extensible({bridge:z.enum(['online','offline','unknown']),internet:z.enum(['reachable','unknown']),history_sync:z.enum(['fresh','stale','partial','unknown']),last_heartbeat_at:counter.nullable(),last_successful_sync_at:counter.nullable()}),
new_since_last_check:extensible({available:z.boolean(),changes:z.array(extensible({session_id:id,change:z.enum(['needs_you','finished']),reason:Reason.nullable()})),note:z.string()}),
Expand Down
Loading
Loading