@ai-matrx/desktop-protocol 0.15.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { BackoffOptions } from '@ai-matrx/realtime';
2
2
  export { RECONNECT_ALARM_ATTEMPTS } from '@ai-matrx/realtime';
3
3
  import { z } from 'zod';
4
- import { W as Welcome, D as DesktopProtocolError, C as CloseOutcome, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, e as ClientType, M as ModelsTranscribeResult, T as TranscriptionModelId, f as MlProgress } from './models-iOvmEOHd.cjs';
5
- export { i as isDesktopProtocolError } from './models-iOvmEOHd.cjs';
4
+ import { W as Welcome, D as DesktopProtocolError, C as CloseOutcome, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, e as ClientType, M as ModelsTranscribeResult, T as TranscriptionModelId, f as MlProgress } from './models-CCOaAWaM.cjs';
5
+ export { i as isDesktopProtocolError } from './models-CCOaAWaM.cjs';
6
6
  import { FrameHeader } from './frame.cjs';
7
7
 
8
8
  /** The subset of the WHATWG WebSocket the client uses — browser, React Native, `ws` and Workers all fit. */
package/dist/client.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { BackoffOptions } from '@ai-matrx/realtime';
2
2
  export { RECONNECT_ALARM_ATTEMPTS } from '@ai-matrx/realtime';
3
3
  import { z } from 'zod';
4
- import { W as Welcome, D as DesktopProtocolError, C as CloseOutcome, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, e as ClientType, M as ModelsTranscribeResult, T as TranscriptionModelId, f as MlProgress } from './models-iOvmEOHd.js';
5
- export { i as isDesktopProtocolError } from './models-iOvmEOHd.js';
4
+ import { W as Welcome, D as DesktopProtocolError, C as CloseOutcome, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, e as ClientType, M as ModelsTranscribeResult, T as TranscriptionModelId, f as MlProgress } from './models-CCOaAWaM.js';
5
+ export { i as isDesktopProtocolError } from './models-CCOaAWaM.js';
6
6
  import { FrameHeader } from './frame.js';
7
7
 
8
8
  /** The subset of the WHATWG WebSocket the client uses — browser, React Native, `ws` and Workers all fit. */
package/dist/client.js CHANGED
@@ -94,7 +94,7 @@ import { z as z2 } from "zod";
94
94
  // src/schema/primitives.ts
95
95
  import { z } from "zod";
96
96
  var PROTOCOL_MAJOR = 1;
97
- var PROTOCOL_MINOR = 4;
97
+ var PROTOCOL_MINOR = 5;
98
98
  var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
99
99
  var ProtocolVersion = z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
100
100
  var RequestId = z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
