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