@serviceme/devtools-protocol 0.1.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -82,6 +82,354 @@ function isAgentPermissionsResult(value) {
82
82
  return isRecord(value) && typeof value.agentId === "string" && isAgentPermissionSummary(value.summary);
83
83
  }
84
84
 
85
+ // src/auth.ts
86
+ var AUTH_PROVIDERS = ["github", "microsoft"];
87
+ function isRecord2(value) {
88
+ return typeof value === "object" && value !== null;
89
+ }
90
+ function isAuthProvider(value) {
91
+ return value === "github" || value === "microsoft";
92
+ }
93
+ function isStringOrUndefined(value) {
94
+ return value === void 0 || typeof value === "string";
95
+ }
96
+ function isNumberOrUndefined(value) {
97
+ return value === void 0 || value === null || typeof value === "number" && Number.isFinite(value);
98
+ }
99
+ function isAuthAccountMeta(value) {
100
+ if (!isRecord2(value)) return false;
101
+ if (typeof value.id !== "string") return false;
102
+ if (!isAuthProvider(value.provider)) return false;
103
+ if (value.id.length === 0) return false;
104
+ if (!isStringOrUndefined(value.displayName)) return false;
105
+ if (!isStringOrUndefined(value.login)) return false;
106
+ if (!isStringOrUndefined(value.email)) return false;
107
+ if (!isStringOrUndefined(value.avatarUrl)) return false;
108
+ if (!isNumberOrUndefined(value.expiresAt)) return false;
109
+ return true;
110
+ }
111
+ function isAuthLoginResult(value) {
112
+ if (!isRecord2(value)) return false;
113
+ if (!isAuthProvider(value.provider)) return false;
114
+ if (value.userCode !== void 0 && typeof value.userCode !== "string") {
115
+ return false;
116
+ }
117
+ if (value.verificationUrl !== void 0 && typeof value.verificationUrl !== "string") {
118
+ return false;
119
+ }
120
+ if (value.expiresAt !== void 0 && (typeof value.expiresAt !== "number" || !Number.isFinite(value.expiresAt))) {
121
+ return false;
122
+ }
123
+ if (!isStringOrUndefined(value.message)) return false;
124
+ return true;
125
+ }
126
+ function isAuthSessionHandle(value) {
127
+ if (!isRecord2(value)) return false;
128
+ if (!isAuthProvider(value.provider)) return false;
129
+ if (value.account !== void 0 && value.account !== null && !isAuthAccountMeta(value.account)) {
130
+ return false;
131
+ }
132
+ if (!isNumberOrUndefined(value.expiresAt)) return false;
133
+ return true;
134
+ }
135
+ function isAuthStatus(value) {
136
+ if (!isRecord2(value)) return false;
137
+ if (value.activeProvider !== null && !isAuthProvider(value.activeProvider)) {
138
+ return false;
139
+ }
140
+ if (!isRecord2(value.accounts)) return false;
141
+ for (const [provider, account] of Object.entries(value.accounts)) {
142
+ if (!isAuthProvider(provider)) return false;
143
+ if (account !== void 0 && account !== null && !isAuthAccountMeta(account)) {
144
+ return false;
145
+ }
146
+ }
147
+ if (typeof value.hasAnySession !== "boolean") return false;
148
+ if (!isStringOrUndefined(value.lastError)) return false;
149
+ return true;
150
+ }
151
+ function isAuthLoginParams(value) {
152
+ return isRecord2(value) && isAuthProvider(value.provider) && (value.force === void 0 || typeof value.force === "boolean");
153
+ }
154
+ function isAuthLogoutParams(value) {
155
+ return isRecord2(value) && (value.provider === void 0 || isAuthProvider(value.provider));
156
+ }
157
+ function isAuthLogoutResult(value) {
158
+ if (!isRecord2(value)) return false;
159
+ if (value.provider !== null && !isAuthProvider(value.provider)) return false;
160
+ if (typeof value.success !== "boolean") return false;
161
+ return true;
162
+ }
163
+ function isAuthWhoamiResult(value) {
164
+ if (!isRecord2(value)) return false;
165
+ if (value.provider !== null && !isAuthProvider(value.provider)) return false;
166
+ if (!isStringOrUndefined(value.login)) return false;
167
+ if (!isStringOrUndefined(value.name)) return false;
168
+ if (!isStringOrUndefined(value.avatarUrl)) return false;
169
+ if (!isStringOrUndefined(value.email)) return false;
170
+ return true;
171
+ }
172
+ function isAuthSwitchParams(value) {
173
+ return isRecord2(value) && isAuthProvider(value.provider);
174
+ }
175
+ function isAuthSwitchResult(value) {
176
+ if (!isRecord2(value)) return false;
177
+ if (value.activeProvider !== null && !isAuthProvider(value.activeProvider)) {
178
+ return false;
179
+ }
180
+ if (value.account !== null && !isAuthAccountMeta(value.account)) return false;
181
+ return true;
182
+ }
183
+
184
+ // src/bridge-skill-repo.ts
185
+ function isRecord3(value) {
186
+ return typeof value === "object" && value !== null;
187
+ }
188
+ function isStringOrUndefined2(value) {
189
+ return value === void 0 || typeof value === "string";
190
+ }
191
+ function isSkillKindOrUndefined(value) {
192
+ return value === void 0 || value === "skill" || value === "agent";
193
+ }
194
+ function isLinkScope(value) {
195
+ return value === "workspace" || value === "user";
196
+ }
197
+ function isLinkScopeOrUndefined(value) {
198
+ return value === void 0 || isLinkScope(value);
199
+ }
200
+ function isLinkScopeFilterOrUndefined(value) {
201
+ return value === void 0 || value === "workspace" || value === "user" || value === "all";
202
+ }
203
+ function isLinkModeOrUndefined(value) {
204
+ return value === void 0 || value === "auto" || value === "symlink" || value === "junction" || value === "copy";
205
+ }
206
+ function isLinkMode(value) {
207
+ return value === "symlink" || value === "junction" || value === "copy";
208
+ }
209
+ function isRepoEntry(value) {
210
+ if (!isRecord3(value)) return false;
211
+ if (typeof value.id !== "string") return false;
212
+ if (typeof value.name !== "string") return false;
213
+ if (typeof value.url !== "string") return false;
214
+ if (typeof value.branch !== "string") return false;
215
+ if (typeof value.enabled !== "boolean") return false;
216
+ if (typeof value.writeEnabled !== "boolean") return false;
217
+ if (value.source !== "default" && value.source !== "user") return false;
218
+ if (typeof value.addedAt !== "string") return false;
219
+ if (value.description !== void 0 && typeof value.description !== "string")
220
+ return false;
221
+ if (value.lastSyncAt !== void 0 && typeof value.lastSyncAt !== "string")
222
+ return false;
223
+ if (value.lastSyncCommitSha !== void 0 && typeof value.lastSyncCommitSha !== "string") {
224
+ return false;
225
+ }
226
+ if (value.lastSyncStatus !== void 0 && value.lastSyncStatus !== "ok" && value.lastSyncStatus !== "error") {
227
+ return false;
228
+ }
229
+ if (value.lastSyncError !== void 0 && typeof value.lastSyncError !== "string") {
230
+ return false;
231
+ }
232
+ return true;
233
+ }
234
+ function isSkillEntry(value) {
235
+ if (!isRecord3(value)) return false;
236
+ if (typeof value.repoId !== "string") return false;
237
+ if (typeof value.name !== "string") return false;
238
+ if (value.kind !== "skill" && value.kind !== "agent") return false;
239
+ if (typeof value.manifestPath !== "string") return false;
240
+ if (typeof value.dir !== "string") return false;
241
+ if (typeof value.frontmatter !== "object" || value.frontmatter === null) {
242
+ return false;
243
+ }
244
+ if (typeof value.modifiedAt !== "string") return false;
245
+ return true;
246
+ }
247
+ function isSkillFile(value) {
248
+ return isRecord3(value) && typeof value.path === "string" && typeof value.content === "string";
249
+ }
250
+ function isLinkedSkill(value) {
251
+ return isRecord3(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.linkPath === "string" && typeof value.targetPath === "string" && isLinkMode(value.mode) && isLinkScope(value.scope);
252
+ }
253
+ function isSyncPull(value) {
254
+ return isRecord3(value) && typeof value.repoId === "string" && (value.status === "ok" || value.status === "error");
255
+ }
256
+ function isSkillRepoListResult(value) {
257
+ return isRecord3(value) && Array.isArray(value.entries) && value.entries.every(isSkillEntry);
258
+ }
259
+ function isSkillRepoGetResult(value) {
260
+ return isRecord3(value) && typeof value.repoId === "string" && typeof value.name === "string" && (value.kind === "skill" || value.kind === "agent") && typeof value.manifestPath === "string" && typeof value.dir === "string" && typeof value.frontmatter === "object" && value.frontmatter !== null && typeof value.modifiedAt === "string" && Array.isArray(value.files) && value.files.every(isSkillFile);
261
+ }
262
+ function isSkillRepoInstallResult(value) {
263
+ return isRecord3(value) && isLinkMode(value.mode) && typeof value.linkPath === "string" && typeof value.targetPath === "string";
264
+ }
265
+ function isSkillRepoConvertToSymlinkResult(value) {
266
+ return isRecord3(value) && isLinkMode(value.mode) && typeof value.linkPath === "string" && typeof value.targetPath === "string";
267
+ }
268
+ function isSkillRepoUninstallResult(value) {
269
+ return isRecord3(value) && value.removed === true;
270
+ }
271
+ function isSkillRepoListLinkedResult(value) {
272
+ return isRecord3(value) && Array.isArray(value.links) && value.links.every(isLinkedSkill);
273
+ }
274
+ function isSkillRepoDraftCreateResult(value) {
275
+ return isRecord3(value) && typeof value.id === "string";
276
+ }
277
+ function isSkillRepoDraftCommitResult(value) {
278
+ return isRecord3(value) && typeof value.repoId === "string" && typeof value.skillName === "string" && typeof value.commitSha === "string" && isStringOrUndefined2(value.pushedRef) && isStringOrUndefined2(value.pushedSha);
279
+ }
280
+ function isSkillRepoDraftListResult(value) {
281
+ return isRecord3(value) && Array.isArray(value.drafts) && value.drafts.every(
282
+ (d) => isRecord3(d) && typeof d.id === "string" && (d.kind === "skill" || d.kind === "agent") && typeof d.name === "string" && typeof d.description === "string" && typeof d.modifiedAt === "string"
283
+ );
284
+ }
285
+ function isSkillRepoDraftDeleteResult(value) {
286
+ return isRecord3(value) && value.deleted === true;
287
+ }
288
+ function isRepoListResult(value) {
289
+ return isRecord3(value) && Array.isArray(value.repos) && value.repos.every(isRepoEntry);
290
+ }
291
+ function isRepoAddResult(value) {
292
+ return isRecord3(value) && isRepoEntry(value.repo) && typeof value.branch === "string" && typeof value.cloned === "boolean";
293
+ }
294
+ function isRepoRemoveResult(value) {
295
+ return isRecord3(value) && value.removed === true;
296
+ }
297
+ function isRepoEnableResult(value) {
298
+ return isRecord3(value) && isRepoEntry(value.repo);
299
+ }
300
+ function isRepoDisableResult(value) {
301
+ return isRecord3(value) && isRepoEntry(value.repo);
302
+ }
303
+ function isRepoSyncResult(value) {
304
+ return isRecord3(value) && Array.isArray(value.pulls) && value.pulls.length >= 1 && value.pulls.every(isSyncPull);
305
+ }
306
+ function isRepoSyncAllResult(value) {
307
+ return isRecord3(value) && Array.isArray(value.pulls) && value.pulls.every(isSyncPull);
308
+ }
309
+ function isSkillRepoListParams(value) {
310
+ return isRecord3(value) && isStringOrUndefined2(value.repoId) && isSkillKindOrUndefined(value.kind);
311
+ }
312
+ function isSkillRepoGetParams(value) {
313
+ return isRecord3(value) && typeof value.repoId === "string" && typeof value.name === "string";
314
+ }
315
+ function isSkillRepoInstallParams(value) {
316
+ return isRecord3(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkModeOrUndefined(value.mode) && isLinkScopeOrUndefined(value.scope);
317
+ }
318
+ function isSkillRepoConvertToSymlinkParams(value) {
319
+ return isRecord3(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkModeOrUndefined(value.mode) && isLinkScopeOrUndefined(value.scope);
320
+ }
321
+ function isSkillRepoUninstallParams(value) {
322
+ return isRecord3(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkScopeOrUndefined(value.scope);
323
+ }
324
+ function isSkillRepoListLinkedParams(value) {
325
+ return isRecord3(value) && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkScopeFilterOrUndefined(value.scope);
326
+ }
327
+ function isRepoListParams(value) {
328
+ return isRecord3(value) && (value.source === void 0 || value.source === "default" || value.source === "user");
329
+ }
330
+ function isRepoAddParams(value) {
331
+ return isRecord3(value) && typeof value.url === "string" && isStringOrUndefined2(value.branch) && isStringOrUndefined2(value.name);
332
+ }
333
+ function isRepoRemoveParams(value) {
334
+ return isRecord3(value) && typeof value.repoId === "string";
335
+ }
336
+ function isRepoEnableParams(value) {
337
+ return isRecord3(value) && typeof value.repoId === "string";
338
+ }
339
+ function isRepoDisableParams(value) {
340
+ return isRecord3(value) && typeof value.repoId === "string";
341
+ }
342
+ function isRepoSyncParams(value) {
343
+ return isRecord3(value) && typeof value.repoId === "string";
344
+ }
345
+ function isRepoSyncAllParams(value) {
346
+ return isRecord3(value);
347
+ }
348
+
349
+ // src/device.ts
350
+ var DEVICE_BINDING_STATES = [
351
+ "anonymous",
352
+ "pending",
353
+ "claimed",
354
+ "expired"
355
+ ];
356
+ function isRecord4(value) {
357
+ return typeof value === "object" && value !== null;
358
+ }
359
+ function isStringOrUndefined3(value) {
360
+ return value === void 0 || typeof value === "string";
361
+ }
362
+ function isDeviceBindingState(value) {
363
+ return value === "anonymous" || value === "pending" || value === "claimed" || value === "expired";
364
+ }
365
+ function isDeviceIdentityState(value) {
366
+ if (!isRecord4(value)) return false;
367
+ if (typeof value.publicId !== "string") return false;
368
+ if (value.publicId.length === 0) return false;
369
+ if (typeof value.secretVersion !== "number") return false;
370
+ if (!Number.isInteger(value.secretVersion)) return false;
371
+ if (value.secretVersion < 0) return false;
372
+ if (!isDeviceBindingState(value.bindingState)) return false;
373
+ return true;
374
+ }
375
+ function isDeviceMetadata(value) {
376
+ if (!isRecord4(value)) return false;
377
+ if (typeof value.installationId !== "string") return false;
378
+ if (value.installationId.length === 0) return false;
379
+ if (typeof value.machineId !== "string") return false;
380
+ if (value.machineId.length === 0) return false;
381
+ if (typeof value.platform !== "string") return false;
382
+ if (value.platform.length === 0) return false;
383
+ if (!isStringOrUndefined3(value.hostname)) return false;
384
+ if (!isStringOrUndefined3(value.vscodeVersion)) return false;
385
+ if (!isStringOrUndefined3(value.extensionVersion)) return false;
386
+ return true;
387
+ }
388
+ function isDeviceStatus(value) {
389
+ if (!isRecord4(value)) return false;
390
+ if (!isDeviceBindingState(value.bindingState)) return false;
391
+ if (value.identity !== void 0 && !isDeviceIdentityState(value.identity)) {
392
+ return false;
393
+ }
394
+ if (value.metadata !== void 0 && !isDeviceMetadata(value.metadata)) {
395
+ return false;
396
+ }
397
+ if (!isStringOrUndefined3(value.lastSyncAt)) return false;
398
+ if (!isStringOrUndefined3(value.lastSyncError)) return false;
399
+ return true;
400
+ }
401
+ function isDeviceEnrollParams(value) {
402
+ return isRecord4(value) && (value.force === void 0 || typeof value.force === "boolean") && (value.requireAuth === void 0 || typeof value.requireAuth === "boolean");
403
+ }
404
+ function isDeviceEnrollResult(value) {
405
+ if (!isRecord4(value)) return false;
406
+ if (typeof value.publicId !== "string") return false;
407
+ if (value.publicId.length === 0) return false;
408
+ if (!isDeviceBindingState(value.bindingState)) return false;
409
+ if (!isStringOrUndefined3(value.expiresAt)) return false;
410
+ return true;
411
+ }
412
+ function isDeviceRotateSecretParams(value) {
413
+ if (!isRecord4(value)) return false;
414
+ if (value.gracePeriodDays !== void 0 && (typeof value.gracePeriodDays !== "number" || !Number.isInteger(value.gracePeriodDays) || value.gracePeriodDays < 0 || value.gracePeriodDays > 365)) {
415
+ return false;
416
+ }
417
+ return true;
418
+ }
419
+ function isDeviceRotateSecretResult(value) {
420
+ if (!isRecord4(value)) return false;
421
+ if (typeof value.publicId !== "string") return false;
422
+ if (value.publicId.length === 0) return false;
423
+ if (typeof value.secretVersion !== "number") return false;
424
+ if (!Number.isInteger(value.secretVersion)) return false;
425
+ if (value.secretVersion < 0) return false;
426
+ if (typeof value.gracePeriodDays !== "number") return false;
427
+ if (!Number.isInteger(value.gracePeriodDays)) return false;
428
+ if (value.gracePeriodDays < 0) return false;
429
+ if (!isStringOrUndefined3(value.gracePeriodEndsAt)) return false;
430
+ return true;
431
+ }
432
+
85
433
  // src/scheduled-tasks.ts
86
434
  var VALID_TASK_TYPES = [
87
435
  "command",
@@ -90,144 +438,228 @@ var VALID_TASK_TYPES = [
90
438
  "github_copilot_cli"
91
439
  ];
92
440
  var VALID_SCHEDULE_TYPES = ["cron", "interval"];
93
- var VALID_TERMINAL_STATUSES = ["success", "failure", "timeout", "cancelled"];
94
- function isRecord2(value) {
441
+ var VALID_TERMINAL_STATUSES = [
442
+ "success",
443
+ "failure",
444
+ "timeout",
445
+ "cancelled"
446
+ ];
447
+ function isRecord5(value) {
95
448
  return typeof value === "object" && value !== null;
96
449
  }
97
450
  function isScheduledTaskType(value) {
98
451
  return typeof value === "string" && VALID_TASK_TYPES.includes(value);
99
452
  }
453
+ function isScheduledTaskV1(value) {
454
+ if (!isRecord5(value)) return false;
455
+ return typeof value.id === "string" && typeof value.name === "string" && typeof value.enabled === "boolean" && VALID_SCHEDULE_TYPES.includes(value.scheduleType) && typeof value.schedule === "string" && isScheduledTaskType(value.taskType) && isRecord5(value.payload) && typeof value.createdAt === "string" && typeof value.updatedAt === "string";
456
+ }
457
+ function isTaskWorkspaceRef(value) {
458
+ if (!isRecord5(value)) return false;
459
+ if (typeof value.path !== "string" || value.path.length === 0) return false;
460
+ if (typeof value.name !== "string" || value.name.length === 0) return false;
461
+ if (value.gitRemote !== void 0 && typeof value.gitRemote !== "string") {
462
+ return false;
463
+ }
464
+ if (value.gitBranch !== void 0 && typeof value.gitBranch !== "string") {
465
+ return false;
466
+ }
467
+ if (value.lastSeenAt !== void 0 && typeof value.lastSeenAt !== "string") {
468
+ return false;
469
+ }
470
+ return true;
471
+ }
100
472
  function isScheduledTask(value) {
101
- if (!isRecord2(value)) return false;
102
- return typeof value.id === "string" && typeof value.name === "string" && typeof value.enabled === "boolean" && VALID_SCHEDULE_TYPES.includes(value.scheduleType) && typeof value.schedule === "string" && isScheduledTaskType(value.taskType) && isRecord2(value.payload) && typeof value.createdAt === "string" && typeof value.updatedAt === "string";
473
+ if (!isScheduledTaskV1(value)) return false;
474
+ return isTaskWorkspaceRef(value.workspace);
475
+ }
476
+ function isScheduledTasksConfig(value) {
477
+ if (!isRecord5(value)) return false;
478
+ if (value.version !== 2) return false;
479
+ if (!Array.isArray(value.tasks)) return false;
480
+ return value.tasks.every((t) => isScheduledTask(t));
481
+ }
482
+ function isScheduledTasksConfigV1(value) {
483
+ if (!isRecord5(value)) return false;
484
+ if (value.version !== 1) return false;
485
+ if (!Array.isArray(value.tasks)) return false;
486
+ return value.tasks.every((t) => isScheduledTaskV1(t));
103
487
  }
104
488
  function isTaskExecutionLog(value) {
105
- if (!isRecord2(value)) return false;
106
- return typeof value.id === "string" && typeof value.taskId === "string" && typeof value.taskName === "string" && typeof value.startedAt === "string" && typeof value.finishedAt === "string" && VALID_TERMINAL_STATUSES.includes(
107
- value.status
108
- );
489
+ if (!isRecord5(value)) return false;
490
+ return typeof value.id === "string" && typeof value.taskId === "string" && typeof value.taskName === "string" && typeof value.startedAt === "string" && typeof value.finishedAt === "string" && VALID_TERMINAL_STATUSES.includes(value.status);
109
491
  }
110
492
  function isSchedulerStatus(value) {
111
- if (!isRecord2(value)) return false;
493
+ if (!isRecord5(value)) return false;
112
494
  return typeof value.running === "boolean" && typeof value.tasksRegistered === "number" && typeof value.workspacePath === "string";
113
495
  }
114
496
  function isTaskExecuteResult(value) {
115
- return isRecord2(value) && typeof value.executionId === "string" && value.accepted === true;
497
+ return isRecord5(value) && typeof value.executionId === "string" && value.accepted === true;
116
498
  }
117
499
  function isTaskCancelResult(value) {
118
- return isRecord2(value) && typeof value.executionId === "string" && typeof value.cancelled === "boolean";
500
+ return isRecord5(value) && typeof value.executionId === "string" && typeof value.cancelled === "boolean";
119
501
  }
120
502
  function isTaskListRunningResult(value) {
121
- return isRecord2(value) && Array.isArray(value.executions);
503
+ return isRecord5(value) && Array.isArray(value.executions);
122
504
  }
123
505
  function isTaskStartedEventParams(value) {
124
- return isRecord2(value) && typeof value.executionId === "string" && typeof value.taskId === "string" && typeof value.startedAt === "string";
506
+ return isRecord5(value) && typeof value.executionId === "string" && typeof value.taskId === "string" && typeof value.startedAt === "string";
125
507
  }
126
508
  function isTaskOutputEventParams(value) {
127
- return isRecord2(value) && typeof value.executionId === "string" && (value.stream === "stdout" || value.stream === "stderr") && typeof value.data === "string";
509
+ return isRecord5(value) && typeof value.executionId === "string" && (value.stream === "stdout" || value.stream === "stderr") && typeof value.data === "string";
128
510
  }
129
511
  function isTaskCompletedEventParams(value) {
130
- return isRecord2(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
512
+ return isRecord5(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
131
513
  }
132
514
  function isTaskFailedEventParams(value) {
133
- return isRecord2(value) && typeof value.executionId === "string" && (value.status === "failure" || value.status === "timeout") && (value.reason === "error" || value.reason === "timeout") && isTaskExecutionLog(value.log);
515
+ return isRecord5(value) && typeof value.executionId === "string" && (value.status === "failure" || value.status === "timeout") && (value.reason === "error" || value.reason === "timeout") && isTaskExecutionLog(value.log);
134
516
  }
135
517
  function isTaskCancelledEventParams(value) {
136
- return isRecord2(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
518
+ return isRecord5(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
137
519
  }
138
520
  function isAgentSessionStatus(value) {
139
521
  return value === "idle" || value === "running" || value === "needs-input" || value === "completed" || value === "failed" || value === "aborted";
140
522
  }
523
+ function migrateTaskV1ToV2(v1, workspace) {
524
+ const issues = [];
525
+ if (!isScheduledTaskType(v1.taskType)) {
526
+ issues.push(`unknown taskType: ${String(v1.taskType)}`);
527
+ }
528
+ const task = {
529
+ ...v1,
530
+ workspace
531
+ };
532
+ return { task, issues };
533
+ }
534
+ function migrateV1ToV2(v1Config, workspace) {
535
+ if (!isTaskWorkspaceRef(workspace)) {
536
+ const w = workspace;
537
+ throw new Error(
538
+ `migrateV1ToV2: invalid workspace ref (path=${String(w.path)}, name=${String(w.name)})`
539
+ );
540
+ }
541
+ const allIssues = [];
542
+ const tasks = v1Config.tasks.map((t) => {
543
+ const { task, issues } = migrateTaskV1ToV2(t, workspace);
544
+ allIssues.push(...issues);
545
+ return task;
546
+ });
547
+ return { config: { version: 2, tasks }, issues: allIssues };
548
+ }
141
549
 
142
- // src/skill.ts
143
- var VALID_SKILL_SCOPES = ["workspace", "user"];
144
- var VALID_SKILL_SCOPE_STATUSES = [
145
- "absent",
146
- "available",
147
- "installed",
148
- "blocked",
149
- "conflict"
150
- ];
151
- var VALID_SKILL_MUTATION_ACTIONS = [
152
- "install",
153
- "uninstall",
154
- "move",
155
- "removeExternal",
156
- "publish",
157
- "republish",
158
- "submit-to-official"
159
- ];
160
- function isRecord3(value) {
550
+ // src/toolbox.ts
551
+ var TOOLBOX_SCOPES = ["user", "workspace"];
552
+ function isRecord6(value) {
161
553
  return typeof value === "object" && value !== null;
162
554
  }
163
- function isSkillScope(value) {
164
- return typeof value === "string" && VALID_SKILL_SCOPES.includes(value);
165
- }
166
- function isSkillScopeStatus(value) {
167
- return typeof value === "string" && VALID_SKILL_SCOPE_STATUSES.includes(value);
168
- }
169
- function isSkillMutationAction(value) {
170
- return typeof value === "string" && VALID_SKILL_MUTATION_ACTIONS.includes(value);
171
- }
172
- function isStringArray2(value) {
173
- return Array.isArray(value) && value.every((item) => typeof item === "string");
174
- }
175
- function isSafeResourceId2(value) {
176
- if (typeof value !== "string" || value.length === 0 || value.includes("\\")) {
555
+ function isStringOrUndefined4(value) {
556
+ return value === void 0 || typeof value === "string";
557
+ }
558
+ function isFiniteNumberOrUndefined(value) {
559
+ return value === void 0 || typeof value === "number" && Number.isFinite(value);
560
+ }
561
+ function isToolboxScope(value) {
562
+ return value === "user" || value === "workspace";
563
+ }
564
+ function isExternalTool(value) {
565
+ if (!isRecord6(value)) return false;
566
+ if (typeof value.id !== "string") return false;
567
+ if (value.id.length === 0) return false;
568
+ if (typeof value.name !== "string") return false;
569
+ if (value.name.length === 0) return false;
570
+ if (typeof value.description !== "string") return false;
571
+ if (typeof value.icon !== "string") return false;
572
+ if (typeof value.url !== "string") return false;
573
+ if (value.url.length === 0) return false;
574
+ if (value.isDefault !== void 0 && typeof value.isDefault !== "boolean") {
177
575
  return false;
178
576
  }
179
- const segments = value.split("/");
180
- if (segments.some((segment) => segment.length === 0)) {
181
- return false;
577
+ if (!isFiniteNumberOrUndefined(value.order)) return false;
578
+ if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
579
+ if (!isStringOrUndefined4(value.lastUsedAt)) return false;
580
+ return true;
581
+ }
582
+ function isExternalToolPatch(value) {
583
+ if (!isRecord6(value)) return false;
584
+ if (value.name !== void 0) {
585
+ if (typeof value.name !== "string" || value.name.length === 0) return false;
182
586
  }
183
- return segments.every(
184
- (segment) => segment !== "." && segment !== ".." && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(segment)
185
- );
186
- }
187
- function isSkillScopeState(value) {
188
- if (!isRecord3(value)) {
587
+ if (value.description !== void 0 && typeof value.description !== "string") {
189
588
  return false;
190
589
  }
191
- return isSkillScope(value.scope) && isSkillScopeStatus(value.status) && (value.kind === void 0 || value.kind === "builtin" || value.kind === "external") && (value.path === void 0 || typeof value.path === "string") && typeof value.isInstalled === "boolean" && typeof value.canInstall === "boolean" && typeof value.canUninstall === "boolean" && typeof value.canRemove === "boolean" && typeof value.canMoveHere === "boolean" && (value.summary === void 0 || typeof value.summary === "string");
192
- }
193
- function isSkillMarketplaceEntry(value) {
194
- if (!isRecord3(value)) {
195
- return false;
590
+ if (value.icon !== void 0 && typeof value.icon !== "string") return false;
591
+ if (value.url !== void 0) {
592
+ if (typeof value.url !== "string" || value.url.length === 0) return false;
196
593
  }
197
- return typeof value.id === "string" && typeof value.displayName === "string" && typeof value.description === "string" && typeof value.version === "string" && typeof value.updatedAt === "string" && (value.categoryId === void 0 || typeof value.categoryId === "string") && (value.enabled === void 0 || typeof value.enabled === "boolean") && typeof value.isCatalogSkill === "boolean" && typeof value.recommended === "boolean" && typeof value.installCount === "number" && (value.requiresSetup === void 0 || typeof value.requiresSetup === "boolean") && (value.setupHint === void 0 || typeof value.setupHint === "string") && (value.homepage === void 0 || typeof value.homepage === "string") && (value.ownerScope === void 0 || isSkillScope(value.ownerScope)) && (value.ownerKind === void 0 || value.ownerKind === "builtin" || value.ownerKind === "external") && typeof value.hasConflict === "boolean" && (value.hasScripts === void 0 || typeof value.hasScripts === "boolean") && (value.hasHooks === void 0 || typeof value.hasHooks === "boolean") && (value.source === void 0 || value.source === "official" || value.source === "community" || value.source === "local") && (value.localSkillPath === void 0 || typeof value.localSkillPath === "string") && (value.canPublish === void 0 || typeof value.canPublish === "boolean") && isSkillScopeState(value.workspaceState) && isSkillScopeState(value.userState);
198
- }
199
- function isSkillMarketplaceState(value) {
200
- if (!isRecord3(value)) {
594
+ if (value.isDefault !== void 0 && typeof value.isDefault !== "boolean") {
201
595
  return false;
202
596
  }
203
- return typeof value.configPath === "string" && typeof value.userSkillsPath === "string" && Array.isArray(value.skills) && value.skills.every((entry) => isSkillMarketplaceEntry(entry)) && (value.enabledSkillIds === void 0 || isStringArray2(value.enabledSkillIds)) && (value.recommendedSkillIds === void 0 || isStringArray2(value.recommendedSkillIds)) && typeof value.onboardingRequired === "boolean" && typeof value.hasPersistedSelection === "boolean" && (value.workspaceOpen === void 0 || typeof value.workspaceOpen === "boolean");
204
- }
205
- function isSkillMutationRequest(value) {
206
- return isRecord3(value) && isSafeResourceId2(value.skillId) && isSkillScope(value.targetScope) && isSkillMutationAction(value.action) && (value.confirmed === void 0 || typeof value.confirmed === "boolean");
207
- }
208
- function isSkillMutationResult(value) {
209
- return isRecord3(value) && isSkillMarketplaceState(value.state) && typeof value.skillId === "string" && isSkillScope(value.targetScope) && isSkillMutationAction(value.action) && typeof value.changed === "boolean" && (value.status === "success" || value.status === "blocked" || value.status === "requires_confirmation") && (value.message === void 0 || typeof value.message === "string") && (value.hasScripts === void 0 || typeof value.hasScripts === "boolean") && (value.hasHooks === void 0 || typeof value.hasHooks === "boolean") && (value.prUrl === void 0 || typeof value.prUrl === "string") && (value.fromVersion === void 0 || typeof value.fromVersion === "string") && (value.toVersion === void 0 || typeof value.toVersion === "string");
210
- }
211
- function isSkillReconcileResult(value) {
212
- return isRecord3(value) && isSkillMarketplaceState(value.state) && typeof value.changed === "boolean";
213
- }
214
- function isPublishableSkillEntry(value) {
215
- return isRecord3(value) && typeof value.id === "string" && typeof value.displayName === "string" && typeof value.path === "string" && (value.version === void 0 || typeof value.version === "string");
216
- }
217
- function isSkillPublishableResult(value) {
218
- return isRecord3(value) && Array.isArray(value.skills) && value.skills.every((entry) => isPublishableSkillEntry(entry));
597
+ if (!isFiniteNumberOrUndefined(value.order)) return false;
598
+ if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
599
+ if (!isStringOrUndefined4(value.lastUsedAt)) return false;
600
+ return true;
601
+ }
602
+ function isToolboxList(value) {
603
+ if (!isRecord6(value)) return false;
604
+ if (!isToolboxScope(value.scope)) return false;
605
+ if (!Array.isArray(value.tools)) return false;
606
+ for (const tool of value.tools) {
607
+ if (!isExternalTool(tool)) return false;
608
+ }
609
+ return true;
610
+ }
611
+ function isToolboxListParams(value) {
612
+ return isRecord6(value) && (value.scope === void 0 || isToolboxScope(value.scope));
613
+ }
614
+ function isToolboxAddParams(value) {
615
+ return isExternalTool(value);
616
+ }
617
+ function isToolboxAddResult(value) {
618
+ if (!isRecord6(value)) return false;
619
+ if (!isToolboxScope(value.scope)) return false;
620
+ if (!isExternalTool(value.tool)) return false;
621
+ return true;
622
+ }
623
+ function isToolboxRemoveParams(value) {
624
+ if (!isRecord6(value)) return false;
625
+ if (typeof value.id !== "string") return false;
626
+ if (value.id.length === 0) return false;
627
+ if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
628
+ return true;
629
+ }
630
+ function isToolboxRemoveResult(value) {
631
+ if (!isRecord6(value)) return false;
632
+ if (!isToolboxScope(value.scope)) return false;
633
+ if (typeof value.toolId !== "string") return false;
634
+ if (value.toolId.length === 0) return false;
635
+ if (typeof value.success !== "boolean") return false;
636
+ return true;
637
+ }
638
+ function isToolboxUpdateParams(value) {
639
+ if (!isRecord6(value)) return false;
640
+ if (typeof value.id !== "string") return false;
641
+ if (value.id.length === 0) return false;
642
+ if (!isExternalToolPatch(value.patch)) return false;
643
+ if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
644
+ return true;
645
+ }
646
+ function isToolboxUpdateResult(value) {
647
+ if (!isRecord6(value)) return false;
648
+ if (!isToolboxScope(value.scope)) return false;
649
+ if (!isExternalTool(value.tool)) return false;
650
+ return true;
219
651
  }
220
652
 
221
653
  // src/bridge.ts
222
654
  var SERVICEME_PROTOCOL_VERSION = 2;
223
- function isRecord4(value) {
655
+ function isRecord7(value) {
224
656
  return typeof value === "object" && value !== null;
225
657
  }
226
658
  function isValidProtocolVersion(value) {
227
659
  return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= SERVICEME_PROTOCOL_VERSION;
228
660
  }
229
661
  function isBridgeCapabilities(value) {
230
- return isRecord4(value) && value.bridge === true && value.json === 1 && value.env === 1 && (value.tasks === void 0 || value.tasks === 1) && (value.skills === void 0 || value.skills === 1) && (value.agents === void 0 || value.agents === 1);
662
+ return isRecord7(value) && value.bridge === true && value.json === 1 && value.env === 1 && (value.tasks === void 0 || value.tasks === 1) && (value.skillRepo === void 0 || value.skillRepo === 1) && (value.repoMgmt === void 0 || value.repoMgmt === 1) && (value.auth === void 0 || value.auth === 1) && (value.device === void 0 || value.device === 1) && (value.toolbox === void 0 || value.toolbox === 1) && (value["auth.tokenRead"] === void 0 || value["auth.tokenRead"] === 1);
231
663
  }
232
664
  var BRIDGE_METHODS = [
233
665
  "system.hello",
@@ -236,13 +668,35 @@ var BRIDGE_METHODS = [
236
668
  "task.execute",
237
669
  "task.cancel",
238
670
  "task.list-running",
239
- "skill.marketplace-state",
240
- "skill.mutate",
241
- "skill.reconcile",
242
- "skill.publishable",
243
- "agent.marketplace-state",
244
- "agent.mutate",
245
- "agent.permissions"
671
+ "skillRepo.list",
672
+ "skillRepo.get",
673
+ "skillRepo.install",
674
+ "skillRepo.convertToSymlink",
675
+ "skillRepo.uninstall",
676
+ "skillRepo.listLinked",
677
+ "skillRepo.draft.create",
678
+ "skillRepo.draft.commit",
679
+ "skillRepo.draft.list",
680
+ "skillRepo.draft.delete",
681
+ "repo.list",
682
+ "repo.add",
683
+ "repo.remove",
684
+ "repo.enable",
685
+ "repo.disable",
686
+ "repo.sync",
687
+ "repo.syncAll",
688
+ "auth.status",
689
+ "auth.login",
690
+ "auth.logout",
691
+ "auth.whoami",
692
+ "auth.switch",
693
+ "device.status",
694
+ "device.enroll",
695
+ "device.rotate-secret",
696
+ "toolbox.list",
697
+ "toolbox.add",
698
+ "toolbox.remove",
699
+ "toolbox.update"
246
700
  ];
247
701
  var BRIDGE_EVENTS = [
248
702
  "task.started",
@@ -252,13 +706,13 @@ var BRIDGE_EVENTS = [
252
706
  "task.cancelled"
253
707
  ];
254
708
  function isSystemHelloResult(value) {
255
- return isRecord4(value) && typeof value.cliVersion === "string" && isValidProtocolVersion(value.protocolVersion) && isBridgeCapabilities(value.capabilities) && typeof value.pid === "number";
709
+ return isRecord7(value) && typeof value.cliVersion === "string" && isValidProtocolVersion(value.protocolVersion) && isBridgeCapabilities(value.capabilities) && typeof value.pid === "number";
256
710
  }
257
711
  function isSystemPingResult(value) {
258
- return isRecord4(value) && typeof value.now === "string";
712
+ return isRecord7(value) && typeof value.now === "string";
259
713
  }
260
714
  function isSystemShutdownResult(value) {
261
- return isRecord4(value) && value.shuttingDown === true;
715
+ return isRecord7(value) && value.shuttingDown === true;
262
716
  }
263
717
  function getBridgeResultValidator(method) {
264
718
  switch (method) {
@@ -274,20 +728,64 @@ function getBridgeResultValidator(method) {
274
728
  return isTaskCancelResult;
275
729
  case "task.list-running":
276
730
  return isTaskListRunningResult;
277
- case "skill.marketplace-state":
278
- return isSkillMarketplaceState;
279
- case "skill.mutate":
280
- return isSkillMutationResult;
281
- case "skill.reconcile":
282
- return isSkillReconcileResult;
283
- case "skill.publishable":
284
- return isSkillPublishableResult;
285
- case "agent.marketplace-state":
286
- return isAgentMarketplaceState;
287
- case "agent.mutate":
288
- return isAgentMutationResult;
289
- case "agent.permissions":
290
- return isAgentPermissionSummary;
731
+ case "skillRepo.list":
732
+ return isSkillRepoListResult;
733
+ case "skillRepo.get":
734
+ return isSkillRepoGetResult;
735
+ case "skillRepo.install":
736
+ return isSkillRepoInstallResult;
737
+ case "skillRepo.convertToSymlink":
738
+ return isSkillRepoConvertToSymlinkResult;
739
+ case "skillRepo.uninstall":
740
+ return isSkillRepoUninstallResult;
741
+ case "skillRepo.listLinked":
742
+ return isSkillRepoListLinkedResult;
743
+ case "skillRepo.draft.create":
744
+ return isSkillRepoDraftCreateResult;
745
+ case "skillRepo.draft.commit":
746
+ return isSkillRepoDraftCommitResult;
747
+ case "skillRepo.draft.list":
748
+ return isSkillRepoDraftListResult;
749
+ case "skillRepo.draft.delete":
750
+ return isSkillRepoDraftDeleteResult;
751
+ case "repo.list":
752
+ return isRepoListResult;
753
+ case "repo.add":
754
+ return isRepoAddResult;
755
+ case "repo.remove":
756
+ return isRepoRemoveResult;
757
+ case "repo.enable":
758
+ return isRepoEnableResult;
759
+ case "repo.disable":
760
+ return isRepoDisableResult;
761
+ case "repo.sync":
762
+ return isRepoSyncResult;
763
+ case "repo.syncAll":
764
+ return isRepoSyncAllResult;
765
+ case "auth.status":
766
+ return isAuthStatus;
767
+ case "auth.login":
768
+ return isAuthLoginResult;
769
+ case "auth.logout":
770
+ return isAuthLogoutResult;
771
+ case "auth.whoami":
772
+ return isAuthWhoamiResult;
773
+ case "auth.switch":
774
+ return isAuthSwitchResult;
775
+ case "device.status":
776
+ return isDeviceStatus;
777
+ case "device.enroll":
778
+ return isDeviceEnrollResult;
779
+ case "device.rotate-secret":
780
+ return isDeviceRotateSecretResult;
781
+ case "toolbox.list":
782
+ return isToolboxList;
783
+ case "toolbox.add":
784
+ return isToolboxAddResult;
785
+ case "toolbox.remove":
786
+ return isToolboxRemoveResult;
787
+ case "toolbox.update":
788
+ return isToolboxUpdateResult;
291
789
  default:
292
790
  return void 0;
293
791
  }
@@ -315,13 +813,13 @@ function isBridgeEventName(value) {
315
813
  return typeof value === "string" && BRIDGE_EVENTS.includes(value);
316
814
  }
317
815
  function isBridgeRequest(value) {
318
- if (!isRecord4(value)) {
816
+ if (!isRecord7(value)) {
319
817
  return false;
320
818
  }
321
819
  return isValidProtocolVersion(value.protocolVersion) && value.kind === "request" && typeof value.id === "string" && isBridgeMethod(value.method) && "params" in value;
322
820
  }
323
821
  function isBridgeResponse(value) {
324
- if (!isRecord4(value)) {
822
+ if (!isRecord7(value)) {
325
823
  return false;
326
824
  }
327
825
  if (!isValidProtocolVersion(value.protocolVersion) || value.kind !== "response" || typeof value.id !== "string" || typeof value.ok !== "boolean") {
@@ -333,7 +831,7 @@ function isBridgeResponse(value) {
333
831
  return "error" in value;
334
832
  }
335
833
  function isBridgeEvent(value) {
336
- if (!isRecord4(value)) {
834
+ if (!isRecord7(value)) {
337
835
  return false;
338
836
  }
339
837
  return isValidProtocolVersion(value.protocolVersion) && value.kind === "event" && isBridgeEventName(value.event) && "params" in value;
@@ -341,7 +839,7 @@ function isBridgeEvent(value) {
341
839
 
342
840
  // src/cli.ts
343
841
  var SERVICEME_CLI_SCHEMA_VERSION = 1;
344
- function isRecord5(value) {
842
+ function isRecord8(value) {
345
843
  return typeof value === "object" && value !== null;
346
844
  }
347
845
  function createCliSuccess(data) {
@@ -359,7 +857,7 @@ function createCliFailure(error) {
359
857
  };
360
858
  }
361
859
  function isCliEnvelope(value) {
362
- if (!isRecord5(value)) {
860
+ if (!isRecord8(value)) {
363
861
  return false;
364
862
  }
365
863
  if (value.schemaVersion !== SERVICEME_CLI_SCHEMA_VERSION || typeof value.ok !== "boolean") {
@@ -391,20 +889,20 @@ var KNOWN_ENVIRONMENT_TOOLS = [
391
889
  "dotnet",
392
890
  "nuget"
393
891
  ];
394
- function isRecord6(value) {
892
+ function isRecord9(value) {
395
893
  return typeof value === "object" && value !== null;
396
894
  }
397
895
  function isKnownEnvironmentTool(value) {
398
896
  return KNOWN_ENVIRONMENT_TOOLS.includes(value);
399
897
  }
400
898
  function isToolCheckResult(value) {
401
- if (!isRecord6(value)) {
899
+ if (!isRecord9(value)) {
402
900
  return false;
403
901
  }
404
902
  return typeof value.installed === "boolean" && (value.version === void 0 || typeof value.version === "string") && (value.path === void 0 || typeof value.path === "string") && (value.error === void 0 || typeof value.error === "string");
405
903
  }
406
904
  function isEnvironmentCheckResult(value) {
407
- if (!isRecord6(value)) {
905
+ if (!isRecord9(value)) {
408
906
  return false;
409
907
  }
410
908
  return KNOWN_ENVIRONMENT_TOOLS.every(
@@ -442,7 +940,11 @@ var SERVICEME_ERROR_CODES = [
442
940
  "executor_error",
443
941
  "task_already_running",
444
942
  "not_found",
445
- "internal_error"
943
+ "internal_error",
944
+ "auth_not_logged_in",
945
+ "auth_provider_not_registered",
946
+ "device_not_enrolled",
947
+ "toolbox_invalid_scope"
446
948
  ];
447
949
  var RETRYABLE_ERROR_CODES = /* @__PURE__ */ new Set([
448
950
  "command_timeout",
@@ -454,14 +956,14 @@ var RETRYABLE_ERROR_CODES = /* @__PURE__ */ new Set([
454
956
  "executor_timeout",
455
957
  "internal_error"
456
958
  ]);
457
- function isRecord7(value) {
959
+ function isRecord10(value) {
458
960
  return typeof value === "object" && value !== null;
459
961
  }
460
962
  function isServicemeErrorCode(value) {
461
963
  return typeof value === "string" && SERVICEME_ERROR_CODES.includes(value);
462
964
  }
463
965
  function isServicemeErrorDetails(value) {
464
- if (!isRecord7(value)) {
966
+ if (!isRecord10(value)) {
465
967
  return false;
466
968
  }
467
969
  return isServicemeErrorCode(value.code) && typeof value.message === "string" && typeof value.retryable === "boolean";
@@ -501,7 +1003,7 @@ function normalizeServicemeError(error, fallbackCode = "internal_error") {
501
1003
  if (isServicemeErrorDetails(error)) {
502
1004
  return error;
503
1005
  }
504
- if (isRecord7(error)) {
1006
+ if (isRecord10(error)) {
505
1007
  const code = isServicemeErrorCode(error.code) ? error.code : fallbackCode;
506
1008
  const message = typeof error.message === "string" ? error.message : "Unexpected serviceme error.";
507
1009
  const retryable = typeof error.retryable === "boolean" ? error.retryable : isRetryableErrorCode(code);
@@ -532,32 +1034,32 @@ var SERVICEME_IMAGE_FORMATS = [
532
1034
  "png",
533
1035
  "webp"
534
1036
  ];
535
- function isRecord8(value) {
1037
+ function isRecord11(value) {
536
1038
  return typeof value === "object" && value !== null;
537
1039
  }
538
1040
  function isServiceMeImageFormat(value) {
539
1041
  return typeof value === "string" && SERVICEME_IMAGE_FORMATS.includes(value);
540
1042
  }
541
1043
  function isServiceMeImageCompressOptions(value) {
542
- if (!isRecord8(value)) {
1044
+ if (!isRecord11(value)) {
543
1045
  return false;
544
1046
  }
545
1047
  return typeof value.quality === "number" && typeof value.replaceOriginImage === "boolean" && (value.outputPath === void 0 || typeof value.outputPath === "string") && (value.format === void 0 || isServiceMeImageFormat(value.format)) && (value.sharpModulePath === void 0 || typeof value.sharpModulePath === "string") && (value.minimumCompressionRatio === void 0 || typeof value.minimumCompressionRatio === "number");
546
1048
  }
547
1049
  function isServiceMeImageCompressResult(value) {
548
- if (!isRecord8(value)) {
1050
+ if (!isRecord11(value)) {
549
1051
  return false;
550
1052
  }
551
1053
  return typeof value.originalSize === "number" && typeof value.compressedSize === "number" && typeof value.compressionRatio === "number" && typeof value.outputPath === "string";
552
1054
  }
553
1055
  function isServiceMeImageInfo(value) {
554
- if (!isRecord8(value)) {
1056
+ if (!isRecord11(value)) {
555
1057
  return false;
556
1058
  }
557
1059
  return typeof value.width === "number" && typeof value.height === "number" && typeof value.format === "string" && typeof value.size === "number" && (value.colorSpace === void 0 || typeof value.colorSpace === "string");
558
1060
  }
559
1061
  function isServiceMeImageValidationResult(value) {
560
- return isRecord8(value) && typeof value.valid === "boolean";
1062
+ return isRecord11(value) && typeof value.valid === "boolean";
561
1063
  }
562
1064
 
563
1065
  // src/json.ts
@@ -576,7 +1078,7 @@ var DEFAULT_JSON_SORT_OPTIONS = {
576
1078
  sortOrder: "asc",
577
1079
  sortAlgo: "default"
578
1080
  };
579
- function isRecord9(value) {
1081
+ function isRecord12(value) {
580
1082
  return typeof value === "object" && value !== null;
581
1083
  }
582
1084
  function isJsonSortAlgorithm(value) {
@@ -586,62 +1088,141 @@ function isJsonSortOrder(value) {
586
1088
  return typeof value === "string" && JSON_SORT_ORDERS.includes(value);
587
1089
  }
588
1090
  function isJsonSortOptions(value) {
589
- return isRecord9(value) && isJsonSortOrder(value.sortOrder) && isJsonSortAlgorithm(value.sortAlgo);
1091
+ return isRecord12(value) && isJsonSortOrder(value.sortOrder) && isJsonSortAlgorithm(value.sortAlgo);
590
1092
  }
591
1093
  function isJsonValidationResult(value) {
592
- return isRecord9(value) && typeof value.valid === "boolean" && (value.error === void 0 || typeof value.error === "string");
1094
+ return isRecord12(value) && typeof value.valid === "boolean" && (value.error === void 0 || typeof value.error === "string");
593
1095
  }
594
1096
  function isJsonOutputResult(value) {
595
- return isRecord9(value) && typeof value.output === "string";
1097
+ return isRecord12(value) && typeof value.output === "string";
596
1098
  }
597
1099
 
598
1100
  // src/metadata.ts
599
1101
  var SERVICEME_CLI_NAME = "serviceme";
600
- var SERVICEME_CLI_VERSION = "0.1.8";
1102
+ var SERVICEME_CLI_VERSION = "0.2.0";
601
1103
  var SERVICEME_CLI_CAPABILITIES = {
602
1104
  bridge: true,
603
1105
  tasks: 1,
604
1106
  json: 1,
605
1107
  env: 1,
606
1108
  image: 1,
607
- project: 1,
608
- skills: 1,
609
- agents: 1
1109
+ project: 1
610
1110
  };
611
1111
 
612
1112
  // src/project.ts
613
- function isRecord10(value) {
1113
+ function isRecord13(value) {
614
1114
  return typeof value === "object" && value !== null;
615
1115
  }
616
1116
  function isServiceMeProjectScaffoldPruneResult(value) {
617
- if (!isRecord10(value)) {
1117
+ if (!isRecord13(value)) {
618
1118
  return false;
619
1119
  }
620
1120
  return typeof value.applied === "boolean" && typeof value.preset === "string" && Array.isArray(value.commands) && value.commands.every((command) => typeof command === "string");
621
1121
  }
622
1122
  function isServiceMeProjectGitInitResult(value) {
623
- return isRecord10(value) && typeof value.initialized === "boolean" && typeof value.command === "string";
1123
+ return isRecord13(value) && typeof value.initialized === "boolean" && typeof value.command === "string";
624
1124
  }
625
1125
  function isServiceMeProjectMakeScriptsExecutableResult(value) {
626
- if (!isRecord10(value)) {
1126
+ if (!isRecord13(value)) {
627
1127
  return false;
628
1128
  }
629
1129
  return typeof value.processedCount === "number" && typeof value.updatedCount === "number" && typeof value.platform === "string" && Array.isArray(value.scripts) && value.scripts.every((script) => typeof script === "string");
630
1130
  }
631
1131
  function isServiceMeProjectInstallDepsResult(value) {
632
- return isRecord10(value) && typeof value.installed === "boolean" && typeof value.command === "string";
1132
+ return isRecord13(value) && typeof value.installed === "boolean" && typeof value.command === "string";
633
1133
  }
634
1134
  function isServiceMeProjectExtractTemplateInput(value) {
635
- return isRecord10(value) && typeof value.extractedDirName === "string" && typeof value.projectFilePattern === "string";
1135
+ return isRecord13(value) && typeof value.extractedDirName === "string" && typeof value.projectFilePattern === "string";
636
1136
  }
637
1137
  function isServiceMeProjectExtractTemplateResult(value) {
638
- return isRecord10(value) && typeof value.actualDirName === "string";
1138
+ return isRecord13(value) && typeof value.actualDirName === "string";
1139
+ }
1140
+
1141
+ // src/skill.ts
1142
+ var VALID_SKILL_SCOPES = ["workspace", "user"];
1143
+ var VALID_SKILL_SCOPE_STATUSES = [
1144
+ "absent",
1145
+ "available",
1146
+ "installed",
1147
+ "blocked",
1148
+ "conflict"
1149
+ ];
1150
+ var VALID_SKILL_MUTATION_ACTIONS = [
1151
+ "install",
1152
+ "uninstall",
1153
+ "move",
1154
+ "removeExternal",
1155
+ "publish",
1156
+ "republish",
1157
+ "submit-to-official"
1158
+ ];
1159
+ function isRecord14(value) {
1160
+ return typeof value === "object" && value !== null;
1161
+ }
1162
+ function isSkillScope(value) {
1163
+ return typeof value === "string" && VALID_SKILL_SCOPES.includes(value);
1164
+ }
1165
+ function isSkillScopeStatus(value) {
1166
+ return typeof value === "string" && VALID_SKILL_SCOPE_STATUSES.includes(value);
1167
+ }
1168
+ function isSkillMutationAction(value) {
1169
+ return typeof value === "string" && VALID_SKILL_MUTATION_ACTIONS.includes(value);
1170
+ }
1171
+ function isStringArray2(value) {
1172
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
1173
+ }
1174
+ function isSafeResourceId2(value) {
1175
+ if (typeof value !== "string" || value.length === 0 || value.includes("\\")) {
1176
+ return false;
1177
+ }
1178
+ const segments = value.split("/");
1179
+ if (segments.some((segment) => segment.length === 0)) {
1180
+ return false;
1181
+ }
1182
+ return segments.every(
1183
+ (segment) => segment !== "." && segment !== ".." && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(segment)
1184
+ );
1185
+ }
1186
+ function isSkillScopeState(value) {
1187
+ if (!isRecord14(value)) {
1188
+ return false;
1189
+ }
1190
+ return isSkillScope(value.scope) && isSkillScopeStatus(value.status) && (value.kind === void 0 || value.kind === "builtin" || value.kind === "external") && (value.path === void 0 || typeof value.path === "string") && typeof value.isInstalled === "boolean" && typeof value.canInstall === "boolean" && typeof value.canUninstall === "boolean" && typeof value.canRemove === "boolean" && typeof value.canMoveHere === "boolean" && (value.summary === void 0 || typeof value.summary === "string");
1191
+ }
1192
+ function isSkillMarketplaceEntry(value) {
1193
+ if (!isRecord14(value)) {
1194
+ return false;
1195
+ }
1196
+ return typeof value.id === "string" && typeof value.displayName === "string" && typeof value.description === "string" && typeof value.version === "string" && typeof value.updatedAt === "string" && (value.categoryId === void 0 || typeof value.categoryId === "string") && (value.enabled === void 0 || typeof value.enabled === "boolean") && typeof value.isCatalogSkill === "boolean" && typeof value.recommended === "boolean" && typeof value.installCount === "number" && (value.requiresSetup === void 0 || typeof value.requiresSetup === "boolean") && (value.setupHint === void 0 || typeof value.setupHint === "string") && (value.homepage === void 0 || typeof value.homepage === "string") && (value.ownerScope === void 0 || isSkillScope(value.ownerScope)) && (value.ownerKind === void 0 || value.ownerKind === "builtin" || value.ownerKind === "external") && typeof value.hasConflict === "boolean" && (value.hasScripts === void 0 || typeof value.hasScripts === "boolean") && (value.hasHooks === void 0 || typeof value.hasHooks === "boolean") && (value.source === void 0 || value.source === "official" || value.source === "community" || value.source === "local") && (value.localSkillPath === void 0 || typeof value.localSkillPath === "string") && (value.canPublish === void 0 || typeof value.canPublish === "boolean") && isSkillScopeState(value.workspaceState) && isSkillScopeState(value.userState);
1197
+ }
1198
+ function isSkillMarketplaceState(value) {
1199
+ if (!isRecord14(value)) {
1200
+ return false;
1201
+ }
1202
+ return typeof value.configPath === "string" && typeof value.userSkillsPath === "string" && Array.isArray(value.skills) && value.skills.every((entry) => isSkillMarketplaceEntry(entry)) && (value.enabledSkillIds === void 0 || isStringArray2(value.enabledSkillIds)) && (value.recommendedSkillIds === void 0 || isStringArray2(value.recommendedSkillIds)) && typeof value.onboardingRequired === "boolean" && typeof value.hasPersistedSelection === "boolean" && (value.workspaceOpen === void 0 || typeof value.workspaceOpen === "boolean");
1203
+ }
1204
+ function isSkillMutationRequest(value) {
1205
+ return isRecord14(value) && isSafeResourceId2(value.skillId) && isSkillScope(value.targetScope) && isSkillMutationAction(value.action) && (value.confirmed === void 0 || typeof value.confirmed === "boolean");
1206
+ }
1207
+ function isSkillMutationResult(value) {
1208
+ return isRecord14(value) && isSkillMarketplaceState(value.state) && typeof value.skillId === "string" && isSkillScope(value.targetScope) && isSkillMutationAction(value.action) && typeof value.changed === "boolean" && (value.status === "success" || value.status === "blocked" || value.status === "requires_confirmation") && (value.message === void 0 || typeof value.message === "string") && (value.hasScripts === void 0 || typeof value.hasScripts === "boolean") && (value.hasHooks === void 0 || typeof value.hasHooks === "boolean") && (value.prUrl === void 0 || typeof value.prUrl === "string") && (value.fromVersion === void 0 || typeof value.fromVersion === "string") && (value.toVersion === void 0 || typeof value.toVersion === "string");
1209
+ }
1210
+ function isSkillReconcileResult(value) {
1211
+ return isRecord14(value) && isSkillMarketplaceState(value.state) && typeof value.changed === "boolean";
1212
+ }
1213
+ function isPublishableSkillEntry(value) {
1214
+ return isRecord14(value) && typeof value.id === "string" && typeof value.displayName === "string" && typeof value.path === "string" && (value.version === void 0 || typeof value.version === "string");
1215
+ }
1216
+ function isSkillPublishableResult(value) {
1217
+ return isRecord14(value) && Array.isArray(value.skills) && value.skills.every((entry) => isPublishableSkillEntry(entry));
639
1218
  }
640
1219
  export {
1220
+ AUTH_PROVIDERS,
641
1221
  BRIDGE_EVENTS,
642
1222
  BRIDGE_METHODS,
643
1223
  COPILOT_ERROR_CODES,
644
1224
  DEFAULT_JSON_SORT_OPTIONS,
1225
+ DEVICE_BINDING_STATES,
645
1226
  JSON_SORT_ALGORITHMS,
646
1227
  JSON_SORT_ORDERS,
647
1228
  KNOWN_ENVIRONMENT_TOOLS,
@@ -653,6 +1234,7 @@ export {
653
1234
  SERVICEME_IMAGE_FORMATS,
654
1235
  SERVICEME_PROTOCOL_VERSION,
655
1236
  ServicemeProtocolError,
1237
+ TOOLBOX_SCOPES,
656
1238
  createCliFailure,
657
1239
  createCliSuccess,
658
1240
  createServicemeError,
@@ -664,6 +1246,17 @@ export {
664
1246
  isAgentPermissionSummary,
665
1247
  isAgentPermissionsResult,
666
1248
  isAgentSessionStatus,
1249
+ isAuthAccountMeta,
1250
+ isAuthLoginParams,
1251
+ isAuthLoginResult,
1252
+ isAuthLogoutParams,
1253
+ isAuthLogoutResult,
1254
+ isAuthProvider,
1255
+ isAuthSessionHandle,
1256
+ isAuthStatus,
1257
+ isAuthSwitchParams,
1258
+ isAuthSwitchResult,
1259
+ isAuthWhoamiResult,
667
1260
  isBridgeCapabilities,
668
1261
  isBridgeEvent,
669
1262
  isBridgeEventName,
@@ -671,16 +1264,43 @@ export {
671
1264
  isBridgeRequest,
672
1265
  isBridgeResponse,
673
1266
  isCliEnvelope,
1267
+ isDeviceBindingState,
1268
+ isDeviceEnrollParams,
1269
+ isDeviceEnrollResult,
1270
+ isDeviceIdentityState,
1271
+ isDeviceMetadata,
1272
+ isDeviceRotateSecretParams,
1273
+ isDeviceRotateSecretResult,
1274
+ isDeviceStatus,
674
1275
  isEnvironmentCheckResult,
1276
+ isExternalTool,
1277
+ isExternalToolPatch,
675
1278
  isJsonOutputResult,
676
1279
  isJsonSortAlgorithm,
677
1280
  isJsonSortOptions,
678
1281
  isJsonSortOrder,
679
1282
  isJsonValidationResult,
680
1283
  isKnownEnvironmentTool,
1284
+ isRepoAddParams,
1285
+ isRepoAddResult,
1286
+ isRepoDisableParams,
1287
+ isRepoDisableResult,
1288
+ isRepoEnableParams,
1289
+ isRepoEnableResult,
1290
+ isRepoListParams,
1291
+ isRepoListResult,
1292
+ isRepoRemoveParams,
1293
+ isRepoRemoveResult,
1294
+ isRepoSyncAllParams,
1295
+ isRepoSyncAllResult,
1296
+ isRepoSyncParams,
1297
+ isRepoSyncResult,
681
1298
  isRetryableErrorCode,
682
1299
  isScheduledTask,
683
1300
  isScheduledTaskType,
1301
+ isScheduledTaskV1,
1302
+ isScheduledTasksConfig,
1303
+ isScheduledTasksConfigV1,
684
1304
  isSchedulerStatus,
685
1305
  isServiceMeImageCompressOptions,
686
1306
  isServiceMeImageCompressResult,
@@ -700,6 +1320,22 @@ export {
700
1320
  isSkillMutationResult,
701
1321
  isSkillPublishableResult,
702
1322
  isSkillReconcileResult,
1323
+ isSkillRepoConvertToSymlinkParams,
1324
+ isSkillRepoConvertToSymlinkResult,
1325
+ isSkillRepoDraftCommitResult,
1326
+ isSkillRepoDraftCreateResult,
1327
+ isSkillRepoDraftDeleteResult,
1328
+ isSkillRepoDraftListResult,
1329
+ isSkillRepoGetParams,
1330
+ isSkillRepoGetResult,
1331
+ isSkillRepoInstallParams,
1332
+ isSkillRepoInstallResult,
1333
+ isSkillRepoListLinkedParams,
1334
+ isSkillRepoListLinkedResult,
1335
+ isSkillRepoListParams,
1336
+ isSkillRepoListResult,
1337
+ isSkillRepoUninstallParams,
1338
+ isSkillRepoUninstallResult,
703
1339
  isSystemHelloResult,
704
1340
  isSystemPingResult,
705
1341
  isSystemShutdownResult,
@@ -712,6 +1348,18 @@ export {
712
1348
  isTaskListRunningResult,
713
1349
  isTaskOutputEventParams,
714
1350
  isTaskStartedEventParams,
1351
+ isTaskWorkspaceRef,
715
1352
  isToolCheckResult,
1353
+ isToolboxAddParams,
1354
+ isToolboxAddResult,
1355
+ isToolboxList,
1356
+ isToolboxListParams,
1357
+ isToolboxRemoveParams,
1358
+ isToolboxRemoveResult,
1359
+ isToolboxScope,
1360
+ isToolboxUpdateParams,
1361
+ isToolboxUpdateResult,
1362
+ migrateTaskV1ToV2,
1363
+ migrateV1ToV2,
716
1364
  normalizeServicemeError
717
1365
  };