@@ -1179,23 +1179,98 @@ var ExecJobInfo = z20.strictObject({
1179
1179
  var ExecJobListParams = z20.strictObject({});
1180
1180
  var ExecJobListResult = z20.strictObject({ jobs: z20.array(ExecJobInfo).max(64) });
1181
1181
 
1182
- // src/schema/apps.ts
1182
+ // src/schema/coding.ts
1183
1183
  import { z as z21 } from "zod";
1184
- var AppKey = z21.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);
1185
- var AppProfileId = z21.string().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/);
1186
- var AppProfileLocator = z21.string().min(1).max(512).regex(/^[A-Za-z0-9 _()+@,-][A-Za-z0-9 ._()+@,-]{0,127}(\/[A-Za-z0-9 _()+@,-][A-Za-z0-9 ._()+@,-]{0,127}){0,7}$/);
1187
- var AppSupport = z21.enum(["supported", "partial", "unsupported"]);
1188
- var AppFeatureStatus = z21.strictObject({
1184
+ var CodingServiceCredentials = z21.strictObject({
1185
+ access_token: z21.string().min(16).max(16384),
1186
+ user_id: z21.string().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),
1187
+ /** The AI Matrx server this app talks to (production, or a local server on the nightly copy). */
1188
+ server_url: z21.string().min(1).max(2048).regex(/^https?:\/\/[^\s/?#]+(\/[^\s?#]*)?$/)
1189
+ });
1190
+ var CodingHistoryBlocked = z21.enum([
1191
+ "signed_out",
1192
+ "offline",
1193
+ "organization_required",
1194
+ "claude_unavailable",
1195
+ "cloud_list_unavailable",
1196
+ "history_too_large"
1197
+ ]);
1198
+ var CodingHistoryFailure = z21.strictObject({
1199
+ session_id: z21.string().max(64),
1200
+ reason: z21.string().max(300)
1201
+ });
1202
+ var CodingHistoryRun = z21.strictObject({
1203
+ /** Claude Code sessions found on this computer. */
1204
+ local_sessions: nonNegInt,
1205
+ /** Of those, already complete in AI Matrx. */
1206
+ in_cloud: nonNegInt,
1207
+ /** In AI Matrx under neither of its identities. */
1208
+ missing: nonNegInt,
1209
+ /** In AI Matrx, but changed here after the last turn AI Matrx received (turns the hook lost). */
1210
+ behind: nonNegInt,
1211
+ /** Over the importer's size cap; never imported. */
1212
+ too_large: nonNegInt,
1213
+ imported: nonNegInt,
1214
+ /** Changed while being read; a later run takes them. */
1215
+ changed: nonNegInt,
1216
+ failed: nonNegInt,
1217
+ failures: z21.array(CodingHistoryFailure).max(20),
1218
+ /** Candidates not reached yet. */
1219
+ remaining: nonNegInt,
1220
+ /** The one line a person reads, e.g. "Imported 12 of 14 sessions. 140 already in AI Matrx." */
1221
+ summary: z21.string().max(400)
1222
+ });
1223
+ var CodingHistoryStep = z21.strictObject({
1224
+ /** Null when the run could not start (blocked before a plan existed). */
1225
+ plan_id: z21.string().regex(/^[0-9a-f]{32}$/).nullable(),
1226
+ finished: z21.boolean(),
1227
+ blocked: CodingHistoryBlocked.nullable(),
1228
+ run: CodingHistoryRun
1229
+ });
1230
+ var CodingPlanMissingParams = z21.strictObject({ credentials: CodingServiceCredentials.nullable() });
1231
+ var CodingImportNextParams = z21.strictObject({
1232
+ plan_id: z21.string().regex(/^[0-9a-f]{32}$/),
1233
+ credentials: CodingServiceCredentials.nullable()
1234
+ });
1235
+ var CodingServiceProgress = z21.strictObject({
1236
+ phase: z21.enum(["checking", "importing"]),
1237
+ done: nonNegInt,
1238
+ total: nonNegInt
1239
+ });
1240
+ var CodingHistoryImportMissingParams = z21.strictObject({});
1241
+ var CodingHistoryImportMissingResult = z21.strictObject({
1242
+ state: z21.enum(["done", "blocked", "cancelled"]),
1243
+ blocked: CodingHistoryBlocked.nullable(),
1244
+ run: CodingHistoryRun,
1245
+ elapsed_ms: nonNegInt
1246
+ });
1247
+ var CodingHistoryProgressEvent = z21.strictObject({
1248
+ request_id: RequestId,
1249
+ phase: z21.enum(["checking", "importing"]),
1250
+ /** Sessions settled so far, of `total` candidates (0 of 0 while checking). */
1251
+ done: nonNegInt,
1252
+ total: nonNegInt,
1253
+ imported: nonNegInt,
1254
+ failed: nonNegInt
1255
+ });
1256
+
1257
+ // src/schema/apps.ts
1258
+ import { z as z22 } from "zod";
1259
+ var AppKey = z22.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);
1260
+ var AppProfileId = z22.string().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/);
1261
+ var AppProfileLocator = z22.string().min(1).max(512).regex(/^[A-Za-z0-9 _()+@,-][A-Za-z0-9 ._()+@,-]{0,127}(\/[A-Za-z0-9 _()+@,-][A-Za-z0-9 ._()+@,-]{0,127}){0,7}$/);
1262
+ var AppSupport = z22.enum(["supported", "partial", "unsupported"]);
1263
+ var AppFeatureStatus = z22.strictObject({
1189
1264
  status: AppSupport,
1190
1265
  /** One line, set whenever status is not "supported". */
1191
- reason: z21.string().max(140).nullable()
1266
+ reason: z22.string().max(140).nullable()
1192
1267
  });
1193
- var AppInfo = z21.strictObject({
1268
+ var AppInfo = z22.strictObject({
1194
1269
  app_key: AppKey,
1195
- name: z21.string().max(64),
1196
- installed: z21.boolean(),
1270
+ name: z22.string().max(64),
1271
+ installed: z22.boolean(),
1197
1272
  /** The app's own version string, or null when it is not installed or does not say. */
1198
- version: z21.string().max(64).nullable(),
1273
+ version: z22.string().max(64).nullable(),
1199
1274
  /** The install found (an .app bundle, an .exe, a binary), or null. */
1200
1275
  location: AbsPath.nullable(),
1201
1276
  /** Open the app at all on this OS. */
@@ -1205,69 +1280,69 @@ var AppInfo = z21.strictObject({
1205
1280
  /** Plan usage read from the app's own files on this OS. */
1206
1281
  usage: AppFeatureStatus
1207
1282
  });
1208
- var AppUsageReading = z21.strictObject({
1209
- window: z21.enum(["five_hour", "weekly", "extra"]),
1283
+ var AppUsageReading = z22.strictObject({
1284
+ window: z22.enum(["five_hour", "weekly", "extra"]),
1210
1285
  /** 0–100 for five_hour and weekly; extra-usage spend as a percent of its cap (may pass 100). */
1211
- percent: z21.number().min(0).max(1e4),
1286
+ percent: z22.number().min(0).max(1e4),
1212
1287
  /** When the app recorded it. */
1213
1288
  sampled_at_ms: epochMs,
1214
1289
  /** True when the window has rolled over since the sample, so the figure has reset. */
1215
- reset_since: z21.boolean()
1290
+ reset_since: z22.boolean()
1216
1291
  });
1217
- var AppProfile = z21.strictObject({
1292
+ var AppProfile = z22.strictObject({
1218
1293
  /** The row's id; null for a folder found on disk that no row names yet. */
1219
1294
  id: AppProfileId.nullable(),
1220
1295
  app_key: AppKey,
1221
- display_name: z21.string().min(1).max(120),
1296
+ display_name: z22.string().min(1).max(120),
1222
1297
  /** The account the person means to be signed in here; null when not stated (never guessed). */
1223
- account_identity: z21.string().min(3).max(320).nullable(),
1298
+ account_identity: z22.string().min(3).max(320).nullable(),
1224
1299
  profile_locator: AppProfileLocator.nullable(),
1225
1300
  /** The device the row is tied to; null when the row names none. */
1226
1301
  device_id: DeviceId.nullable(),
1227
1302
  /** The folder this profile resolves to on this device; null for a row tied to another device. */
1228
1303
  folder: AbsPath.nullable(),
1229
1304
  /** The folder exists on this device. */
1230
- on_disk: z21.boolean(),
1305
+ on_disk: z22.boolean(),
1231
1306
  /** An instance with this profile is running; null when it could not be determined. */
1232
- running: z21.boolean().nullable(),
1307
+ running: z22.boolean().nullable(),
1233
1308
  /** Usage the app recorded for this profile; null when the app exposes none here. */
1234
- usage: z21.array(AppUsageReading).nullable(),
1309
+ usage: z22.array(AppUsageReading).nullable(),
1235
1310
  last_opened_ms: epochMs.nullable()
1236
1311
  });
1237
- var AppsListParams = z21.strictObject({});
1238
- var AppsListResult = z21.strictObject({ apps: z21.array(AppInfo) });
1239
- var AppsProfilesListParams = z21.strictObject({
1312
+ var AppsListParams = z22.strictObject({});
1313
+ var AppsListResult = z22.strictObject({ apps: z22.array(AppInfo) });
1314
+ var AppsProfilesListParams = z22.strictObject({
1240
1315
  /** Only this app's profiles; every app's when absent. */
1241
1316
  app_key: AppKey.optional()
1242
1317
  });
1243
- var AppsProfilesListResult = z21.strictObject({
1244
- profiles: z21.array(AppProfile),
1318
+ var AppsProfilesListResult = z22.strictObject({
1319
+ profiles: z22.array(AppProfile),
1245
1320
  /**
1246
1321
  * Whether the saved rows could be read: false while signed out or offline, when only folders
1247
1322
  * found on disk are listed.
1248
1323
  */
1249
- registry: z21.enum(["ok", "signed_out", "unavailable"])
1324
+ registry: z22.enum(["ok", "signed_out", "unavailable"])
1250
1325
  });
1251
- var AppsProfilesSaveParams = z21.strictObject({
1326
+ var AppsProfilesSaveParams = z22.strictObject({
1252
1327
  id: AppProfileId.optional(),
1253
1328
  app_key: AppKey,
1254
- display_name: z21.string().min(1).max(120),
1255
- account_identity: z21.string().min(3).max(320).nullable(),
1329
+ display_name: z22.string().min(1).max(120),
1330
+ account_identity: z22.string().min(3).max(320).nullable(),
1256
1331
  /** On create: the folder to use (one found on disk), or null for the app's default profile. Ignored on update. */
1257
1332
  profile_locator: AppProfileLocator.nullable(),
1258
1333
  /** On create with profile_locator null: make a new folder named after display_name instead. */
1259
- new_folder: z21.boolean().default(false)
1334
+ new_folder: z22.boolean().default(false)
1260
1335
  });
1261
1336
  var AppsProfilesSaveResult = AppProfile;
1262
- var AppsProfilesRemoveParams = z21.strictObject({ id: AppProfileId });
1263
- var AppsProfilesRemoveResult = z21.strictObject({ removed: z21.boolean() });
1264
- var AppsOpenParams = z21.strictObject({
1337
+ var AppsProfilesRemoveParams = z22.strictObject({ id: AppProfileId });
1338
+ var AppsProfilesRemoveResult = z22.strictObject({ removed: z22.boolean() });
1339
+ var AppsOpenParams = z22.strictObject({
1265
1340
  app_key: AppKey,
1266
1341
  profile_id: AppProfileId.optional()
1267
1342
  });
1268
- var AppsOpenResult = z21.strictObject({
1343
+ var AppsOpenResult = z22.strictObject({
1269
1344
  /** True when an instance with this profile was already running; it is brought forward. */
1270
- already_running: z21.boolean(),
1345
+ already_running: z22.boolean(),
1271
1346
  folder: AbsPath.nullable()
1272
1347
  });
1273
1348
 
@@ -1335,7 +1410,9 @@ var OPS = {
1335
1410
  "input.mouse_click": { params: InputMouseClickParams, result: InputMouseClickResult, kind: "unary", since: "1.4", errors: ["INVALID_PARAMS", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
1336
1411
  "power.status": { params: PowerStatusParams, result: PowerStatusResult, kind: "unary", since: "1.4", errors: ["INTERNAL"] },
1337
1412
  "power.prevent_sleep": { params: PowerPreventSleepParams, result: PowerPreventSleepResult, kind: "unary", since: "1.4", errors: ["PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
1338
- "resources.snapshot": { params: ResourcesSnapshotParams, result: ResourcesSnapshotResult, kind: "unary", since: "1.4", errors: ["INTERNAL"] }
1413
+ "resources.snapshot": { params: ResourcesSnapshotParams, result: ResourcesSnapshotResult, kind: "unary", since: "1.4", errors: ["INTERNAL"] },
1414
+ // Claude Code history (SPEC §6 coding): served by the `coding` Python service through SERVICES below.
1415
+ "coding.history.import_missing": { params: CodingHistoryImportMissingParams, result: CodingHistoryImportMissingResult, kind: "unary", since: "1.5", errors: ["RESOURCE_BUSY", "RESOURCE_GONE", "CANCELLED", "INTERNAL"] }
1339
1416
  };
1340
1417
  var EVENTS = {
1341
1418
  "fs.changed": FsChangedEvent,
@@ -1344,6 +1421,7 @@ var EVENTS = {
1344
1421
  "exec.cwd": ExecCwdEvent,
1345
1422
  "session.control_changed": SessionControlChangedEvent,
1346
1423
  "models.progress": ModelsProgressEvent,
1424
+ "coding.history.progress": CodingHistoryProgressEvent,
1347
1425
  "relay.device_status": RelayDeviceStatusEvent,
1348
1426
  "relay.auth_expiring": RelayAuthExpiringEvent
1349
1427
  };