@serviceme/devtools-protocol 0.4.13 → 2.0.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 +414 -7
- package/dist/index.d.ts +414 -7
- package/dist/index.js +528 -144
- package/dist/index.mjs +491 -144
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(index_exports, {
|
|
|
23
23
|
AUTH_PROVIDERS: () => AUTH_PROVIDERS,
|
|
24
24
|
BRIDGE_EVENTS: () => BRIDGE_EVENTS,
|
|
25
25
|
BRIDGE_METHODS: () => BRIDGE_METHODS,
|
|
26
|
+
COPILOT_CONTENT_METHOD_ALIASES: () => COPILOT_CONTENT_METHOD_ALIASES,
|
|
26
27
|
COPILOT_ERROR_CODES: () => COPILOT_ERROR_CODES,
|
|
27
28
|
DEFAULT_JSON_SORT_OPTIONS: () => DEFAULT_JSON_SORT_OPTIONS,
|
|
28
29
|
DEVICE_BINDING_STATES: () => DEVICE_BINDING_STATES,
|
|
@@ -67,6 +68,38 @@ __export(index_exports, {
|
|
|
67
68
|
isBridgeRequest: () => isBridgeRequest,
|
|
68
69
|
isBridgeResponse: () => isBridgeResponse,
|
|
69
70
|
isCliEnvelope: () => isCliEnvelope,
|
|
71
|
+
isCopilotContentApproveResult: () => isCopilotContentApproveResult,
|
|
72
|
+
isCopilotContentIntegrationStatusResult: () => isCopilotContentIntegrationStatusResult,
|
|
73
|
+
isCopilotContentMigrateLegacyResult: () => isCopilotContentMigrateLegacyResult,
|
|
74
|
+
isCopilotContentRestoreResult: () => isCopilotContentRestoreResult,
|
|
75
|
+
isCopilotContentStatusResult: () => isCopilotContentStatusResult,
|
|
76
|
+
isCopilotCustomizationViewPayload: () => isCopilotCustomizationViewPayload,
|
|
77
|
+
isCopilotCustomizationsListParams: () => isCopilotCustomizationsListParams,
|
|
78
|
+
isCopilotCustomizationsListResult: () => isCopilotCustomizationsListResult,
|
|
79
|
+
isCopilotLegacyMigrateParams: () => isCopilotLegacyMigrateParams,
|
|
80
|
+
isCopilotLegacyMigrateResult: () => isCopilotLegacyMigrateResult,
|
|
81
|
+
isCopilotLegacyPreviewParams: () => isCopilotLegacyPreviewParams,
|
|
82
|
+
isCopilotLegacyPreviewResult: () => isCopilotLegacyPreviewResult,
|
|
83
|
+
isCopilotPackageInstallParams: () => isCopilotPackageInstallParams,
|
|
84
|
+
isCopilotPackageInstallResult: () => isCopilotPackageInstallResult,
|
|
85
|
+
isCopilotPackageMoveParams: () => isCopilotPackageMoveParams,
|
|
86
|
+
isCopilotPackageMoveResult: () => isCopilotPackageMoveResult,
|
|
87
|
+
isCopilotPackageUninstallParams: () => isCopilotPackageUninstallParams,
|
|
88
|
+
isCopilotPackageUninstallResult: () => isCopilotPackageUninstallResult,
|
|
89
|
+
isCopilotPackageUpdateParams: () => isCopilotPackageUpdateParams,
|
|
90
|
+
isCopilotPackageUpdateResult: () => isCopilotPackageUpdateResult,
|
|
91
|
+
isCopilotPluginListParams: () => isCopilotPluginListParams,
|
|
92
|
+
isCopilotPluginListResult: () => isCopilotPluginListResult,
|
|
93
|
+
isCopilotPluginRegisterParams: () => isCopilotPluginRegisterParams,
|
|
94
|
+
isCopilotPluginRegisterResult: () => isCopilotPluginRegisterResult,
|
|
95
|
+
isCopilotPluginUnregisterParams: () => isCopilotPluginUnregisterParams,
|
|
96
|
+
isCopilotPluginUnregisterResult: () => isCopilotPluginUnregisterResult,
|
|
97
|
+
isCopilotSourceListParams: () => isCopilotSourceListParams,
|
|
98
|
+
isCopilotSourceListResult: () => isCopilotSourceListResult,
|
|
99
|
+
isCopilotSourceRemoveParams: () => isCopilotSourceRemoveParams,
|
|
100
|
+
isCopilotSourceRemoveResult: () => isCopilotSourceRemoveResult,
|
|
101
|
+
isCopilotUpdatePreviewParams: () => isCopilotUpdatePreviewParams,
|
|
102
|
+
isCopilotUpdatePreviewResult: () => isCopilotUpdatePreviewResult,
|
|
70
103
|
isDeviceBindingState: () => isDeviceBindingState,
|
|
71
104
|
isDeviceEnrollParams: () => isDeviceEnrollParams,
|
|
72
105
|
isDeviceEnrollResult: () => isDeviceEnrollResult,
|
|
@@ -84,6 +117,7 @@ __export(index_exports, {
|
|
|
84
117
|
isJsonSortOrder: () => isJsonSortOrder,
|
|
85
118
|
isJsonValidationResult: () => isJsonValidationResult,
|
|
86
119
|
isKnownEnvironmentTool: () => isKnownEnvironmentTool,
|
|
120
|
+
isRecord: () => isRecord4,
|
|
87
121
|
isRepoAddParams: () => isRepoAddParams,
|
|
88
122
|
isRepoAddResult: () => isRepoAddResult,
|
|
89
123
|
isRepoDisableParams: () => isRepoDisableParams,
|
|
@@ -138,6 +172,8 @@ __export(index_exports, {
|
|
|
138
172
|
isSkillRepoListLinkedResult: () => isSkillRepoListLinkedResult,
|
|
139
173
|
isSkillRepoListParams: () => isSkillRepoListParams,
|
|
140
174
|
isSkillRepoListResult: () => isSkillRepoListResult,
|
|
175
|
+
isSkillRepoSetEntryEnabledParams: () => isSkillRepoSetEntryEnabledParams,
|
|
176
|
+
isSkillRepoSetEntryEnabledResult: () => isSkillRepoSetEntryEnabledResult,
|
|
141
177
|
isSkillRepoUninstallParams: () => isSkillRepoUninstallParams,
|
|
142
178
|
isSkillRepoUninstallResult: () => isSkillRepoUninstallResult,
|
|
143
179
|
isSystemHelloResult: () => isSystemHelloResult,
|
|
@@ -165,6 +201,7 @@ __export(index_exports, {
|
|
|
165
201
|
isToolboxUpdateResult: () => isToolboxUpdateResult,
|
|
166
202
|
migrateTaskV1ToV2: () => migrateTaskV1ToV2,
|
|
167
203
|
migrateV1ToV2: () => migrateV1ToV2,
|
|
204
|
+
normalizeBridgeMethod: () => normalizeBridgeMethod,
|
|
168
205
|
normalizeServicemeError: () => normalizeServicemeError
|
|
169
206
|
});
|
|
170
207
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -354,8 +391,206 @@ function isAuthSwitchResult(value) {
|
|
|
354
391
|
return true;
|
|
355
392
|
}
|
|
356
393
|
|
|
357
|
-
// src/bridge-
|
|
394
|
+
// src/bridge-copilot-customizations.ts
|
|
395
|
+
var PRIVATE_RESULT_KEYS = /* @__PURE__ */ new Set([
|
|
396
|
+
"sourcePath",
|
|
397
|
+
"configPath",
|
|
398
|
+
"token",
|
|
399
|
+
"secret",
|
|
400
|
+
"approvalPayload"
|
|
401
|
+
]);
|
|
402
|
+
var SCOPES = /* @__PURE__ */ new Set(["workspace", "personal"]);
|
|
403
|
+
var KINDS = /* @__PURE__ */ new Set(["agent", "skill", "prompt", "instruction", "mcp", "hook"]);
|
|
404
|
+
var INTENTS = /* @__PURE__ */ new Set(["available", "selected", "moving", "removing"]);
|
|
405
|
+
var HEALTH = /* @__PURE__ */ new Set([
|
|
406
|
+
"healthy",
|
|
407
|
+
"missing",
|
|
408
|
+
"drifted",
|
|
409
|
+
"conflict",
|
|
410
|
+
"source-unavailable",
|
|
411
|
+
"unsupported"
|
|
412
|
+
]);
|
|
413
|
+
var GATES = /* @__PURE__ */ new Set(["ready", "approval-required", "configuration-required"]);
|
|
414
|
+
var STATUSES = /* @__PURE__ */ new Set(["healthy", "action-required", "blocked", "not-enabled"]);
|
|
415
|
+
var SOURCE_TYPES = /* @__PURE__ */ new Set(["marketplace", "git", "local"]);
|
|
416
|
+
var UPDATE_CAPABILITIES = /* @__PURE__ */ new Set(["pinned", "live", "none"]);
|
|
358
417
|
function isRecord3(value) {
|
|
418
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
419
|
+
}
|
|
420
|
+
function isString(value) {
|
|
421
|
+
return typeof value === "string" && value.length > 0;
|
|
422
|
+
}
|
|
423
|
+
function isOptionalString(value) {
|
|
424
|
+
return value === void 0 || typeof value === "string";
|
|
425
|
+
}
|
|
426
|
+
function isStringArray2(value, allowEmpty = true) {
|
|
427
|
+
return Array.isArray(value) && (allowEmpty || value.length > 0) && value.every((entry) => isString(entry));
|
|
428
|
+
}
|
|
429
|
+
function hasPrivateResultKey(value) {
|
|
430
|
+
if (Array.isArray(value)) return value.some(hasPrivateResultKey);
|
|
431
|
+
if (!isRecord3(value)) return false;
|
|
432
|
+
return Object.entries(value).some(
|
|
433
|
+
([key, nested]) => PRIVATE_RESULT_KEYS.has(key) || hasPrivateResultKey(nested)
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
function isScope(value) {
|
|
437
|
+
return typeof value === "string" && SCOPES.has(value);
|
|
438
|
+
}
|
|
439
|
+
function hasOptionalWorkspaceDir(value) {
|
|
440
|
+
return value.workspaceDir === void 0 || isString(value.workspaceDir);
|
|
441
|
+
}
|
|
442
|
+
function hasRequiredWorkspaceDirForWorkspaceScope(value) {
|
|
443
|
+
return value.scope !== "workspace" || isString(value.workspaceDir);
|
|
444
|
+
}
|
|
445
|
+
function isArtifactState(value) {
|
|
446
|
+
return isRecord3(value) && typeof value.intent === "string" && INTENTS.has(value.intent) && typeof value.health === "string" && HEALTH.has(value.health) && typeof value.gate === "string" && GATES.has(value.gate);
|
|
447
|
+
}
|
|
448
|
+
function isArtifactSummary(value) {
|
|
449
|
+
return isRecord3(value) && isString(value.id) && isString(value.packageId) && typeof value.kind === "string" && KINDS.has(value.kind) && isString(value.displayName) && isOptionalString(value.description) && (value.installStrategy === "link" || value.installStrategy === "generated-config" || value.installStrategy === "approval-gated") && (value.risk === "none" || value.risk === "review-required");
|
|
450
|
+
}
|
|
451
|
+
function isInstallation(value) {
|
|
452
|
+
return isRecord3(value) && isString(value.packageId) && isScope(value.scope) && isStringArray2(value.selectedArtifactIds) && isOptionalString(value.pinnedVersion);
|
|
453
|
+
}
|
|
454
|
+
function isDefinition(value) {
|
|
455
|
+
return isRecord3(value) && isString(value.id) && isString(value.sourceId) && isString(value.displayName) && isOptionalString(value.description) && isOptionalString(value.version) && Array.isArray(value.artifacts) && value.artifacts.every(isArtifactSummary);
|
|
456
|
+
}
|
|
457
|
+
function isArtifactView(value) {
|
|
458
|
+
return isRecord3(value) && isArtifactSummary(value.artifact) && isArtifactState(value.state);
|
|
459
|
+
}
|
|
460
|
+
function isPackageView(value) {
|
|
461
|
+
return isRecord3(value) && isDefinition(value.definition) && isInstallation(value.installation) && Array.isArray(value.artifacts) && value.artifacts.every(isArtifactView) && Number.isInteger(value.selectedArtifactCount) && value.selectedArtifactCount >= 0 && typeof value.status === "string" && STATUSES.has(value.status);
|
|
462
|
+
}
|
|
463
|
+
function isSourceView(value) {
|
|
464
|
+
return isRecord3(value) && isString(value.id) && (value.type === "marketplace" || value.type === "git" || value.type === "local") && isString(value.displayName) && (value.updateCapability === "pinned" || value.updateCapability === "live" || value.updateCapability === "none") && Array.isArray(value.packages) && value.packages.every(isPackageView);
|
|
465
|
+
}
|
|
466
|
+
function isSourceRecord(value) {
|
|
467
|
+
return isRecord3(value) && isString(value.id) && typeof value.type === "string" && SOURCE_TYPES.has(value.type) && isString(value.displayName) && typeof value.updateCapability === "string" && UPDATE_CAPABILITIES.has(value.updateCapability) && typeof value.available === "boolean" && Array.isArray(value.declaredIn) && value.declaredIn.every((entry) => entry === "workspace" || entry === "personal");
|
|
468
|
+
}
|
|
469
|
+
function isUpdatePreview(value) {
|
|
470
|
+
return isRecord3(value) && isString(value.packageId) && isOptionalString(value.fromVersion) && isString(value.toVersion) && isStringArray2(value.addedArtifactIds) && isStringArray2(value.removedArtifactIds) && isStringArray2(value.changedArtifactIds) && isStringArray2(value.approvalInvalidatedArtifactIds);
|
|
471
|
+
}
|
|
472
|
+
function isCopilotCustomizationViewPayload(value) {
|
|
473
|
+
if (!isRecord3(value) || hasPrivateResultKey(value)) return false;
|
|
474
|
+
const summary = value.summary;
|
|
475
|
+
return isScope(value.scope) && isString(value.generatedAt) && Array.isArray(value.sources) && value.sources.every(isSourceView) && Array.isArray(value.packages) && value.packages.every(isPackageView) && Array.isArray(value.attention) && value.attention.every(isArtifactView) && isRecord3(summary) && Number.isInteger(summary.packageCount) && summary.packageCount >= 0 && Number.isInteger(summary.enabledArtifactCount) && summary.enabledArtifactCount >= 0 && Number.isInteger(summary.attentionCount) && summary.attentionCount >= 0 && (value.legacyMigration === void 0 || isRecord3(value.legacyMigration) && Number.isInteger(value.legacyMigration.count) && value.legacyMigration.count >= 0 && value.legacyMigration.sourceLabel === "~/.agents");
|
|
476
|
+
}
|
|
477
|
+
function isCopilotCustomizationsListParams(value) {
|
|
478
|
+
return isRecord3(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value);
|
|
479
|
+
}
|
|
480
|
+
function isAvailablePackage(value) {
|
|
481
|
+
return isRecord3(value) && isString(value.packageId) && isString(value.sourceId) && isString(value.displayName) && isOptionalString(value.description) && isOptionalString(value.version) && Array.isArray(value.artifacts) && value.artifacts.every(isArtifactSummary) && Array.isArray(value.installedScopes) && value.installedScopes.every(isScope);
|
|
482
|
+
}
|
|
483
|
+
function isCopilotCustomizationsListResult(value) {
|
|
484
|
+
if (!isRecord3(value) || hasPrivateResultKey(value) || !isCopilotCustomizationViewPayload(value.view)) {
|
|
485
|
+
return false;
|
|
486
|
+
}
|
|
487
|
+
return value.availablePackages === void 0 || Array.isArray(value.availablePackages) && value.availablePackages.every(isAvailablePackage);
|
|
488
|
+
}
|
|
489
|
+
function isCopilotPackageInstallParams(value) {
|
|
490
|
+
return isRecord3(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && hasRequiredWorkspaceDirForWorkspaceScope(value) && isString(value.sourceId) && isString(value.packageId) && isStringArray2(value.artifactIds, false) && isOptionalString(value.pinnedVersion) && (value.localMode === void 0 || value.localMode === "live" || value.localMode === "private-workspace-override");
|
|
491
|
+
}
|
|
492
|
+
function isCopilotPackageUpdateParams(value) {
|
|
493
|
+
return isRecord3(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && hasRequiredWorkspaceDirForWorkspaceScope(value) && isString(value.packageId) && isStringArray2(value.artifactIds, false) && isOptionalString(value.pinnedVersion);
|
|
494
|
+
}
|
|
495
|
+
function isCopilotPackageUninstallParams(value) {
|
|
496
|
+
return isRecord3(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && hasRequiredWorkspaceDirForWorkspaceScope(value) && isString(value.packageId);
|
|
497
|
+
}
|
|
498
|
+
function isCopilotPackageMoveParams(value) {
|
|
499
|
+
return isRecord3(value) && hasOptionalWorkspaceDir(value) && isString(value.packageId) && isScope(value.from) && isScope(value.to) && value.from !== value.to && isString(value.workspaceDir);
|
|
500
|
+
}
|
|
501
|
+
function isCopilotLegacyPreviewParams(value) {
|
|
502
|
+
return isRecord3(value) && hasOptionalWorkspaceDir(value);
|
|
503
|
+
}
|
|
504
|
+
function isCopilotLegacyMigrateParams(value) {
|
|
505
|
+
return isRecord3(value) && hasOptionalWorkspaceDir(value) && isStringArray2(value.artifactIds, false);
|
|
506
|
+
}
|
|
507
|
+
function isCopilotSourceListParams(value) {
|
|
508
|
+
return isRecord3(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value);
|
|
509
|
+
}
|
|
510
|
+
function isCopilotSourceListResult(value) {
|
|
511
|
+
return isRecord3(value) && !hasPrivateResultKey(value) && Array.isArray(value.sources) && value.sources.every(isSourceRecord);
|
|
512
|
+
}
|
|
513
|
+
function isCopilotSourceRemoveParams(value) {
|
|
514
|
+
return isRecord3(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && isString(value.sourceId);
|
|
515
|
+
}
|
|
516
|
+
function isCopilotSourceRemoveResult(value) {
|
|
517
|
+
return isRecord3(value) && !hasPrivateResultKey(value) && value.removed === true;
|
|
518
|
+
}
|
|
519
|
+
function isCopilotUpdatePreviewParams(value) {
|
|
520
|
+
return isRecord3(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && isString(value.packageId) && isString(value.revision);
|
|
521
|
+
}
|
|
522
|
+
function isCopilotUpdatePreviewResult(value) {
|
|
523
|
+
return isRecord3(value) && !hasPrivateResultKey(value) && isUpdatePreview(value.preview);
|
|
524
|
+
}
|
|
525
|
+
function isCopilotLegacyPreviewResult(value) {
|
|
526
|
+
return isRecord3(value) && !hasPrivateResultKey(value) && value.sourceLabel === "~/.agents" && Number.isInteger(value.count) && value.count >= 0 && Array.isArray(value.artifacts) && value.artifacts.every(isArtifactSummary);
|
|
527
|
+
}
|
|
528
|
+
var isCopilotPackageInstallResult = isCopilotCustomizationsListResult;
|
|
529
|
+
var isCopilotPackageUpdateResult = isCopilotCustomizationsListResult;
|
|
530
|
+
var isCopilotPackageUninstallResult = isCopilotCustomizationsListResult;
|
|
531
|
+
var isCopilotPackageMoveResult = isCopilotCustomizationsListResult;
|
|
532
|
+
var isCopilotLegacyMigrateResult = isCopilotCustomizationsListResult;
|
|
533
|
+
|
|
534
|
+
// src/json.ts
|
|
535
|
+
var JSON_SORT_ALGORITHMS = [
|
|
536
|
+
"default",
|
|
537
|
+
"keyLength",
|
|
538
|
+
"alphaNum",
|
|
539
|
+
"values",
|
|
540
|
+
"type"
|
|
541
|
+
];
|
|
542
|
+
var JSON_SORT_ORDERS = ["asc", "desc"];
|
|
543
|
+
var DEFAULT_JSON_SORT_OPTIONS = {
|
|
544
|
+
sortOrder: "asc",
|
|
545
|
+
sortAlgo: "default"
|
|
546
|
+
};
|
|
547
|
+
function isRecord4(value) {
|
|
548
|
+
return typeof value === "object" && value !== null;
|
|
549
|
+
}
|
|
550
|
+
function isJsonSortAlgorithm(value) {
|
|
551
|
+
return typeof value === "string" && JSON_SORT_ALGORITHMS.includes(value);
|
|
552
|
+
}
|
|
553
|
+
function isJsonSortOrder(value) {
|
|
554
|
+
return typeof value === "string" && JSON_SORT_ORDERS.includes(value);
|
|
555
|
+
}
|
|
556
|
+
function isJsonSortOptions(value) {
|
|
557
|
+
return isRecord4(value) && isJsonSortOrder(value.sortOrder) && isJsonSortAlgorithm(value.sortAlgo);
|
|
558
|
+
}
|
|
559
|
+
function isJsonValidationResult(value) {
|
|
560
|
+
return isRecord4(value) && typeof value.valid === "boolean" && (value.error === void 0 || typeof value.error === "string");
|
|
561
|
+
}
|
|
562
|
+
function isJsonOutputResult(value) {
|
|
563
|
+
return isRecord4(value) && typeof value.output === "string";
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
// src/bridge-copilot-plugins.ts
|
|
567
|
+
var SCOPES2 = /* @__PURE__ */ new Set(["workspace", "personal"]);
|
|
568
|
+
function isOptionalScope(value) {
|
|
569
|
+
return value === void 0 || typeof value === "string" && SCOPES2.has(value);
|
|
570
|
+
}
|
|
571
|
+
function isScopeArray(value) {
|
|
572
|
+
return Array.isArray(value) && value.every((s) => typeof s === "string" && SCOPES2.has(s));
|
|
573
|
+
}
|
|
574
|
+
function isRegistration(value) {
|
|
575
|
+
return isRecord4(value) && typeof value.registrationId === "string" && typeof value.repoId === "string" && typeof value.pluginId === "string" && (value.displayName === void 0 || typeof value.displayName === "string") && (value.version === void 0 || typeof value.version === "string") && isScopeArray(value.scopes) && (value.enabled === void 0 || typeof value.enabled === "boolean") && Array.isArray(value.mcpServers) && value.mcpServers.every((s) => typeof s === "string") && typeof value.hasExtensions === "boolean";
|
|
576
|
+
}
|
|
577
|
+
function isCopilotPluginListParams(value) {
|
|
578
|
+
return isRecord4(value);
|
|
579
|
+
}
|
|
580
|
+
function isCopilotPluginListResult(value) {
|
|
581
|
+
return isRecord4(value) && Array.isArray(value.plugins) && value.plugins.every(isRegistration);
|
|
582
|
+
}
|
|
583
|
+
function isCopilotPluginRegisterParams(value) {
|
|
584
|
+
return isRecord4(value) && isOptionalScope(value.scope) && (value.workspaceDir === void 0 || typeof value.workspaceDir === "string") && typeof value.repoId === "string" && typeof value.pluginId === "string";
|
|
585
|
+
}
|
|
586
|
+
var isCopilotPluginRegisterResult = isCopilotPluginListResult;
|
|
587
|
+
function isCopilotPluginUnregisterParams(value) {
|
|
588
|
+
return isRecord4(value) && isOptionalScope(value.scope) && (value.workspaceDir === void 0 || typeof value.workspaceDir === "string") && typeof value.registrationId === "string";
|
|
589
|
+
}
|
|
590
|
+
var isCopilotPluginUnregisterResult = isCopilotPluginListResult;
|
|
591
|
+
|
|
592
|
+
// src/bridge-skill-repo.ts
|
|
593
|
+
function isRecord5(value) {
|
|
359
594
|
return typeof value === "object" && value !== null;
|
|
360
595
|
}
|
|
361
596
|
function isStringOrUndefined2(value) {
|
|
@@ -383,7 +618,7 @@ function isLinkMode(value) {
|
|
|
383
618
|
return value === "symlink" || value === "junction" || value === "copy";
|
|
384
619
|
}
|
|
385
620
|
function isRepoEntry(value) {
|
|
386
|
-
if (!
|
|
621
|
+
if (!isRecord5(value)) return false;
|
|
387
622
|
if (typeof value.id !== "string") return false;
|
|
388
623
|
if (typeof value.name !== "string") return false;
|
|
389
624
|
if (typeof value.url !== "string") return false;
|
|
@@ -407,7 +642,7 @@ function isRepoEntry(value) {
|
|
|
407
642
|
return true;
|
|
408
643
|
}
|
|
409
644
|
function isSkillEntry(value) {
|
|
410
|
-
if (!
|
|
645
|
+
if (!isRecord5(value)) return false;
|
|
411
646
|
if (typeof value.repoId !== "string") return false;
|
|
412
647
|
if (typeof value.name !== "string") return false;
|
|
413
648
|
if (value.kind !== "skill" && value.kind !== "agent") return false;
|
|
@@ -420,108 +655,155 @@ function isSkillEntry(value) {
|
|
|
420
655
|
return true;
|
|
421
656
|
}
|
|
422
657
|
function isSkillFile(value) {
|
|
423
|
-
return
|
|
658
|
+
return isRecord5(value) && typeof value.path === "string" && typeof value.content === "string";
|
|
424
659
|
}
|
|
425
660
|
function isLinkedSkill(value) {
|
|
426
|
-
return
|
|
661
|
+
return isRecord5(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.linkPath === "string" && typeof value.targetPath === "string" && isLinkMode(value.mode) && isLinkScope(value.scope);
|
|
427
662
|
}
|
|
428
663
|
function isSyncPull(value) {
|
|
429
|
-
return
|
|
664
|
+
return isRecord5(value) && typeof value.repoId === "string" && (value.status === "ok" || value.status === "error");
|
|
665
|
+
}
|
|
666
|
+
function isCopilotContentStatus(value) {
|
|
667
|
+
return value === "restored" || value === "adopted" || value === "pending_approval" || value === "missing_source" || value === "conflict" || value === "drifted";
|
|
668
|
+
}
|
|
669
|
+
function isCopilotContentEntry(value) {
|
|
670
|
+
if (!isRecord5(value)) return false;
|
|
671
|
+
if (typeof value.identity !== "string") return false;
|
|
672
|
+
if (!isCopilotContentStatus(value.status)) return false;
|
|
673
|
+
if (value.message !== void 0 && typeof value.message !== "string") return false;
|
|
674
|
+
return true;
|
|
675
|
+
}
|
|
676
|
+
function isCopilotContentIntegrationKind(value) {
|
|
677
|
+
return value === "mcp" || value === "hook";
|
|
678
|
+
}
|
|
679
|
+
function isCopilotContentIntegrationStatus(value) {
|
|
680
|
+
return value === "active" || value === "inactive" || value === "pending_approval" || value === "missing_local_configuration";
|
|
681
|
+
}
|
|
682
|
+
function isCopilotContentIntegration(value) {
|
|
683
|
+
if (!isRecord5(value)) return false;
|
|
684
|
+
if (typeof value.identity !== "string") return false;
|
|
685
|
+
if (!isCopilotContentIntegrationKind(value.kind)) return false;
|
|
686
|
+
if (typeof value.configPath !== "string") return false;
|
|
687
|
+
if (!Array.isArray(value.names) || value.names.some((name) => typeof name !== "string")) {
|
|
688
|
+
return false;
|
|
689
|
+
}
|
|
690
|
+
return isCopilotContentIntegrationStatus(value.status);
|
|
430
691
|
}
|
|
431
692
|
function isSkillRepoListResult(value) {
|
|
432
|
-
return
|
|
693
|
+
return isRecord5(value) && Array.isArray(value.entries) && value.entries.every(isSkillEntry);
|
|
433
694
|
}
|
|
434
695
|
function isSkillRepoGetResult(value) {
|
|
435
|
-
return
|
|
696
|
+
return isRecord5(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);
|
|
436
697
|
}
|
|
437
698
|
function isSkillRepoInstallResult(value) {
|
|
438
|
-
return
|
|
699
|
+
return isRecord5(value) && isLinkMode(value.mode) && typeof value.linkPath === "string" && typeof value.targetPath === "string";
|
|
439
700
|
}
|
|
440
701
|
function isSkillRepoConvertToSymlinkResult(value) {
|
|
441
|
-
return
|
|
702
|
+
return isRecord5(value) && isLinkMode(value.mode) && typeof value.linkPath === "string" && typeof value.targetPath === "string";
|
|
442
703
|
}
|
|
443
704
|
function isSkillRepoUninstallResult(value) {
|
|
444
|
-
return
|
|
705
|
+
return isRecord5(value) && value.removed === true;
|
|
706
|
+
}
|
|
707
|
+
function isSkillRepoSetEntryEnabledResult(value) {
|
|
708
|
+
return isRecord5(value) && typeof value.enabled === "boolean";
|
|
445
709
|
}
|
|
446
710
|
function isSkillRepoListLinkedResult(value) {
|
|
447
|
-
return
|
|
711
|
+
return isRecord5(value) && Array.isArray(value.links) && value.links.every(isLinkedSkill);
|
|
448
712
|
}
|
|
449
713
|
function isSkillRepoDraftCreateResult(value) {
|
|
450
|
-
return
|
|
714
|
+
return isRecord5(value) && typeof value.id === "string";
|
|
451
715
|
}
|
|
452
716
|
function isSkillRepoDraftCommitResult(value) {
|
|
453
|
-
return
|
|
717
|
+
return isRecord5(value) && typeof value.repoId === "string" && typeof value.skillName === "string" && typeof value.commitSha === "string" && isStringOrUndefined2(value.pushedRef) && isStringOrUndefined2(value.pushedSha);
|
|
454
718
|
}
|
|
455
719
|
function isSkillRepoDraftListResult(value) {
|
|
456
|
-
return
|
|
457
|
-
(d) =>
|
|
720
|
+
return isRecord5(value) && Array.isArray(value.drafts) && value.drafts.every(
|
|
721
|
+
(d) => isRecord5(d) && typeof d.id === "string" && (d.kind === "skill" || d.kind === "agent") && typeof d.name === "string" && typeof d.description === "string" && typeof d.modifiedAt === "string"
|
|
458
722
|
);
|
|
459
723
|
}
|
|
460
724
|
function isSkillRepoDraftDeleteResult(value) {
|
|
461
|
-
return
|
|
725
|
+
return isRecord5(value) && value.deleted === true;
|
|
462
726
|
}
|
|
463
727
|
function isRepoListResult(value) {
|
|
464
|
-
return
|
|
728
|
+
return isRecord5(value) && Array.isArray(value.repos) && value.repos.every(isRepoEntry);
|
|
465
729
|
}
|
|
466
730
|
function isRepoAddResult(value) {
|
|
467
|
-
return
|
|
731
|
+
return isRecord5(value) && isRepoEntry(value.repo) && typeof value.branch === "string" && typeof value.cloned === "boolean";
|
|
468
732
|
}
|
|
469
733
|
function isRepoRemoveResult(value) {
|
|
470
|
-
return
|
|
734
|
+
return isRecord5(value) && value.removed === true;
|
|
471
735
|
}
|
|
472
736
|
function isRepoEnableResult(value) {
|
|
473
|
-
return
|
|
737
|
+
return isRecord5(value) && isRepoEntry(value.repo);
|
|
474
738
|
}
|
|
475
739
|
function isRepoDisableResult(value) {
|
|
476
|
-
return
|
|
740
|
+
return isRecord5(value) && isRepoEntry(value.repo);
|
|
477
741
|
}
|
|
478
742
|
function isRepoUpdateResult(value) {
|
|
479
|
-
return
|
|
743
|
+
return isRecord5(value) && isRepoEntry(value.repo);
|
|
480
744
|
}
|
|
481
745
|
function isRepoSyncResult(value) {
|
|
482
|
-
return
|
|
746
|
+
return isRecord5(value) && Array.isArray(value.pulls) && value.pulls.length >= 1 && value.pulls.every(isSyncPull);
|
|
483
747
|
}
|
|
484
748
|
function isRepoSyncAllResult(value) {
|
|
485
|
-
return
|
|
749
|
+
return isRecord5(value) && Array.isArray(value.pulls) && value.pulls.every(isSyncPull);
|
|
750
|
+
}
|
|
751
|
+
function isCopilotContentRestoreResult(value) {
|
|
752
|
+
return isRecord5(value) && typeof value.changed === "boolean" && Array.isArray(value.entries) && value.entries.every(isCopilotContentEntry);
|
|
753
|
+
}
|
|
754
|
+
function isCopilotContentStatusResult(value) {
|
|
755
|
+
return isCopilotContentRestoreResult(value);
|
|
756
|
+
}
|
|
757
|
+
function isCopilotContentApproveResult(value) {
|
|
758
|
+
return isCopilotContentRestoreResult(value);
|
|
759
|
+
}
|
|
760
|
+
function isCopilotContentMigrateLegacyResult(value) {
|
|
761
|
+
return isRecord5(value) && Array.isArray(value.entries) && value.entries.every(isCopilotContentEntry);
|
|
762
|
+
}
|
|
763
|
+
function isCopilotContentIntegrationStatusResult(value) {
|
|
764
|
+
return isRecord5(value) && Array.isArray(value.integrations) && value.integrations.every(isCopilotContentIntegration);
|
|
486
765
|
}
|
|
487
766
|
function isSkillRepoListParams(value) {
|
|
488
|
-
return
|
|
767
|
+
return isRecord5(value) && isStringOrUndefined2(value.repoId) && isSkillKindOrUndefined(value.kind) && isStringOrUndefined2(value.workspaceDir);
|
|
489
768
|
}
|
|
490
769
|
function isSkillRepoGetParams(value) {
|
|
491
|
-
return
|
|
770
|
+
return isRecord5(value) && typeof value.repoId === "string" && typeof value.name === "string";
|
|
492
771
|
}
|
|
493
772
|
function isSkillRepoInstallParams(value) {
|
|
494
|
-
return
|
|
773
|
+
return isRecord5(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkModeOrUndefined(value.mode) && isLinkScopeOrUndefined(value.scope);
|
|
495
774
|
}
|
|
496
775
|
function isSkillRepoConvertToSymlinkParams(value) {
|
|
497
|
-
return
|
|
776
|
+
return isRecord5(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkModeOrUndefined(value.mode) && isLinkScopeOrUndefined(value.scope);
|
|
498
777
|
}
|
|
499
778
|
function isSkillRepoUninstallParams(value) {
|
|
500
|
-
return
|
|
779
|
+
return isRecord5(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkScopeOrUndefined(value.scope);
|
|
780
|
+
}
|
|
781
|
+
function isSkillRepoSetEntryEnabledParams(value) {
|
|
782
|
+
return isRecord5(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.enabled === "boolean" && isSkillKindOrUndefined(value.kind) && isLinkScopeOrUndefined(value.scope) && (value.workspaceDir === void 0 || typeof value.workspaceDir === "string");
|
|
501
783
|
}
|
|
502
784
|
function isSkillRepoListLinkedParams(value) {
|
|
503
|
-
return
|
|
785
|
+
return isRecord5(value) && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkScopeFilterOrUndefined(value.scope);
|
|
504
786
|
}
|
|
505
787
|
function isRepoListParams(value) {
|
|
506
|
-
return
|
|
788
|
+
return isRecord5(value) && (value.source === void 0 || value.source === "default" || value.source === "user");
|
|
507
789
|
}
|
|
508
790
|
function isRepoAddParams(value) {
|
|
509
|
-
return
|
|
791
|
+
return isRecord5(value) && typeof value.url === "string" && isStringOrUndefined2(value.branch) && isStringOrUndefined2(value.name) && isBooleanOrUndefined(value.useProxy);
|
|
510
792
|
}
|
|
511
793
|
function isRepoRemoveParams(value) {
|
|
512
|
-
return
|
|
794
|
+
return isRecord5(value) && typeof value.repoId === "string";
|
|
513
795
|
}
|
|
514
796
|
function isRepoEnableParams(value) {
|
|
515
|
-
return
|
|
797
|
+
return isRecord5(value) && typeof value.repoId === "string";
|
|
516
798
|
}
|
|
517
799
|
function isRepoDisableParams(value) {
|
|
518
|
-
return
|
|
800
|
+
return isRecord5(value) && typeof value.repoId === "string";
|
|
519
801
|
}
|
|
520
802
|
function isRepoSyncParams(value) {
|
|
521
|
-
return
|
|
803
|
+
return isRecord5(value) && typeof value.repoId === "string";
|
|
522
804
|
}
|
|
523
805
|
function isRepoSyncAllParams(value) {
|
|
524
|
-
return
|
|
806
|
+
return isRecord5(value);
|
|
525
807
|
}
|
|
526
808
|
|
|
527
809
|
// src/device.ts
|
|
@@ -531,7 +813,7 @@ var DEVICE_BINDING_STATES = [
|
|
|
531
813
|
"claimed",
|
|
532
814
|
"expired"
|
|
533
815
|
];
|
|
534
|
-
function
|
|
816
|
+
function isRecord6(value) {
|
|
535
817
|
return typeof value === "object" && value !== null;
|
|
536
818
|
}
|
|
537
819
|
function isStringOrUndefined3(value) {
|
|
@@ -541,7 +823,7 @@ function isDeviceBindingState(value) {
|
|
|
541
823
|
return value === "anonymous" || value === "pending" || value === "claimed" || value === "expired";
|
|
542
824
|
}
|
|
543
825
|
function isDeviceIdentityState(value) {
|
|
544
|
-
if (!
|
|
826
|
+
if (!isRecord6(value)) return false;
|
|
545
827
|
if (typeof value.publicId !== "string") return false;
|
|
546
828
|
if (value.publicId.length === 0) return false;
|
|
547
829
|
if (typeof value.secretVersion !== "number") return false;
|
|
@@ -551,7 +833,7 @@ function isDeviceIdentityState(value) {
|
|
|
551
833
|
return true;
|
|
552
834
|
}
|
|
553
835
|
function isDeviceMetadata(value) {
|
|
554
|
-
if (!
|
|
836
|
+
if (!isRecord6(value)) return false;
|
|
555
837
|
if (typeof value.installationId !== "string") return false;
|
|
556
838
|
if (value.installationId.length === 0) return false;
|
|
557
839
|
if (typeof value.machineId !== "string") return false;
|
|
@@ -564,7 +846,7 @@ function isDeviceMetadata(value) {
|
|
|
564
846
|
return true;
|
|
565
847
|
}
|
|
566
848
|
function isDeviceStatus(value) {
|
|
567
|
-
if (!
|
|
849
|
+
if (!isRecord6(value)) return false;
|
|
568
850
|
if (!isDeviceBindingState(value.bindingState)) return false;
|
|
569
851
|
if (value.identity !== void 0 && !isDeviceIdentityState(value.identity)) {
|
|
570
852
|
return false;
|
|
@@ -577,10 +859,10 @@ function isDeviceStatus(value) {
|
|
|
577
859
|
return true;
|
|
578
860
|
}
|
|
579
861
|
function isDeviceEnrollParams(value) {
|
|
580
|
-
return
|
|
862
|
+
return isRecord6(value) && (value.force === void 0 || typeof value.force === "boolean") && (value.requireAuth === void 0 || typeof value.requireAuth === "boolean");
|
|
581
863
|
}
|
|
582
864
|
function isDeviceEnrollResult(value) {
|
|
583
|
-
if (!
|
|
865
|
+
if (!isRecord6(value)) return false;
|
|
584
866
|
if (typeof value.publicId !== "string") return false;
|
|
585
867
|
if (value.publicId.length === 0) return false;
|
|
586
868
|
if (!isDeviceBindingState(value.bindingState)) return false;
|
|
@@ -588,14 +870,14 @@ function isDeviceEnrollResult(value) {
|
|
|
588
870
|
return true;
|
|
589
871
|
}
|
|
590
872
|
function isDeviceRotateSecretParams(value) {
|
|
591
|
-
if (!
|
|
873
|
+
if (!isRecord6(value)) return false;
|
|
592
874
|
if (value.gracePeriodDays !== void 0 && (typeof value.gracePeriodDays !== "number" || !Number.isInteger(value.gracePeriodDays) || value.gracePeriodDays < 0 || value.gracePeriodDays > 365)) {
|
|
593
875
|
return false;
|
|
594
876
|
}
|
|
595
877
|
return true;
|
|
596
878
|
}
|
|
597
879
|
function isDeviceRotateSecretResult(value) {
|
|
598
|
-
if (!
|
|
880
|
+
if (!isRecord6(value)) return false;
|
|
599
881
|
if (typeof value.publicId !== "string") return false;
|
|
600
882
|
if (value.publicId.length === 0) return false;
|
|
601
883
|
if (typeof value.secretVersion !== "number") return false;
|
|
@@ -622,18 +904,18 @@ var VALID_TERMINAL_STATUSES = [
|
|
|
622
904
|
"timeout",
|
|
623
905
|
"cancelled"
|
|
624
906
|
];
|
|
625
|
-
function
|
|
907
|
+
function isRecord7(value) {
|
|
626
908
|
return typeof value === "object" && value !== null;
|
|
627
909
|
}
|
|
628
910
|
function isScheduledTaskType(value) {
|
|
629
911
|
return typeof value === "string" && VALID_TASK_TYPES.includes(value);
|
|
630
912
|
}
|
|
631
913
|
function isScheduledTaskV1(value) {
|
|
632
|
-
if (!
|
|
633
|
-
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) &&
|
|
914
|
+
if (!isRecord7(value)) return false;
|
|
915
|
+
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) && isRecord7(value.payload) && typeof value.createdAt === "string" && typeof value.updatedAt === "string";
|
|
634
916
|
}
|
|
635
917
|
function isTaskWorkspaceRef(value) {
|
|
636
|
-
if (!
|
|
918
|
+
if (!isRecord7(value)) return false;
|
|
637
919
|
if (typeof value.path !== "string" || value.path.length === 0) return false;
|
|
638
920
|
if (typeof value.name !== "string" || value.name.length === 0) return false;
|
|
639
921
|
if (value.gitRemote !== void 0 && typeof value.gitRemote !== "string") {
|
|
@@ -652,48 +934,48 @@ function isScheduledTask(value) {
|
|
|
652
934
|
return isTaskWorkspaceRef(value.workspace);
|
|
653
935
|
}
|
|
654
936
|
function isScheduledTasksConfig(value) {
|
|
655
|
-
if (!
|
|
937
|
+
if (!isRecord7(value)) return false;
|
|
656
938
|
if (value.version !== 2) return false;
|
|
657
939
|
if (!Array.isArray(value.tasks)) return false;
|
|
658
940
|
return value.tasks.every((t) => isScheduledTask(t));
|
|
659
941
|
}
|
|
660
942
|
function isScheduledTasksConfigV1(value) {
|
|
661
|
-
if (!
|
|
943
|
+
if (!isRecord7(value)) return false;
|
|
662
944
|
if (value.version !== 1) return false;
|
|
663
945
|
if (!Array.isArray(value.tasks)) return false;
|
|
664
946
|
return value.tasks.every((t) => isScheduledTaskV1(t));
|
|
665
947
|
}
|
|
666
948
|
function isTaskExecutionLog(value) {
|
|
667
|
-
if (!
|
|
949
|
+
if (!isRecord7(value)) return false;
|
|
668
950
|
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);
|
|
669
951
|
}
|
|
670
952
|
function isSchedulerStatus(value) {
|
|
671
|
-
if (!
|
|
953
|
+
if (!isRecord7(value)) return false;
|
|
672
954
|
return typeof value.running === "boolean" && typeof value.tasksRegistered === "number" && typeof value.workspacePath === "string";
|
|
673
955
|
}
|
|
674
956
|
function isTaskExecuteResult(value) {
|
|
675
|
-
return
|
|
957
|
+
return isRecord7(value) && typeof value.executionId === "string" && value.accepted === true;
|
|
676
958
|
}
|
|
677
959
|
function isTaskCancelResult(value) {
|
|
678
|
-
return
|
|
960
|
+
return isRecord7(value) && typeof value.executionId === "string" && typeof value.cancelled === "boolean";
|
|
679
961
|
}
|
|
680
962
|
function isTaskListRunningResult(value) {
|
|
681
|
-
return
|
|
963
|
+
return isRecord7(value) && Array.isArray(value.executions);
|
|
682
964
|
}
|
|
683
965
|
function isTaskStartedEventParams(value) {
|
|
684
|
-
return
|
|
966
|
+
return isRecord7(value) && typeof value.executionId === "string" && typeof value.taskId === "string" && typeof value.startedAt === "string";
|
|
685
967
|
}
|
|
686
968
|
function isTaskOutputEventParams(value) {
|
|
687
|
-
return
|
|
969
|
+
return isRecord7(value) && typeof value.executionId === "string" && (value.stream === "stdout" || value.stream === "stderr") && typeof value.data === "string";
|
|
688
970
|
}
|
|
689
971
|
function isTaskCompletedEventParams(value) {
|
|
690
|
-
return
|
|
972
|
+
return isRecord7(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
|
|
691
973
|
}
|
|
692
974
|
function isTaskFailedEventParams(value) {
|
|
693
|
-
return
|
|
975
|
+
return isRecord7(value) && typeof value.executionId === "string" && (value.status === "failure" || value.status === "timeout") && (value.reason === "error" || value.reason === "timeout") && isTaskExecutionLog(value.log);
|
|
694
976
|
}
|
|
695
977
|
function isTaskCancelledEventParams(value) {
|
|
696
|
-
return
|
|
978
|
+
return isRecord7(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
|
|
697
979
|
}
|
|
698
980
|
function isAgentSessionStatus(value) {
|
|
699
981
|
return value === "idle" || value === "running" || value === "needs-input" || value === "completed" || value === "failed" || value === "aborted";
|
|
@@ -727,7 +1009,7 @@ function migrateV1ToV2(v1Config, workspace) {
|
|
|
727
1009
|
|
|
728
1010
|
// src/toolbox.ts
|
|
729
1011
|
var TOOLBOX_SCOPES = ["user", "workspace"];
|
|
730
|
-
function
|
|
1012
|
+
function isRecord8(value) {
|
|
731
1013
|
return typeof value === "object" && value !== null;
|
|
732
1014
|
}
|
|
733
1015
|
function isStringOrUndefined4(value) {
|
|
@@ -740,7 +1022,7 @@ function isToolboxScope(value) {
|
|
|
740
1022
|
return value === "user" || value === "workspace";
|
|
741
1023
|
}
|
|
742
1024
|
function isExternalTool(value) {
|
|
743
|
-
if (!
|
|
1025
|
+
if (!isRecord8(value)) return false;
|
|
744
1026
|
if (typeof value.id !== "string") return false;
|
|
745
1027
|
if (value.id.length === 0) return false;
|
|
746
1028
|
if (typeof value.name !== "string") return false;
|
|
@@ -758,7 +1040,7 @@ function isExternalTool(value) {
|
|
|
758
1040
|
return true;
|
|
759
1041
|
}
|
|
760
1042
|
function isExternalToolPatch(value) {
|
|
761
|
-
if (!
|
|
1043
|
+
if (!isRecord8(value)) return false;
|
|
762
1044
|
if (value.name !== void 0) {
|
|
763
1045
|
if (typeof value.name !== "string" || value.name.length === 0) return false;
|
|
764
1046
|
}
|
|
@@ -778,7 +1060,7 @@ function isExternalToolPatch(value) {
|
|
|
778
1060
|
return true;
|
|
779
1061
|
}
|
|
780
1062
|
function isToolboxList(value) {
|
|
781
|
-
if (!
|
|
1063
|
+
if (!isRecord8(value)) return false;
|
|
782
1064
|
if (!isToolboxScope(value.scope)) return false;
|
|
783
1065
|
if (!Array.isArray(value.tools)) return false;
|
|
784
1066
|
for (const tool of value.tools) {
|
|
@@ -787,26 +1069,26 @@ function isToolboxList(value) {
|
|
|
787
1069
|
return true;
|
|
788
1070
|
}
|
|
789
1071
|
function isToolboxListParams(value) {
|
|
790
|
-
return
|
|
1072
|
+
return isRecord8(value) && (value.scope === void 0 || isToolboxScope(value.scope));
|
|
791
1073
|
}
|
|
792
1074
|
function isToolboxAddParams(value) {
|
|
793
1075
|
return isExternalTool(value);
|
|
794
1076
|
}
|
|
795
1077
|
function isToolboxAddResult(value) {
|
|
796
|
-
if (!
|
|
1078
|
+
if (!isRecord8(value)) return false;
|
|
797
1079
|
if (!isToolboxScope(value.scope)) return false;
|
|
798
1080
|
if (!isExternalTool(value.tool)) return false;
|
|
799
1081
|
return true;
|
|
800
1082
|
}
|
|
801
1083
|
function isToolboxRemoveParams(value) {
|
|
802
|
-
if (!
|
|
1084
|
+
if (!isRecord8(value)) return false;
|
|
803
1085
|
if (typeof value.id !== "string") return false;
|
|
804
1086
|
if (value.id.length === 0) return false;
|
|
805
1087
|
if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
|
|
806
1088
|
return true;
|
|
807
1089
|
}
|
|
808
1090
|
function isToolboxRemoveResult(value) {
|
|
809
|
-
if (!
|
|
1091
|
+
if (!isRecord8(value)) return false;
|
|
810
1092
|
if (!isToolboxScope(value.scope)) return false;
|
|
811
1093
|
if (typeof value.toolId !== "string") return false;
|
|
812
1094
|
if (value.toolId.length === 0) return false;
|
|
@@ -814,7 +1096,7 @@ function isToolboxRemoveResult(value) {
|
|
|
814
1096
|
return true;
|
|
815
1097
|
}
|
|
816
1098
|
function isToolboxUpdateParams(value) {
|
|
817
|
-
if (!
|
|
1099
|
+
if (!isRecord8(value)) return false;
|
|
818
1100
|
if (typeof value.id !== "string") return false;
|
|
819
1101
|
if (value.id.length === 0) return false;
|
|
820
1102
|
if (!isExternalToolPatch(value.patch)) return false;
|
|
@@ -822,7 +1104,7 @@ function isToolboxUpdateParams(value) {
|
|
|
822
1104
|
return true;
|
|
823
1105
|
}
|
|
824
1106
|
function isToolboxUpdateResult(value) {
|
|
825
|
-
if (!
|
|
1107
|
+
if (!isRecord8(value)) return false;
|
|
826
1108
|
if (!isToolboxScope(value.scope)) return false;
|
|
827
1109
|
if (!isExternalTool(value.tool)) return false;
|
|
828
1110
|
return true;
|
|
@@ -830,14 +1112,14 @@ function isToolboxUpdateResult(value) {
|
|
|
830
1112
|
|
|
831
1113
|
// src/bridge.ts
|
|
832
1114
|
var SERVICEME_PROTOCOL_VERSION = 2;
|
|
833
|
-
function
|
|
1115
|
+
function isRecord9(value) {
|
|
834
1116
|
return typeof value === "object" && value !== null;
|
|
835
1117
|
}
|
|
836
1118
|
function isValidProtocolVersion(value) {
|
|
837
1119
|
return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= SERVICEME_PROTOCOL_VERSION;
|
|
838
1120
|
}
|
|
839
1121
|
function isBridgeCapabilities(value) {
|
|
840
|
-
return
|
|
1122
|
+
return isRecord9(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.copilotContent === void 0 || value.copilotContent === 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);
|
|
841
1123
|
}
|
|
842
1124
|
var BRIDGE_METHODS = [
|
|
843
1125
|
"system.hello",
|
|
@@ -846,11 +1128,23 @@ var BRIDGE_METHODS = [
|
|
|
846
1128
|
"task.execute",
|
|
847
1129
|
"task.cancel",
|
|
848
1130
|
"task.list-running",
|
|
1131
|
+
"copilotContent.list",
|
|
1132
|
+
"copilotContent.get",
|
|
1133
|
+
"copilotContent.install",
|
|
1134
|
+
"copilotContent.convertToSymlink",
|
|
1135
|
+
"copilotContent.uninstall",
|
|
1136
|
+
"copilotContent.setEntryEnabled",
|
|
1137
|
+
"copilotContent.listLinked",
|
|
1138
|
+
"copilotContent.draft.create",
|
|
1139
|
+
"copilotContent.draft.commit",
|
|
1140
|
+
"copilotContent.draft.list",
|
|
1141
|
+
"copilotContent.draft.delete",
|
|
849
1142
|
"skillRepo.list",
|
|
850
1143
|
"skillRepo.get",
|
|
851
1144
|
"skillRepo.install",
|
|
852
1145
|
"skillRepo.convertToSymlink",
|
|
853
1146
|
"skillRepo.uninstall",
|
|
1147
|
+
"skillRepo.setEntryEnabled",
|
|
854
1148
|
"skillRepo.listLinked",
|
|
855
1149
|
"skillRepo.draft.create",
|
|
856
1150
|
"skillRepo.draft.commit",
|
|
@@ -864,6 +1158,25 @@ var BRIDGE_METHODS = [
|
|
|
864
1158
|
"repo.update",
|
|
865
1159
|
"repo.sync",
|
|
866
1160
|
"repo.syncAll",
|
|
1161
|
+
"repo.resetParseCache",
|
|
1162
|
+
"copilotContent.status",
|
|
1163
|
+
"copilotContent.restore",
|
|
1164
|
+
"copilotContent.approve",
|
|
1165
|
+
"copilotContent.migrateLegacy",
|
|
1166
|
+
"copilotContent.integrationStatus",
|
|
1167
|
+
"copilotContent.customizations.list",
|
|
1168
|
+
"copilotContent.package.install",
|
|
1169
|
+
"copilotContent.package.update",
|
|
1170
|
+
"copilotContent.package.uninstall",
|
|
1171
|
+
"copilotContent.package.move",
|
|
1172
|
+
"copilotPlugin.list",
|
|
1173
|
+
"copilotPlugin.register",
|
|
1174
|
+
"copilotPlugin.unregister",
|
|
1175
|
+
"copilotContent.legacy.preview",
|
|
1176
|
+
"copilotContent.legacy.migrate",
|
|
1177
|
+
"copilotContent.sources.list",
|
|
1178
|
+
"copilotContent.sources.remove",
|
|
1179
|
+
"copilotContent.package.previewUpdate",
|
|
867
1180
|
"auth.status",
|
|
868
1181
|
"auth.login",
|
|
869
1182
|
"auth.logout",
|
|
@@ -877,6 +1190,22 @@ var BRIDGE_METHODS = [
|
|
|
877
1190
|
"toolbox.remove",
|
|
878
1191
|
"toolbox.update"
|
|
879
1192
|
];
|
|
1193
|
+
var COPILOT_CONTENT_METHOD_ALIASES = {
|
|
1194
|
+
"skillRepo.list": "copilotContent.list",
|
|
1195
|
+
"skillRepo.get": "copilotContent.get",
|
|
1196
|
+
"skillRepo.install": "copilotContent.install",
|
|
1197
|
+
"skillRepo.convertToSymlink": "copilotContent.convertToSymlink",
|
|
1198
|
+
"skillRepo.uninstall": "copilotContent.uninstall",
|
|
1199
|
+
"skillRepo.setEntryEnabled": "copilotContent.setEntryEnabled",
|
|
1200
|
+
"skillRepo.listLinked": "copilotContent.listLinked",
|
|
1201
|
+
"skillRepo.draft.create": "copilotContent.draft.create",
|
|
1202
|
+
"skillRepo.draft.commit": "copilotContent.draft.commit",
|
|
1203
|
+
"skillRepo.draft.list": "copilotContent.draft.list",
|
|
1204
|
+
"skillRepo.draft.delete": "copilotContent.draft.delete"
|
|
1205
|
+
};
|
|
1206
|
+
function normalizeBridgeMethod(method) {
|
|
1207
|
+
return COPILOT_CONTENT_METHOD_ALIASES[method] ?? method;
|
|
1208
|
+
}
|
|
880
1209
|
var BRIDGE_EVENTS = [
|
|
881
1210
|
"task.started",
|
|
882
1211
|
"task.output",
|
|
@@ -885,13 +1214,13 @@ var BRIDGE_EVENTS = [
|
|
|
885
1214
|
"task.cancelled"
|
|
886
1215
|
];
|
|
887
1216
|
function isSystemHelloResult(value) {
|
|
888
|
-
return
|
|
1217
|
+
return isRecord9(value) && typeof value.cliVersion === "string" && isValidProtocolVersion(value.protocolVersion) && isBridgeCapabilities(value.capabilities) && typeof value.pid === "number";
|
|
889
1218
|
}
|
|
890
1219
|
function isSystemPingResult(value) {
|
|
891
|
-
return
|
|
1220
|
+
return isRecord9(value) && typeof value.now === "string";
|
|
892
1221
|
}
|
|
893
1222
|
function isSystemShutdownResult(value) {
|
|
894
|
-
return
|
|
1223
|
+
return isRecord9(value) && value.shuttingDown === true;
|
|
895
1224
|
}
|
|
896
1225
|
function getBridgeResultValidator(method) {
|
|
897
1226
|
switch (method) {
|
|
@@ -907,24 +1236,37 @@ function getBridgeResultValidator(method) {
|
|
|
907
1236
|
return isTaskCancelResult;
|
|
908
1237
|
case "task.list-running":
|
|
909
1238
|
return isTaskListRunningResult;
|
|
1239
|
+
case "copilotContent.list":
|
|
910
1240
|
case "skillRepo.list":
|
|
911
1241
|
return isSkillRepoListResult;
|
|
1242
|
+
case "copilotContent.get":
|
|
912
1243
|
case "skillRepo.get":
|
|
913
1244
|
return isSkillRepoGetResult;
|
|
1245
|
+
case "copilotContent.install":
|
|
914
1246
|
case "skillRepo.install":
|
|
915
1247
|
return isSkillRepoInstallResult;
|
|
1248
|
+
case "copilotContent.convertToSymlink":
|
|
916
1249
|
case "skillRepo.convertToSymlink":
|
|
917
1250
|
return isSkillRepoConvertToSymlinkResult;
|
|
1251
|
+
case "copilotContent.uninstall":
|
|
918
1252
|
case "skillRepo.uninstall":
|
|
919
1253
|
return isSkillRepoUninstallResult;
|
|
1254
|
+
case "copilotContent.setEntryEnabled":
|
|
1255
|
+
case "skillRepo.setEntryEnabled":
|
|
1256
|
+
return isSkillRepoSetEntryEnabledResult;
|
|
1257
|
+
case "copilotContent.listLinked":
|
|
920
1258
|
case "skillRepo.listLinked":
|
|
921
1259
|
return isSkillRepoListLinkedResult;
|
|
1260
|
+
case "copilotContent.draft.create":
|
|
922
1261
|
case "skillRepo.draft.create":
|
|
923
1262
|
return isSkillRepoDraftCreateResult;
|
|
1263
|
+
case "copilotContent.draft.commit":
|
|
924
1264
|
case "skillRepo.draft.commit":
|
|
925
1265
|
return isSkillRepoDraftCommitResult;
|
|
1266
|
+
case "copilotContent.draft.list":
|
|
926
1267
|
case "skillRepo.draft.list":
|
|
927
1268
|
return isSkillRepoDraftListResult;
|
|
1269
|
+
case "copilotContent.draft.delete":
|
|
928
1270
|
case "skillRepo.draft.delete":
|
|
929
1271
|
return isSkillRepoDraftDeleteResult;
|
|
930
1272
|
case "repo.list":
|
|
@@ -943,6 +1285,42 @@ function getBridgeResultValidator(method) {
|
|
|
943
1285
|
return isRepoSyncResult;
|
|
944
1286
|
case "repo.syncAll":
|
|
945
1287
|
return isRepoSyncAllResult;
|
|
1288
|
+
case "copilotContent.status":
|
|
1289
|
+
return isCopilotContentStatusResult;
|
|
1290
|
+
case "copilotContent.restore":
|
|
1291
|
+
return isCopilotContentRestoreResult;
|
|
1292
|
+
case "copilotContent.approve":
|
|
1293
|
+
return isCopilotContentApproveResult;
|
|
1294
|
+
case "copilotContent.migrateLegacy":
|
|
1295
|
+
return isCopilotContentMigrateLegacyResult;
|
|
1296
|
+
case "copilotContent.integrationStatus":
|
|
1297
|
+
return isCopilotContentIntegrationStatusResult;
|
|
1298
|
+
case "copilotContent.customizations.list":
|
|
1299
|
+
return isCopilotCustomizationsListResult;
|
|
1300
|
+
case "copilotPlugin.list":
|
|
1301
|
+
return isCopilotPluginListResult;
|
|
1302
|
+
case "copilotPlugin.register":
|
|
1303
|
+
return isCopilotPluginRegisterResult;
|
|
1304
|
+
case "copilotPlugin.unregister":
|
|
1305
|
+
return isCopilotPluginUnregisterResult;
|
|
1306
|
+
case "copilotContent.package.install":
|
|
1307
|
+
return isCopilotPackageInstallResult;
|
|
1308
|
+
case "copilotContent.package.update":
|
|
1309
|
+
return isCopilotPackageUpdateResult;
|
|
1310
|
+
case "copilotContent.package.uninstall":
|
|
1311
|
+
return isCopilotPackageUninstallResult;
|
|
1312
|
+
case "copilotContent.package.move":
|
|
1313
|
+
return isCopilotPackageMoveResult;
|
|
1314
|
+
case "copilotContent.legacy.preview":
|
|
1315
|
+
return isCopilotLegacyPreviewResult;
|
|
1316
|
+
case "copilotContent.legacy.migrate":
|
|
1317
|
+
return isCopilotLegacyMigrateResult;
|
|
1318
|
+
case "copilotContent.sources.list":
|
|
1319
|
+
return isCopilotSourceListResult;
|
|
1320
|
+
case "copilotContent.sources.remove":
|
|
1321
|
+
return isCopilotSourceRemoveResult;
|
|
1322
|
+
case "copilotContent.package.previewUpdate":
|
|
1323
|
+
return isCopilotUpdatePreviewResult;
|
|
946
1324
|
case "auth.status":
|
|
947
1325
|
return isAuthStatus;
|
|
948
1326
|
case "auth.login":
|
|
@@ -994,13 +1372,13 @@ function isBridgeEventName(value) {
|
|
|
994
1372
|
return typeof value === "string" && BRIDGE_EVENTS.includes(value);
|
|
995
1373
|
}
|
|
996
1374
|
function isBridgeRequest(value) {
|
|
997
|
-
if (!
|
|
1375
|
+
if (!isRecord9(value)) {
|
|
998
1376
|
return false;
|
|
999
1377
|
}
|
|
1000
1378
|
return isValidProtocolVersion(value.protocolVersion) && value.kind === "request" && typeof value.id === "string" && isBridgeMethod(value.method) && "params" in value;
|
|
1001
1379
|
}
|
|
1002
1380
|
function isBridgeResponse(value) {
|
|
1003
|
-
if (!
|
|
1381
|
+
if (!isRecord9(value)) {
|
|
1004
1382
|
return false;
|
|
1005
1383
|
}
|
|
1006
1384
|
if (!isValidProtocolVersion(value.protocolVersion) || value.kind !== "response" || typeof value.id !== "string" || typeof value.ok !== "boolean") {
|
|
@@ -1012,7 +1390,7 @@ function isBridgeResponse(value) {
|
|
|
1012
1390
|
return "error" in value;
|
|
1013
1391
|
}
|
|
1014
1392
|
function isBridgeEvent(value) {
|
|
1015
|
-
if (!
|
|
1393
|
+
if (!isRecord9(value)) {
|
|
1016
1394
|
return false;
|
|
1017
1395
|
}
|
|
1018
1396
|
return isValidProtocolVersion(value.protocolVersion) && value.kind === "event" && isBridgeEventName(value.event) && "params" in value;
|
|
@@ -1020,7 +1398,7 @@ function isBridgeEvent(value) {
|
|
|
1020
1398
|
|
|
1021
1399
|
// src/cli.ts
|
|
1022
1400
|
var SERVICEME_CLI_SCHEMA_VERSION = 1;
|
|
1023
|
-
function
|
|
1401
|
+
function isRecord10(value) {
|
|
1024
1402
|
return typeof value === "object" && value !== null;
|
|
1025
1403
|
}
|
|
1026
1404
|
function createCliSuccess(data) {
|
|
@@ -1038,7 +1416,7 @@ function createCliFailure(error) {
|
|
|
1038
1416
|
};
|
|
1039
1417
|
}
|
|
1040
1418
|
function isCliEnvelope(value) {
|
|
1041
|
-
if (!
|
|
1419
|
+
if (!isRecord10(value)) {
|
|
1042
1420
|
return false;
|
|
1043
1421
|
}
|
|
1044
1422
|
if (value.schemaVersion !== SERVICEME_CLI_SCHEMA_VERSION || typeof value.ok !== "boolean") {
|
|
@@ -1068,23 +1446,24 @@ var KNOWN_ENVIRONMENT_TOOLS = [
|
|
|
1068
1446
|
"nrm",
|
|
1069
1447
|
"rtk",
|
|
1070
1448
|
"codegraph",
|
|
1449
|
+
"ocx",
|
|
1071
1450
|
"dotnet",
|
|
1072
1451
|
"nuget"
|
|
1073
1452
|
];
|
|
1074
|
-
function
|
|
1453
|
+
function isRecord11(value) {
|
|
1075
1454
|
return typeof value === "object" && value !== null;
|
|
1076
1455
|
}
|
|
1077
1456
|
function isKnownEnvironmentTool(value) {
|
|
1078
1457
|
return KNOWN_ENVIRONMENT_TOOLS.includes(value);
|
|
1079
1458
|
}
|
|
1080
1459
|
function isToolCheckResult(value) {
|
|
1081
|
-
if (!
|
|
1460
|
+
if (!isRecord11(value)) {
|
|
1082
1461
|
return false;
|
|
1083
1462
|
}
|
|
1084
1463
|
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");
|
|
1085
1464
|
}
|
|
1086
1465
|
function isEnvironmentCheckResult(value) {
|
|
1087
|
-
if (!
|
|
1466
|
+
if (!isRecord11(value)) {
|
|
1088
1467
|
return false;
|
|
1089
1468
|
}
|
|
1090
1469
|
return KNOWN_ENVIRONMENT_TOOLS.every((tool) => isToolCheckResult(value[tool]));
|
|
@@ -1136,14 +1515,14 @@ var RETRYABLE_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
1136
1515
|
"executor_timeout",
|
|
1137
1516
|
"internal_error"
|
|
1138
1517
|
]);
|
|
1139
|
-
function
|
|
1518
|
+
function isRecord12(value) {
|
|
1140
1519
|
return typeof value === "object" && value !== null;
|
|
1141
1520
|
}
|
|
1142
1521
|
function isServicemeErrorCode(value) {
|
|
1143
1522
|
return typeof value === "string" && SERVICEME_ERROR_CODES.includes(value);
|
|
1144
1523
|
}
|
|
1145
1524
|
function isServicemeErrorDetails(value) {
|
|
1146
|
-
if (!
|
|
1525
|
+
if (!isRecord12(value)) {
|
|
1147
1526
|
return false;
|
|
1148
1527
|
}
|
|
1149
1528
|
return isServicemeErrorCode(value.code) && typeof value.message === "string" && typeof value.retryable === "boolean";
|
|
@@ -1183,7 +1562,7 @@ function normalizeServicemeError(error, fallbackCode = "internal_error") {
|
|
|
1183
1562
|
if (isServicemeErrorDetails(error)) {
|
|
1184
1563
|
return error;
|
|
1185
1564
|
}
|
|
1186
|
-
if (
|
|
1565
|
+
if (isRecord12(error)) {
|
|
1187
1566
|
const code = isServicemeErrorCode(error.code) ? error.code : fallbackCode;
|
|
1188
1567
|
const message = typeof error.message === "string" ? error.message : "Unexpected serviceme error.";
|
|
1189
1568
|
const retryable = typeof error.retryable === "boolean" ? error.retryable : isRetryableErrorCode(code);
|
|
@@ -1214,69 +1593,37 @@ var SERVICEME_IMAGE_FORMATS = [
|
|
|
1214
1593
|
"png",
|
|
1215
1594
|
"webp"
|
|
1216
1595
|
];
|
|
1217
|
-
function
|
|
1596
|
+
function isRecord13(value) {
|
|
1218
1597
|
return typeof value === "object" && value !== null;
|
|
1219
1598
|
}
|
|
1220
1599
|
function isServiceMeImageFormat(value) {
|
|
1221
1600
|
return typeof value === "string" && SERVICEME_IMAGE_FORMATS.includes(value);
|
|
1222
1601
|
}
|
|
1223
1602
|
function isServiceMeImageCompressOptions(value) {
|
|
1224
|
-
if (!
|
|
1603
|
+
if (!isRecord13(value)) {
|
|
1225
1604
|
return false;
|
|
1226
1605
|
}
|
|
1227
1606
|
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");
|
|
1228
1607
|
}
|
|
1229
1608
|
function isServiceMeImageCompressResult(value) {
|
|
1230
|
-
if (!
|
|
1609
|
+
if (!isRecord13(value)) {
|
|
1231
1610
|
return false;
|
|
1232
1611
|
}
|
|
1233
1612
|
return typeof value.originalSize === "number" && typeof value.compressedSize === "number" && typeof value.compressionRatio === "number" && typeof value.outputPath === "string";
|
|
1234
1613
|
}
|
|
1235
1614
|
function isServiceMeImageInfo(value) {
|
|
1236
|
-
if (!
|
|
1615
|
+
if (!isRecord13(value)) {
|
|
1237
1616
|
return false;
|
|
1238
1617
|
}
|
|
1239
1618
|
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");
|
|
1240
1619
|
}
|
|
1241
1620
|
function isServiceMeImageValidationResult(value) {
|
|
1242
|
-
return
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
// src/json.ts
|
|
1246
|
-
var JSON_SORT_ALGORITHMS = [
|
|
1247
|
-
"default",
|
|
1248
|
-
"keyLength",
|
|
1249
|
-
"alphaNum",
|
|
1250
|
-
"values",
|
|
1251
|
-
"type"
|
|
1252
|
-
];
|
|
1253
|
-
var JSON_SORT_ORDERS = ["asc", "desc"];
|
|
1254
|
-
var DEFAULT_JSON_SORT_OPTIONS = {
|
|
1255
|
-
sortOrder: "asc",
|
|
1256
|
-
sortAlgo: "default"
|
|
1257
|
-
};
|
|
1258
|
-
function isRecord12(value) {
|
|
1259
|
-
return typeof value === "object" && value !== null;
|
|
1260
|
-
}
|
|
1261
|
-
function isJsonSortAlgorithm(value) {
|
|
1262
|
-
return typeof value === "string" && JSON_SORT_ALGORITHMS.includes(value);
|
|
1263
|
-
}
|
|
1264
|
-
function isJsonSortOrder(value) {
|
|
1265
|
-
return typeof value === "string" && JSON_SORT_ORDERS.includes(value);
|
|
1266
|
-
}
|
|
1267
|
-
function isJsonSortOptions(value) {
|
|
1268
|
-
return isRecord12(value) && isJsonSortOrder(value.sortOrder) && isJsonSortAlgorithm(value.sortAlgo);
|
|
1269
|
-
}
|
|
1270
|
-
function isJsonValidationResult(value) {
|
|
1271
|
-
return isRecord12(value) && typeof value.valid === "boolean" && (value.error === void 0 || typeof value.error === "string");
|
|
1272
|
-
}
|
|
1273
|
-
function isJsonOutputResult(value) {
|
|
1274
|
-
return isRecord12(value) && typeof value.output === "string";
|
|
1621
|
+
return isRecord13(value) && typeof value.valid === "boolean";
|
|
1275
1622
|
}
|
|
1276
1623
|
|
|
1277
1624
|
// src/metadata.ts
|
|
1278
1625
|
var SERVICEME_CLI_NAME = "serviceme";
|
|
1279
|
-
var SERVICEME_CLI_VERSION = "0.
|
|
1626
|
+
var SERVICEME_CLI_VERSION = "2.0.0";
|
|
1280
1627
|
var SERVICEME_CLI_CAPABILITIES = {
|
|
1281
1628
|
bridge: true,
|
|
1282
1629
|
tasks: 1,
|
|
@@ -1287,32 +1634,32 @@ var SERVICEME_CLI_CAPABILITIES = {
|
|
|
1287
1634
|
};
|
|
1288
1635
|
|
|
1289
1636
|
// src/project.ts
|
|
1290
|
-
function
|
|
1637
|
+
function isRecord14(value) {
|
|
1291
1638
|
return typeof value === "object" && value !== null;
|
|
1292
1639
|
}
|
|
1293
1640
|
function isServiceMeProjectScaffoldPruneResult(value) {
|
|
1294
|
-
if (!
|
|
1641
|
+
if (!isRecord14(value)) {
|
|
1295
1642
|
return false;
|
|
1296
1643
|
}
|
|
1297
1644
|
return typeof value.applied === "boolean" && typeof value.preset === "string" && Array.isArray(value.commands) && value.commands.every((command) => typeof command === "string");
|
|
1298
1645
|
}
|
|
1299
1646
|
function isServiceMeProjectGitInitResult(value) {
|
|
1300
|
-
return
|
|
1647
|
+
return isRecord14(value) && typeof value.initialized === "boolean" && typeof value.command === "string";
|
|
1301
1648
|
}
|
|
1302
1649
|
function isServiceMeProjectMakeScriptsExecutableResult(value) {
|
|
1303
|
-
if (!
|
|
1650
|
+
if (!isRecord14(value)) {
|
|
1304
1651
|
return false;
|
|
1305
1652
|
}
|
|
1306
1653
|
return typeof value.processedCount === "number" && typeof value.updatedCount === "number" && typeof value.platform === "string" && Array.isArray(value.scripts) && value.scripts.every((script) => typeof script === "string");
|
|
1307
1654
|
}
|
|
1308
1655
|
function isServiceMeProjectInstallDepsResult(value) {
|
|
1309
|
-
return
|
|
1656
|
+
return isRecord14(value) && typeof value.installed === "boolean" && typeof value.command === "string";
|
|
1310
1657
|
}
|
|
1311
1658
|
function isServiceMeProjectExtractTemplateInput(value) {
|
|
1312
|
-
return
|
|
1659
|
+
return isRecord14(value) && typeof value.extractedDirName === "string" && typeof value.projectFilePattern === "string";
|
|
1313
1660
|
}
|
|
1314
1661
|
function isServiceMeProjectExtractTemplateResult(value) {
|
|
1315
|
-
return
|
|
1662
|
+
return isRecord14(value) && typeof value.actualDirName === "string";
|
|
1316
1663
|
}
|
|
1317
1664
|
|
|
1318
1665
|
// src/skill.ts
|
|
@@ -1333,7 +1680,7 @@ var VALID_SKILL_MUTATION_ACTIONS = [
|
|
|
1333
1680
|
"republish",
|
|
1334
1681
|
"submit-to-official"
|
|
1335
1682
|
];
|
|
1336
|
-
function
|
|
1683
|
+
function isRecord15(value) {
|
|
1337
1684
|
return typeof value === "object" && value !== null;
|
|
1338
1685
|
}
|
|
1339
1686
|
function isSkillScope(value) {
|
|
@@ -1345,7 +1692,7 @@ function isSkillScopeStatus(value) {
|
|
|
1345
1692
|
function isSkillMutationAction(value) {
|
|
1346
1693
|
return typeof value === "string" && VALID_SKILL_MUTATION_ACTIONS.includes(value);
|
|
1347
1694
|
}
|
|
1348
|
-
function
|
|
1695
|
+
function isStringArray3(value) {
|
|
1349
1696
|
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
1350
1697
|
}
|
|
1351
1698
|
function isSafeResourceId2(value) {
|
|
@@ -1361,43 +1708,44 @@ function isSafeResourceId2(value) {
|
|
|
1361
1708
|
);
|
|
1362
1709
|
}
|
|
1363
1710
|
function isSkillScopeState(value) {
|
|
1364
|
-
if (!
|
|
1711
|
+
if (!isRecord15(value)) {
|
|
1365
1712
|
return false;
|
|
1366
1713
|
}
|
|
1367
1714
|
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");
|
|
1368
1715
|
}
|
|
1369
1716
|
function isSkillMarketplaceEntry(value) {
|
|
1370
|
-
if (!
|
|
1717
|
+
if (!isRecord15(value)) {
|
|
1371
1718
|
return false;
|
|
1372
1719
|
}
|
|
1373
1720
|
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);
|
|
1374
1721
|
}
|
|
1375
1722
|
function isSkillMarketplaceState(value) {
|
|
1376
|
-
if (!
|
|
1723
|
+
if (!isRecord15(value)) {
|
|
1377
1724
|
return false;
|
|
1378
1725
|
}
|
|
1379
|
-
return typeof value.configPath === "string" && typeof value.userSkillsPath === "string" && Array.isArray(value.skills) && value.skills.every((entry) => isSkillMarketplaceEntry(entry)) && (value.enabledSkillIds === void 0 ||
|
|
1726
|
+
return typeof value.configPath === "string" && typeof value.userSkillsPath === "string" && Array.isArray(value.skills) && value.skills.every((entry) => isSkillMarketplaceEntry(entry)) && (value.enabledSkillIds === void 0 || isStringArray3(value.enabledSkillIds)) && (value.recommendedSkillIds === void 0 || isStringArray3(value.recommendedSkillIds)) && typeof value.onboardingRequired === "boolean" && typeof value.hasPersistedSelection === "boolean" && (value.workspaceOpen === void 0 || typeof value.workspaceOpen === "boolean");
|
|
1380
1727
|
}
|
|
1381
1728
|
function isSkillMutationRequest(value) {
|
|
1382
|
-
return
|
|
1729
|
+
return isRecord15(value) && isSafeResourceId2(value.skillId) && isSkillScope(value.targetScope) && isSkillMutationAction(value.action) && (value.confirmed === void 0 || typeof value.confirmed === "boolean");
|
|
1383
1730
|
}
|
|
1384
1731
|
function isSkillMutationResult(value) {
|
|
1385
|
-
return
|
|
1732
|
+
return isRecord15(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");
|
|
1386
1733
|
}
|
|
1387
1734
|
function isSkillReconcileResult(value) {
|
|
1388
|
-
return
|
|
1735
|
+
return isRecord15(value) && isSkillMarketplaceState(value.state) && typeof value.changed === "boolean";
|
|
1389
1736
|
}
|
|
1390
1737
|
function isPublishableSkillEntry(value) {
|
|
1391
|
-
return
|
|
1738
|
+
return isRecord15(value) && typeof value.id === "string" && typeof value.displayName === "string" && typeof value.path === "string" && (value.version === void 0 || typeof value.version === "string");
|
|
1392
1739
|
}
|
|
1393
1740
|
function isSkillPublishableResult(value) {
|
|
1394
|
-
return
|
|
1741
|
+
return isRecord15(value) && Array.isArray(value.skills) && value.skills.every((entry) => isPublishableSkillEntry(entry));
|
|
1395
1742
|
}
|
|
1396
1743
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1397
1744
|
0 && (module.exports = {
|
|
1398
1745
|
AUTH_PROVIDERS,
|
|
1399
1746
|
BRIDGE_EVENTS,
|
|
1400
1747
|
BRIDGE_METHODS,
|
|
1748
|
+
COPILOT_CONTENT_METHOD_ALIASES,
|
|
1401
1749
|
COPILOT_ERROR_CODES,
|
|
1402
1750
|
DEFAULT_JSON_SORT_OPTIONS,
|
|
1403
1751
|
DEVICE_BINDING_STATES,
|
|
@@ -1442,6 +1790,38 @@ function isSkillPublishableResult(value) {
|
|
|
1442
1790
|
isBridgeRequest,
|
|
1443
1791
|
isBridgeResponse,
|
|
1444
1792
|
isCliEnvelope,
|
|
1793
|
+
isCopilotContentApproveResult,
|
|
1794
|
+
isCopilotContentIntegrationStatusResult,
|
|
1795
|
+
isCopilotContentMigrateLegacyResult,
|
|
1796
|
+
isCopilotContentRestoreResult,
|
|
1797
|
+
isCopilotContentStatusResult,
|
|
1798
|
+
isCopilotCustomizationViewPayload,
|
|
1799
|
+
isCopilotCustomizationsListParams,
|
|
1800
|
+
isCopilotCustomizationsListResult,
|
|
1801
|
+
isCopilotLegacyMigrateParams,
|
|
1802
|
+
isCopilotLegacyMigrateResult,
|
|
1803
|
+
isCopilotLegacyPreviewParams,
|
|
1804
|
+
isCopilotLegacyPreviewResult,
|
|
1805
|
+
isCopilotPackageInstallParams,
|
|
1806
|
+
isCopilotPackageInstallResult,
|
|
1807
|
+
isCopilotPackageMoveParams,
|
|
1808
|
+
isCopilotPackageMoveResult,
|
|
1809
|
+
isCopilotPackageUninstallParams,
|
|
1810
|
+
isCopilotPackageUninstallResult,
|
|
1811
|
+
isCopilotPackageUpdateParams,
|
|
1812
|
+
isCopilotPackageUpdateResult,
|
|
1813
|
+
isCopilotPluginListParams,
|
|
1814
|
+
isCopilotPluginListResult,
|
|
1815
|
+
isCopilotPluginRegisterParams,
|
|
1816
|
+
isCopilotPluginRegisterResult,
|
|
1817
|
+
isCopilotPluginUnregisterParams,
|
|
1818
|
+
isCopilotPluginUnregisterResult,
|
|
1819
|
+
isCopilotSourceListParams,
|
|
1820
|
+
isCopilotSourceListResult,
|
|
1821
|
+
isCopilotSourceRemoveParams,
|
|
1822
|
+
isCopilotSourceRemoveResult,
|
|
1823
|
+
isCopilotUpdatePreviewParams,
|
|
1824
|
+
isCopilotUpdatePreviewResult,
|
|
1445
1825
|
isDeviceBindingState,
|
|
1446
1826
|
isDeviceEnrollParams,
|
|
1447
1827
|
isDeviceEnrollResult,
|
|
@@ -1459,6 +1839,7 @@ function isSkillPublishableResult(value) {
|
|
|
1459
1839
|
isJsonSortOrder,
|
|
1460
1840
|
isJsonValidationResult,
|
|
1461
1841
|
isKnownEnvironmentTool,
|
|
1842
|
+
isRecord,
|
|
1462
1843
|
isRepoAddParams,
|
|
1463
1844
|
isRepoAddResult,
|
|
1464
1845
|
isRepoDisableParams,
|
|
@@ -1513,6 +1894,8 @@ function isSkillPublishableResult(value) {
|
|
|
1513
1894
|
isSkillRepoListLinkedResult,
|
|
1514
1895
|
isSkillRepoListParams,
|
|
1515
1896
|
isSkillRepoListResult,
|
|
1897
|
+
isSkillRepoSetEntryEnabledParams,
|
|
1898
|
+
isSkillRepoSetEntryEnabledResult,
|
|
1516
1899
|
isSkillRepoUninstallParams,
|
|
1517
1900
|
isSkillRepoUninstallResult,
|
|
1518
1901
|
isSystemHelloResult,
|
|
@@ -1540,5 +1923,6 @@ function isSkillPublishableResult(value) {
|
|
|
1540
1923
|
isToolboxUpdateResult,
|
|
1541
1924
|
migrateTaskV1ToV2,
|
|
1542
1925
|
migrateV1ToV2,
|
|
1926
|
+
normalizeBridgeMethod,
|
|
1543
1927
|
normalizeServicemeError
|
|
1544
1928
|
});
|