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