@serviceme/devtools-protocol 0.1.9 → 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.d.mts +1026 -130
- package/dist/index.d.ts +1026 -130
- package/dist/index.js +859 -142
- package/dist/index.mjs +790 -142
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20,10 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
AUTH_PROVIDERS: () => AUTH_PROVIDERS,
|
|
23
24
|
BRIDGE_EVENTS: () => BRIDGE_EVENTS,
|
|
24
25
|
BRIDGE_METHODS: () => BRIDGE_METHODS,
|
|
25
26
|
COPILOT_ERROR_CODES: () => COPILOT_ERROR_CODES,
|
|
26
27
|
DEFAULT_JSON_SORT_OPTIONS: () => DEFAULT_JSON_SORT_OPTIONS,
|
|
28
|
+
DEVICE_BINDING_STATES: () => DEVICE_BINDING_STATES,
|
|
27
29
|
JSON_SORT_ALGORITHMS: () => JSON_SORT_ALGORITHMS,
|
|
28
30
|
JSON_SORT_ORDERS: () => JSON_SORT_ORDERS,
|
|
29
31
|
KNOWN_ENVIRONMENT_TOOLS: () => KNOWN_ENVIRONMENT_TOOLS,
|
|
@@ -35,6 +37,7 @@ __export(index_exports, {
|
|
|
35
37
|
SERVICEME_IMAGE_FORMATS: () => SERVICEME_IMAGE_FORMATS,
|
|
36
38
|
SERVICEME_PROTOCOL_VERSION: () => SERVICEME_PROTOCOL_VERSION,
|
|
37
39
|
ServicemeProtocolError: () => ServicemeProtocolError,
|
|
40
|
+
TOOLBOX_SCOPES: () => TOOLBOX_SCOPES,
|
|
38
41
|
createCliFailure: () => createCliFailure,
|
|
39
42
|
createCliSuccess: () => createCliSuccess,
|
|
40
43
|
createServicemeError: () => createServicemeError,
|
|
@@ -46,6 +49,17 @@ __export(index_exports, {
|
|
|
46
49
|
isAgentPermissionSummary: () => isAgentPermissionSummary,
|
|
47
50
|
isAgentPermissionsResult: () => isAgentPermissionsResult,
|
|
48
51
|
isAgentSessionStatus: () => isAgentSessionStatus,
|
|
52
|
+
isAuthAccountMeta: () => isAuthAccountMeta,
|
|
53
|
+
isAuthLoginParams: () => isAuthLoginParams,
|
|
54
|
+
isAuthLoginResult: () => isAuthLoginResult,
|
|
55
|
+
isAuthLogoutParams: () => isAuthLogoutParams,
|
|
56
|
+
isAuthLogoutResult: () => isAuthLogoutResult,
|
|
57
|
+
isAuthProvider: () => isAuthProvider,
|
|
58
|
+
isAuthSessionHandle: () => isAuthSessionHandle,
|
|
59
|
+
isAuthStatus: () => isAuthStatus,
|
|
60
|
+
isAuthSwitchParams: () => isAuthSwitchParams,
|
|
61
|
+
isAuthSwitchResult: () => isAuthSwitchResult,
|
|
62
|
+
isAuthWhoamiResult: () => isAuthWhoamiResult,
|
|
49
63
|
isBridgeCapabilities: () => isBridgeCapabilities,
|
|
50
64
|
isBridgeEvent: () => isBridgeEvent,
|
|
51
65
|
isBridgeEventName: () => isBridgeEventName,
|
|
@@ -53,16 +67,43 @@ __export(index_exports, {
|
|
|
53
67
|
isBridgeRequest: () => isBridgeRequest,
|
|
54
68
|
isBridgeResponse: () => isBridgeResponse,
|
|
55
69
|
isCliEnvelope: () => isCliEnvelope,
|
|
70
|
+
isDeviceBindingState: () => isDeviceBindingState,
|
|
71
|
+
isDeviceEnrollParams: () => isDeviceEnrollParams,
|
|
72
|
+
isDeviceEnrollResult: () => isDeviceEnrollResult,
|
|
73
|
+
isDeviceIdentityState: () => isDeviceIdentityState,
|
|
74
|
+
isDeviceMetadata: () => isDeviceMetadata,
|
|
75
|
+
isDeviceRotateSecretParams: () => isDeviceRotateSecretParams,
|
|
76
|
+
isDeviceRotateSecretResult: () => isDeviceRotateSecretResult,
|
|
77
|
+
isDeviceStatus: () => isDeviceStatus,
|
|
56
78
|
isEnvironmentCheckResult: () => isEnvironmentCheckResult,
|
|
79
|
+
isExternalTool: () => isExternalTool,
|
|
80
|
+
isExternalToolPatch: () => isExternalToolPatch,
|
|
57
81
|
isJsonOutputResult: () => isJsonOutputResult,
|
|
58
82
|
isJsonSortAlgorithm: () => isJsonSortAlgorithm,
|
|
59
83
|
isJsonSortOptions: () => isJsonSortOptions,
|
|
60
84
|
isJsonSortOrder: () => isJsonSortOrder,
|
|
61
85
|
isJsonValidationResult: () => isJsonValidationResult,
|
|
62
86
|
isKnownEnvironmentTool: () => isKnownEnvironmentTool,
|
|
87
|
+
isRepoAddParams: () => isRepoAddParams,
|
|
88
|
+
isRepoAddResult: () => isRepoAddResult,
|
|
89
|
+
isRepoDisableParams: () => isRepoDisableParams,
|
|
90
|
+
isRepoDisableResult: () => isRepoDisableResult,
|
|
91
|
+
isRepoEnableParams: () => isRepoEnableParams,
|
|
92
|
+
isRepoEnableResult: () => isRepoEnableResult,
|
|
93
|
+
isRepoListParams: () => isRepoListParams,
|
|
94
|
+
isRepoListResult: () => isRepoListResult,
|
|
95
|
+
isRepoRemoveParams: () => isRepoRemoveParams,
|
|
96
|
+
isRepoRemoveResult: () => isRepoRemoveResult,
|
|
97
|
+
isRepoSyncAllParams: () => isRepoSyncAllParams,
|
|
98
|
+
isRepoSyncAllResult: () => isRepoSyncAllResult,
|
|
99
|
+
isRepoSyncParams: () => isRepoSyncParams,
|
|
100
|
+
isRepoSyncResult: () => isRepoSyncResult,
|
|
63
101
|
isRetryableErrorCode: () => isRetryableErrorCode,
|
|
64
102
|
isScheduledTask: () => isScheduledTask,
|
|
65
103
|
isScheduledTaskType: () => isScheduledTaskType,
|
|
104
|
+
isScheduledTaskV1: () => isScheduledTaskV1,
|
|
105
|
+
isScheduledTasksConfig: () => isScheduledTasksConfig,
|
|
106
|
+
isScheduledTasksConfigV1: () => isScheduledTasksConfigV1,
|
|
66
107
|
isSchedulerStatus: () => isSchedulerStatus,
|
|
67
108
|
isServiceMeImageCompressOptions: () => isServiceMeImageCompressOptions,
|
|
68
109
|
isServiceMeImageCompressResult: () => isServiceMeImageCompressResult,
|
|
@@ -82,6 +123,22 @@ __export(index_exports, {
|
|
|
82
123
|
isSkillMutationResult: () => isSkillMutationResult,
|
|
83
124
|
isSkillPublishableResult: () => isSkillPublishableResult,
|
|
84
125
|
isSkillReconcileResult: () => isSkillReconcileResult,
|
|
126
|
+
isSkillRepoConvertToSymlinkParams: () => isSkillRepoConvertToSymlinkParams,
|
|
127
|
+
isSkillRepoConvertToSymlinkResult: () => isSkillRepoConvertToSymlinkResult,
|
|
128
|
+
isSkillRepoDraftCommitResult: () => isSkillRepoDraftCommitResult,
|
|
129
|
+
isSkillRepoDraftCreateResult: () => isSkillRepoDraftCreateResult,
|
|
130
|
+
isSkillRepoDraftDeleteResult: () => isSkillRepoDraftDeleteResult,
|
|
131
|
+
isSkillRepoDraftListResult: () => isSkillRepoDraftListResult,
|
|
132
|
+
isSkillRepoGetParams: () => isSkillRepoGetParams,
|
|
133
|
+
isSkillRepoGetResult: () => isSkillRepoGetResult,
|
|
134
|
+
isSkillRepoInstallParams: () => isSkillRepoInstallParams,
|
|
135
|
+
isSkillRepoInstallResult: () => isSkillRepoInstallResult,
|
|
136
|
+
isSkillRepoListLinkedParams: () => isSkillRepoListLinkedParams,
|
|
137
|
+
isSkillRepoListLinkedResult: () => isSkillRepoListLinkedResult,
|
|
138
|
+
isSkillRepoListParams: () => isSkillRepoListParams,
|
|
139
|
+
isSkillRepoListResult: () => isSkillRepoListResult,
|
|
140
|
+
isSkillRepoUninstallParams: () => isSkillRepoUninstallParams,
|
|
141
|
+
isSkillRepoUninstallResult: () => isSkillRepoUninstallResult,
|
|
85
142
|
isSystemHelloResult: () => isSystemHelloResult,
|
|
86
143
|
isSystemPingResult: () => isSystemPingResult,
|
|
87
144
|
isSystemShutdownResult: () => isSystemShutdownResult,
|
|
@@ -94,7 +151,19 @@ __export(index_exports, {
|
|
|
94
151
|
isTaskListRunningResult: () => isTaskListRunningResult,
|
|
95
152
|
isTaskOutputEventParams: () => isTaskOutputEventParams,
|
|
96
153
|
isTaskStartedEventParams: () => isTaskStartedEventParams,
|
|
154
|
+
isTaskWorkspaceRef: () => isTaskWorkspaceRef,
|
|
97
155
|
isToolCheckResult: () => isToolCheckResult,
|
|
156
|
+
isToolboxAddParams: () => isToolboxAddParams,
|
|
157
|
+
isToolboxAddResult: () => isToolboxAddResult,
|
|
158
|
+
isToolboxList: () => isToolboxList,
|
|
159
|
+
isToolboxListParams: () => isToolboxListParams,
|
|
160
|
+
isToolboxRemoveParams: () => isToolboxRemoveParams,
|
|
161
|
+
isToolboxRemoveResult: () => isToolboxRemoveResult,
|
|
162
|
+
isToolboxScope: () => isToolboxScope,
|
|
163
|
+
isToolboxUpdateParams: () => isToolboxUpdateParams,
|
|
164
|
+
isToolboxUpdateResult: () => isToolboxUpdateResult,
|
|
165
|
+
migrateTaskV1ToV2: () => migrateTaskV1ToV2,
|
|
166
|
+
migrateV1ToV2: () => migrateV1ToV2,
|
|
98
167
|
normalizeServicemeError: () => normalizeServicemeError
|
|
99
168
|
});
|
|
100
169
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -183,6 +252,354 @@ function isAgentPermissionsResult(value) {
|
|
|
183
252
|
return isRecord(value) && typeof value.agentId === "string" && isAgentPermissionSummary(value.summary);
|
|
184
253
|
}
|
|
185
254
|
|
|
255
|
+
// src/auth.ts
|
|
256
|
+
var AUTH_PROVIDERS = ["github", "microsoft"];
|
|
257
|
+
function isRecord2(value) {
|
|
258
|
+
return typeof value === "object" && value !== null;
|
|
259
|
+
}
|
|
260
|
+
function isAuthProvider(value) {
|
|
261
|
+
return value === "github" || value === "microsoft";
|
|
262
|
+
}
|
|
263
|
+
function isStringOrUndefined(value) {
|
|
264
|
+
return value === void 0 || typeof value === "string";
|
|
265
|
+
}
|
|
266
|
+
function isNumberOrUndefined(value) {
|
|
267
|
+
return value === void 0 || value === null || typeof value === "number" && Number.isFinite(value);
|
|
268
|
+
}
|
|
269
|
+
function isAuthAccountMeta(value) {
|
|
270
|
+
if (!isRecord2(value)) return false;
|
|
271
|
+
if (typeof value.id !== "string") return false;
|
|
272
|
+
if (!isAuthProvider(value.provider)) return false;
|
|
273
|
+
if (value.id.length === 0) return false;
|
|
274
|
+
if (!isStringOrUndefined(value.displayName)) return false;
|
|
275
|
+
if (!isStringOrUndefined(value.login)) return false;
|
|
276
|
+
if (!isStringOrUndefined(value.email)) return false;
|
|
277
|
+
if (!isStringOrUndefined(value.avatarUrl)) return false;
|
|
278
|
+
if (!isNumberOrUndefined(value.expiresAt)) return false;
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
function isAuthLoginResult(value) {
|
|
282
|
+
if (!isRecord2(value)) return false;
|
|
283
|
+
if (!isAuthProvider(value.provider)) return false;
|
|
284
|
+
if (value.userCode !== void 0 && typeof value.userCode !== "string") {
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
if (value.verificationUrl !== void 0 && typeof value.verificationUrl !== "string") {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
if (value.expiresAt !== void 0 && (typeof value.expiresAt !== "number" || !Number.isFinite(value.expiresAt))) {
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
if (!isStringOrUndefined(value.message)) return false;
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
function isAuthSessionHandle(value) {
|
|
297
|
+
if (!isRecord2(value)) return false;
|
|
298
|
+
if (!isAuthProvider(value.provider)) return false;
|
|
299
|
+
if (value.account !== void 0 && value.account !== null && !isAuthAccountMeta(value.account)) {
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
if (!isNumberOrUndefined(value.expiresAt)) return false;
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
function isAuthStatus(value) {
|
|
306
|
+
if (!isRecord2(value)) return false;
|
|
307
|
+
if (value.activeProvider !== null && !isAuthProvider(value.activeProvider)) {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
if (!isRecord2(value.accounts)) return false;
|
|
311
|
+
for (const [provider, account] of Object.entries(value.accounts)) {
|
|
312
|
+
if (!isAuthProvider(provider)) return false;
|
|
313
|
+
if (account !== void 0 && account !== null && !isAuthAccountMeta(account)) {
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
if (typeof value.hasAnySession !== "boolean") return false;
|
|
318
|
+
if (!isStringOrUndefined(value.lastError)) return false;
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
function isAuthLoginParams(value) {
|
|
322
|
+
return isRecord2(value) && isAuthProvider(value.provider) && (value.force === void 0 || typeof value.force === "boolean");
|
|
323
|
+
}
|
|
324
|
+
function isAuthLogoutParams(value) {
|
|
325
|
+
return isRecord2(value) && (value.provider === void 0 || isAuthProvider(value.provider));
|
|
326
|
+
}
|
|
327
|
+
function isAuthLogoutResult(value) {
|
|
328
|
+
if (!isRecord2(value)) return false;
|
|
329
|
+
if (value.provider !== null && !isAuthProvider(value.provider)) return false;
|
|
330
|
+
if (typeof value.success !== "boolean") return false;
|
|
331
|
+
return true;
|
|
332
|
+
}
|
|
333
|
+
function isAuthWhoamiResult(value) {
|
|
334
|
+
if (!isRecord2(value)) return false;
|
|
335
|
+
if (value.provider !== null && !isAuthProvider(value.provider)) return false;
|
|
336
|
+
if (!isStringOrUndefined(value.login)) return false;
|
|
337
|
+
if (!isStringOrUndefined(value.name)) return false;
|
|
338
|
+
if (!isStringOrUndefined(value.avatarUrl)) return false;
|
|
339
|
+
if (!isStringOrUndefined(value.email)) return false;
|
|
340
|
+
return true;
|
|
341
|
+
}
|
|
342
|
+
function isAuthSwitchParams(value) {
|
|
343
|
+
return isRecord2(value) && isAuthProvider(value.provider);
|
|
344
|
+
}
|
|
345
|
+
function isAuthSwitchResult(value) {
|
|
346
|
+
if (!isRecord2(value)) return false;
|
|
347
|
+
if (value.activeProvider !== null && !isAuthProvider(value.activeProvider)) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
if (value.account !== null && !isAuthAccountMeta(value.account)) return false;
|
|
351
|
+
return true;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// src/bridge-skill-repo.ts
|
|
355
|
+
function isRecord3(value) {
|
|
356
|
+
return typeof value === "object" && value !== null;
|
|
357
|
+
}
|
|
358
|
+
function isStringOrUndefined2(value) {
|
|
359
|
+
return value === void 0 || typeof value === "string";
|
|
360
|
+
}
|
|
361
|
+
function isSkillKindOrUndefined(value) {
|
|
362
|
+
return value === void 0 || value === "skill" || value === "agent";
|
|
363
|
+
}
|
|
364
|
+
function isLinkScope(value) {
|
|
365
|
+
return value === "workspace" || value === "user";
|
|
366
|
+
}
|
|
367
|
+
function isLinkScopeOrUndefined(value) {
|
|
368
|
+
return value === void 0 || isLinkScope(value);
|
|
369
|
+
}
|
|
370
|
+
function isLinkScopeFilterOrUndefined(value) {
|
|
371
|
+
return value === void 0 || value === "workspace" || value === "user" || value === "all";
|
|
372
|
+
}
|
|
373
|
+
function isLinkModeOrUndefined(value) {
|
|
374
|
+
return value === void 0 || value === "auto" || value === "symlink" || value === "junction" || value === "copy";
|
|
375
|
+
}
|
|
376
|
+
function isLinkMode(value) {
|
|
377
|
+
return value === "symlink" || value === "junction" || value === "copy";
|
|
378
|
+
}
|
|
379
|
+
function isRepoEntry(value) {
|
|
380
|
+
if (!isRecord3(value)) return false;
|
|
381
|
+
if (typeof value.id !== "string") return false;
|
|
382
|
+
if (typeof value.name !== "string") return false;
|
|
383
|
+
if (typeof value.url !== "string") return false;
|
|
384
|
+
if (typeof value.branch !== "string") return false;
|
|
385
|
+
if (typeof value.enabled !== "boolean") return false;
|
|
386
|
+
if (typeof value.writeEnabled !== "boolean") return false;
|
|
387
|
+
if (value.source !== "default" && value.source !== "user") return false;
|
|
388
|
+
if (typeof value.addedAt !== "string") return false;
|
|
389
|
+
if (value.description !== void 0 && typeof value.description !== "string")
|
|
390
|
+
return false;
|
|
391
|
+
if (value.lastSyncAt !== void 0 && typeof value.lastSyncAt !== "string")
|
|
392
|
+
return false;
|
|
393
|
+
if (value.lastSyncCommitSha !== void 0 && typeof value.lastSyncCommitSha !== "string") {
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
if (value.lastSyncStatus !== void 0 && value.lastSyncStatus !== "ok" && value.lastSyncStatus !== "error") {
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
if (value.lastSyncError !== void 0 && typeof value.lastSyncError !== "string") {
|
|
400
|
+
return false;
|
|
401
|
+
}
|
|
402
|
+
return true;
|
|
403
|
+
}
|
|
404
|
+
function isSkillEntry(value) {
|
|
405
|
+
if (!isRecord3(value)) return false;
|
|
406
|
+
if (typeof value.repoId !== "string") return false;
|
|
407
|
+
if (typeof value.name !== "string") return false;
|
|
408
|
+
if (value.kind !== "skill" && value.kind !== "agent") return false;
|
|
409
|
+
if (typeof value.manifestPath !== "string") return false;
|
|
410
|
+
if (typeof value.dir !== "string") return false;
|
|
411
|
+
if (typeof value.frontmatter !== "object" || value.frontmatter === null) {
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
if (typeof value.modifiedAt !== "string") return false;
|
|
415
|
+
return true;
|
|
416
|
+
}
|
|
417
|
+
function isSkillFile(value) {
|
|
418
|
+
return isRecord3(value) && typeof value.path === "string" && typeof value.content === "string";
|
|
419
|
+
}
|
|
420
|
+
function isLinkedSkill(value) {
|
|
421
|
+
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);
|
|
422
|
+
}
|
|
423
|
+
function isSyncPull(value) {
|
|
424
|
+
return isRecord3(value) && typeof value.repoId === "string" && (value.status === "ok" || value.status === "error");
|
|
425
|
+
}
|
|
426
|
+
function isSkillRepoListResult(value) {
|
|
427
|
+
return isRecord3(value) && Array.isArray(value.entries) && value.entries.every(isSkillEntry);
|
|
428
|
+
}
|
|
429
|
+
function isSkillRepoGetResult(value) {
|
|
430
|
+
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);
|
|
431
|
+
}
|
|
432
|
+
function isSkillRepoInstallResult(value) {
|
|
433
|
+
return isRecord3(value) && isLinkMode(value.mode) && typeof value.linkPath === "string" && typeof value.targetPath === "string";
|
|
434
|
+
}
|
|
435
|
+
function isSkillRepoConvertToSymlinkResult(value) {
|
|
436
|
+
return isRecord3(value) && isLinkMode(value.mode) && typeof value.linkPath === "string" && typeof value.targetPath === "string";
|
|
437
|
+
}
|
|
438
|
+
function isSkillRepoUninstallResult(value) {
|
|
439
|
+
return isRecord3(value) && value.removed === true;
|
|
440
|
+
}
|
|
441
|
+
function isSkillRepoListLinkedResult(value) {
|
|
442
|
+
return isRecord3(value) && Array.isArray(value.links) && value.links.every(isLinkedSkill);
|
|
443
|
+
}
|
|
444
|
+
function isSkillRepoDraftCreateResult(value) {
|
|
445
|
+
return isRecord3(value) && typeof value.id === "string";
|
|
446
|
+
}
|
|
447
|
+
function isSkillRepoDraftCommitResult(value) {
|
|
448
|
+
return isRecord3(value) && typeof value.repoId === "string" && typeof value.skillName === "string" && typeof value.commitSha === "string" && isStringOrUndefined2(value.pushedRef) && isStringOrUndefined2(value.pushedSha);
|
|
449
|
+
}
|
|
450
|
+
function isSkillRepoDraftListResult(value) {
|
|
451
|
+
return isRecord3(value) && Array.isArray(value.drafts) && value.drafts.every(
|
|
452
|
+
(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"
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
function isSkillRepoDraftDeleteResult(value) {
|
|
456
|
+
return isRecord3(value) && value.deleted === true;
|
|
457
|
+
}
|
|
458
|
+
function isRepoListResult(value) {
|
|
459
|
+
return isRecord3(value) && Array.isArray(value.repos) && value.repos.every(isRepoEntry);
|
|
460
|
+
}
|
|
461
|
+
function isRepoAddResult(value) {
|
|
462
|
+
return isRecord3(value) && isRepoEntry(value.repo) && typeof value.branch === "string" && typeof value.cloned === "boolean";
|
|
463
|
+
}
|
|
464
|
+
function isRepoRemoveResult(value) {
|
|
465
|
+
return isRecord3(value) && value.removed === true;
|
|
466
|
+
}
|
|
467
|
+
function isRepoEnableResult(value) {
|
|
468
|
+
return isRecord3(value) && isRepoEntry(value.repo);
|
|
469
|
+
}
|
|
470
|
+
function isRepoDisableResult(value) {
|
|
471
|
+
return isRecord3(value) && isRepoEntry(value.repo);
|
|
472
|
+
}
|
|
473
|
+
function isRepoSyncResult(value) {
|
|
474
|
+
return isRecord3(value) && Array.isArray(value.pulls) && value.pulls.length >= 1 && value.pulls.every(isSyncPull);
|
|
475
|
+
}
|
|
476
|
+
function isRepoSyncAllResult(value) {
|
|
477
|
+
return isRecord3(value) && Array.isArray(value.pulls) && value.pulls.every(isSyncPull);
|
|
478
|
+
}
|
|
479
|
+
function isSkillRepoListParams(value) {
|
|
480
|
+
return isRecord3(value) && isStringOrUndefined2(value.repoId) && isSkillKindOrUndefined(value.kind);
|
|
481
|
+
}
|
|
482
|
+
function isSkillRepoGetParams(value) {
|
|
483
|
+
return isRecord3(value) && typeof value.repoId === "string" && typeof value.name === "string";
|
|
484
|
+
}
|
|
485
|
+
function isSkillRepoInstallParams(value) {
|
|
486
|
+
return isRecord3(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkModeOrUndefined(value.mode) && isLinkScopeOrUndefined(value.scope);
|
|
487
|
+
}
|
|
488
|
+
function isSkillRepoConvertToSymlinkParams(value) {
|
|
489
|
+
return isRecord3(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkModeOrUndefined(value.mode) && isLinkScopeOrUndefined(value.scope);
|
|
490
|
+
}
|
|
491
|
+
function isSkillRepoUninstallParams(value) {
|
|
492
|
+
return isRecord3(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkScopeOrUndefined(value.scope);
|
|
493
|
+
}
|
|
494
|
+
function isSkillRepoListLinkedParams(value) {
|
|
495
|
+
return isRecord3(value) && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkScopeFilterOrUndefined(value.scope);
|
|
496
|
+
}
|
|
497
|
+
function isRepoListParams(value) {
|
|
498
|
+
return isRecord3(value) && (value.source === void 0 || value.source === "default" || value.source === "user");
|
|
499
|
+
}
|
|
500
|
+
function isRepoAddParams(value) {
|
|
501
|
+
return isRecord3(value) && typeof value.url === "string" && isStringOrUndefined2(value.branch) && isStringOrUndefined2(value.name);
|
|
502
|
+
}
|
|
503
|
+
function isRepoRemoveParams(value) {
|
|
504
|
+
return isRecord3(value) && typeof value.repoId === "string";
|
|
505
|
+
}
|
|
506
|
+
function isRepoEnableParams(value) {
|
|
507
|
+
return isRecord3(value) && typeof value.repoId === "string";
|
|
508
|
+
}
|
|
509
|
+
function isRepoDisableParams(value) {
|
|
510
|
+
return isRecord3(value) && typeof value.repoId === "string";
|
|
511
|
+
}
|
|
512
|
+
function isRepoSyncParams(value) {
|
|
513
|
+
return isRecord3(value) && typeof value.repoId === "string";
|
|
514
|
+
}
|
|
515
|
+
function isRepoSyncAllParams(value) {
|
|
516
|
+
return isRecord3(value);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// src/device.ts
|
|
520
|
+
var DEVICE_BINDING_STATES = [
|
|
521
|
+
"anonymous",
|
|
522
|
+
"pending",
|
|
523
|
+
"claimed",
|
|
524
|
+
"expired"
|
|
525
|
+
];
|
|
526
|
+
function isRecord4(value) {
|
|
527
|
+
return typeof value === "object" && value !== null;
|
|
528
|
+
}
|
|
529
|
+
function isStringOrUndefined3(value) {
|
|
530
|
+
return value === void 0 || typeof value === "string";
|
|
531
|
+
}
|
|
532
|
+
function isDeviceBindingState(value) {
|
|
533
|
+
return value === "anonymous" || value === "pending" || value === "claimed" || value === "expired";
|
|
534
|
+
}
|
|
535
|
+
function isDeviceIdentityState(value) {
|
|
536
|
+
if (!isRecord4(value)) return false;
|
|
537
|
+
if (typeof value.publicId !== "string") return false;
|
|
538
|
+
if (value.publicId.length === 0) return false;
|
|
539
|
+
if (typeof value.secretVersion !== "number") return false;
|
|
540
|
+
if (!Number.isInteger(value.secretVersion)) return false;
|
|
541
|
+
if (value.secretVersion < 0) return false;
|
|
542
|
+
if (!isDeviceBindingState(value.bindingState)) return false;
|
|
543
|
+
return true;
|
|
544
|
+
}
|
|
545
|
+
function isDeviceMetadata(value) {
|
|
546
|
+
if (!isRecord4(value)) return false;
|
|
547
|
+
if (typeof value.installationId !== "string") return false;
|
|
548
|
+
if (value.installationId.length === 0) return false;
|
|
549
|
+
if (typeof value.machineId !== "string") return false;
|
|
550
|
+
if (value.machineId.length === 0) return false;
|
|
551
|
+
if (typeof value.platform !== "string") return false;
|
|
552
|
+
if (value.platform.length === 0) return false;
|
|
553
|
+
if (!isStringOrUndefined3(value.hostname)) return false;
|
|
554
|
+
if (!isStringOrUndefined3(value.vscodeVersion)) return false;
|
|
555
|
+
if (!isStringOrUndefined3(value.extensionVersion)) return false;
|
|
556
|
+
return true;
|
|
557
|
+
}
|
|
558
|
+
function isDeviceStatus(value) {
|
|
559
|
+
if (!isRecord4(value)) return false;
|
|
560
|
+
if (!isDeviceBindingState(value.bindingState)) return false;
|
|
561
|
+
if (value.identity !== void 0 && !isDeviceIdentityState(value.identity)) {
|
|
562
|
+
return false;
|
|
563
|
+
}
|
|
564
|
+
if (value.metadata !== void 0 && !isDeviceMetadata(value.metadata)) {
|
|
565
|
+
return false;
|
|
566
|
+
}
|
|
567
|
+
if (!isStringOrUndefined3(value.lastSyncAt)) return false;
|
|
568
|
+
if (!isStringOrUndefined3(value.lastSyncError)) return false;
|
|
569
|
+
return true;
|
|
570
|
+
}
|
|
571
|
+
function isDeviceEnrollParams(value) {
|
|
572
|
+
return isRecord4(value) && (value.force === void 0 || typeof value.force === "boolean") && (value.requireAuth === void 0 || typeof value.requireAuth === "boolean");
|
|
573
|
+
}
|
|
574
|
+
function isDeviceEnrollResult(value) {
|
|
575
|
+
if (!isRecord4(value)) return false;
|
|
576
|
+
if (typeof value.publicId !== "string") return false;
|
|
577
|
+
if (value.publicId.length === 0) return false;
|
|
578
|
+
if (!isDeviceBindingState(value.bindingState)) return false;
|
|
579
|
+
if (!isStringOrUndefined3(value.expiresAt)) return false;
|
|
580
|
+
return true;
|
|
581
|
+
}
|
|
582
|
+
function isDeviceRotateSecretParams(value) {
|
|
583
|
+
if (!isRecord4(value)) return false;
|
|
584
|
+
if (value.gracePeriodDays !== void 0 && (typeof value.gracePeriodDays !== "number" || !Number.isInteger(value.gracePeriodDays) || value.gracePeriodDays < 0 || value.gracePeriodDays > 365)) {
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
return true;
|
|
588
|
+
}
|
|
589
|
+
function isDeviceRotateSecretResult(value) {
|
|
590
|
+
if (!isRecord4(value)) return false;
|
|
591
|
+
if (typeof value.publicId !== "string") return false;
|
|
592
|
+
if (value.publicId.length === 0) return false;
|
|
593
|
+
if (typeof value.secretVersion !== "number") return false;
|
|
594
|
+
if (!Number.isInteger(value.secretVersion)) return false;
|
|
595
|
+
if (value.secretVersion < 0) return false;
|
|
596
|
+
if (typeof value.gracePeriodDays !== "number") return false;
|
|
597
|
+
if (!Number.isInteger(value.gracePeriodDays)) return false;
|
|
598
|
+
if (value.gracePeriodDays < 0) return false;
|
|
599
|
+
if (!isStringOrUndefined3(value.gracePeriodEndsAt)) return false;
|
|
600
|
+
return true;
|
|
601
|
+
}
|
|
602
|
+
|
|
186
603
|
// src/scheduled-tasks.ts
|
|
187
604
|
var VALID_TASK_TYPES = [
|
|
188
605
|
"command",
|
|
@@ -191,144 +608,228 @@ var VALID_TASK_TYPES = [
|
|
|
191
608
|
"github_copilot_cli"
|
|
192
609
|
];
|
|
193
610
|
var VALID_SCHEDULE_TYPES = ["cron", "interval"];
|
|
194
|
-
var VALID_TERMINAL_STATUSES = [
|
|
195
|
-
|
|
611
|
+
var VALID_TERMINAL_STATUSES = [
|
|
612
|
+
"success",
|
|
613
|
+
"failure",
|
|
614
|
+
"timeout",
|
|
615
|
+
"cancelled"
|
|
616
|
+
];
|
|
617
|
+
function isRecord5(value) {
|
|
196
618
|
return typeof value === "object" && value !== null;
|
|
197
619
|
}
|
|
198
620
|
function isScheduledTaskType(value) {
|
|
199
621
|
return typeof value === "string" && VALID_TASK_TYPES.includes(value);
|
|
200
622
|
}
|
|
623
|
+
function isScheduledTaskV1(value) {
|
|
624
|
+
if (!isRecord5(value)) return false;
|
|
625
|
+
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";
|
|
626
|
+
}
|
|
627
|
+
function isTaskWorkspaceRef(value) {
|
|
628
|
+
if (!isRecord5(value)) return false;
|
|
629
|
+
if (typeof value.path !== "string" || value.path.length === 0) return false;
|
|
630
|
+
if (typeof value.name !== "string" || value.name.length === 0) return false;
|
|
631
|
+
if (value.gitRemote !== void 0 && typeof value.gitRemote !== "string") {
|
|
632
|
+
return false;
|
|
633
|
+
}
|
|
634
|
+
if (value.gitBranch !== void 0 && typeof value.gitBranch !== "string") {
|
|
635
|
+
return false;
|
|
636
|
+
}
|
|
637
|
+
if (value.lastSeenAt !== void 0 && typeof value.lastSeenAt !== "string") {
|
|
638
|
+
return false;
|
|
639
|
+
}
|
|
640
|
+
return true;
|
|
641
|
+
}
|
|
201
642
|
function isScheduledTask(value) {
|
|
202
|
-
if (!
|
|
203
|
-
return
|
|
643
|
+
if (!isScheduledTaskV1(value)) return false;
|
|
644
|
+
return isTaskWorkspaceRef(value.workspace);
|
|
645
|
+
}
|
|
646
|
+
function isScheduledTasksConfig(value) {
|
|
647
|
+
if (!isRecord5(value)) return false;
|
|
648
|
+
if (value.version !== 2) return false;
|
|
649
|
+
if (!Array.isArray(value.tasks)) return false;
|
|
650
|
+
return value.tasks.every((t) => isScheduledTask(t));
|
|
651
|
+
}
|
|
652
|
+
function isScheduledTasksConfigV1(value) {
|
|
653
|
+
if (!isRecord5(value)) return false;
|
|
654
|
+
if (value.version !== 1) return false;
|
|
655
|
+
if (!Array.isArray(value.tasks)) return false;
|
|
656
|
+
return value.tasks.every((t) => isScheduledTaskV1(t));
|
|
204
657
|
}
|
|
205
658
|
function isTaskExecutionLog(value) {
|
|
206
|
-
if (!
|
|
207
|
-
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(
|
|
208
|
-
value.status
|
|
209
|
-
);
|
|
659
|
+
if (!isRecord5(value)) return false;
|
|
660
|
+
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);
|
|
210
661
|
}
|
|
211
662
|
function isSchedulerStatus(value) {
|
|
212
|
-
if (!
|
|
663
|
+
if (!isRecord5(value)) return false;
|
|
213
664
|
return typeof value.running === "boolean" && typeof value.tasksRegistered === "number" && typeof value.workspacePath === "string";
|
|
214
665
|
}
|
|
215
666
|
function isTaskExecuteResult(value) {
|
|
216
|
-
return
|
|
667
|
+
return isRecord5(value) && typeof value.executionId === "string" && value.accepted === true;
|
|
217
668
|
}
|
|
218
669
|
function isTaskCancelResult(value) {
|
|
219
|
-
return
|
|
670
|
+
return isRecord5(value) && typeof value.executionId === "string" && typeof value.cancelled === "boolean";
|
|
220
671
|
}
|
|
221
672
|
function isTaskListRunningResult(value) {
|
|
222
|
-
return
|
|
673
|
+
return isRecord5(value) && Array.isArray(value.executions);
|
|
223
674
|
}
|
|
224
675
|
function isTaskStartedEventParams(value) {
|
|
225
|
-
return
|
|
676
|
+
return isRecord5(value) && typeof value.executionId === "string" && typeof value.taskId === "string" && typeof value.startedAt === "string";
|
|
226
677
|
}
|
|
227
678
|
function isTaskOutputEventParams(value) {
|
|
228
|
-
return
|
|
679
|
+
return isRecord5(value) && typeof value.executionId === "string" && (value.stream === "stdout" || value.stream === "stderr") && typeof value.data === "string";
|
|
229
680
|
}
|
|
230
681
|
function isTaskCompletedEventParams(value) {
|
|
231
|
-
return
|
|
682
|
+
return isRecord5(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
|
|
232
683
|
}
|
|
233
684
|
function isTaskFailedEventParams(value) {
|
|
234
|
-
return
|
|
685
|
+
return isRecord5(value) && typeof value.executionId === "string" && (value.status === "failure" || value.status === "timeout") && (value.reason === "error" || value.reason === "timeout") && isTaskExecutionLog(value.log);
|
|
235
686
|
}
|
|
236
687
|
function isTaskCancelledEventParams(value) {
|
|
237
|
-
return
|
|
688
|
+
return isRecord5(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
|
|
238
689
|
}
|
|
239
690
|
function isAgentSessionStatus(value) {
|
|
240
691
|
return value === "idle" || value === "running" || value === "needs-input" || value === "completed" || value === "failed" || value === "aborted";
|
|
241
692
|
}
|
|
693
|
+
function migrateTaskV1ToV2(v1, workspace) {
|
|
694
|
+
const issues = [];
|
|
695
|
+
if (!isScheduledTaskType(v1.taskType)) {
|
|
696
|
+
issues.push(`unknown taskType: ${String(v1.taskType)}`);
|
|
697
|
+
}
|
|
698
|
+
const task = {
|
|
699
|
+
...v1,
|
|
700
|
+
workspace
|
|
701
|
+
};
|
|
702
|
+
return { task, issues };
|
|
703
|
+
}
|
|
704
|
+
function migrateV1ToV2(v1Config, workspace) {
|
|
705
|
+
if (!isTaskWorkspaceRef(workspace)) {
|
|
706
|
+
const w = workspace;
|
|
707
|
+
throw new Error(
|
|
708
|
+
`migrateV1ToV2: invalid workspace ref (path=${String(w.path)}, name=${String(w.name)})`
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
const allIssues = [];
|
|
712
|
+
const tasks = v1Config.tasks.map((t) => {
|
|
713
|
+
const { task, issues } = migrateTaskV1ToV2(t, workspace);
|
|
714
|
+
allIssues.push(...issues);
|
|
715
|
+
return task;
|
|
716
|
+
});
|
|
717
|
+
return { config: { version: 2, tasks }, issues: allIssues };
|
|
718
|
+
}
|
|
242
719
|
|
|
243
|
-
// src/
|
|
244
|
-
var
|
|
245
|
-
|
|
246
|
-
"absent",
|
|
247
|
-
"available",
|
|
248
|
-
"installed",
|
|
249
|
-
"blocked",
|
|
250
|
-
"conflict"
|
|
251
|
-
];
|
|
252
|
-
var VALID_SKILL_MUTATION_ACTIONS = [
|
|
253
|
-
"install",
|
|
254
|
-
"uninstall",
|
|
255
|
-
"move",
|
|
256
|
-
"removeExternal",
|
|
257
|
-
"publish",
|
|
258
|
-
"republish",
|
|
259
|
-
"submit-to-official"
|
|
260
|
-
];
|
|
261
|
-
function isRecord3(value) {
|
|
720
|
+
// src/toolbox.ts
|
|
721
|
+
var TOOLBOX_SCOPES = ["user", "workspace"];
|
|
722
|
+
function isRecord6(value) {
|
|
262
723
|
return typeof value === "object" && value !== null;
|
|
263
724
|
}
|
|
264
|
-
function
|
|
265
|
-
return typeof value === "string"
|
|
266
|
-
}
|
|
267
|
-
function
|
|
268
|
-
return typeof value === "
|
|
269
|
-
}
|
|
270
|
-
function
|
|
271
|
-
return
|
|
272
|
-
}
|
|
273
|
-
function
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
if (typeof value !== "string"
|
|
725
|
+
function isStringOrUndefined4(value) {
|
|
726
|
+
return value === void 0 || typeof value === "string";
|
|
727
|
+
}
|
|
728
|
+
function isFiniteNumberOrUndefined(value) {
|
|
729
|
+
return value === void 0 || typeof value === "number" && Number.isFinite(value);
|
|
730
|
+
}
|
|
731
|
+
function isToolboxScope(value) {
|
|
732
|
+
return value === "user" || value === "workspace";
|
|
733
|
+
}
|
|
734
|
+
function isExternalTool(value) {
|
|
735
|
+
if (!isRecord6(value)) return false;
|
|
736
|
+
if (typeof value.id !== "string") return false;
|
|
737
|
+
if (value.id.length === 0) return false;
|
|
738
|
+
if (typeof value.name !== "string") return false;
|
|
739
|
+
if (value.name.length === 0) return false;
|
|
740
|
+
if (typeof value.description !== "string") return false;
|
|
741
|
+
if (typeof value.icon !== "string") return false;
|
|
742
|
+
if (typeof value.url !== "string") return false;
|
|
743
|
+
if (value.url.length === 0) return false;
|
|
744
|
+
if (value.isDefault !== void 0 && typeof value.isDefault !== "boolean") {
|
|
278
745
|
return false;
|
|
279
746
|
}
|
|
280
|
-
|
|
281
|
-
if (
|
|
282
|
-
|
|
747
|
+
if (!isFiniteNumberOrUndefined(value.order)) return false;
|
|
748
|
+
if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
|
|
749
|
+
if (!isStringOrUndefined4(value.lastUsedAt)) return false;
|
|
750
|
+
return true;
|
|
751
|
+
}
|
|
752
|
+
function isExternalToolPatch(value) {
|
|
753
|
+
if (!isRecord6(value)) return false;
|
|
754
|
+
if (value.name !== void 0) {
|
|
755
|
+
if (typeof value.name !== "string" || value.name.length === 0) return false;
|
|
283
756
|
}
|
|
284
|
-
|
|
285
|
-
(segment) => segment !== "." && segment !== ".." && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(segment)
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
|
-
function isSkillScopeState(value) {
|
|
289
|
-
if (!isRecord3(value)) {
|
|
757
|
+
if (value.description !== void 0 && typeof value.description !== "string") {
|
|
290
758
|
return false;
|
|
291
759
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
if (!isRecord3(value)) {
|
|
296
|
-
return false;
|
|
760
|
+
if (value.icon !== void 0 && typeof value.icon !== "string") return false;
|
|
761
|
+
if (value.url !== void 0) {
|
|
762
|
+
if (typeof value.url !== "string" || value.url.length === 0) return false;
|
|
297
763
|
}
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
function isSkillMarketplaceState(value) {
|
|
301
|
-
if (!isRecord3(value)) {
|
|
764
|
+
if (value.isDefault !== void 0 && typeof value.isDefault !== "boolean") {
|
|
302
765
|
return false;
|
|
303
766
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
return
|
|
308
|
-
}
|
|
309
|
-
function
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
return
|
|
317
|
-
}
|
|
318
|
-
function
|
|
319
|
-
return
|
|
767
|
+
if (!isFiniteNumberOrUndefined(value.order)) return false;
|
|
768
|
+
if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
|
|
769
|
+
if (!isStringOrUndefined4(value.lastUsedAt)) return false;
|
|
770
|
+
return true;
|
|
771
|
+
}
|
|
772
|
+
function isToolboxList(value) {
|
|
773
|
+
if (!isRecord6(value)) return false;
|
|
774
|
+
if (!isToolboxScope(value.scope)) return false;
|
|
775
|
+
if (!Array.isArray(value.tools)) return false;
|
|
776
|
+
for (const tool of value.tools) {
|
|
777
|
+
if (!isExternalTool(tool)) return false;
|
|
778
|
+
}
|
|
779
|
+
return true;
|
|
780
|
+
}
|
|
781
|
+
function isToolboxListParams(value) {
|
|
782
|
+
return isRecord6(value) && (value.scope === void 0 || isToolboxScope(value.scope));
|
|
783
|
+
}
|
|
784
|
+
function isToolboxAddParams(value) {
|
|
785
|
+
return isExternalTool(value);
|
|
786
|
+
}
|
|
787
|
+
function isToolboxAddResult(value) {
|
|
788
|
+
if (!isRecord6(value)) return false;
|
|
789
|
+
if (!isToolboxScope(value.scope)) return false;
|
|
790
|
+
if (!isExternalTool(value.tool)) return false;
|
|
791
|
+
return true;
|
|
792
|
+
}
|
|
793
|
+
function isToolboxRemoveParams(value) {
|
|
794
|
+
if (!isRecord6(value)) return false;
|
|
795
|
+
if (typeof value.id !== "string") return false;
|
|
796
|
+
if (value.id.length === 0) return false;
|
|
797
|
+
if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
|
|
798
|
+
return true;
|
|
799
|
+
}
|
|
800
|
+
function isToolboxRemoveResult(value) {
|
|
801
|
+
if (!isRecord6(value)) return false;
|
|
802
|
+
if (!isToolboxScope(value.scope)) return false;
|
|
803
|
+
if (typeof value.toolId !== "string") return false;
|
|
804
|
+
if (value.toolId.length === 0) return false;
|
|
805
|
+
if (typeof value.success !== "boolean") return false;
|
|
806
|
+
return true;
|
|
807
|
+
}
|
|
808
|
+
function isToolboxUpdateParams(value) {
|
|
809
|
+
if (!isRecord6(value)) return false;
|
|
810
|
+
if (typeof value.id !== "string") return false;
|
|
811
|
+
if (value.id.length === 0) return false;
|
|
812
|
+
if (!isExternalToolPatch(value.patch)) return false;
|
|
813
|
+
if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
|
|
814
|
+
return true;
|
|
815
|
+
}
|
|
816
|
+
function isToolboxUpdateResult(value) {
|
|
817
|
+
if (!isRecord6(value)) return false;
|
|
818
|
+
if (!isToolboxScope(value.scope)) return false;
|
|
819
|
+
if (!isExternalTool(value.tool)) return false;
|
|
820
|
+
return true;
|
|
320
821
|
}
|
|
321
822
|
|
|
322
823
|
// src/bridge.ts
|
|
323
824
|
var SERVICEME_PROTOCOL_VERSION = 2;
|
|
324
|
-
function
|
|
825
|
+
function isRecord7(value) {
|
|
325
826
|
return typeof value === "object" && value !== null;
|
|
326
827
|
}
|
|
327
828
|
function isValidProtocolVersion(value) {
|
|
328
829
|
return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= SERVICEME_PROTOCOL_VERSION;
|
|
329
830
|
}
|
|
330
831
|
function isBridgeCapabilities(value) {
|
|
331
|
-
return
|
|
832
|
+
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);
|
|
332
833
|
}
|
|
333
834
|
var BRIDGE_METHODS = [
|
|
334
835
|
"system.hello",
|
|
@@ -337,13 +838,35 @@ var BRIDGE_METHODS = [
|
|
|
337
838
|
"task.execute",
|
|
338
839
|
"task.cancel",
|
|
339
840
|
"task.list-running",
|
|
340
|
-
"
|
|
341
|
-
"
|
|
342
|
-
"
|
|
343
|
-
"
|
|
344
|
-
"
|
|
345
|
-
"
|
|
346
|
-
"
|
|
841
|
+
"skillRepo.list",
|
|
842
|
+
"skillRepo.get",
|
|
843
|
+
"skillRepo.install",
|
|
844
|
+
"skillRepo.convertToSymlink",
|
|
845
|
+
"skillRepo.uninstall",
|
|
846
|
+
"skillRepo.listLinked",
|
|
847
|
+
"skillRepo.draft.create",
|
|
848
|
+
"skillRepo.draft.commit",
|
|
849
|
+
"skillRepo.draft.list",
|
|
850
|
+
"skillRepo.draft.delete",
|
|
851
|
+
"repo.list",
|
|
852
|
+
"repo.add",
|
|
853
|
+
"repo.remove",
|
|
854
|
+
"repo.enable",
|
|
855
|
+
"repo.disable",
|
|
856
|
+
"repo.sync",
|
|
857
|
+
"repo.syncAll",
|
|
858
|
+
"auth.status",
|
|
859
|
+
"auth.login",
|
|
860
|
+
"auth.logout",
|
|
861
|
+
"auth.whoami",
|
|
862
|
+
"auth.switch",
|
|
863
|
+
"device.status",
|
|
864
|
+
"device.enroll",
|
|
865
|
+
"device.rotate-secret",
|
|
866
|
+
"toolbox.list",
|
|
867
|
+
"toolbox.add",
|
|
868
|
+
"toolbox.remove",
|
|
869
|
+
"toolbox.update"
|
|
347
870
|
];
|
|
348
871
|
var BRIDGE_EVENTS = [
|
|
349
872
|
"task.started",
|
|
@@ -353,13 +876,13 @@ var BRIDGE_EVENTS = [
|
|
|
353
876
|
"task.cancelled"
|
|
354
877
|
];
|
|
355
878
|
function isSystemHelloResult(value) {
|
|
356
|
-
return
|
|
879
|
+
return isRecord7(value) && typeof value.cliVersion === "string" && isValidProtocolVersion(value.protocolVersion) && isBridgeCapabilities(value.capabilities) && typeof value.pid === "number";
|
|
357
880
|
}
|
|
358
881
|
function isSystemPingResult(value) {
|
|
359
|
-
return
|
|
882
|
+
return isRecord7(value) && typeof value.now === "string";
|
|
360
883
|
}
|
|
361
884
|
function isSystemShutdownResult(value) {
|
|
362
|
-
return
|
|
885
|
+
return isRecord7(value) && value.shuttingDown === true;
|
|
363
886
|
}
|
|
364
887
|
function getBridgeResultValidator(method) {
|
|
365
888
|
switch (method) {
|
|
@@ -375,20 +898,64 @@ function getBridgeResultValidator(method) {
|
|
|
375
898
|
return isTaskCancelResult;
|
|
376
899
|
case "task.list-running":
|
|
377
900
|
return isTaskListRunningResult;
|
|
378
|
-
case "
|
|
379
|
-
return
|
|
380
|
-
case "
|
|
381
|
-
return
|
|
382
|
-
case "
|
|
383
|
-
return
|
|
384
|
-
case "
|
|
385
|
-
return
|
|
386
|
-
case "
|
|
387
|
-
return
|
|
388
|
-
case "
|
|
389
|
-
return
|
|
390
|
-
case "
|
|
391
|
-
return
|
|
901
|
+
case "skillRepo.list":
|
|
902
|
+
return isSkillRepoListResult;
|
|
903
|
+
case "skillRepo.get":
|
|
904
|
+
return isSkillRepoGetResult;
|
|
905
|
+
case "skillRepo.install":
|
|
906
|
+
return isSkillRepoInstallResult;
|
|
907
|
+
case "skillRepo.convertToSymlink":
|
|
908
|
+
return isSkillRepoConvertToSymlinkResult;
|
|
909
|
+
case "skillRepo.uninstall":
|
|
910
|
+
return isSkillRepoUninstallResult;
|
|
911
|
+
case "skillRepo.listLinked":
|
|
912
|
+
return isSkillRepoListLinkedResult;
|
|
913
|
+
case "skillRepo.draft.create":
|
|
914
|
+
return isSkillRepoDraftCreateResult;
|
|
915
|
+
case "skillRepo.draft.commit":
|
|
916
|
+
return isSkillRepoDraftCommitResult;
|
|
917
|
+
case "skillRepo.draft.list":
|
|
918
|
+
return isSkillRepoDraftListResult;
|
|
919
|
+
case "skillRepo.draft.delete":
|
|
920
|
+
return isSkillRepoDraftDeleteResult;
|
|
921
|
+
case "repo.list":
|
|
922
|
+
return isRepoListResult;
|
|
923
|
+
case "repo.add":
|
|
924
|
+
return isRepoAddResult;
|
|
925
|
+
case "repo.remove":
|
|
926
|
+
return isRepoRemoveResult;
|
|
927
|
+
case "repo.enable":
|
|
928
|
+
return isRepoEnableResult;
|
|
929
|
+
case "repo.disable":
|
|
930
|
+
return isRepoDisableResult;
|
|
931
|
+
case "repo.sync":
|
|
932
|
+
return isRepoSyncResult;
|
|
933
|
+
case "repo.syncAll":
|
|
934
|
+
return isRepoSyncAllResult;
|
|
935
|
+
case "auth.status":
|
|
936
|
+
return isAuthStatus;
|
|
937
|
+
case "auth.login":
|
|
938
|
+
return isAuthLoginResult;
|
|
939
|
+
case "auth.logout":
|
|
940
|
+
return isAuthLogoutResult;
|
|
941
|
+
case "auth.whoami":
|
|
942
|
+
return isAuthWhoamiResult;
|
|
943
|
+
case "auth.switch":
|
|
944
|
+
return isAuthSwitchResult;
|
|
945
|
+
case "device.status":
|
|
946
|
+
return isDeviceStatus;
|
|
947
|
+
case "device.enroll":
|
|
948
|
+
return isDeviceEnrollResult;
|
|
949
|
+
case "device.rotate-secret":
|
|
950
|
+
return isDeviceRotateSecretResult;
|
|
951
|
+
case "toolbox.list":
|
|
952
|
+
return isToolboxList;
|
|
953
|
+
case "toolbox.add":
|
|
954
|
+
return isToolboxAddResult;
|
|
955
|
+
case "toolbox.remove":
|
|
956
|
+
return isToolboxRemoveResult;
|
|
957
|
+
case "toolbox.update":
|
|
958
|
+
return isToolboxUpdateResult;
|
|
392
959
|
default:
|
|
393
960
|
return void 0;
|
|
394
961
|
}
|
|
@@ -416,13 +983,13 @@ function isBridgeEventName(value) {
|
|
|
416
983
|
return typeof value === "string" && BRIDGE_EVENTS.includes(value);
|
|
417
984
|
}
|
|
418
985
|
function isBridgeRequest(value) {
|
|
419
|
-
if (!
|
|
986
|
+
if (!isRecord7(value)) {
|
|
420
987
|
return false;
|
|
421
988
|
}
|
|
422
989
|
return isValidProtocolVersion(value.protocolVersion) && value.kind === "request" && typeof value.id === "string" && isBridgeMethod(value.method) && "params" in value;
|
|
423
990
|
}
|
|
424
991
|
function isBridgeResponse(value) {
|
|
425
|
-
if (!
|
|
992
|
+
if (!isRecord7(value)) {
|
|
426
993
|
return false;
|
|
427
994
|
}
|
|
428
995
|
if (!isValidProtocolVersion(value.protocolVersion) || value.kind !== "response" || typeof value.id !== "string" || typeof value.ok !== "boolean") {
|
|
@@ -434,7 +1001,7 @@ function isBridgeResponse(value) {
|
|
|
434
1001
|
return "error" in value;
|
|
435
1002
|
}
|
|
436
1003
|
function isBridgeEvent(value) {
|
|
437
|
-
if (!
|
|
1004
|
+
if (!isRecord7(value)) {
|
|
438
1005
|
return false;
|
|
439
1006
|
}
|
|
440
1007
|
return isValidProtocolVersion(value.protocolVersion) && value.kind === "event" && isBridgeEventName(value.event) && "params" in value;
|
|
@@ -442,7 +1009,7 @@ function isBridgeEvent(value) {
|
|
|
442
1009
|
|
|
443
1010
|
// src/cli.ts
|
|
444
1011
|
var SERVICEME_CLI_SCHEMA_VERSION = 1;
|
|
445
|
-
function
|
|
1012
|
+
function isRecord8(value) {
|
|
446
1013
|
return typeof value === "object" && value !== null;
|
|
447
1014
|
}
|
|
448
1015
|
function createCliSuccess(data) {
|
|
@@ -460,7 +1027,7 @@ function createCliFailure(error) {
|
|
|
460
1027
|
};
|
|
461
1028
|
}
|
|
462
1029
|
function isCliEnvelope(value) {
|
|
463
|
-
if (!
|
|
1030
|
+
if (!isRecord8(value)) {
|
|
464
1031
|
return false;
|
|
465
1032
|
}
|
|
466
1033
|
if (value.schemaVersion !== SERVICEME_CLI_SCHEMA_VERSION || typeof value.ok !== "boolean") {
|
|
@@ -492,20 +1059,20 @@ var KNOWN_ENVIRONMENT_TOOLS = [
|
|
|
492
1059
|
"dotnet",
|
|
493
1060
|
"nuget"
|
|
494
1061
|
];
|
|
495
|
-
function
|
|
1062
|
+
function isRecord9(value) {
|
|
496
1063
|
return typeof value === "object" && value !== null;
|
|
497
1064
|
}
|
|
498
1065
|
function isKnownEnvironmentTool(value) {
|
|
499
1066
|
return KNOWN_ENVIRONMENT_TOOLS.includes(value);
|
|
500
1067
|
}
|
|
501
1068
|
function isToolCheckResult(value) {
|
|
502
|
-
if (!
|
|
1069
|
+
if (!isRecord9(value)) {
|
|
503
1070
|
return false;
|
|
504
1071
|
}
|
|
505
1072
|
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");
|
|
506
1073
|
}
|
|
507
1074
|
function isEnvironmentCheckResult(value) {
|
|
508
|
-
if (!
|
|
1075
|
+
if (!isRecord9(value)) {
|
|
509
1076
|
return false;
|
|
510
1077
|
}
|
|
511
1078
|
return KNOWN_ENVIRONMENT_TOOLS.every(
|
|
@@ -543,7 +1110,11 @@ var SERVICEME_ERROR_CODES = [
|
|
|
543
1110
|
"executor_error",
|
|
544
1111
|
"task_already_running",
|
|
545
1112
|
"not_found",
|
|
546
|
-
"internal_error"
|
|
1113
|
+
"internal_error",
|
|
1114
|
+
"auth_not_logged_in",
|
|
1115
|
+
"auth_provider_not_registered",
|
|
1116
|
+
"device_not_enrolled",
|
|
1117
|
+
"toolbox_invalid_scope"
|
|
547
1118
|
];
|
|
548
1119
|
var RETRYABLE_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
549
1120
|
"command_timeout",
|
|
@@ -555,14 +1126,14 @@ var RETRYABLE_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
555
1126
|
"executor_timeout",
|
|
556
1127
|
"internal_error"
|
|
557
1128
|
]);
|
|
558
|
-
function
|
|
1129
|
+
function isRecord10(value) {
|
|
559
1130
|
return typeof value === "object" && value !== null;
|
|
560
1131
|
}
|
|
561
1132
|
function isServicemeErrorCode(value) {
|
|
562
1133
|
return typeof value === "string" && SERVICEME_ERROR_CODES.includes(value);
|
|
563
1134
|
}
|
|
564
1135
|
function isServicemeErrorDetails(value) {
|
|
565
|
-
if (!
|
|
1136
|
+
if (!isRecord10(value)) {
|
|
566
1137
|
return false;
|
|
567
1138
|
}
|
|
568
1139
|
return isServicemeErrorCode(value.code) && typeof value.message === "string" && typeof value.retryable === "boolean";
|
|
@@ -602,7 +1173,7 @@ function normalizeServicemeError(error, fallbackCode = "internal_error") {
|
|
|
602
1173
|
if (isServicemeErrorDetails(error)) {
|
|
603
1174
|
return error;
|
|
604
1175
|
}
|
|
605
|
-
if (
|
|
1176
|
+
if (isRecord10(error)) {
|
|
606
1177
|
const code = isServicemeErrorCode(error.code) ? error.code : fallbackCode;
|
|
607
1178
|
const message = typeof error.message === "string" ? error.message : "Unexpected serviceme error.";
|
|
608
1179
|
const retryable = typeof error.retryable === "boolean" ? error.retryable : isRetryableErrorCode(code);
|
|
@@ -633,32 +1204,32 @@ var SERVICEME_IMAGE_FORMATS = [
|
|
|
633
1204
|
"png",
|
|
634
1205
|
"webp"
|
|
635
1206
|
];
|
|
636
|
-
function
|
|
1207
|
+
function isRecord11(value) {
|
|
637
1208
|
return typeof value === "object" && value !== null;
|
|
638
1209
|
}
|
|
639
1210
|
function isServiceMeImageFormat(value) {
|
|
640
1211
|
return typeof value === "string" && SERVICEME_IMAGE_FORMATS.includes(value);
|
|
641
1212
|
}
|
|
642
1213
|
function isServiceMeImageCompressOptions(value) {
|
|
643
|
-
if (!
|
|
1214
|
+
if (!isRecord11(value)) {
|
|
644
1215
|
return false;
|
|
645
1216
|
}
|
|
646
1217
|
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");
|
|
647
1218
|
}
|
|
648
1219
|
function isServiceMeImageCompressResult(value) {
|
|
649
|
-
if (!
|
|
1220
|
+
if (!isRecord11(value)) {
|
|
650
1221
|
return false;
|
|
651
1222
|
}
|
|
652
1223
|
return typeof value.originalSize === "number" && typeof value.compressedSize === "number" && typeof value.compressionRatio === "number" && typeof value.outputPath === "string";
|
|
653
1224
|
}
|
|
654
1225
|
function isServiceMeImageInfo(value) {
|
|
655
|
-
if (!
|
|
1226
|
+
if (!isRecord11(value)) {
|
|
656
1227
|
return false;
|
|
657
1228
|
}
|
|
658
1229
|
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");
|
|
659
1230
|
}
|
|
660
1231
|
function isServiceMeImageValidationResult(value) {
|
|
661
|
-
return
|
|
1232
|
+
return isRecord11(value) && typeof value.valid === "boolean";
|
|
662
1233
|
}
|
|
663
1234
|
|
|
664
1235
|
// src/json.ts
|
|
@@ -677,7 +1248,7 @@ var DEFAULT_JSON_SORT_OPTIONS = {
|
|
|
677
1248
|
sortOrder: "asc",
|
|
678
1249
|
sortAlgo: "default"
|
|
679
1250
|
};
|
|
680
|
-
function
|
|
1251
|
+
function isRecord12(value) {
|
|
681
1252
|
return typeof value === "object" && value !== null;
|
|
682
1253
|
}
|
|
683
1254
|
function isJsonSortAlgorithm(value) {
|
|
@@ -687,63 +1258,142 @@ function isJsonSortOrder(value) {
|
|
|
687
1258
|
return typeof value === "string" && JSON_SORT_ORDERS.includes(value);
|
|
688
1259
|
}
|
|
689
1260
|
function isJsonSortOptions(value) {
|
|
690
|
-
return
|
|
1261
|
+
return isRecord12(value) && isJsonSortOrder(value.sortOrder) && isJsonSortAlgorithm(value.sortAlgo);
|
|
691
1262
|
}
|
|
692
1263
|
function isJsonValidationResult(value) {
|
|
693
|
-
return
|
|
1264
|
+
return isRecord12(value) && typeof value.valid === "boolean" && (value.error === void 0 || typeof value.error === "string");
|
|
694
1265
|
}
|
|
695
1266
|
function isJsonOutputResult(value) {
|
|
696
|
-
return
|
|
1267
|
+
return isRecord12(value) && typeof value.output === "string";
|
|
697
1268
|
}
|
|
698
1269
|
|
|
699
1270
|
// src/metadata.ts
|
|
700
1271
|
var SERVICEME_CLI_NAME = "serviceme";
|
|
701
|
-
var SERVICEME_CLI_VERSION = "0.
|
|
1272
|
+
var SERVICEME_CLI_VERSION = "0.2.0";
|
|
702
1273
|
var SERVICEME_CLI_CAPABILITIES = {
|
|
703
1274
|
bridge: true,
|
|
704
1275
|
tasks: 1,
|
|
705
1276
|
json: 1,
|
|
706
1277
|
env: 1,
|
|
707
1278
|
image: 1,
|
|
708
|
-
project: 1
|
|
709
|
-
skills: 1,
|
|
710
|
-
agents: 1
|
|
1279
|
+
project: 1
|
|
711
1280
|
};
|
|
712
1281
|
|
|
713
1282
|
// src/project.ts
|
|
714
|
-
function
|
|
1283
|
+
function isRecord13(value) {
|
|
715
1284
|
return typeof value === "object" && value !== null;
|
|
716
1285
|
}
|
|
717
1286
|
function isServiceMeProjectScaffoldPruneResult(value) {
|
|
718
|
-
if (!
|
|
1287
|
+
if (!isRecord13(value)) {
|
|
719
1288
|
return false;
|
|
720
1289
|
}
|
|
721
1290
|
return typeof value.applied === "boolean" && typeof value.preset === "string" && Array.isArray(value.commands) && value.commands.every((command) => typeof command === "string");
|
|
722
1291
|
}
|
|
723
1292
|
function isServiceMeProjectGitInitResult(value) {
|
|
724
|
-
return
|
|
1293
|
+
return isRecord13(value) && typeof value.initialized === "boolean" && typeof value.command === "string";
|
|
725
1294
|
}
|
|
726
1295
|
function isServiceMeProjectMakeScriptsExecutableResult(value) {
|
|
727
|
-
if (!
|
|
1296
|
+
if (!isRecord13(value)) {
|
|
728
1297
|
return false;
|
|
729
1298
|
}
|
|
730
1299
|
return typeof value.processedCount === "number" && typeof value.updatedCount === "number" && typeof value.platform === "string" && Array.isArray(value.scripts) && value.scripts.every((script) => typeof script === "string");
|
|
731
1300
|
}
|
|
732
1301
|
function isServiceMeProjectInstallDepsResult(value) {
|
|
733
|
-
return
|
|
1302
|
+
return isRecord13(value) && typeof value.installed === "boolean" && typeof value.command === "string";
|
|
734
1303
|
}
|
|
735
1304
|
function isServiceMeProjectExtractTemplateInput(value) {
|
|
736
|
-
return
|
|
1305
|
+
return isRecord13(value) && typeof value.extractedDirName === "string" && typeof value.projectFilePattern === "string";
|
|
737
1306
|
}
|
|
738
1307
|
function isServiceMeProjectExtractTemplateResult(value) {
|
|
739
|
-
return
|
|
1308
|
+
return isRecord13(value) && typeof value.actualDirName === "string";
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
// src/skill.ts
|
|
1312
|
+
var VALID_SKILL_SCOPES = ["workspace", "user"];
|
|
1313
|
+
var VALID_SKILL_SCOPE_STATUSES = [
|
|
1314
|
+
"absent",
|
|
1315
|
+
"available",
|
|
1316
|
+
"installed",
|
|
1317
|
+
"blocked",
|
|
1318
|
+
"conflict"
|
|
1319
|
+
];
|
|
1320
|
+
var VALID_SKILL_MUTATION_ACTIONS = [
|
|
1321
|
+
"install",
|
|
1322
|
+
"uninstall",
|
|
1323
|
+
"move",
|
|
1324
|
+
"removeExternal",
|
|
1325
|
+
"publish",
|
|
1326
|
+
"republish",
|
|
1327
|
+
"submit-to-official"
|
|
1328
|
+
];
|
|
1329
|
+
function isRecord14(value) {
|
|
1330
|
+
return typeof value === "object" && value !== null;
|
|
1331
|
+
}
|
|
1332
|
+
function isSkillScope(value) {
|
|
1333
|
+
return typeof value === "string" && VALID_SKILL_SCOPES.includes(value);
|
|
1334
|
+
}
|
|
1335
|
+
function isSkillScopeStatus(value) {
|
|
1336
|
+
return typeof value === "string" && VALID_SKILL_SCOPE_STATUSES.includes(value);
|
|
1337
|
+
}
|
|
1338
|
+
function isSkillMutationAction(value) {
|
|
1339
|
+
return typeof value === "string" && VALID_SKILL_MUTATION_ACTIONS.includes(value);
|
|
1340
|
+
}
|
|
1341
|
+
function isStringArray2(value) {
|
|
1342
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
1343
|
+
}
|
|
1344
|
+
function isSafeResourceId2(value) {
|
|
1345
|
+
if (typeof value !== "string" || value.length === 0 || value.includes("\\")) {
|
|
1346
|
+
return false;
|
|
1347
|
+
}
|
|
1348
|
+
const segments = value.split("/");
|
|
1349
|
+
if (segments.some((segment) => segment.length === 0)) {
|
|
1350
|
+
return false;
|
|
1351
|
+
}
|
|
1352
|
+
return segments.every(
|
|
1353
|
+
(segment) => segment !== "." && segment !== ".." && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(segment)
|
|
1354
|
+
);
|
|
1355
|
+
}
|
|
1356
|
+
function isSkillScopeState(value) {
|
|
1357
|
+
if (!isRecord14(value)) {
|
|
1358
|
+
return false;
|
|
1359
|
+
}
|
|
1360
|
+
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");
|
|
1361
|
+
}
|
|
1362
|
+
function isSkillMarketplaceEntry(value) {
|
|
1363
|
+
if (!isRecord14(value)) {
|
|
1364
|
+
return false;
|
|
1365
|
+
}
|
|
1366
|
+
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);
|
|
1367
|
+
}
|
|
1368
|
+
function isSkillMarketplaceState(value) {
|
|
1369
|
+
if (!isRecord14(value)) {
|
|
1370
|
+
return false;
|
|
1371
|
+
}
|
|
1372
|
+
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");
|
|
1373
|
+
}
|
|
1374
|
+
function isSkillMutationRequest(value) {
|
|
1375
|
+
return isRecord14(value) && isSafeResourceId2(value.skillId) && isSkillScope(value.targetScope) && isSkillMutationAction(value.action) && (value.confirmed === void 0 || typeof value.confirmed === "boolean");
|
|
1376
|
+
}
|
|
1377
|
+
function isSkillMutationResult(value) {
|
|
1378
|
+
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");
|
|
1379
|
+
}
|
|
1380
|
+
function isSkillReconcileResult(value) {
|
|
1381
|
+
return isRecord14(value) && isSkillMarketplaceState(value.state) && typeof value.changed === "boolean";
|
|
1382
|
+
}
|
|
1383
|
+
function isPublishableSkillEntry(value) {
|
|
1384
|
+
return isRecord14(value) && typeof value.id === "string" && typeof value.displayName === "string" && typeof value.path === "string" && (value.version === void 0 || typeof value.version === "string");
|
|
1385
|
+
}
|
|
1386
|
+
function isSkillPublishableResult(value) {
|
|
1387
|
+
return isRecord14(value) && Array.isArray(value.skills) && value.skills.every((entry) => isPublishableSkillEntry(entry));
|
|
740
1388
|
}
|
|
741
1389
|
// Annotate the CommonJS export names for ESM import in node:
|
|
742
1390
|
0 && (module.exports = {
|
|
1391
|
+
AUTH_PROVIDERS,
|
|
743
1392
|
BRIDGE_EVENTS,
|
|
744
1393
|
BRIDGE_METHODS,
|
|
745
1394
|
COPILOT_ERROR_CODES,
|
|
746
1395
|
DEFAULT_JSON_SORT_OPTIONS,
|
|
1396
|
+
DEVICE_BINDING_STATES,
|
|
747
1397
|
JSON_SORT_ALGORITHMS,
|
|
748
1398
|
JSON_SORT_ORDERS,
|
|
749
1399
|
KNOWN_ENVIRONMENT_TOOLS,
|
|
@@ -755,6 +1405,7 @@ function isServiceMeProjectExtractTemplateResult(value) {
|
|
|
755
1405
|
SERVICEME_IMAGE_FORMATS,
|
|
756
1406
|
SERVICEME_PROTOCOL_VERSION,
|
|
757
1407
|
ServicemeProtocolError,
|
|
1408
|
+
TOOLBOX_SCOPES,
|
|
758
1409
|
createCliFailure,
|
|
759
1410
|
createCliSuccess,
|
|
760
1411
|
createServicemeError,
|
|
@@ -766,6 +1417,17 @@ function isServiceMeProjectExtractTemplateResult(value) {
|
|
|
766
1417
|
isAgentPermissionSummary,
|
|
767
1418
|
isAgentPermissionsResult,
|
|
768
1419
|
isAgentSessionStatus,
|
|
1420
|
+
isAuthAccountMeta,
|
|
1421
|
+
isAuthLoginParams,
|
|
1422
|
+
isAuthLoginResult,
|
|
1423
|
+
isAuthLogoutParams,
|
|
1424
|
+
isAuthLogoutResult,
|
|
1425
|
+
isAuthProvider,
|
|
1426
|
+
isAuthSessionHandle,
|
|
1427
|
+
isAuthStatus,
|
|
1428
|
+
isAuthSwitchParams,
|
|
1429
|
+
isAuthSwitchResult,
|
|
1430
|
+
isAuthWhoamiResult,
|
|
769
1431
|
isBridgeCapabilities,
|
|
770
1432
|
isBridgeEvent,
|
|
771
1433
|
isBridgeEventName,
|
|
@@ -773,16 +1435,43 @@ function isServiceMeProjectExtractTemplateResult(value) {
|
|
|
773
1435
|
isBridgeRequest,
|
|
774
1436
|
isBridgeResponse,
|
|
775
1437
|
isCliEnvelope,
|
|
1438
|
+
isDeviceBindingState,
|
|
1439
|
+
isDeviceEnrollParams,
|
|
1440
|
+
isDeviceEnrollResult,
|
|
1441
|
+
isDeviceIdentityState,
|
|
1442
|
+
isDeviceMetadata,
|
|
1443
|
+
isDeviceRotateSecretParams,
|
|
1444
|
+
isDeviceRotateSecretResult,
|
|
1445
|
+
isDeviceStatus,
|
|
776
1446
|
isEnvironmentCheckResult,
|
|
1447
|
+
isExternalTool,
|
|
1448
|
+
isExternalToolPatch,
|
|
777
1449
|
isJsonOutputResult,
|
|
778
1450
|
isJsonSortAlgorithm,
|
|
779
1451
|
isJsonSortOptions,
|
|
780
1452
|
isJsonSortOrder,
|
|
781
1453
|
isJsonValidationResult,
|
|
782
1454
|
isKnownEnvironmentTool,
|
|
1455
|
+
isRepoAddParams,
|
|
1456
|
+
isRepoAddResult,
|
|
1457
|
+
isRepoDisableParams,
|
|
1458
|
+
isRepoDisableResult,
|
|
1459
|
+
isRepoEnableParams,
|
|
1460
|
+
isRepoEnableResult,
|
|
1461
|
+
isRepoListParams,
|
|
1462
|
+
isRepoListResult,
|
|
1463
|
+
isRepoRemoveParams,
|
|
1464
|
+
isRepoRemoveResult,
|
|
1465
|
+
isRepoSyncAllParams,
|
|
1466
|
+
isRepoSyncAllResult,
|
|
1467
|
+
isRepoSyncParams,
|
|
1468
|
+
isRepoSyncResult,
|
|
783
1469
|
isRetryableErrorCode,
|
|
784
1470
|
isScheduledTask,
|
|
785
1471
|
isScheduledTaskType,
|
|
1472
|
+
isScheduledTaskV1,
|
|
1473
|
+
isScheduledTasksConfig,
|
|
1474
|
+
isScheduledTasksConfigV1,
|
|
786
1475
|
isSchedulerStatus,
|
|
787
1476
|
isServiceMeImageCompressOptions,
|
|
788
1477
|
isServiceMeImageCompressResult,
|
|
@@ -802,6 +1491,22 @@ function isServiceMeProjectExtractTemplateResult(value) {
|
|
|
802
1491
|
isSkillMutationResult,
|
|
803
1492
|
isSkillPublishableResult,
|
|
804
1493
|
isSkillReconcileResult,
|
|
1494
|
+
isSkillRepoConvertToSymlinkParams,
|
|
1495
|
+
isSkillRepoConvertToSymlinkResult,
|
|
1496
|
+
isSkillRepoDraftCommitResult,
|
|
1497
|
+
isSkillRepoDraftCreateResult,
|
|
1498
|
+
isSkillRepoDraftDeleteResult,
|
|
1499
|
+
isSkillRepoDraftListResult,
|
|
1500
|
+
isSkillRepoGetParams,
|
|
1501
|
+
isSkillRepoGetResult,
|
|
1502
|
+
isSkillRepoInstallParams,
|
|
1503
|
+
isSkillRepoInstallResult,
|
|
1504
|
+
isSkillRepoListLinkedParams,
|
|
1505
|
+
isSkillRepoListLinkedResult,
|
|
1506
|
+
isSkillRepoListParams,
|
|
1507
|
+
isSkillRepoListResult,
|
|
1508
|
+
isSkillRepoUninstallParams,
|
|
1509
|
+
isSkillRepoUninstallResult,
|
|
805
1510
|
isSystemHelloResult,
|
|
806
1511
|
isSystemPingResult,
|
|
807
1512
|
isSystemShutdownResult,
|
|
@@ -814,6 +1519,18 @@ function isServiceMeProjectExtractTemplateResult(value) {
|
|
|
814
1519
|
isTaskListRunningResult,
|
|
815
1520
|
isTaskOutputEventParams,
|
|
816
1521
|
isTaskStartedEventParams,
|
|
1522
|
+
isTaskWorkspaceRef,
|
|
817
1523
|
isToolCheckResult,
|
|
1524
|
+
isToolboxAddParams,
|
|
1525
|
+
isToolboxAddResult,
|
|
1526
|
+
isToolboxList,
|
|
1527
|
+
isToolboxListParams,
|
|
1528
|
+
isToolboxRemoveParams,
|
|
1529
|
+
isToolboxRemoveResult,
|
|
1530
|
+
isToolboxScope,
|
|
1531
|
+
isToolboxUpdateParams,
|
|
1532
|
+
isToolboxUpdateResult,
|
|
1533
|
+
migrateTaskV1ToV2,
|
|
1534
|
+
migrateV1ToV2,
|
|
818
1535
|
normalizeServicemeError
|
|
819
1536
|
});
|