@serviceme/devtools-protocol 2.0.0 → 2.0.2
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 +1663 -1614
- package/dist/index.d.ts +1663 -1614
- package/dist/index.js +1205 -1487
- package/dist/index.mjs +1018 -1278
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -1,1719 +1,1459 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
//#region src/agent.ts
|
|
2
|
+
const VALID_AGENT_SCOPES = ["workspace", "user"];
|
|
3
|
+
const VALID_AGENT_SCOPE_STATUSES = [
|
|
4
|
+
"absent",
|
|
5
|
+
"available",
|
|
6
|
+
"installed",
|
|
7
|
+
"blocked",
|
|
8
|
+
"conflict"
|
|
9
9
|
];
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
const VALID_AGENT_MUTATION_ACTIONS = [
|
|
11
|
+
"install",
|
|
12
|
+
"uninstall",
|
|
13
|
+
"move",
|
|
14
|
+
"removeExternal",
|
|
15
|
+
"publish",
|
|
16
|
+
"republish",
|
|
17
|
+
"submit-to-official"
|
|
18
18
|
];
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const VALID_AGENT_TOOL_RISK_LEVELS = [
|
|
20
|
+
"high",
|
|
21
|
+
"medium",
|
|
22
|
+
"low"
|
|
23
|
+
];
|
|
24
|
+
function isRecord$14(value) {
|
|
25
|
+
return typeof value === "object" && value !== null;
|
|
22
26
|
}
|
|
23
|
-
function isStringArray(value) {
|
|
24
|
-
|
|
27
|
+
function isStringArray$2(value) {
|
|
28
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
25
29
|
}
|
|
26
30
|
function isAgentScope(value) {
|
|
27
|
-
|
|
31
|
+
return typeof value === "string" && VALID_AGENT_SCOPES.includes(value);
|
|
28
32
|
}
|
|
29
33
|
function isAgentScopeStatus(value) {
|
|
30
|
-
|
|
34
|
+
return typeof value === "string" && VALID_AGENT_SCOPE_STATUSES.includes(value);
|
|
31
35
|
}
|
|
32
36
|
function isAgentMutationAction(value) {
|
|
33
|
-
|
|
37
|
+
return typeof value === "string" && VALID_AGENT_MUTATION_ACTIONS.includes(value);
|
|
34
38
|
}
|
|
35
|
-
function isSafeResourceId(value) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (segments.some((segment) => segment.length === 0)) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
return segments.every(
|
|
44
|
-
(segment) => segment !== "." && segment !== ".." && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(segment)
|
|
45
|
-
);
|
|
39
|
+
function isSafeResourceId$1(value) {
|
|
40
|
+
if (typeof value !== "string" || value.length === 0 || value.includes("\\")) return false;
|
|
41
|
+
const segments = value.split("/");
|
|
42
|
+
if (segments.some((segment) => segment.length === 0)) return false;
|
|
43
|
+
return segments.every((segment) => segment !== "." && segment !== ".." && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(segment));
|
|
46
44
|
}
|
|
47
45
|
function isAgentScopeState(value) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
return isAgentScope(value.scope) && isAgentScopeStatus(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");
|
|
46
|
+
if (!isRecord$14(value)) return false;
|
|
47
|
+
return isAgentScope(value.scope) && isAgentScopeStatus(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");
|
|
52
48
|
}
|
|
53
49
|
function isAgentMarketplaceEntry(value) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
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") && typeof value.isCatalogAgent === "boolean" && typeof value.recommended === "boolean" && typeof value.installCount === "number" && (value.ownerScope === void 0 || isAgentScope(value.ownerScope)) && (value.ownerKind === void 0 || value.ownerKind === "builtin" || value.ownerKind === "external") && typeof value.hasConflict === "boolean" && isStringArray(value.tools) && (value.source === void 0 || value.source === "official" || value.source === "community" || value.source === "local") && (value.localAgentPath === void 0 || typeof value.localAgentPath === "string") && (value.canPublish === void 0 || typeof value.canPublish === "boolean") && isAgentScopeState(value.workspaceState) && isAgentScopeState(value.userState);
|
|
50
|
+
if (!isRecord$14(value)) return false;
|
|
51
|
+
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") && typeof value.isCatalogAgent === "boolean" && typeof value.recommended === "boolean" && typeof value.installCount === "number" && (value.ownerScope === void 0 || isAgentScope(value.ownerScope)) && (value.ownerKind === void 0 || value.ownerKind === "builtin" || value.ownerKind === "external") && typeof value.hasConflict === "boolean" && isStringArray$2(value.tools) && (value.source === void 0 || value.source === "official" || value.source === "community" || value.source === "local") && (value.localAgentPath === void 0 || typeof value.localAgentPath === "string") && (value.canPublish === void 0 || typeof value.canPublish === "boolean") && isAgentScopeState(value.workspaceState) && isAgentScopeState(value.userState);
|
|
58
52
|
}
|
|
59
53
|
function isAgentMarketplaceState(value) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
return typeof value.configPath === "string" && typeof value.userAgentsPath === "string" && Array.isArray(value.agents) && value.agents.every((entry) => isAgentMarketplaceEntry(entry)) && (value.installedAgentIds === void 0 || isStringArray(value.installedAgentIds)) && (value.workspaceOpen === void 0 || typeof value.workspaceOpen === "boolean");
|
|
54
|
+
if (!isRecord$14(value)) return false;
|
|
55
|
+
return typeof value.configPath === "string" && typeof value.userAgentsPath === "string" && Array.isArray(value.agents) && value.agents.every((entry) => isAgentMarketplaceEntry(entry)) && (value.installedAgentIds === void 0 || isStringArray$2(value.installedAgentIds)) && (value.workspaceOpen === void 0 || typeof value.workspaceOpen === "boolean");
|
|
64
56
|
}
|
|
65
57
|
function isAgentMutationRequest(value) {
|
|
66
|
-
|
|
58
|
+
return isRecord$14(value) && isSafeResourceId$1(value.agentId) && isAgentScope(value.targetScope) && isAgentMutationAction(value.action) && (value.confirmed === void 0 || typeof value.confirmed === "boolean");
|
|
67
59
|
}
|
|
68
60
|
function isAgentMutationResult(value) {
|
|
69
|
-
|
|
61
|
+
return isRecord$14(value) && isAgentMarketplaceState(value.state) && typeof value.agentId === "string" && isAgentScope(value.targetScope) && isAgentMutationAction(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.tools === void 0 || isStringArray$2(value.tools)) && (value.prUrl === void 0 || typeof value.prUrl === "string") && (value.fromVersion === void 0 || typeof value.fromVersion === "string") && (value.toVersion === void 0 || typeof value.toVersion === "string");
|
|
70
62
|
}
|
|
71
63
|
function isAgentToolPermission(value) {
|
|
72
|
-
|
|
64
|
+
return isRecord$14(value) && typeof value.tool === "string" && typeof value.riskLevel === "string" && VALID_AGENT_TOOL_RISK_LEVELS.includes(value.riskLevel);
|
|
73
65
|
}
|
|
74
66
|
function isAgentPermissionSummary(value) {
|
|
75
|
-
|
|
67
|
+
return isRecord$14(value) && typeof value.agentId === "string" && typeof value.agentName === "string" && Array.isArray(value.tools) && value.tools.every((tool) => isAgentToolPermission(tool)) && typeof value.highRiskCount === "number" && typeof value.mediumRiskCount === "number" && typeof value.lowRiskCount === "number";
|
|
76
68
|
}
|
|
77
69
|
function isAgentPermissionsResult(value) {
|
|
78
|
-
|
|
70
|
+
return isRecord$14(value) && typeof value.agentId === "string" && isAgentPermissionSummary(value.summary);
|
|
79
71
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
function
|
|
84
|
-
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/auth.ts
|
|
74
|
+
const AUTH_PROVIDERS = ["github", "microsoft"];
|
|
75
|
+
function isRecord$13(value) {
|
|
76
|
+
return typeof value === "object" && value !== null;
|
|
85
77
|
}
|
|
86
78
|
function isAuthProvider(value) {
|
|
87
|
-
|
|
79
|
+
return value === "github" || value === "microsoft";
|
|
88
80
|
}
|
|
89
|
-
function isStringOrUndefined(value) {
|
|
90
|
-
|
|
81
|
+
function isStringOrUndefined$3(value) {
|
|
82
|
+
return value === void 0 || typeof value === "string";
|
|
91
83
|
}
|
|
92
84
|
function isNumberOrUndefined(value) {
|
|
93
|
-
|
|
85
|
+
return value === void 0 || value === null || typeof value === "number" && Number.isFinite(value);
|
|
94
86
|
}
|
|
95
87
|
function isAuthAccountMeta(value) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
88
|
+
if (!isRecord$13(value)) return false;
|
|
89
|
+
if (typeof value.id !== "string") return false;
|
|
90
|
+
if (!isAuthProvider(value.provider)) return false;
|
|
91
|
+
if (value.id.length === 0) return false;
|
|
92
|
+
if (!isStringOrUndefined$3(value.displayName)) return false;
|
|
93
|
+
if (!isStringOrUndefined$3(value.login)) return false;
|
|
94
|
+
if (!isStringOrUndefined$3(value.email)) return false;
|
|
95
|
+
if (!isStringOrUndefined$3(value.avatarUrl)) return false;
|
|
96
|
+
if (!isNumberOrUndefined(value.expiresAt)) return false;
|
|
97
|
+
return true;
|
|
106
98
|
}
|
|
107
99
|
function isAuthLoginResult(value) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
if (value.expiresAt !== void 0 && (typeof value.expiresAt !== "number" || !Number.isFinite(value.expiresAt))) {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
if (value.pollIntervalMs !== void 0 && (typeof value.pollIntervalMs !== "number" || !Number.isFinite(value.pollIntervalMs))) {
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
if (!isStringOrUndefined(value.message)) return false;
|
|
126
|
-
return true;
|
|
100
|
+
if (!isRecord$13(value)) return false;
|
|
101
|
+
if (!isAuthProvider(value.provider)) return false;
|
|
102
|
+
if (value.deviceCode !== void 0 && typeof value.deviceCode !== "string") return false;
|
|
103
|
+
if (value.userCode !== void 0 && typeof value.userCode !== "string") return false;
|
|
104
|
+
if (value.verificationUrl !== void 0 && typeof value.verificationUrl !== "string") return false;
|
|
105
|
+
if (value.expiresAt !== void 0 && (typeof value.expiresAt !== "number" || !Number.isFinite(value.expiresAt))) return false;
|
|
106
|
+
if (value.pollIntervalMs !== void 0 && (typeof value.pollIntervalMs !== "number" || !Number.isFinite(value.pollIntervalMs))) return false;
|
|
107
|
+
if (!isStringOrUndefined$3(value.message)) return false;
|
|
108
|
+
return true;
|
|
127
109
|
}
|
|
128
110
|
function isAuthSessionHandle(value) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (!isNumberOrUndefined(value.expiresAt)) return false;
|
|
135
|
-
return true;
|
|
111
|
+
if (!isRecord$13(value)) return false;
|
|
112
|
+
if (!isAuthProvider(value.provider)) return false;
|
|
113
|
+
if (value.account !== void 0 && value.account !== null && !isAuthAccountMeta(value.account)) return false;
|
|
114
|
+
if (!isNumberOrUndefined(value.expiresAt)) return false;
|
|
115
|
+
return true;
|
|
136
116
|
}
|
|
137
117
|
function isAuthStatus(value) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
if (typeof value.hasAnySession !== "boolean") return false;
|
|
150
|
-
if (!isStringOrUndefined(value.lastError)) return false;
|
|
151
|
-
return true;
|
|
118
|
+
if (!isRecord$13(value)) return false;
|
|
119
|
+
if (value.activeProvider !== null && !isAuthProvider(value.activeProvider)) return false;
|
|
120
|
+
if (!isRecord$13(value.accounts)) return false;
|
|
121
|
+
for (const [provider, account] of Object.entries(value.accounts)) {
|
|
122
|
+
if (!isAuthProvider(provider)) return false;
|
|
123
|
+
if (account !== void 0 && account !== null && !isAuthAccountMeta(account)) return false;
|
|
124
|
+
}
|
|
125
|
+
if (typeof value.hasAnySession !== "boolean") return false;
|
|
126
|
+
if (!isStringOrUndefined$3(value.lastError)) return false;
|
|
127
|
+
return true;
|
|
152
128
|
}
|
|
153
129
|
function isAuthLoginParams(value) {
|
|
154
|
-
|
|
130
|
+
return isRecord$13(value) && isAuthProvider(value.provider) && (value.force === void 0 || typeof value.force === "boolean");
|
|
155
131
|
}
|
|
156
132
|
function isAuthLogoutParams(value) {
|
|
157
|
-
|
|
133
|
+
return isRecord$13(value) && (value.provider === void 0 || isAuthProvider(value.provider));
|
|
158
134
|
}
|
|
159
135
|
function isAuthLogoutResult(value) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
136
|
+
if (!isRecord$13(value)) return false;
|
|
137
|
+
if (value.provider !== null && !isAuthProvider(value.provider)) return false;
|
|
138
|
+
if (typeof value.success !== "boolean") return false;
|
|
139
|
+
return true;
|
|
164
140
|
}
|
|
165
141
|
function isAuthWhoamiResult(value) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
142
|
+
if (!isRecord$13(value)) return false;
|
|
143
|
+
if (value.provider !== null && !isAuthProvider(value.provider)) return false;
|
|
144
|
+
if (!isStringOrUndefined$3(value.login)) return false;
|
|
145
|
+
if (!isStringOrUndefined$3(value.name)) return false;
|
|
146
|
+
if (!isStringOrUndefined$3(value.avatarUrl)) return false;
|
|
147
|
+
if (!isStringOrUndefined$3(value.email)) return false;
|
|
148
|
+
return true;
|
|
173
149
|
}
|
|
174
150
|
function isAuthSwitchParams(value) {
|
|
175
|
-
|
|
151
|
+
return isRecord$13(value) && isAuthProvider(value.provider);
|
|
176
152
|
}
|
|
177
153
|
function isAuthSwitchResult(value) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
154
|
+
if (!isRecord$13(value)) return false;
|
|
155
|
+
if (value.activeProvider !== null && !isAuthProvider(value.activeProvider)) return false;
|
|
156
|
+
if (value.account !== null && !isAuthAccountMeta(value.account)) return false;
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/bridge-copilot-customizations.ts
|
|
161
|
+
const PRIVATE_RESULT_KEYS = /* @__PURE__ */ new Set([
|
|
162
|
+
"sourcePath",
|
|
163
|
+
"configPath",
|
|
164
|
+
"token",
|
|
165
|
+
"secret",
|
|
166
|
+
"approvalPayload"
|
|
167
|
+
]);
|
|
168
|
+
const SCOPES$1 = /* @__PURE__ */ new Set(["workspace", "personal"]);
|
|
169
|
+
const KINDS = /* @__PURE__ */ new Set([
|
|
170
|
+
"agent",
|
|
171
|
+
"skill",
|
|
172
|
+
"prompt",
|
|
173
|
+
"instruction",
|
|
174
|
+
"mcp",
|
|
175
|
+
"hook"
|
|
176
|
+
]);
|
|
177
|
+
const INTENTS = /* @__PURE__ */ new Set([
|
|
178
|
+
"available",
|
|
179
|
+
"selected",
|
|
180
|
+
"moving",
|
|
181
|
+
"removing"
|
|
193
182
|
]);
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
"conflict",
|
|
202
|
-
"source-unavailable",
|
|
203
|
-
"unsupported"
|
|
183
|
+
const HEALTH = /* @__PURE__ */ new Set([
|
|
184
|
+
"healthy",
|
|
185
|
+
"missing",
|
|
186
|
+
"drifted",
|
|
187
|
+
"conflict",
|
|
188
|
+
"source-unavailable",
|
|
189
|
+
"unsupported"
|
|
204
190
|
]);
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
191
|
+
const GATES = /* @__PURE__ */ new Set([
|
|
192
|
+
"ready",
|
|
193
|
+
"approval-required",
|
|
194
|
+
"configuration-required"
|
|
195
|
+
]);
|
|
196
|
+
const STATUSES = /* @__PURE__ */ new Set([
|
|
197
|
+
"healthy",
|
|
198
|
+
"action-required",
|
|
199
|
+
"blocked",
|
|
200
|
+
"not-enabled"
|
|
201
|
+
]);
|
|
202
|
+
const SOURCE_TYPES = /* @__PURE__ */ new Set([
|
|
203
|
+
"marketplace",
|
|
204
|
+
"git",
|
|
205
|
+
"local"
|
|
206
|
+
]);
|
|
207
|
+
const UPDATE_CAPABILITIES = /* @__PURE__ */ new Set([
|
|
208
|
+
"pinned",
|
|
209
|
+
"live",
|
|
210
|
+
"none"
|
|
211
|
+
]);
|
|
212
|
+
function isRecord$12(value) {
|
|
213
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
211
214
|
}
|
|
212
215
|
function isString(value) {
|
|
213
|
-
|
|
216
|
+
return typeof value === "string" && value.length > 0;
|
|
214
217
|
}
|
|
215
218
|
function isOptionalString(value) {
|
|
216
|
-
|
|
219
|
+
return value === void 0 || typeof value === "string";
|
|
217
220
|
}
|
|
218
|
-
function
|
|
219
|
-
|
|
221
|
+
function isStringArray$1(value, allowEmpty = true) {
|
|
222
|
+
return Array.isArray(value) && (allowEmpty || value.length > 0) && value.every((entry) => isString(entry));
|
|
220
223
|
}
|
|
221
224
|
function hasPrivateResultKey(value) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
([key, nested]) => PRIVATE_RESULT_KEYS.has(key) || hasPrivateResultKey(nested)
|
|
226
|
-
);
|
|
225
|
+
if (Array.isArray(value)) return value.some(hasPrivateResultKey);
|
|
226
|
+
if (!isRecord$12(value)) return false;
|
|
227
|
+
return Object.entries(value).some(([key, nested]) => PRIVATE_RESULT_KEYS.has(key) || hasPrivateResultKey(nested));
|
|
227
228
|
}
|
|
228
229
|
function isScope(value) {
|
|
229
|
-
|
|
230
|
+
return typeof value === "string" && SCOPES$1.has(value);
|
|
230
231
|
}
|
|
231
232
|
function hasOptionalWorkspaceDir(value) {
|
|
232
|
-
|
|
233
|
+
return value.workspaceDir === void 0 || isString(value.workspaceDir);
|
|
233
234
|
}
|
|
234
235
|
function hasRequiredWorkspaceDirForWorkspaceScope(value) {
|
|
235
|
-
|
|
236
|
+
return value.scope !== "workspace" || isString(value.workspaceDir);
|
|
236
237
|
}
|
|
237
238
|
function isArtifactState(value) {
|
|
238
|
-
|
|
239
|
+
return isRecord$12(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);
|
|
239
240
|
}
|
|
240
241
|
function isArtifactSummary(value) {
|
|
241
|
-
|
|
242
|
+
return isRecord$12(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");
|
|
242
243
|
}
|
|
243
244
|
function isInstallation(value) {
|
|
244
|
-
|
|
245
|
+
return isRecord$12(value) && isString(value.packageId) && isScope(value.scope) && isStringArray$1(value.selectedArtifactIds) && isOptionalString(value.pinnedVersion);
|
|
245
246
|
}
|
|
246
247
|
function isDefinition(value) {
|
|
247
|
-
|
|
248
|
+
return isRecord$12(value) && isString(value.id) && isString(value.sourceId) && isString(value.displayName) && isOptionalString(value.description) && isOptionalString(value.version) && Array.isArray(value.artifacts) && value.artifacts.every(isArtifactSummary);
|
|
248
249
|
}
|
|
249
250
|
function isArtifactView(value) {
|
|
250
|
-
|
|
251
|
+
return isRecord$12(value) && isArtifactSummary(value.artifact) && isArtifactState(value.state);
|
|
251
252
|
}
|
|
252
253
|
function isPackageView(value) {
|
|
253
|
-
|
|
254
|
+
return isRecord$12(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);
|
|
254
255
|
}
|
|
255
256
|
function isSourceView(value) {
|
|
256
|
-
|
|
257
|
+
return isRecord$12(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);
|
|
257
258
|
}
|
|
258
259
|
function isSourceRecord(value) {
|
|
259
|
-
|
|
260
|
+
return isRecord$12(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");
|
|
260
261
|
}
|
|
261
262
|
function isUpdatePreview(value) {
|
|
262
|
-
|
|
263
|
+
return isRecord$12(value) && isString(value.packageId) && isOptionalString(value.fromVersion) && isString(value.toVersion) && isStringArray$1(value.addedArtifactIds) && isStringArray$1(value.removedArtifactIds) && isStringArray$1(value.changedArtifactIds) && isStringArray$1(value.approvalInvalidatedArtifactIds);
|
|
263
264
|
}
|
|
264
265
|
function isCopilotCustomizationViewPayload(value) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
if (!isRecord$12(value) || hasPrivateResultKey(value)) return false;
|
|
267
|
+
const summary = value.summary;
|
|
268
|
+
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) && isRecord$12(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 || isRecord$12(value.legacyMigration) && Number.isInteger(value.legacyMigration.count) && value.legacyMigration.count >= 0 && value.legacyMigration.sourceLabel === "~/.agents");
|
|
268
269
|
}
|
|
269
270
|
function isCopilotCustomizationsListParams(value) {
|
|
270
|
-
|
|
271
|
+
return isRecord$12(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value);
|
|
271
272
|
}
|
|
272
273
|
function isAvailablePackage(value) {
|
|
273
|
-
|
|
274
|
+
return isRecord$12(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);
|
|
274
275
|
}
|
|
275
276
|
function isCopilotCustomizationsListResult(value) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
return value.availablePackages === void 0 || Array.isArray(value.availablePackages) && value.availablePackages.every(isAvailablePackage);
|
|
277
|
+
if (!isRecord$12(value) || hasPrivateResultKey(value) || !isCopilotCustomizationViewPayload(value.view)) return false;
|
|
278
|
+
return value.availablePackages === void 0 || Array.isArray(value.availablePackages) && value.availablePackages.every(isAvailablePackage);
|
|
280
279
|
}
|
|
281
280
|
function isCopilotPackageInstallParams(value) {
|
|
282
|
-
|
|
281
|
+
return isRecord$12(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && hasRequiredWorkspaceDirForWorkspaceScope(value) && isString(value.sourceId) && isString(value.packageId) && isStringArray$1(value.artifactIds, false) && isOptionalString(value.pinnedVersion) && (value.localMode === void 0 || value.localMode === "live" || value.localMode === "private-workspace-override");
|
|
283
282
|
}
|
|
284
283
|
function isCopilotPackageUpdateParams(value) {
|
|
285
|
-
|
|
284
|
+
return isRecord$12(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && hasRequiredWorkspaceDirForWorkspaceScope(value) && isString(value.packageId) && isStringArray$1(value.artifactIds, false) && isOptionalString(value.pinnedVersion);
|
|
286
285
|
}
|
|
287
286
|
function isCopilotPackageUninstallParams(value) {
|
|
288
|
-
|
|
287
|
+
return isRecord$12(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && hasRequiredWorkspaceDirForWorkspaceScope(value) && isString(value.packageId);
|
|
289
288
|
}
|
|
290
289
|
function isCopilotPackageMoveParams(value) {
|
|
291
|
-
|
|
290
|
+
return isRecord$12(value) && hasOptionalWorkspaceDir(value) && isString(value.packageId) && isScope(value.from) && isScope(value.to) && value.from !== value.to && isString(value.workspaceDir);
|
|
292
291
|
}
|
|
293
292
|
function isCopilotLegacyPreviewParams(value) {
|
|
294
|
-
|
|
293
|
+
return isRecord$12(value) && hasOptionalWorkspaceDir(value);
|
|
295
294
|
}
|
|
296
295
|
function isCopilotLegacyMigrateParams(value) {
|
|
297
|
-
|
|
296
|
+
return isRecord$12(value) && hasOptionalWorkspaceDir(value) && isStringArray$1(value.artifactIds, false);
|
|
298
297
|
}
|
|
299
298
|
function isCopilotSourceListParams(value) {
|
|
300
|
-
|
|
299
|
+
return isRecord$12(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value);
|
|
301
300
|
}
|
|
302
301
|
function isCopilotSourceListResult(value) {
|
|
303
|
-
|
|
302
|
+
return isRecord$12(value) && !hasPrivateResultKey(value) && Array.isArray(value.sources) && value.sources.every(isSourceRecord);
|
|
304
303
|
}
|
|
305
304
|
function isCopilotSourceRemoveParams(value) {
|
|
306
|
-
|
|
305
|
+
return isRecord$12(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && isString(value.sourceId);
|
|
307
306
|
}
|
|
308
307
|
function isCopilotSourceRemoveResult(value) {
|
|
309
|
-
|
|
308
|
+
return isRecord$12(value) && !hasPrivateResultKey(value) && value.removed === true;
|
|
310
309
|
}
|
|
311
310
|
function isCopilotUpdatePreviewParams(value) {
|
|
312
|
-
|
|
311
|
+
return isRecord$12(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && isString(value.packageId) && isString(value.revision);
|
|
313
312
|
}
|
|
314
313
|
function isCopilotUpdatePreviewResult(value) {
|
|
315
|
-
|
|
314
|
+
return isRecord$12(value) && !hasPrivateResultKey(value) && isUpdatePreview(value.preview);
|
|
316
315
|
}
|
|
317
316
|
function isCopilotLegacyPreviewResult(value) {
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
317
|
+
return isRecord$12(value) && !hasPrivateResultKey(value) && value.sourceLabel === "~/.agents" && Number.isInteger(value.count) && value.count >= 0 && Array.isArray(value.artifacts) && value.artifacts.every(isArtifactSummary);
|
|
318
|
+
}
|
|
319
|
+
const isCopilotPackageInstallResult = isCopilotCustomizationsListResult;
|
|
320
|
+
const isCopilotPackageUpdateResult = isCopilotCustomizationsListResult;
|
|
321
|
+
const isCopilotPackageUninstallResult = isCopilotCustomizationsListResult;
|
|
322
|
+
const isCopilotPackageMoveResult = isCopilotCustomizationsListResult;
|
|
323
|
+
const isCopilotLegacyMigrateResult = isCopilotCustomizationsListResult;
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region src/json.ts
|
|
326
|
+
const JSON_SORT_ALGORITHMS = [
|
|
327
|
+
"default",
|
|
328
|
+
"keyLength",
|
|
329
|
+
"alphaNum",
|
|
330
|
+
"values",
|
|
331
|
+
"type"
|
|
333
332
|
];
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
333
|
+
const JSON_SORT_ORDERS = ["asc", "desc"];
|
|
334
|
+
const DEFAULT_JSON_SORT_OPTIONS = {
|
|
335
|
+
sortOrder: "asc",
|
|
336
|
+
sortAlgo: "default"
|
|
338
337
|
};
|
|
339
|
-
function
|
|
340
|
-
|
|
338
|
+
function isRecord(value) {
|
|
339
|
+
return typeof value === "object" && value !== null;
|
|
341
340
|
}
|
|
342
341
|
function isJsonSortAlgorithm(value) {
|
|
343
|
-
|
|
342
|
+
return typeof value === "string" && JSON_SORT_ALGORITHMS.includes(value);
|
|
344
343
|
}
|
|
345
344
|
function isJsonSortOrder(value) {
|
|
346
|
-
|
|
345
|
+
return typeof value === "string" && JSON_SORT_ORDERS.includes(value);
|
|
347
346
|
}
|
|
348
347
|
function isJsonSortOptions(value) {
|
|
349
|
-
|
|
348
|
+
return isRecord(value) && isJsonSortOrder(value.sortOrder) && isJsonSortAlgorithm(value.sortAlgo);
|
|
350
349
|
}
|
|
351
350
|
function isJsonValidationResult(value) {
|
|
352
|
-
|
|
351
|
+
return isRecord(value) && typeof value.valid === "boolean" && (value.error === void 0 || typeof value.error === "string");
|
|
353
352
|
}
|
|
354
353
|
function isJsonOutputResult(value) {
|
|
355
|
-
|
|
354
|
+
return isRecord(value) && typeof value.output === "string";
|
|
356
355
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region src/bridge-copilot-plugins.ts
|
|
358
|
+
const SCOPES = /* @__PURE__ */ new Set(["workspace", "personal"]);
|
|
360
359
|
function isOptionalScope(value) {
|
|
361
|
-
|
|
360
|
+
return value === void 0 || typeof value === "string" && SCOPES.has(value);
|
|
362
361
|
}
|
|
363
362
|
function isScopeArray(value) {
|
|
364
|
-
|
|
363
|
+
return Array.isArray(value) && value.every((s) => typeof s === "string" && SCOPES.has(s));
|
|
365
364
|
}
|
|
366
365
|
function isRegistration(value) {
|
|
367
|
-
|
|
366
|
+
return isRecord(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";
|
|
368
367
|
}
|
|
369
368
|
function isCopilotPluginListParams(value) {
|
|
370
|
-
|
|
369
|
+
return isRecord(value);
|
|
371
370
|
}
|
|
372
371
|
function isCopilotPluginListResult(value) {
|
|
373
|
-
|
|
372
|
+
return isRecord(value) && Array.isArray(value.plugins) && value.plugins.every(isRegistration);
|
|
374
373
|
}
|
|
375
374
|
function isCopilotPluginRegisterParams(value) {
|
|
376
|
-
|
|
375
|
+
return isRecord(value) && isOptionalScope(value.scope) && (value.workspaceDir === void 0 || typeof value.workspaceDir === "string") && typeof value.repoId === "string" && typeof value.pluginId === "string";
|
|
377
376
|
}
|
|
378
|
-
|
|
377
|
+
const isCopilotPluginRegisterResult = isCopilotPluginListResult;
|
|
379
378
|
function isCopilotPluginUnregisterParams(value) {
|
|
380
|
-
|
|
379
|
+
return isRecord(value) && isOptionalScope(value.scope) && (value.workspaceDir === void 0 || typeof value.workspaceDir === "string") && typeof value.registrationId === "string";
|
|
381
380
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
function
|
|
386
|
-
|
|
381
|
+
const isCopilotPluginUnregisterResult = isCopilotPluginListResult;
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region src/bridge-skill-repo.ts
|
|
384
|
+
function isRecord$11(value) {
|
|
385
|
+
return typeof value === "object" && value !== null;
|
|
387
386
|
}
|
|
388
|
-
function
|
|
389
|
-
|
|
387
|
+
function isStringOrUndefined$2(value) {
|
|
388
|
+
return value === void 0 || typeof value === "string";
|
|
390
389
|
}
|
|
391
390
|
function isBooleanOrUndefined(value) {
|
|
392
|
-
|
|
391
|
+
return value === void 0 || typeof value === "boolean";
|
|
393
392
|
}
|
|
394
393
|
function isSkillKindOrUndefined(value) {
|
|
395
|
-
|
|
394
|
+
return value === void 0 || value === "skill" || value === "agent";
|
|
396
395
|
}
|
|
397
396
|
function isLinkScope(value) {
|
|
398
|
-
|
|
397
|
+
return value === "workspace" || value === "user";
|
|
399
398
|
}
|
|
400
399
|
function isLinkScopeOrUndefined(value) {
|
|
401
|
-
|
|
400
|
+
return value === void 0 || isLinkScope(value);
|
|
402
401
|
}
|
|
403
402
|
function isLinkScopeFilterOrUndefined(value) {
|
|
404
|
-
|
|
403
|
+
return value === void 0 || value === "workspace" || value === "user" || value === "all";
|
|
405
404
|
}
|
|
406
405
|
function isLinkModeOrUndefined(value) {
|
|
407
|
-
|
|
406
|
+
return value === void 0 || value === "auto" || value === "symlink" || value === "junction" || value === "copy";
|
|
408
407
|
}
|
|
409
408
|
function isLinkMode(value) {
|
|
410
|
-
|
|
409
|
+
return value === "symlink" || value === "junction" || value === "copy";
|
|
411
410
|
}
|
|
412
411
|
function isRepoEntry(value) {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
return false;
|
|
430
|
-
}
|
|
431
|
-
if (value.lastSyncError !== void 0 && typeof value.lastSyncError !== "string") {
|
|
432
|
-
return false;
|
|
433
|
-
}
|
|
434
|
-
return true;
|
|
412
|
+
if (!isRecord$11(value)) return false;
|
|
413
|
+
if (typeof value.id !== "string") return false;
|
|
414
|
+
if (typeof value.name !== "string") return false;
|
|
415
|
+
if (typeof value.url !== "string") return false;
|
|
416
|
+
if (typeof value.branch !== "string") return false;
|
|
417
|
+
if (typeof value.enabled !== "boolean") return false;
|
|
418
|
+
if (value.useProxy !== void 0 && typeof value.useProxy !== "boolean") return false;
|
|
419
|
+
if (typeof value.writeEnabled !== "boolean") return false;
|
|
420
|
+
if (value.source !== "default" && value.source !== "user") return false;
|
|
421
|
+
if (typeof value.addedAt !== "string") return false;
|
|
422
|
+
if (value.description !== void 0 && typeof value.description !== "string") return false;
|
|
423
|
+
if (value.lastSyncAt !== void 0 && typeof value.lastSyncAt !== "string") return false;
|
|
424
|
+
if (value.lastSyncCommitSha !== void 0 && typeof value.lastSyncCommitSha !== "string") return false;
|
|
425
|
+
if (value.lastSyncStatus !== void 0 && value.lastSyncStatus !== "ok" && value.lastSyncStatus !== "error") return false;
|
|
426
|
+
if (value.lastSyncError !== void 0 && typeof value.lastSyncError !== "string") return false;
|
|
427
|
+
return true;
|
|
435
428
|
}
|
|
436
429
|
function isSkillEntry(value) {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
if (typeof value.modifiedAt !== "string") return false;
|
|
447
|
-
return true;
|
|
430
|
+
if (!isRecord$11(value)) return false;
|
|
431
|
+
if (typeof value.repoId !== "string") return false;
|
|
432
|
+
if (typeof value.name !== "string") return false;
|
|
433
|
+
if (value.kind !== "skill" && value.kind !== "agent") return false;
|
|
434
|
+
if (typeof value.manifestPath !== "string") return false;
|
|
435
|
+
if (typeof value.dir !== "string") return false;
|
|
436
|
+
if (typeof value.frontmatter !== "object" || value.frontmatter === null) return false;
|
|
437
|
+
if (typeof value.modifiedAt !== "string") return false;
|
|
438
|
+
return true;
|
|
448
439
|
}
|
|
449
440
|
function isSkillFile(value) {
|
|
450
|
-
|
|
441
|
+
return isRecord$11(value) && typeof value.path === "string" && typeof value.content === "string";
|
|
451
442
|
}
|
|
452
443
|
function isLinkedSkill(value) {
|
|
453
|
-
|
|
444
|
+
return isRecord$11(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.linkPath === "string" && typeof value.targetPath === "string" && isLinkMode(value.mode) && isLinkScope(value.scope);
|
|
454
445
|
}
|
|
455
446
|
function isSyncPull(value) {
|
|
456
|
-
|
|
447
|
+
return isRecord$11(value) && typeof value.repoId === "string" && (value.status === "ok" || value.status === "error");
|
|
457
448
|
}
|
|
458
449
|
function isCopilotContentStatus(value) {
|
|
459
|
-
|
|
450
|
+
return value === "restored" || value === "adopted" || value === "pending_approval" || value === "missing_source" || value === "conflict" || value === "drifted";
|
|
460
451
|
}
|
|
461
452
|
function isCopilotContentEntry(value) {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
453
|
+
if (!isRecord$11(value)) return false;
|
|
454
|
+
if (typeof value.identity !== "string") return false;
|
|
455
|
+
if (!isCopilotContentStatus(value.status)) return false;
|
|
456
|
+
if (value.message !== void 0 && typeof value.message !== "string") return false;
|
|
457
|
+
return true;
|
|
467
458
|
}
|
|
468
459
|
function isCopilotContentIntegrationKind(value) {
|
|
469
|
-
|
|
460
|
+
return value === "mcp" || value === "hook";
|
|
470
461
|
}
|
|
471
462
|
function isCopilotContentIntegrationStatus(value) {
|
|
472
|
-
|
|
463
|
+
return value === "active" || value === "inactive" || value === "pending_approval" || value === "missing_local_configuration";
|
|
473
464
|
}
|
|
474
465
|
function isCopilotContentIntegration(value) {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
return isCopilotContentIntegrationStatus(value.status);
|
|
466
|
+
if (!isRecord$11(value)) return false;
|
|
467
|
+
if (typeof value.identity !== "string") return false;
|
|
468
|
+
if (!isCopilotContentIntegrationKind(value.kind)) return false;
|
|
469
|
+
if (typeof value.configPath !== "string") return false;
|
|
470
|
+
if (!Array.isArray(value.names) || value.names.some((name) => typeof name !== "string")) return false;
|
|
471
|
+
return isCopilotContentIntegrationStatus(value.status);
|
|
483
472
|
}
|
|
484
473
|
function isSkillRepoListResult(value) {
|
|
485
|
-
|
|
474
|
+
return isRecord$11(value) && Array.isArray(value.entries) && value.entries.every(isSkillEntry);
|
|
486
475
|
}
|
|
487
476
|
function isSkillRepoGetResult(value) {
|
|
488
|
-
|
|
477
|
+
return isRecord$11(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);
|
|
489
478
|
}
|
|
490
479
|
function isSkillRepoInstallResult(value) {
|
|
491
|
-
|
|
480
|
+
return isRecord$11(value) && isLinkMode(value.mode) && typeof value.linkPath === "string" && typeof value.targetPath === "string";
|
|
492
481
|
}
|
|
493
482
|
function isSkillRepoConvertToSymlinkResult(value) {
|
|
494
|
-
|
|
483
|
+
return isRecord$11(value) && isLinkMode(value.mode) && typeof value.linkPath === "string" && typeof value.targetPath === "string";
|
|
495
484
|
}
|
|
496
485
|
function isSkillRepoUninstallResult(value) {
|
|
497
|
-
|
|
486
|
+
return isRecord$11(value) && value.removed === true;
|
|
498
487
|
}
|
|
499
488
|
function isSkillRepoSetEntryEnabledResult(value) {
|
|
500
|
-
|
|
489
|
+
return isRecord$11(value) && typeof value.enabled === "boolean";
|
|
490
|
+
}
|
|
491
|
+
function isSkillKind(value) {
|
|
492
|
+
return value === "skill" || value === "agent";
|
|
493
|
+
}
|
|
494
|
+
function isCopilotContentDetectUnmanagedParams(value) {
|
|
495
|
+
return isRecord$11(value) && typeof value.workspaceDir === "string";
|
|
496
|
+
}
|
|
497
|
+
function isCopilotContentDetectUnmanagedResult(value) {
|
|
498
|
+
if (!isRecord$11(value)) return false;
|
|
499
|
+
if (!Array.isArray(value.adoptions) || !Array.isArray(value.ambiguous)) return false;
|
|
500
|
+
if (!Array.isArray(value.integrations) || !Array.isArray(value.unmatched)) return false;
|
|
501
|
+
return value.adoptions.every((a) => isRecord$11(a) && typeof a.repoId === "string" && typeof a.name === "string" && isSkillKind(a.kind) && (a.source === "symlink" || a.source === "fingerprint")) && value.ambiguous.every((a) => isRecord$11(a) && typeof a.name === "string" && isSkillKind(a.kind) && Array.isArray(a.candidates) && a.candidates.every((c) => typeof c === "string")) && value.integrations.every((i) => isRecord$11(i) && typeof i.repoId === "string" && typeof i.pluginId === "string" && (i.kind === "hook" || i.kind === "mcp")) && value.unmatched.every((u) => isRecord$11(u) && typeof u.name === "string" && typeof u.reason === "string");
|
|
502
|
+
}
|
|
503
|
+
function isCopilotContentAdoptUnmanagedParams(value) {
|
|
504
|
+
if (!isRecord$11(value) || typeof value.workspaceDir !== "string") return false;
|
|
505
|
+
if (!Array.isArray(value.entries)) return false;
|
|
506
|
+
if (!value.entries.every((e) => isRecord$11(e) && typeof e.repoId === "string" && typeof e.name === "string" && isSkillKind(e.kind) && (e.convertRealCopy === void 0 || typeof e.convertRealCopy === "boolean"))) return false;
|
|
507
|
+
if (value.integrations !== void 0 && !Array.isArray(value.integrations)) return false;
|
|
508
|
+
if (Array.isArray(value.integrations)) return value.integrations.every((i) => isRecord$11(i) && typeof i.repoId === "string" && typeof i.pluginId === "string" && (i.kind === "hook" || i.kind === "mcp"));
|
|
509
|
+
return true;
|
|
510
|
+
}
|
|
511
|
+
function isCopilotContentAdoptUnmanagedResult(value) {
|
|
512
|
+
if (!isRecord$11(value) || typeof value.changed !== "boolean") return false;
|
|
513
|
+
if (!Array.isArray(value.entries)) return false;
|
|
514
|
+
return value.entries.every((e) => isRecord$11(e) && typeof e.identity === "string" && typeof e.status === "string" && (e.message === void 0 || typeof e.message === "string"));
|
|
501
515
|
}
|
|
502
516
|
function isSkillRepoListLinkedResult(value) {
|
|
503
|
-
|
|
517
|
+
return isRecord$11(value) && Array.isArray(value.links) && value.links.every(isLinkedSkill);
|
|
504
518
|
}
|
|
505
519
|
function isSkillRepoDraftCreateResult(value) {
|
|
506
|
-
|
|
520
|
+
return isRecord$11(value) && typeof value.id === "string";
|
|
507
521
|
}
|
|
508
522
|
function isSkillRepoDraftCommitResult(value) {
|
|
509
|
-
|
|
523
|
+
return isRecord$11(value) && typeof value.repoId === "string" && typeof value.skillName === "string" && typeof value.commitSha === "string" && isStringOrUndefined$2(value.pushedRef) && isStringOrUndefined$2(value.pushedSha);
|
|
510
524
|
}
|
|
511
525
|
function isSkillRepoDraftListResult(value) {
|
|
512
|
-
|
|
513
|
-
(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"
|
|
514
|
-
);
|
|
526
|
+
return isRecord$11(value) && Array.isArray(value.drafts) && value.drafts.every((d) => isRecord$11(d) && typeof d.id === "string" && (d.kind === "skill" || d.kind === "agent") && typeof d.name === "string" && typeof d.description === "string" && typeof d.modifiedAt === "string");
|
|
515
527
|
}
|
|
516
528
|
function isSkillRepoDraftDeleteResult(value) {
|
|
517
|
-
|
|
529
|
+
return isRecord$11(value) && value.deleted === true;
|
|
518
530
|
}
|
|
519
531
|
function isRepoListResult(value) {
|
|
520
|
-
|
|
532
|
+
return isRecord$11(value) && Array.isArray(value.repos) && value.repos.every(isRepoEntry);
|
|
521
533
|
}
|
|
522
534
|
function isRepoAddResult(value) {
|
|
523
|
-
|
|
535
|
+
return isRecord$11(value) && isRepoEntry(value.repo) && typeof value.branch === "string" && typeof value.cloned === "boolean";
|
|
524
536
|
}
|
|
525
537
|
function isRepoRemoveResult(value) {
|
|
526
|
-
|
|
538
|
+
return isRecord$11(value) && value.removed === true;
|
|
527
539
|
}
|
|
528
540
|
function isRepoEnableResult(value) {
|
|
529
|
-
|
|
541
|
+
return isRecord$11(value) && isRepoEntry(value.repo);
|
|
530
542
|
}
|
|
531
543
|
function isRepoDisableResult(value) {
|
|
532
|
-
|
|
544
|
+
return isRecord$11(value) && isRepoEntry(value.repo);
|
|
533
545
|
}
|
|
534
546
|
function isRepoUpdateResult(value) {
|
|
535
|
-
|
|
547
|
+
return isRecord$11(value) && isRepoEntry(value.repo);
|
|
536
548
|
}
|
|
537
549
|
function isRepoSyncResult(value) {
|
|
538
|
-
|
|
550
|
+
return isRecord$11(value) && Array.isArray(value.pulls) && value.pulls.length >= 1 && value.pulls.every(isSyncPull);
|
|
539
551
|
}
|
|
540
552
|
function isRepoSyncAllResult(value) {
|
|
541
|
-
|
|
553
|
+
return isRecord$11(value) && Array.isArray(value.pulls) && value.pulls.every(isSyncPull);
|
|
542
554
|
}
|
|
543
555
|
function isCopilotContentRestoreResult(value) {
|
|
544
|
-
|
|
556
|
+
return isRecord$11(value) && typeof value.changed === "boolean" && Array.isArray(value.entries) && value.entries.every(isCopilotContentEntry);
|
|
545
557
|
}
|
|
546
558
|
function isCopilotContentStatusResult(value) {
|
|
547
|
-
|
|
559
|
+
return isCopilotContentRestoreResult(value);
|
|
548
560
|
}
|
|
549
561
|
function isCopilotContentApproveResult(value) {
|
|
550
|
-
|
|
562
|
+
return isCopilotContentRestoreResult(value);
|
|
551
563
|
}
|
|
552
564
|
function isCopilotContentMigrateLegacyResult(value) {
|
|
553
|
-
|
|
565
|
+
return isRecord$11(value) && Array.isArray(value.entries) && value.entries.every(isCopilotContentEntry);
|
|
554
566
|
}
|
|
555
567
|
function isCopilotContentIntegrationStatusResult(value) {
|
|
556
|
-
|
|
568
|
+
return isRecord$11(value) && Array.isArray(value.integrations) && value.integrations.every(isCopilotContentIntegration);
|
|
557
569
|
}
|
|
558
570
|
function isSkillRepoListParams(value) {
|
|
559
|
-
|
|
571
|
+
return isRecord$11(value) && isStringOrUndefined$2(value.repoId) && isSkillKindOrUndefined(value.kind) && isStringOrUndefined$2(value.workspaceDir);
|
|
560
572
|
}
|
|
561
573
|
function isSkillRepoGetParams(value) {
|
|
562
|
-
|
|
574
|
+
return isRecord$11(value) && typeof value.repoId === "string" && typeof value.name === "string";
|
|
563
575
|
}
|
|
564
576
|
function isSkillRepoInstallParams(value) {
|
|
565
|
-
|
|
577
|
+
return isRecord$11(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkModeOrUndefined(value.mode) && isLinkScopeOrUndefined(value.scope);
|
|
566
578
|
}
|
|
567
579
|
function isSkillRepoConvertToSymlinkParams(value) {
|
|
568
|
-
|
|
580
|
+
return isRecord$11(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkModeOrUndefined(value.mode) && isLinkScopeOrUndefined(value.scope);
|
|
569
581
|
}
|
|
570
582
|
function isSkillRepoUninstallParams(value) {
|
|
571
|
-
|
|
583
|
+
return isRecord$11(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkScopeOrUndefined(value.scope);
|
|
572
584
|
}
|
|
573
585
|
function isSkillRepoSetEntryEnabledParams(value) {
|
|
574
|
-
|
|
586
|
+
return isRecord$11(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");
|
|
575
587
|
}
|
|
576
588
|
function isSkillRepoListLinkedParams(value) {
|
|
577
|
-
|
|
589
|
+
return isRecord$11(value) && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkScopeFilterOrUndefined(value.scope);
|
|
578
590
|
}
|
|
579
591
|
function isRepoListParams(value) {
|
|
580
|
-
|
|
592
|
+
return isRecord$11(value) && (value.source === void 0 || value.source === "default" || value.source === "user");
|
|
581
593
|
}
|
|
582
594
|
function isRepoAddParams(value) {
|
|
583
|
-
|
|
595
|
+
return isRecord$11(value) && typeof value.url === "string" && isStringOrUndefined$2(value.branch) && isStringOrUndefined$2(value.name) && isBooleanOrUndefined(value.useProxy);
|
|
584
596
|
}
|
|
585
597
|
function isRepoRemoveParams(value) {
|
|
586
|
-
|
|
598
|
+
return isRecord$11(value) && typeof value.repoId === "string";
|
|
587
599
|
}
|
|
588
600
|
function isRepoEnableParams(value) {
|
|
589
|
-
|
|
601
|
+
return isRecord$11(value) && typeof value.repoId === "string";
|
|
590
602
|
}
|
|
591
603
|
function isRepoDisableParams(value) {
|
|
592
|
-
|
|
604
|
+
return isRecord$11(value) && typeof value.repoId === "string";
|
|
593
605
|
}
|
|
594
606
|
function isRepoSyncParams(value) {
|
|
595
|
-
|
|
607
|
+
return isRecord$11(value) && typeof value.repoId === "string";
|
|
596
608
|
}
|
|
597
609
|
function isRepoSyncAllParams(value) {
|
|
598
|
-
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
610
|
+
return isRecord$11(value);
|
|
611
|
+
}
|
|
612
|
+
//#endregion
|
|
613
|
+
//#region src/device.ts
|
|
614
|
+
const DEVICE_BINDING_STATES = [
|
|
615
|
+
"anonymous",
|
|
616
|
+
"pending",
|
|
617
|
+
"claimed",
|
|
618
|
+
"expired"
|
|
607
619
|
];
|
|
608
|
-
function
|
|
609
|
-
|
|
620
|
+
function isRecord$10(value) {
|
|
621
|
+
return typeof value === "object" && value !== null;
|
|
610
622
|
}
|
|
611
|
-
function
|
|
612
|
-
|
|
623
|
+
function isStringOrUndefined$1(value) {
|
|
624
|
+
return value === void 0 || typeof value === "string";
|
|
613
625
|
}
|
|
614
626
|
function isDeviceBindingState(value) {
|
|
615
|
-
|
|
627
|
+
return value === "anonymous" || value === "pending" || value === "claimed" || value === "expired";
|
|
616
628
|
}
|
|
617
629
|
function isDeviceIdentityState(value) {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
630
|
+
if (!isRecord$10(value)) return false;
|
|
631
|
+
if (typeof value.publicId !== "string") return false;
|
|
632
|
+
if (value.publicId.length === 0) return false;
|
|
633
|
+
if (typeof value.secretVersion !== "number") return false;
|
|
634
|
+
if (!Number.isInteger(value.secretVersion)) return false;
|
|
635
|
+
if (value.secretVersion < 0) return false;
|
|
636
|
+
if (!isDeviceBindingState(value.bindingState)) return false;
|
|
637
|
+
return true;
|
|
626
638
|
}
|
|
627
639
|
function isDeviceMetadata(value) {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
640
|
+
if (!isRecord$10(value)) return false;
|
|
641
|
+
if (typeof value.installationId !== "string") return false;
|
|
642
|
+
if (value.installationId.length === 0) return false;
|
|
643
|
+
if (typeof value.machineId !== "string") return false;
|
|
644
|
+
if (value.machineId.length === 0) return false;
|
|
645
|
+
if (typeof value.platform !== "string") return false;
|
|
646
|
+
if (value.platform.length === 0) return false;
|
|
647
|
+
if (!isStringOrUndefined$1(value.hostname)) return false;
|
|
648
|
+
if (!isStringOrUndefined$1(value.vscodeVersion)) return false;
|
|
649
|
+
if (!isStringOrUndefined$1(value.extensionVersion)) return false;
|
|
650
|
+
return true;
|
|
639
651
|
}
|
|
640
652
|
function isDeviceStatus(value) {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
}
|
|
649
|
-
if (!isStringOrUndefined3(value.lastSyncAt)) return false;
|
|
650
|
-
if (!isStringOrUndefined3(value.lastSyncError)) return false;
|
|
651
|
-
return true;
|
|
653
|
+
if (!isRecord$10(value)) return false;
|
|
654
|
+
if (!isDeviceBindingState(value.bindingState)) return false;
|
|
655
|
+
if (value.identity !== void 0 && !isDeviceIdentityState(value.identity)) return false;
|
|
656
|
+
if (value.metadata !== void 0 && !isDeviceMetadata(value.metadata)) return false;
|
|
657
|
+
if (!isStringOrUndefined$1(value.lastSyncAt)) return false;
|
|
658
|
+
if (!isStringOrUndefined$1(value.lastSyncError)) return false;
|
|
659
|
+
return true;
|
|
652
660
|
}
|
|
653
661
|
function isDeviceEnrollParams(value) {
|
|
654
|
-
|
|
662
|
+
return isRecord$10(value) && (value.force === void 0 || typeof value.force === "boolean") && (value.requireAuth === void 0 || typeof value.requireAuth === "boolean");
|
|
655
663
|
}
|
|
656
664
|
function isDeviceEnrollResult(value) {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
665
|
+
if (!isRecord$10(value)) return false;
|
|
666
|
+
if (typeof value.publicId !== "string") return false;
|
|
667
|
+
if (value.publicId.length === 0) return false;
|
|
668
|
+
if (!isDeviceBindingState(value.bindingState)) return false;
|
|
669
|
+
if (!isStringOrUndefined$1(value.expiresAt)) return false;
|
|
670
|
+
return true;
|
|
663
671
|
}
|
|
664
672
|
function isDeviceRotateSecretParams(value) {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
}
|
|
669
|
-
return true;
|
|
673
|
+
if (!isRecord$10(value)) return false;
|
|
674
|
+
if (value.gracePeriodDays !== void 0 && (typeof value.gracePeriodDays !== "number" || !Number.isInteger(value.gracePeriodDays) || value.gracePeriodDays < 0 || value.gracePeriodDays > 365)) return false;
|
|
675
|
+
return true;
|
|
670
676
|
}
|
|
671
677
|
function isDeviceRotateSecretResult(value) {
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
678
|
+
if (!isRecord$10(value)) return false;
|
|
679
|
+
if (typeof value.publicId !== "string") return false;
|
|
680
|
+
if (value.publicId.length === 0) return false;
|
|
681
|
+
if (typeof value.secretVersion !== "number") return false;
|
|
682
|
+
if (!Number.isInteger(value.secretVersion)) return false;
|
|
683
|
+
if (value.secretVersion < 0) return false;
|
|
684
|
+
if (typeof value.gracePeriodDays !== "number") return false;
|
|
685
|
+
if (!Number.isInteger(value.gracePeriodDays)) return false;
|
|
686
|
+
if (value.gracePeriodDays < 0) return false;
|
|
687
|
+
if (!isStringOrUndefined$1(value.gracePeriodEndsAt)) return false;
|
|
688
|
+
return true;
|
|
689
|
+
}
|
|
690
|
+
//#endregion
|
|
691
|
+
//#region src/scheduled-tasks.ts
|
|
692
|
+
const VALID_TASK_TYPES = [
|
|
693
|
+
"command",
|
|
694
|
+
"shell",
|
|
695
|
+
"http_request",
|
|
696
|
+
"github_copilot_cli"
|
|
691
697
|
];
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
+
const VALID_SCHEDULE_TYPES = ["cron", "interval"];
|
|
699
|
+
const VALID_TERMINAL_STATUSES = [
|
|
700
|
+
"success",
|
|
701
|
+
"failure",
|
|
702
|
+
"timeout",
|
|
703
|
+
"cancelled"
|
|
698
704
|
];
|
|
699
|
-
function
|
|
700
|
-
|
|
705
|
+
function isRecord$9(value) {
|
|
706
|
+
return typeof value === "object" && value !== null;
|
|
701
707
|
}
|
|
702
708
|
function isScheduledTaskType(value) {
|
|
703
|
-
|
|
709
|
+
return typeof value === "string" && VALID_TASK_TYPES.includes(value);
|
|
704
710
|
}
|
|
711
|
+
/**
|
|
712
|
+
* Validates a v1 task shape (no `workspace`). Used for reading legacy config
|
|
713
|
+
* during migration only. New code should validate against {@link ScheduledTask}
|
|
714
|
+
* with {@link isScheduledTask}.
|
|
715
|
+
*/
|
|
705
716
|
function isScheduledTaskV1(value) {
|
|
706
|
-
|
|
707
|
-
|
|
717
|
+
if (!isRecord$9(value)) return false;
|
|
718
|
+
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) && isRecord$9(value.payload) && typeof value.createdAt === "string" && typeof value.updatedAt === "string";
|
|
708
719
|
}
|
|
720
|
+
/** Validates a {@link TaskWorkspaceRef} payload. */
|
|
709
721
|
function isTaskWorkspaceRef(value) {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
if (value.lastSeenAt !== void 0 && typeof value.lastSeenAt !== "string") {
|
|
720
|
-
return false;
|
|
721
|
-
}
|
|
722
|
-
return true;
|
|
723
|
-
}
|
|
722
|
+
if (!isRecord$9(value)) return false;
|
|
723
|
+
if (typeof value.path !== "string" || value.path.length === 0) return false;
|
|
724
|
+
if (typeof value.name !== "string" || value.name.length === 0) return false;
|
|
725
|
+
if (value.gitRemote !== void 0 && typeof value.gitRemote !== "string") return false;
|
|
726
|
+
if (value.gitBranch !== void 0 && typeof value.gitBranch !== "string") return false;
|
|
727
|
+
if (value.lastSeenAt !== void 0 && typeof value.lastSeenAt !== "string") return false;
|
|
728
|
+
return true;
|
|
729
|
+
}
|
|
730
|
+
/** Validates a v2 task shape. Requires the `workspace` field. */
|
|
724
731
|
function isScheduledTask(value) {
|
|
725
|
-
|
|
726
|
-
|
|
732
|
+
if (!isScheduledTaskV1(value)) return false;
|
|
733
|
+
return isTaskWorkspaceRef(value.workspace);
|
|
727
734
|
}
|
|
735
|
+
/** Validates a v2 {@link ScheduledTasksConfig} (version: 2). */
|
|
728
736
|
function isScheduledTasksConfig(value) {
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
737
|
+
if (!isRecord$9(value)) return false;
|
|
738
|
+
if (value.version !== 2) return false;
|
|
739
|
+
if (!Array.isArray(value.tasks)) return false;
|
|
740
|
+
return value.tasks.every((t) => isScheduledTask(t));
|
|
733
741
|
}
|
|
742
|
+
/** Validates a v1 {@link ScheduledTasksConfigV1} (version: 1). */
|
|
734
743
|
function isScheduledTasksConfigV1(value) {
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
744
|
+
if (!isRecord$9(value)) return false;
|
|
745
|
+
if (value.version !== 1) return false;
|
|
746
|
+
if (!Array.isArray(value.tasks)) return false;
|
|
747
|
+
return value.tasks.every((t) => isScheduledTaskV1(t));
|
|
739
748
|
}
|
|
740
749
|
function isTaskExecutionLog(value) {
|
|
741
|
-
|
|
742
|
-
|
|
750
|
+
if (!isRecord$9(value)) return false;
|
|
751
|
+
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);
|
|
743
752
|
}
|
|
744
753
|
function isSchedulerStatus(value) {
|
|
745
|
-
|
|
746
|
-
|
|
754
|
+
if (!isRecord$9(value)) return false;
|
|
755
|
+
return typeof value.running === "boolean" && typeof value.tasksRegistered === "number" && typeof value.workspacePath === "string";
|
|
747
756
|
}
|
|
748
757
|
function isTaskExecuteResult(value) {
|
|
749
|
-
|
|
758
|
+
return isRecord$9(value) && typeof value.executionId === "string" && value.accepted === true;
|
|
750
759
|
}
|
|
751
760
|
function isTaskCancelResult(value) {
|
|
752
|
-
|
|
761
|
+
return isRecord$9(value) && typeof value.executionId === "string" && typeof value.cancelled === "boolean";
|
|
753
762
|
}
|
|
754
763
|
function isTaskListRunningResult(value) {
|
|
755
|
-
|
|
764
|
+
return isRecord$9(value) && Array.isArray(value.executions);
|
|
756
765
|
}
|
|
757
766
|
function isTaskStartedEventParams(value) {
|
|
758
|
-
|
|
767
|
+
return isRecord$9(value) && typeof value.executionId === "string" && typeof value.taskId === "string" && typeof value.startedAt === "string";
|
|
759
768
|
}
|
|
760
769
|
function isTaskOutputEventParams(value) {
|
|
761
|
-
|
|
770
|
+
return isRecord$9(value) && typeof value.executionId === "string" && (value.stream === "stdout" || value.stream === "stderr") && typeof value.data === "string";
|
|
762
771
|
}
|
|
763
772
|
function isTaskCompletedEventParams(value) {
|
|
764
|
-
|
|
773
|
+
return isRecord$9(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
|
|
765
774
|
}
|
|
766
775
|
function isTaskFailedEventParams(value) {
|
|
767
|
-
|
|
776
|
+
return isRecord$9(value) && typeof value.executionId === "string" && (value.status === "failure" || value.status === "timeout") && (value.reason === "error" || value.reason === "timeout") && isTaskExecutionLog(value.log);
|
|
768
777
|
}
|
|
769
778
|
function isTaskCancelledEventParams(value) {
|
|
770
|
-
|
|
779
|
+
return isRecord$9(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
|
|
771
780
|
}
|
|
772
781
|
function isAgentSessionStatus(value) {
|
|
773
|
-
|
|
774
|
-
}
|
|
782
|
+
return value === "idle" || value === "running" || value === "needs-input" || value === "completed" || value === "failed" || value === "aborted";
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Converts a single v1 task to v2 by attaching the given workspace context.
|
|
786
|
+
* Preserves all v1 fields (id, name, description, schedule, payload, etc.)
|
|
787
|
+
* and adds the new runtime metadata fields as undefined.
|
|
788
|
+
*
|
|
789
|
+
* The `workspace` argument supplies the workspace binding that the v1 task
|
|
790
|
+
* lacked. Callers (e.g. `MigrateToGlobal`) build this from the file location
|
|
791
|
+
* of the v1 config plus auto-probed git metadata.
|
|
792
|
+
*/
|
|
775
793
|
function migrateTaskV1ToV2(v1, workspace) {
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
}
|
|
794
|
+
const issues = [];
|
|
795
|
+
if (!isScheduledTaskType(v1.taskType)) issues.push(`unknown taskType: ${String(v1.taskType)}`);
|
|
796
|
+
return {
|
|
797
|
+
task: {
|
|
798
|
+
...v1,
|
|
799
|
+
workspace
|
|
800
|
+
},
|
|
801
|
+
issues
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* Converts a v1 config (from a single per-workspace file) to a v2 config
|
|
806
|
+
* (the global config). Every v1 task inherits the supplied workspace context
|
|
807
|
+
* — v1 had no per-task workspace, so the file's location is authoritative.
|
|
808
|
+
*
|
|
809
|
+
* The returned v2 config can be appended to the global config by the caller.
|
|
810
|
+
* Tasks with structural issues (unknown task type) are still migrated but
|
|
811
|
+
* surface a non-fatal issue string.
|
|
812
|
+
*/
|
|
786
813
|
function migrateV1ToV2(v1Config, workspace) {
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
function
|
|
808
|
-
|
|
814
|
+
if (!isTaskWorkspaceRef(workspace)) {
|
|
815
|
+
const w = workspace;
|
|
816
|
+
throw new Error(`migrateV1ToV2: invalid workspace ref (path=${String(w.path)}, name=${String(w.name)})`);
|
|
817
|
+
}
|
|
818
|
+
const allIssues = [];
|
|
819
|
+
return {
|
|
820
|
+
config: {
|
|
821
|
+
version: 2,
|
|
822
|
+
tasks: v1Config.tasks.map((t) => {
|
|
823
|
+
const { task, issues } = migrateTaskV1ToV2(t, workspace);
|
|
824
|
+
allIssues.push(...issues);
|
|
825
|
+
return task;
|
|
826
|
+
})
|
|
827
|
+
},
|
|
828
|
+
issues: allIssues
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
//#endregion
|
|
832
|
+
//#region src/toolbox.ts
|
|
833
|
+
const TOOLBOX_SCOPES = ["user", "workspace"];
|
|
834
|
+
function isRecord$8(value) {
|
|
835
|
+
return typeof value === "object" && value !== null;
|
|
836
|
+
}
|
|
837
|
+
function isStringOrUndefined(value) {
|
|
838
|
+
return value === void 0 || typeof value === "string";
|
|
809
839
|
}
|
|
810
840
|
function isFiniteNumberOrUndefined(value) {
|
|
811
|
-
|
|
841
|
+
return value === void 0 || typeof value === "number" && Number.isFinite(value);
|
|
812
842
|
}
|
|
813
843
|
function isToolboxScope(value) {
|
|
814
|
-
|
|
844
|
+
return value === "user" || value === "workspace";
|
|
815
845
|
}
|
|
816
846
|
function isExternalTool(value) {
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
if (!isStringOrUndefined4(value.lastUsedAt)) return false;
|
|
832
|
-
return true;
|
|
847
|
+
if (!isRecord$8(value)) return false;
|
|
848
|
+
if (typeof value.id !== "string") return false;
|
|
849
|
+
if (value.id.length === 0) return false;
|
|
850
|
+
if (typeof value.name !== "string") return false;
|
|
851
|
+
if (value.name.length === 0) return false;
|
|
852
|
+
if (typeof value.description !== "string") return false;
|
|
853
|
+
if (typeof value.icon !== "string") return false;
|
|
854
|
+
if (typeof value.url !== "string") return false;
|
|
855
|
+
if (value.url.length === 0) return false;
|
|
856
|
+
if (value.isDefault !== void 0 && typeof value.isDefault !== "boolean") return false;
|
|
857
|
+
if (!isFiniteNumberOrUndefined(value.order)) return false;
|
|
858
|
+
if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
|
|
859
|
+
if (!isStringOrUndefined(value.lastUsedAt)) return false;
|
|
860
|
+
return true;
|
|
833
861
|
}
|
|
834
862
|
function isExternalToolPatch(value) {
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
if (!isFiniteNumberOrUndefined(value.order)) return false;
|
|
850
|
-
if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
|
|
851
|
-
if (!isStringOrUndefined4(value.lastUsedAt)) return false;
|
|
852
|
-
return true;
|
|
863
|
+
if (!isRecord$8(value)) return false;
|
|
864
|
+
if (value.name !== void 0) {
|
|
865
|
+
if (typeof value.name !== "string" || value.name.length === 0) return false;
|
|
866
|
+
}
|
|
867
|
+
if (value.description !== void 0 && typeof value.description !== "string") return false;
|
|
868
|
+
if (value.icon !== void 0 && typeof value.icon !== "string") return false;
|
|
869
|
+
if (value.url !== void 0) {
|
|
870
|
+
if (typeof value.url !== "string" || value.url.length === 0) return false;
|
|
871
|
+
}
|
|
872
|
+
if (value.isDefault !== void 0 && typeof value.isDefault !== "boolean") return false;
|
|
873
|
+
if (!isFiniteNumberOrUndefined(value.order)) return false;
|
|
874
|
+
if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
|
|
875
|
+
if (!isStringOrUndefined(value.lastUsedAt)) return false;
|
|
876
|
+
return true;
|
|
853
877
|
}
|
|
854
878
|
function isToolboxList(value) {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
}
|
|
861
|
-
return true;
|
|
879
|
+
if (!isRecord$8(value)) return false;
|
|
880
|
+
if (!isToolboxScope(value.scope)) return false;
|
|
881
|
+
if (!Array.isArray(value.tools)) return false;
|
|
882
|
+
for (const tool of value.tools) if (!isExternalTool(tool)) return false;
|
|
883
|
+
return true;
|
|
862
884
|
}
|
|
863
885
|
function isToolboxListParams(value) {
|
|
864
|
-
|
|
886
|
+
return isRecord$8(value) && (value.scope === void 0 || isToolboxScope(value.scope));
|
|
865
887
|
}
|
|
866
888
|
function isToolboxAddParams(value) {
|
|
867
|
-
|
|
889
|
+
return isExternalTool(value);
|
|
868
890
|
}
|
|
869
891
|
function isToolboxAddResult(value) {
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
892
|
+
if (!isRecord$8(value)) return false;
|
|
893
|
+
if (!isToolboxScope(value.scope)) return false;
|
|
894
|
+
if (!isExternalTool(value.tool)) return false;
|
|
895
|
+
return true;
|
|
874
896
|
}
|
|
875
897
|
function isToolboxRemoveParams(value) {
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
898
|
+
if (!isRecord$8(value)) return false;
|
|
899
|
+
if (typeof value.id !== "string") return false;
|
|
900
|
+
if (value.id.length === 0) return false;
|
|
901
|
+
if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
|
|
902
|
+
return true;
|
|
881
903
|
}
|
|
882
904
|
function isToolboxRemoveResult(value) {
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
905
|
+
if (!isRecord$8(value)) return false;
|
|
906
|
+
if (!isToolboxScope(value.scope)) return false;
|
|
907
|
+
if (typeof value.toolId !== "string") return false;
|
|
908
|
+
if (value.toolId.length === 0) return false;
|
|
909
|
+
if (typeof value.success !== "boolean") return false;
|
|
910
|
+
return true;
|
|
889
911
|
}
|
|
890
912
|
function isToolboxUpdateParams(value) {
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
913
|
+
if (!isRecord$8(value)) return false;
|
|
914
|
+
if (typeof value.id !== "string") return false;
|
|
915
|
+
if (value.id.length === 0) return false;
|
|
916
|
+
if (!isExternalToolPatch(value.patch)) return false;
|
|
917
|
+
if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
|
|
918
|
+
return true;
|
|
897
919
|
}
|
|
898
920
|
function isToolboxUpdateResult(value) {
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
921
|
+
if (!isRecord$8(value)) return false;
|
|
922
|
+
if (!isToolboxScope(value.scope)) return false;
|
|
923
|
+
if (!isExternalTool(value.tool)) return false;
|
|
924
|
+
return true;
|
|
903
925
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
function
|
|
908
|
-
|
|
926
|
+
//#endregion
|
|
927
|
+
//#region src/bridge.ts
|
|
928
|
+
const SERVICEME_PROTOCOL_VERSION = 2;
|
|
929
|
+
function isRecord$7(value) {
|
|
930
|
+
return typeof value === "object" && value !== null;
|
|
909
931
|
}
|
|
910
932
|
function isValidProtocolVersion(value) {
|
|
911
|
-
|
|
933
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= 2;
|
|
912
934
|
}
|
|
913
935
|
function isBridgeCapabilities(value) {
|
|
914
|
-
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
936
|
+
return isRecord$7(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);
|
|
937
|
+
}
|
|
938
|
+
const BRIDGE_METHODS = [
|
|
939
|
+
"system.hello",
|
|
940
|
+
"system.ping",
|
|
941
|
+
"system.shutdown",
|
|
942
|
+
"task.execute",
|
|
943
|
+
"task.cancel",
|
|
944
|
+
"task.list-running",
|
|
945
|
+
"copilotContent.list",
|
|
946
|
+
"copilotContent.get",
|
|
947
|
+
"copilotContent.install",
|
|
948
|
+
"copilotContent.convertToSymlink",
|
|
949
|
+
"copilotContent.uninstall",
|
|
950
|
+
"copilotContent.setEntryEnabled",
|
|
951
|
+
"copilotContent.detectUnmanaged",
|
|
952
|
+
"copilotContent.adoptUnmanaged",
|
|
953
|
+
"copilotContent.listLinked",
|
|
954
|
+
"copilotContent.draft.create",
|
|
955
|
+
"copilotContent.draft.commit",
|
|
956
|
+
"copilotContent.draft.list",
|
|
957
|
+
"copilotContent.draft.delete",
|
|
958
|
+
"skillRepo.list",
|
|
959
|
+
"skillRepo.get",
|
|
960
|
+
"skillRepo.install",
|
|
961
|
+
"skillRepo.convertToSymlink",
|
|
962
|
+
"skillRepo.uninstall",
|
|
963
|
+
"skillRepo.setEntryEnabled",
|
|
964
|
+
"skillRepo.listLinked",
|
|
965
|
+
"skillRepo.draft.create",
|
|
966
|
+
"skillRepo.draft.commit",
|
|
967
|
+
"skillRepo.draft.list",
|
|
968
|
+
"skillRepo.draft.delete",
|
|
969
|
+
"repo.list",
|
|
970
|
+
"repo.add",
|
|
971
|
+
"repo.remove",
|
|
972
|
+
"repo.enable",
|
|
973
|
+
"repo.disable",
|
|
974
|
+
"repo.update",
|
|
975
|
+
"repo.sync",
|
|
976
|
+
"repo.syncAll",
|
|
977
|
+
"repo.resetParseCache",
|
|
978
|
+
"copilotContent.status",
|
|
979
|
+
"copilotContent.restore",
|
|
980
|
+
"copilotContent.approve",
|
|
981
|
+
"copilotContent.migrateLegacy",
|
|
982
|
+
"copilotContent.integrationStatus",
|
|
983
|
+
"copilotContent.customizations.list",
|
|
984
|
+
"copilotContent.package.install",
|
|
985
|
+
"copilotContent.package.update",
|
|
986
|
+
"copilotContent.package.uninstall",
|
|
987
|
+
"copilotContent.package.move",
|
|
988
|
+
"copilotPlugin.list",
|
|
989
|
+
"copilotPlugin.register",
|
|
990
|
+
"copilotPlugin.unregister",
|
|
991
|
+
"copilotContent.legacy.preview",
|
|
992
|
+
"copilotContent.legacy.migrate",
|
|
993
|
+
"copilotContent.sources.list",
|
|
994
|
+
"copilotContent.sources.remove",
|
|
995
|
+
"copilotContent.package.previewUpdate",
|
|
996
|
+
"auth.status",
|
|
997
|
+
"auth.login",
|
|
998
|
+
"auth.logout",
|
|
999
|
+
"auth.whoami",
|
|
1000
|
+
"auth.switch",
|
|
1001
|
+
"device.status",
|
|
1002
|
+
"device.enroll",
|
|
1003
|
+
"device.rotate-secret",
|
|
1004
|
+
"toolbox.list",
|
|
1005
|
+
"toolbox.add",
|
|
1006
|
+
"toolbox.remove",
|
|
1007
|
+
"toolbox.update"
|
|
984
1008
|
];
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1009
|
+
/**
|
|
1010
|
+
* Legacy `skillRepo.*` → canonical `copilotContent.*` method aliases.
|
|
1011
|
+
* Both names stay wire-compatible during the migration window; new
|
|
1012
|
+
* callers must use the canonical names. Servers should dispatch both
|
|
1013
|
+
* spellings to the same handler and always answer with the method name
|
|
1014
|
+
* the request actually used.
|
|
1015
|
+
*/
|
|
1016
|
+
const COPILOT_CONTENT_METHOD_ALIASES = {
|
|
1017
|
+
"skillRepo.list": "copilotContent.list",
|
|
1018
|
+
"skillRepo.get": "copilotContent.get",
|
|
1019
|
+
"skillRepo.install": "copilotContent.install",
|
|
1020
|
+
"skillRepo.convertToSymlink": "copilotContent.convertToSymlink",
|
|
1021
|
+
"skillRepo.uninstall": "copilotContent.uninstall",
|
|
1022
|
+
"skillRepo.setEntryEnabled": "copilotContent.setEntryEnabled",
|
|
1023
|
+
"skillRepo.listLinked": "copilotContent.listLinked",
|
|
1024
|
+
"skillRepo.draft.create": "copilotContent.draft.create",
|
|
1025
|
+
"skillRepo.draft.commit": "copilotContent.draft.commit",
|
|
1026
|
+
"skillRepo.draft.list": "copilotContent.draft.list",
|
|
1027
|
+
"skillRepo.draft.delete": "copilotContent.draft.delete"
|
|
997
1028
|
};
|
|
1029
|
+
/**
|
|
1030
|
+
* Normalize a legacy `skillRepo.*` method name to its canonical
|
|
1031
|
+
* `copilotContent.*` spelling. Unknown names pass through unchanged.
|
|
1032
|
+
*/
|
|
998
1033
|
function normalizeBridgeMethod(method) {
|
|
999
|
-
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1034
|
+
return COPILOT_CONTENT_METHOD_ALIASES[method] ?? method;
|
|
1035
|
+
}
|
|
1036
|
+
const BRIDGE_EVENTS = [
|
|
1037
|
+
"task.started",
|
|
1038
|
+
"task.output",
|
|
1039
|
+
"task.completed",
|
|
1040
|
+
"task.failed",
|
|
1041
|
+
"task.cancelled"
|
|
1007
1042
|
];
|
|
1008
1043
|
function isSystemHelloResult(value) {
|
|
1009
|
-
|
|
1044
|
+
return isRecord$7(value) && typeof value.cliVersion === "string" && isValidProtocolVersion(value.protocolVersion) && isBridgeCapabilities(value.capabilities) && typeof value.pid === "number";
|
|
1010
1045
|
}
|
|
1011
1046
|
function isSystemPingResult(value) {
|
|
1012
|
-
|
|
1047
|
+
return isRecord$7(value) && typeof value.now === "string";
|
|
1013
1048
|
}
|
|
1014
1049
|
function isSystemShutdownResult(value) {
|
|
1015
|
-
|
|
1050
|
+
return isRecord$7(value) && value.shuttingDown === true;
|
|
1016
1051
|
}
|
|
1017
1052
|
function getBridgeResultValidator(method) {
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
return isCopilotContentIntegrationStatusResult;
|
|
1090
|
-
case "copilotContent.customizations.list":
|
|
1091
|
-
return isCopilotCustomizationsListResult;
|
|
1092
|
-
case "copilotPlugin.list":
|
|
1093
|
-
return isCopilotPluginListResult;
|
|
1094
|
-
case "copilotPlugin.register":
|
|
1095
|
-
return isCopilotPluginRegisterResult;
|
|
1096
|
-
case "copilotPlugin.unregister":
|
|
1097
|
-
return isCopilotPluginUnregisterResult;
|
|
1098
|
-
case "copilotContent.package.install":
|
|
1099
|
-
return isCopilotPackageInstallResult;
|
|
1100
|
-
case "copilotContent.package.update":
|
|
1101
|
-
return isCopilotPackageUpdateResult;
|
|
1102
|
-
case "copilotContent.package.uninstall":
|
|
1103
|
-
return isCopilotPackageUninstallResult;
|
|
1104
|
-
case "copilotContent.package.move":
|
|
1105
|
-
return isCopilotPackageMoveResult;
|
|
1106
|
-
case "copilotContent.legacy.preview":
|
|
1107
|
-
return isCopilotLegacyPreviewResult;
|
|
1108
|
-
case "copilotContent.legacy.migrate":
|
|
1109
|
-
return isCopilotLegacyMigrateResult;
|
|
1110
|
-
case "copilotContent.sources.list":
|
|
1111
|
-
return isCopilotSourceListResult;
|
|
1112
|
-
case "copilotContent.sources.remove":
|
|
1113
|
-
return isCopilotSourceRemoveResult;
|
|
1114
|
-
case "copilotContent.package.previewUpdate":
|
|
1115
|
-
return isCopilotUpdatePreviewResult;
|
|
1116
|
-
case "auth.status":
|
|
1117
|
-
return isAuthStatus;
|
|
1118
|
-
case "auth.login":
|
|
1119
|
-
return isAuthLoginResult;
|
|
1120
|
-
case "auth.logout":
|
|
1121
|
-
return isAuthLogoutResult;
|
|
1122
|
-
case "auth.whoami":
|
|
1123
|
-
return isAuthWhoamiResult;
|
|
1124
|
-
case "auth.switch":
|
|
1125
|
-
return isAuthSwitchResult;
|
|
1126
|
-
case "device.status":
|
|
1127
|
-
return isDeviceStatus;
|
|
1128
|
-
case "device.enroll":
|
|
1129
|
-
return isDeviceEnrollResult;
|
|
1130
|
-
case "device.rotate-secret":
|
|
1131
|
-
return isDeviceRotateSecretResult;
|
|
1132
|
-
case "toolbox.list":
|
|
1133
|
-
return isToolboxList;
|
|
1134
|
-
case "toolbox.add":
|
|
1135
|
-
return isToolboxAddResult;
|
|
1136
|
-
case "toolbox.remove":
|
|
1137
|
-
return isToolboxRemoveResult;
|
|
1138
|
-
case "toolbox.update":
|
|
1139
|
-
return isToolboxUpdateResult;
|
|
1140
|
-
default:
|
|
1141
|
-
return void 0;
|
|
1142
|
-
}
|
|
1053
|
+
switch (method) {
|
|
1054
|
+
case "system.hello": return isSystemHelloResult;
|
|
1055
|
+
case "system.ping": return isSystemPingResult;
|
|
1056
|
+
case "system.shutdown": return isSystemShutdownResult;
|
|
1057
|
+
case "task.execute": return isTaskExecuteResult;
|
|
1058
|
+
case "task.cancel": return isTaskCancelResult;
|
|
1059
|
+
case "task.list-running": return isTaskListRunningResult;
|
|
1060
|
+
case "copilotContent.list":
|
|
1061
|
+
case "skillRepo.list": return isSkillRepoListResult;
|
|
1062
|
+
case "copilotContent.get":
|
|
1063
|
+
case "skillRepo.get": return isSkillRepoGetResult;
|
|
1064
|
+
case "copilotContent.install":
|
|
1065
|
+
case "skillRepo.install": return isSkillRepoInstallResult;
|
|
1066
|
+
case "copilotContent.convertToSymlink":
|
|
1067
|
+
case "skillRepo.convertToSymlink": return isSkillRepoConvertToSymlinkResult;
|
|
1068
|
+
case "copilotContent.uninstall":
|
|
1069
|
+
case "skillRepo.uninstall": return isSkillRepoUninstallResult;
|
|
1070
|
+
case "copilotContent.setEntryEnabled":
|
|
1071
|
+
case "skillRepo.setEntryEnabled": return isSkillRepoSetEntryEnabledResult;
|
|
1072
|
+
case "copilotContent.detectUnmanaged": return isCopilotContentDetectUnmanagedResult;
|
|
1073
|
+
case "copilotContent.adoptUnmanaged": return isCopilotContentAdoptUnmanagedResult;
|
|
1074
|
+
case "copilotContent.listLinked":
|
|
1075
|
+
case "skillRepo.listLinked": return isSkillRepoListLinkedResult;
|
|
1076
|
+
case "copilotContent.draft.create":
|
|
1077
|
+
case "skillRepo.draft.create": return isSkillRepoDraftCreateResult;
|
|
1078
|
+
case "copilotContent.draft.commit":
|
|
1079
|
+
case "skillRepo.draft.commit": return isSkillRepoDraftCommitResult;
|
|
1080
|
+
case "copilotContent.draft.list":
|
|
1081
|
+
case "skillRepo.draft.list": return isSkillRepoDraftListResult;
|
|
1082
|
+
case "copilotContent.draft.delete":
|
|
1083
|
+
case "skillRepo.draft.delete": return isSkillRepoDraftDeleteResult;
|
|
1084
|
+
case "repo.list": return isRepoListResult;
|
|
1085
|
+
case "repo.add": return isRepoAddResult;
|
|
1086
|
+
case "repo.remove": return isRepoRemoveResult;
|
|
1087
|
+
case "repo.enable": return isRepoEnableResult;
|
|
1088
|
+
case "repo.disable": return isRepoDisableResult;
|
|
1089
|
+
case "repo.update": return isRepoUpdateResult;
|
|
1090
|
+
case "repo.sync": return isRepoSyncResult;
|
|
1091
|
+
case "repo.syncAll": return isRepoSyncAllResult;
|
|
1092
|
+
case "copilotContent.status": return isCopilotContentStatusResult;
|
|
1093
|
+
case "copilotContent.restore": return isCopilotContentRestoreResult;
|
|
1094
|
+
case "copilotContent.approve": return isCopilotContentApproveResult;
|
|
1095
|
+
case "copilotContent.migrateLegacy": return isCopilotContentMigrateLegacyResult;
|
|
1096
|
+
case "copilotContent.integrationStatus": return isCopilotContentIntegrationStatusResult;
|
|
1097
|
+
case "copilotContent.customizations.list": return isCopilotCustomizationsListResult;
|
|
1098
|
+
case "copilotPlugin.list": return isCopilotPluginListResult;
|
|
1099
|
+
case "copilotPlugin.register": return isCopilotPluginRegisterResult;
|
|
1100
|
+
case "copilotPlugin.unregister": return isCopilotPluginUnregisterResult;
|
|
1101
|
+
case "copilotContent.package.install": return isCopilotPackageInstallResult;
|
|
1102
|
+
case "copilotContent.package.update": return isCopilotPackageUpdateResult;
|
|
1103
|
+
case "copilotContent.package.uninstall": return isCopilotPackageUninstallResult;
|
|
1104
|
+
case "copilotContent.package.move": return isCopilotPackageMoveResult;
|
|
1105
|
+
case "copilotContent.legacy.preview": return isCopilotLegacyPreviewResult;
|
|
1106
|
+
case "copilotContent.legacy.migrate": return isCopilotLegacyMigrateResult;
|
|
1107
|
+
case "copilotContent.sources.list": return isCopilotSourceListResult;
|
|
1108
|
+
case "copilotContent.sources.remove": return isCopilotSourceRemoveResult;
|
|
1109
|
+
case "copilotContent.package.previewUpdate": return isCopilotUpdatePreviewResult;
|
|
1110
|
+
case "auth.status": return isAuthStatus;
|
|
1111
|
+
case "auth.login": return isAuthLoginResult;
|
|
1112
|
+
case "auth.logout": return isAuthLogoutResult;
|
|
1113
|
+
case "auth.whoami": return isAuthWhoamiResult;
|
|
1114
|
+
case "auth.switch": return isAuthSwitchResult;
|
|
1115
|
+
case "device.status": return isDeviceStatus;
|
|
1116
|
+
case "device.enroll": return isDeviceEnrollResult;
|
|
1117
|
+
case "device.rotate-secret": return isDeviceRotateSecretResult;
|
|
1118
|
+
case "toolbox.list": return isToolboxList;
|
|
1119
|
+
case "toolbox.add": return isToolboxAddResult;
|
|
1120
|
+
case "toolbox.remove": return isToolboxRemoveResult;
|
|
1121
|
+
case "toolbox.update": return isToolboxUpdateResult;
|
|
1122
|
+
default: return;
|
|
1123
|
+
}
|
|
1143
1124
|
}
|
|
1144
1125
|
function getBridgeEventParamsValidator(event) {
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
return isTaskFailedEventParams;
|
|
1154
|
-
case "task.cancelled":
|
|
1155
|
-
return isTaskCancelledEventParams;
|
|
1156
|
-
default:
|
|
1157
|
-
return void 0;
|
|
1158
|
-
}
|
|
1126
|
+
switch (event) {
|
|
1127
|
+
case "task.started": return isTaskStartedEventParams;
|
|
1128
|
+
case "task.output": return isTaskOutputEventParams;
|
|
1129
|
+
case "task.completed": return isTaskCompletedEventParams;
|
|
1130
|
+
case "task.failed": return isTaskFailedEventParams;
|
|
1131
|
+
case "task.cancelled": return isTaskCancelledEventParams;
|
|
1132
|
+
default: return;
|
|
1133
|
+
}
|
|
1159
1134
|
}
|
|
1160
1135
|
function isBridgeMethod(value) {
|
|
1161
|
-
|
|
1136
|
+
return typeof value === "string" && BRIDGE_METHODS.includes(value);
|
|
1162
1137
|
}
|
|
1163
1138
|
function isBridgeEventName(value) {
|
|
1164
|
-
|
|
1139
|
+
return typeof value === "string" && BRIDGE_EVENTS.includes(value);
|
|
1165
1140
|
}
|
|
1166
1141
|
function isBridgeRequest(value) {
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
}
|
|
1170
|
-
return isValidProtocolVersion(value.protocolVersion) && value.kind === "request" && typeof value.id === "string" && isBridgeMethod(value.method) && "params" in value;
|
|
1142
|
+
if (!isRecord$7(value)) return false;
|
|
1143
|
+
return isValidProtocolVersion(value.protocolVersion) && value.kind === "request" && typeof value.id === "string" && isBridgeMethod(value.method) && "params" in value;
|
|
1171
1144
|
}
|
|
1172
1145
|
function isBridgeResponse(value) {
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
return false;
|
|
1178
|
-
}
|
|
1179
|
-
if (value.ok) {
|
|
1180
|
-
return "result" in value;
|
|
1181
|
-
}
|
|
1182
|
-
return "error" in value;
|
|
1146
|
+
if (!isRecord$7(value)) return false;
|
|
1147
|
+
if (!isValidProtocolVersion(value.protocolVersion) || value.kind !== "response" || typeof value.id !== "string" || typeof value.ok !== "boolean") return false;
|
|
1148
|
+
if (value.ok) return "result" in value;
|
|
1149
|
+
return "error" in value;
|
|
1183
1150
|
}
|
|
1184
1151
|
function isBridgeEvent(value) {
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
}
|
|
1188
|
-
return isValidProtocolVersion(value.protocolVersion) && value.kind === "event" && isBridgeEventName(value.event) && "params" in value;
|
|
1152
|
+
if (!isRecord$7(value)) return false;
|
|
1153
|
+
return isValidProtocolVersion(value.protocolVersion) && value.kind === "event" && isBridgeEventName(value.event) && "params" in value;
|
|
1189
1154
|
}
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
function
|
|
1194
|
-
|
|
1155
|
+
//#endregion
|
|
1156
|
+
//#region src/cli.ts
|
|
1157
|
+
const SERVICEME_CLI_SCHEMA_VERSION = 1;
|
|
1158
|
+
function isRecord$6(value) {
|
|
1159
|
+
return typeof value === "object" && value !== null;
|
|
1195
1160
|
}
|
|
1196
1161
|
function createCliSuccess(data) {
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1162
|
+
return {
|
|
1163
|
+
schemaVersion: 1,
|
|
1164
|
+
ok: true,
|
|
1165
|
+
data
|
|
1166
|
+
};
|
|
1202
1167
|
}
|
|
1203
1168
|
function createCliFailure(error) {
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1169
|
+
return {
|
|
1170
|
+
schemaVersion: 1,
|
|
1171
|
+
ok: false,
|
|
1172
|
+
error
|
|
1173
|
+
};
|
|
1209
1174
|
}
|
|
1210
1175
|
function isCliEnvelope(value) {
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
// src/copilot.ts
|
|
1224
|
-
var COPILOT_ERROR_CODES = {
|
|
1225
|
-
NOT_INSTALLED: "copilot_not_installed",
|
|
1226
|
-
AUTH_REQUIRED: "copilot_auth_required",
|
|
1227
|
-
EXECUTION_FAILED: "copilot_execution_failed",
|
|
1228
|
-
TIMEOUT: "copilot_timeout"
|
|
1176
|
+
if (!isRecord$6(value)) return false;
|
|
1177
|
+
if (value.schemaVersion !== 1 || typeof value.ok !== "boolean") return false;
|
|
1178
|
+
if (value.ok) return "data" in value;
|
|
1179
|
+
return "error" in value;
|
|
1180
|
+
}
|
|
1181
|
+
//#endregion
|
|
1182
|
+
//#region src/copilot.ts
|
|
1183
|
+
const COPILOT_ERROR_CODES = {
|
|
1184
|
+
NOT_INSTALLED: "copilot_not_installed",
|
|
1185
|
+
AUTH_REQUIRED: "copilot_auth_required",
|
|
1186
|
+
EXECUTION_FAILED: "copilot_execution_failed",
|
|
1187
|
+
TIMEOUT: "copilot_timeout"
|
|
1229
1188
|
};
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1189
|
+
//#endregion
|
|
1190
|
+
//#region src/env.ts
|
|
1191
|
+
const KNOWN_ENVIRONMENT_TOOLS = [
|
|
1192
|
+
"git",
|
|
1193
|
+
"node",
|
|
1194
|
+
"npm",
|
|
1195
|
+
"pnpm",
|
|
1196
|
+
"nvm",
|
|
1197
|
+
"nrm",
|
|
1198
|
+
"rtk",
|
|
1199
|
+
"codegraph",
|
|
1200
|
+
"ocx",
|
|
1201
|
+
"dotnet",
|
|
1202
|
+
"nuget"
|
|
1244
1203
|
];
|
|
1245
|
-
function
|
|
1246
|
-
|
|
1204
|
+
function isRecord$5(value) {
|
|
1205
|
+
return typeof value === "object" && value !== null;
|
|
1247
1206
|
}
|
|
1248
1207
|
function isKnownEnvironmentTool(value) {
|
|
1249
|
-
|
|
1208
|
+
return KNOWN_ENVIRONMENT_TOOLS.includes(value);
|
|
1250
1209
|
}
|
|
1251
1210
|
function isToolCheckResult(value) {
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
}
|
|
1255
|
-
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");
|
|
1211
|
+
if (!isRecord$5(value)) return false;
|
|
1212
|
+
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");
|
|
1256
1213
|
}
|
|
1257
1214
|
function isEnvironmentCheckResult(value) {
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
"device_not_enrolled",
|
|
1298
|
-
"toolbox_invalid_scope"
|
|
1215
|
+
if (!isRecord$5(value)) return false;
|
|
1216
|
+
return KNOWN_ENVIRONMENT_TOOLS.every((tool) => isToolCheckResult(value[tool]));
|
|
1217
|
+
}
|
|
1218
|
+
//#endregion
|
|
1219
|
+
//#region src/errors.ts
|
|
1220
|
+
const SERVICEME_ERROR_CODES = [
|
|
1221
|
+
"protocol_mismatch",
|
|
1222
|
+
"cli_not_found",
|
|
1223
|
+
"cli_start_failed",
|
|
1224
|
+
"command_timeout",
|
|
1225
|
+
"request_cancelled",
|
|
1226
|
+
"invalid_params",
|
|
1227
|
+
"opencode_not_installed",
|
|
1228
|
+
"opencode_startup_timeout",
|
|
1229
|
+
"opencode_request_failed",
|
|
1230
|
+
"opencode_backend_not_running",
|
|
1231
|
+
"opencode_session_not_found",
|
|
1232
|
+
"copilot_not_installed",
|
|
1233
|
+
"copilot_auth_required",
|
|
1234
|
+
"copilot_execution_failed",
|
|
1235
|
+
"copilot_timeout",
|
|
1236
|
+
"json_invalid_input",
|
|
1237
|
+
"env_tool_not_found",
|
|
1238
|
+
"task_not_found",
|
|
1239
|
+
"task_already_exists",
|
|
1240
|
+
"invalid_schedule",
|
|
1241
|
+
"invalid_payload",
|
|
1242
|
+
"confirmation_required",
|
|
1243
|
+
"workspace_not_found",
|
|
1244
|
+
"daemon_not_running",
|
|
1245
|
+
"executor_timeout",
|
|
1246
|
+
"executor_error",
|
|
1247
|
+
"task_already_running",
|
|
1248
|
+
"not_found",
|
|
1249
|
+
"internal_error",
|
|
1250
|
+
"auth_not_logged_in",
|
|
1251
|
+
"auth_provider_not_registered",
|
|
1252
|
+
"device_not_enrolled",
|
|
1253
|
+
"toolbox_invalid_scope"
|
|
1299
1254
|
];
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1255
|
+
const RETRYABLE_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
1256
|
+
"command_timeout",
|
|
1257
|
+
"request_cancelled",
|
|
1258
|
+
"opencode_startup_timeout",
|
|
1259
|
+
"opencode_request_failed",
|
|
1260
|
+
"opencode_backend_not_running",
|
|
1261
|
+
"copilot_timeout",
|
|
1262
|
+
"executor_timeout",
|
|
1263
|
+
"internal_error"
|
|
1309
1264
|
]);
|
|
1310
|
-
function
|
|
1311
|
-
|
|
1265
|
+
function isRecord$4(value) {
|
|
1266
|
+
return typeof value === "object" && value !== null;
|
|
1312
1267
|
}
|
|
1313
1268
|
function isServicemeErrorCode(value) {
|
|
1314
|
-
|
|
1269
|
+
return typeof value === "string" && SERVICEME_ERROR_CODES.includes(value);
|
|
1315
1270
|
}
|
|
1316
1271
|
function isServicemeErrorDetails(value) {
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
}
|
|
1320
|
-
return isServicemeErrorCode(value.code) && typeof value.message === "string" && typeof value.retryable === "boolean";
|
|
1272
|
+
if (!isRecord$4(value)) return false;
|
|
1273
|
+
return isServicemeErrorCode(value.code) && typeof value.message === "string" && typeof value.retryable === "boolean";
|
|
1321
1274
|
}
|
|
1322
1275
|
function isRetryableErrorCode(code) {
|
|
1323
|
-
|
|
1276
|
+
return RETRYABLE_ERROR_CODES.has(code);
|
|
1324
1277
|
}
|
|
1325
1278
|
var ServicemeProtocolError = class extends Error {
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1279
|
+
constructor(input) {
|
|
1280
|
+
super(input.message);
|
|
1281
|
+
this.name = "ServicemeProtocolError";
|
|
1282
|
+
this.code = input.code;
|
|
1283
|
+
this.retryable = input.retryable ?? isRetryableErrorCode(input.code);
|
|
1284
|
+
this.details = input.details;
|
|
1285
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1286
|
+
}
|
|
1287
|
+
toJSON() {
|
|
1288
|
+
return {
|
|
1289
|
+
code: this.code,
|
|
1290
|
+
message: this.message,
|
|
1291
|
+
retryable: this.retryable,
|
|
1292
|
+
details: this.details
|
|
1293
|
+
};
|
|
1294
|
+
}
|
|
1342
1295
|
};
|
|
1343
1296
|
function createServicemeError(code, message, details) {
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1297
|
+
return new ServicemeProtocolError({
|
|
1298
|
+
code,
|
|
1299
|
+
message,
|
|
1300
|
+
details
|
|
1301
|
+
});
|
|
1349
1302
|
}
|
|
1350
1303
|
function normalizeServicemeError(error, fallbackCode = "internal_error") {
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
};
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
// src/image.ts
|
|
1383
|
-
var SERVICEME_IMAGE_FORMATS = [
|
|
1384
|
-
"jpeg",
|
|
1385
|
-
"png",
|
|
1386
|
-
"webp"
|
|
1304
|
+
if (error instanceof ServicemeProtocolError) return error.toJSON();
|
|
1305
|
+
if (isServicemeErrorDetails(error)) return error;
|
|
1306
|
+
if (isRecord$4(error)) {
|
|
1307
|
+
const code = isServicemeErrorCode(error.code) ? error.code : fallbackCode;
|
|
1308
|
+
return {
|
|
1309
|
+
code,
|
|
1310
|
+
message: typeof error.message === "string" ? error.message : "Unexpected serviceme error.",
|
|
1311
|
+
retryable: typeof error.retryable === "boolean" ? error.retryable : isRetryableErrorCode(code),
|
|
1312
|
+
details: error.details
|
|
1313
|
+
};
|
|
1314
|
+
}
|
|
1315
|
+
if (error instanceof Error) return {
|
|
1316
|
+
code: fallbackCode,
|
|
1317
|
+
message: error.message,
|
|
1318
|
+
retryable: isRetryableErrorCode(fallbackCode)
|
|
1319
|
+
};
|
|
1320
|
+
return {
|
|
1321
|
+
code: fallbackCode,
|
|
1322
|
+
message: typeof error === "string" ? error : "Unexpected serviceme error.",
|
|
1323
|
+
retryable: isRetryableErrorCode(fallbackCode)
|
|
1324
|
+
};
|
|
1325
|
+
}
|
|
1326
|
+
//#endregion
|
|
1327
|
+
//#region src/image.ts
|
|
1328
|
+
const SERVICEME_IMAGE_FORMATS = [
|
|
1329
|
+
"jpeg",
|
|
1330
|
+
"png",
|
|
1331
|
+
"webp"
|
|
1387
1332
|
];
|
|
1388
|
-
function
|
|
1389
|
-
|
|
1333
|
+
function isRecord$3(value) {
|
|
1334
|
+
return typeof value === "object" && value !== null;
|
|
1390
1335
|
}
|
|
1391
1336
|
function isServiceMeImageFormat(value) {
|
|
1392
|
-
|
|
1337
|
+
return typeof value === "string" && SERVICEME_IMAGE_FORMATS.includes(value);
|
|
1393
1338
|
}
|
|
1394
1339
|
function isServiceMeImageCompressOptions(value) {
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
}
|
|
1398
|
-
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");
|
|
1340
|
+
if (!isRecord$3(value)) return false;
|
|
1341
|
+
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");
|
|
1399
1342
|
}
|
|
1400
1343
|
function isServiceMeImageCompressResult(value) {
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
}
|
|
1404
|
-
return typeof value.originalSize === "number" && typeof value.compressedSize === "number" && typeof value.compressionRatio === "number" && typeof value.outputPath === "string";
|
|
1344
|
+
if (!isRecord$3(value)) return false;
|
|
1345
|
+
return typeof value.originalSize === "number" && typeof value.compressedSize === "number" && typeof value.compressionRatio === "number" && typeof value.outputPath === "string";
|
|
1405
1346
|
}
|
|
1406
1347
|
function isServiceMeImageInfo(value) {
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
}
|
|
1410
|
-
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");
|
|
1348
|
+
if (!isRecord$3(value)) return false;
|
|
1349
|
+
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");
|
|
1411
1350
|
}
|
|
1412
1351
|
function isServiceMeImageValidationResult(value) {
|
|
1413
|
-
|
|
1414
|
-
}
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1352
|
+
return isRecord$3(value) && typeof value.valid === "boolean";
|
|
1353
|
+
}
|
|
1354
|
+
//#endregion
|
|
1355
|
+
//#region src/metadata.ts
|
|
1356
|
+
const SERVICEME_CLI_NAME = "serviceme";
|
|
1357
|
+
const SERVICEME_CLI_VERSION = "2.0.2";
|
|
1358
|
+
const SERVICEME_CLI_CAPABILITIES = {
|
|
1359
|
+
bridge: true,
|
|
1360
|
+
tasks: 1,
|
|
1361
|
+
json: 1,
|
|
1362
|
+
env: 1,
|
|
1363
|
+
image: 1,
|
|
1364
|
+
project: 1
|
|
1426
1365
|
};
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
function
|
|
1430
|
-
|
|
1366
|
+
//#endregion
|
|
1367
|
+
//#region src/project.ts
|
|
1368
|
+
function isRecord$2(value) {
|
|
1369
|
+
return typeof value === "object" && value !== null;
|
|
1431
1370
|
}
|
|
1432
1371
|
function isServiceMeProjectScaffoldPruneResult(value) {
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
}
|
|
1436
|
-
return typeof value.applied === "boolean" && typeof value.preset === "string" && Array.isArray(value.commands) && value.commands.every((command) => typeof command === "string");
|
|
1372
|
+
if (!isRecord$2(value)) return false;
|
|
1373
|
+
return typeof value.applied === "boolean" && typeof value.preset === "string" && Array.isArray(value.commands) && value.commands.every((command) => typeof command === "string");
|
|
1437
1374
|
}
|
|
1438
1375
|
function isServiceMeProjectGitInitResult(value) {
|
|
1439
|
-
|
|
1376
|
+
return isRecord$2(value) && typeof value.initialized === "boolean" && typeof value.command === "string";
|
|
1440
1377
|
}
|
|
1441
1378
|
function isServiceMeProjectMakeScriptsExecutableResult(value) {
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
}
|
|
1445
|
-
return typeof value.processedCount === "number" && typeof value.updatedCount === "number" && typeof value.platform === "string" && Array.isArray(value.scripts) && value.scripts.every((script) => typeof script === "string");
|
|
1379
|
+
if (!isRecord$2(value)) return false;
|
|
1380
|
+
return typeof value.processedCount === "number" && typeof value.updatedCount === "number" && typeof value.platform === "string" && Array.isArray(value.scripts) && value.scripts.every((script) => typeof script === "string");
|
|
1446
1381
|
}
|
|
1447
1382
|
function isServiceMeProjectInstallDepsResult(value) {
|
|
1448
|
-
|
|
1383
|
+
return isRecord$2(value) && typeof value.installed === "boolean" && typeof value.command === "string";
|
|
1449
1384
|
}
|
|
1450
1385
|
function isServiceMeProjectExtractTemplateInput(value) {
|
|
1451
|
-
|
|
1386
|
+
return isRecord$2(value) && typeof value.extractedDirName === "string" && typeof value.projectFilePattern === "string";
|
|
1452
1387
|
}
|
|
1453
1388
|
function isServiceMeProjectExtractTemplateResult(value) {
|
|
1454
|
-
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1389
|
+
return isRecord$2(value) && typeof value.actualDirName === "string";
|
|
1390
|
+
}
|
|
1391
|
+
//#endregion
|
|
1392
|
+
//#region src/skill.ts
|
|
1393
|
+
const VALID_SKILL_SCOPES = ["workspace", "user"];
|
|
1394
|
+
const VALID_SKILL_SCOPE_STATUSES = [
|
|
1395
|
+
"absent",
|
|
1396
|
+
"available",
|
|
1397
|
+
"installed",
|
|
1398
|
+
"blocked",
|
|
1399
|
+
"conflict"
|
|
1465
1400
|
];
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1401
|
+
const VALID_SKILL_MUTATION_ACTIONS = [
|
|
1402
|
+
"install",
|
|
1403
|
+
"uninstall",
|
|
1404
|
+
"move",
|
|
1405
|
+
"removeExternal",
|
|
1406
|
+
"publish",
|
|
1407
|
+
"republish",
|
|
1408
|
+
"submit-to-official"
|
|
1474
1409
|
];
|
|
1475
|
-
function
|
|
1476
|
-
|
|
1410
|
+
function isRecord$1(value) {
|
|
1411
|
+
return typeof value === "object" && value !== null;
|
|
1477
1412
|
}
|
|
1478
1413
|
function isSkillScope(value) {
|
|
1479
|
-
|
|
1414
|
+
return typeof value === "string" && VALID_SKILL_SCOPES.includes(value);
|
|
1480
1415
|
}
|
|
1481
1416
|
function isSkillScopeStatus(value) {
|
|
1482
|
-
|
|
1417
|
+
return typeof value === "string" && VALID_SKILL_SCOPE_STATUSES.includes(value);
|
|
1483
1418
|
}
|
|
1484
1419
|
function isSkillMutationAction(value) {
|
|
1485
|
-
|
|
1486
|
-
}
|
|
1487
|
-
function
|
|
1488
|
-
|
|
1489
|
-
}
|
|
1490
|
-
function
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
if (segments.some((segment) => segment.length === 0)) {
|
|
1496
|
-
return false;
|
|
1497
|
-
}
|
|
1498
|
-
return segments.every(
|
|
1499
|
-
(segment) => segment !== "." && segment !== ".." && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(segment)
|
|
1500
|
-
);
|
|
1420
|
+
return typeof value === "string" && VALID_SKILL_MUTATION_ACTIONS.includes(value);
|
|
1421
|
+
}
|
|
1422
|
+
function isStringArray(value) {
|
|
1423
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
1424
|
+
}
|
|
1425
|
+
function isSafeResourceId(value) {
|
|
1426
|
+
if (typeof value !== "string" || value.length === 0 || value.includes("\\")) return false;
|
|
1427
|
+
const segments = value.split("/");
|
|
1428
|
+
if (segments.some((segment) => segment.length === 0)) return false;
|
|
1429
|
+
return segments.every((segment) => segment !== "." && segment !== ".." && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(segment));
|
|
1501
1430
|
}
|
|
1502
1431
|
function isSkillScopeState(value) {
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
}
|
|
1506
|
-
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");
|
|
1432
|
+
if (!isRecord$1(value)) return false;
|
|
1433
|
+
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");
|
|
1507
1434
|
}
|
|
1508
1435
|
function isSkillMarketplaceEntry(value) {
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
}
|
|
1512
|
-
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);
|
|
1436
|
+
if (!isRecord$1(value)) return false;
|
|
1437
|
+
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);
|
|
1513
1438
|
}
|
|
1514
1439
|
function isSkillMarketplaceState(value) {
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
}
|
|
1518
|
-
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");
|
|
1440
|
+
if (!isRecord$1(value)) return false;
|
|
1441
|
+
return typeof value.configPath === "string" && typeof value.userSkillsPath === "string" && Array.isArray(value.skills) && value.skills.every((entry) => isSkillMarketplaceEntry(entry)) && (value.enabledSkillIds === void 0 || isStringArray(value.enabledSkillIds)) && (value.recommendedSkillIds === void 0 || isStringArray(value.recommendedSkillIds)) && typeof value.onboardingRequired === "boolean" && typeof value.hasPersistedSelection === "boolean" && (value.workspaceOpen === void 0 || typeof value.workspaceOpen === "boolean");
|
|
1519
1442
|
}
|
|
1520
1443
|
function isSkillMutationRequest(value) {
|
|
1521
|
-
|
|
1444
|
+
return isRecord$1(value) && isSafeResourceId(value.skillId) && isSkillScope(value.targetScope) && isSkillMutationAction(value.action) && (value.confirmed === void 0 || typeof value.confirmed === "boolean");
|
|
1522
1445
|
}
|
|
1523
1446
|
function isSkillMutationResult(value) {
|
|
1524
|
-
|
|
1447
|
+
return isRecord$1(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");
|
|
1525
1448
|
}
|
|
1526
1449
|
function isSkillReconcileResult(value) {
|
|
1527
|
-
|
|
1450
|
+
return isRecord$1(value) && isSkillMarketplaceState(value.state) && typeof value.changed === "boolean";
|
|
1528
1451
|
}
|
|
1529
1452
|
function isPublishableSkillEntry(value) {
|
|
1530
|
-
|
|
1453
|
+
return isRecord$1(value) && typeof value.id === "string" && typeof value.displayName === "string" && typeof value.path === "string" && (value.version === void 0 || typeof value.version === "string");
|
|
1531
1454
|
}
|
|
1532
1455
|
function isSkillPublishableResult(value) {
|
|
1533
|
-
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
BRIDGE_EVENTS,
|
|
1538
|
-
BRIDGE_METHODS,
|
|
1539
|
-
COPILOT_CONTENT_METHOD_ALIASES,
|
|
1540
|
-
COPILOT_ERROR_CODES,
|
|
1541
|
-
DEFAULT_JSON_SORT_OPTIONS,
|
|
1542
|
-
DEVICE_BINDING_STATES,
|
|
1543
|
-
JSON_SORT_ALGORITHMS,
|
|
1544
|
-
JSON_SORT_ORDERS,
|
|
1545
|
-
KNOWN_ENVIRONMENT_TOOLS,
|
|
1546
|
-
SERVICEME_CLI_CAPABILITIES,
|
|
1547
|
-
SERVICEME_CLI_NAME,
|
|
1548
|
-
SERVICEME_CLI_SCHEMA_VERSION,
|
|
1549
|
-
SERVICEME_CLI_VERSION,
|
|
1550
|
-
SERVICEME_ERROR_CODES,
|
|
1551
|
-
SERVICEME_IMAGE_FORMATS,
|
|
1552
|
-
SERVICEME_PROTOCOL_VERSION,
|
|
1553
|
-
ServicemeProtocolError,
|
|
1554
|
-
TOOLBOX_SCOPES,
|
|
1555
|
-
createCliFailure,
|
|
1556
|
-
createCliSuccess,
|
|
1557
|
-
createServicemeError,
|
|
1558
|
-
getBridgeEventParamsValidator,
|
|
1559
|
-
getBridgeResultValidator,
|
|
1560
|
-
isAgentMarketplaceState,
|
|
1561
|
-
isAgentMutationRequest,
|
|
1562
|
-
isAgentMutationResult,
|
|
1563
|
-
isAgentPermissionSummary,
|
|
1564
|
-
isAgentPermissionsResult,
|
|
1565
|
-
isAgentSessionStatus,
|
|
1566
|
-
isAuthAccountMeta,
|
|
1567
|
-
isAuthLoginParams,
|
|
1568
|
-
isAuthLoginResult,
|
|
1569
|
-
isAuthLogoutParams,
|
|
1570
|
-
isAuthLogoutResult,
|
|
1571
|
-
isAuthProvider,
|
|
1572
|
-
isAuthSessionHandle,
|
|
1573
|
-
isAuthStatus,
|
|
1574
|
-
isAuthSwitchParams,
|
|
1575
|
-
isAuthSwitchResult,
|
|
1576
|
-
isAuthWhoamiResult,
|
|
1577
|
-
isBridgeCapabilities,
|
|
1578
|
-
isBridgeEvent,
|
|
1579
|
-
isBridgeEventName,
|
|
1580
|
-
isBridgeMethod,
|
|
1581
|
-
isBridgeRequest,
|
|
1582
|
-
isBridgeResponse,
|
|
1583
|
-
isCliEnvelope,
|
|
1584
|
-
isCopilotContentApproveResult,
|
|
1585
|
-
isCopilotContentIntegrationStatusResult,
|
|
1586
|
-
isCopilotContentMigrateLegacyResult,
|
|
1587
|
-
isCopilotContentRestoreResult,
|
|
1588
|
-
isCopilotContentStatusResult,
|
|
1589
|
-
isCopilotCustomizationViewPayload,
|
|
1590
|
-
isCopilotCustomizationsListParams,
|
|
1591
|
-
isCopilotCustomizationsListResult,
|
|
1592
|
-
isCopilotLegacyMigrateParams,
|
|
1593
|
-
isCopilotLegacyMigrateResult,
|
|
1594
|
-
isCopilotLegacyPreviewParams,
|
|
1595
|
-
isCopilotLegacyPreviewResult,
|
|
1596
|
-
isCopilotPackageInstallParams,
|
|
1597
|
-
isCopilotPackageInstallResult,
|
|
1598
|
-
isCopilotPackageMoveParams,
|
|
1599
|
-
isCopilotPackageMoveResult,
|
|
1600
|
-
isCopilotPackageUninstallParams,
|
|
1601
|
-
isCopilotPackageUninstallResult,
|
|
1602
|
-
isCopilotPackageUpdateParams,
|
|
1603
|
-
isCopilotPackageUpdateResult,
|
|
1604
|
-
isCopilotPluginListParams,
|
|
1605
|
-
isCopilotPluginListResult,
|
|
1606
|
-
isCopilotPluginRegisterParams,
|
|
1607
|
-
isCopilotPluginRegisterResult,
|
|
1608
|
-
isCopilotPluginUnregisterParams,
|
|
1609
|
-
isCopilotPluginUnregisterResult,
|
|
1610
|
-
isCopilotSourceListParams,
|
|
1611
|
-
isCopilotSourceListResult,
|
|
1612
|
-
isCopilotSourceRemoveParams,
|
|
1613
|
-
isCopilotSourceRemoveResult,
|
|
1614
|
-
isCopilotUpdatePreviewParams,
|
|
1615
|
-
isCopilotUpdatePreviewResult,
|
|
1616
|
-
isDeviceBindingState,
|
|
1617
|
-
isDeviceEnrollParams,
|
|
1618
|
-
isDeviceEnrollResult,
|
|
1619
|
-
isDeviceIdentityState,
|
|
1620
|
-
isDeviceMetadata,
|
|
1621
|
-
isDeviceRotateSecretParams,
|
|
1622
|
-
isDeviceRotateSecretResult,
|
|
1623
|
-
isDeviceStatus,
|
|
1624
|
-
isEnvironmentCheckResult,
|
|
1625
|
-
isExternalTool,
|
|
1626
|
-
isExternalToolPatch,
|
|
1627
|
-
isJsonOutputResult,
|
|
1628
|
-
isJsonSortAlgorithm,
|
|
1629
|
-
isJsonSortOptions,
|
|
1630
|
-
isJsonSortOrder,
|
|
1631
|
-
isJsonValidationResult,
|
|
1632
|
-
isKnownEnvironmentTool,
|
|
1633
|
-
isRecord4 as isRecord,
|
|
1634
|
-
isRepoAddParams,
|
|
1635
|
-
isRepoAddResult,
|
|
1636
|
-
isRepoDisableParams,
|
|
1637
|
-
isRepoDisableResult,
|
|
1638
|
-
isRepoEnableParams,
|
|
1639
|
-
isRepoEnableResult,
|
|
1640
|
-
isRepoListParams,
|
|
1641
|
-
isRepoListResult,
|
|
1642
|
-
isRepoRemoveParams,
|
|
1643
|
-
isRepoRemoveResult,
|
|
1644
|
-
isRepoSyncAllParams,
|
|
1645
|
-
isRepoSyncAllResult,
|
|
1646
|
-
isRepoSyncParams,
|
|
1647
|
-
isRepoSyncResult,
|
|
1648
|
-
isRepoUpdateResult,
|
|
1649
|
-
isRetryableErrorCode,
|
|
1650
|
-
isScheduledTask,
|
|
1651
|
-
isScheduledTaskType,
|
|
1652
|
-
isScheduledTaskV1,
|
|
1653
|
-
isScheduledTasksConfig,
|
|
1654
|
-
isScheduledTasksConfigV1,
|
|
1655
|
-
isSchedulerStatus,
|
|
1656
|
-
isServiceMeImageCompressOptions,
|
|
1657
|
-
isServiceMeImageCompressResult,
|
|
1658
|
-
isServiceMeImageFormat,
|
|
1659
|
-
isServiceMeImageInfo,
|
|
1660
|
-
isServiceMeImageValidationResult,
|
|
1661
|
-
isServiceMeProjectExtractTemplateInput,
|
|
1662
|
-
isServiceMeProjectExtractTemplateResult,
|
|
1663
|
-
isServiceMeProjectGitInitResult,
|
|
1664
|
-
isServiceMeProjectInstallDepsResult,
|
|
1665
|
-
isServiceMeProjectMakeScriptsExecutableResult,
|
|
1666
|
-
isServiceMeProjectScaffoldPruneResult,
|
|
1667
|
-
isServicemeErrorCode,
|
|
1668
|
-
isServicemeErrorDetails,
|
|
1669
|
-
isSkillMarketplaceState,
|
|
1670
|
-
isSkillMutationRequest,
|
|
1671
|
-
isSkillMutationResult,
|
|
1672
|
-
isSkillPublishableResult,
|
|
1673
|
-
isSkillReconcileResult,
|
|
1674
|
-
isSkillRepoConvertToSymlinkParams,
|
|
1675
|
-
isSkillRepoConvertToSymlinkResult,
|
|
1676
|
-
isSkillRepoDraftCommitResult,
|
|
1677
|
-
isSkillRepoDraftCreateResult,
|
|
1678
|
-
isSkillRepoDraftDeleteResult,
|
|
1679
|
-
isSkillRepoDraftListResult,
|
|
1680
|
-
isSkillRepoGetParams,
|
|
1681
|
-
isSkillRepoGetResult,
|
|
1682
|
-
isSkillRepoInstallParams,
|
|
1683
|
-
isSkillRepoInstallResult,
|
|
1684
|
-
isSkillRepoListLinkedParams,
|
|
1685
|
-
isSkillRepoListLinkedResult,
|
|
1686
|
-
isSkillRepoListParams,
|
|
1687
|
-
isSkillRepoListResult,
|
|
1688
|
-
isSkillRepoSetEntryEnabledParams,
|
|
1689
|
-
isSkillRepoSetEntryEnabledResult,
|
|
1690
|
-
isSkillRepoUninstallParams,
|
|
1691
|
-
isSkillRepoUninstallResult,
|
|
1692
|
-
isSystemHelloResult,
|
|
1693
|
-
isSystemPingResult,
|
|
1694
|
-
isSystemShutdownResult,
|
|
1695
|
-
isTaskCancelResult,
|
|
1696
|
-
isTaskCancelledEventParams,
|
|
1697
|
-
isTaskCompletedEventParams,
|
|
1698
|
-
isTaskExecuteResult,
|
|
1699
|
-
isTaskExecutionLog,
|
|
1700
|
-
isTaskFailedEventParams,
|
|
1701
|
-
isTaskListRunningResult,
|
|
1702
|
-
isTaskOutputEventParams,
|
|
1703
|
-
isTaskStartedEventParams,
|
|
1704
|
-
isTaskWorkspaceRef,
|
|
1705
|
-
isToolCheckResult,
|
|
1706
|
-
isToolboxAddParams,
|
|
1707
|
-
isToolboxAddResult,
|
|
1708
|
-
isToolboxList,
|
|
1709
|
-
isToolboxListParams,
|
|
1710
|
-
isToolboxRemoveParams,
|
|
1711
|
-
isToolboxRemoveResult,
|
|
1712
|
-
isToolboxScope,
|
|
1713
|
-
isToolboxUpdateParams,
|
|
1714
|
-
isToolboxUpdateResult,
|
|
1715
|
-
migrateTaskV1ToV2,
|
|
1716
|
-
migrateV1ToV2,
|
|
1717
|
-
normalizeBridgeMethod,
|
|
1718
|
-
normalizeServicemeError
|
|
1719
|
-
};
|
|
1456
|
+
return isRecord$1(value) && Array.isArray(value.skills) && value.skills.every((entry) => isPublishableSkillEntry(entry));
|
|
1457
|
+
}
|
|
1458
|
+
//#endregion
|
|
1459
|
+
export { AUTH_PROVIDERS, BRIDGE_EVENTS, BRIDGE_METHODS, COPILOT_CONTENT_METHOD_ALIASES, COPILOT_ERROR_CODES, DEFAULT_JSON_SORT_OPTIONS, DEVICE_BINDING_STATES, JSON_SORT_ALGORITHMS, JSON_SORT_ORDERS, KNOWN_ENVIRONMENT_TOOLS, SERVICEME_CLI_CAPABILITIES, SERVICEME_CLI_NAME, SERVICEME_CLI_SCHEMA_VERSION, SERVICEME_CLI_VERSION, SERVICEME_ERROR_CODES, SERVICEME_IMAGE_FORMATS, SERVICEME_PROTOCOL_VERSION, ServicemeProtocolError, TOOLBOX_SCOPES, createCliFailure, createCliSuccess, createServicemeError, getBridgeEventParamsValidator, getBridgeResultValidator, isAgentMarketplaceState, isAgentMutationRequest, isAgentMutationResult, isAgentPermissionSummary, isAgentPermissionsResult, isAgentSessionStatus, isAuthAccountMeta, isAuthLoginParams, isAuthLoginResult, isAuthLogoutParams, isAuthLogoutResult, isAuthProvider, isAuthSessionHandle, isAuthStatus, isAuthSwitchParams, isAuthSwitchResult, isAuthWhoamiResult, isBridgeCapabilities, isBridgeEvent, isBridgeEventName, isBridgeMethod, isBridgeRequest, isBridgeResponse, isCliEnvelope, isCopilotContentAdoptUnmanagedParams, isCopilotContentAdoptUnmanagedResult, isCopilotContentApproveResult, isCopilotContentDetectUnmanagedParams, isCopilotContentDetectUnmanagedResult, isCopilotContentIntegrationStatusResult, isCopilotContentMigrateLegacyResult, isCopilotContentRestoreResult, isCopilotContentStatusResult, isCopilotCustomizationViewPayload, isCopilotCustomizationsListParams, isCopilotCustomizationsListResult, isCopilotLegacyMigrateParams, isCopilotLegacyMigrateResult, isCopilotLegacyPreviewParams, isCopilotLegacyPreviewResult, isCopilotPackageInstallParams, isCopilotPackageInstallResult, isCopilotPackageMoveParams, isCopilotPackageMoveResult, isCopilotPackageUninstallParams, isCopilotPackageUninstallResult, isCopilotPackageUpdateParams, isCopilotPackageUpdateResult, isCopilotPluginListParams, isCopilotPluginListResult, isCopilotPluginRegisterParams, isCopilotPluginRegisterResult, isCopilotPluginUnregisterParams, isCopilotPluginUnregisterResult, isCopilotSourceListParams, isCopilotSourceListResult, isCopilotSourceRemoveParams, isCopilotSourceRemoveResult, isCopilotUpdatePreviewParams, isCopilotUpdatePreviewResult, isDeviceBindingState, isDeviceEnrollParams, isDeviceEnrollResult, isDeviceIdentityState, isDeviceMetadata, isDeviceRotateSecretParams, isDeviceRotateSecretResult, isDeviceStatus, isEnvironmentCheckResult, isExternalTool, isExternalToolPatch, isJsonOutputResult, isJsonSortAlgorithm, isJsonSortOptions, isJsonSortOrder, isJsonValidationResult, isKnownEnvironmentTool, isRecord, isRepoAddParams, isRepoAddResult, isRepoDisableParams, isRepoDisableResult, isRepoEnableParams, isRepoEnableResult, isRepoListParams, isRepoListResult, isRepoRemoveParams, isRepoRemoveResult, isRepoSyncAllParams, isRepoSyncAllResult, isRepoSyncParams, isRepoSyncResult, isRepoUpdateResult, isRetryableErrorCode, isScheduledTask, isScheduledTaskType, isScheduledTaskV1, isScheduledTasksConfig, isScheduledTasksConfigV1, isSchedulerStatus, isServiceMeImageCompressOptions, isServiceMeImageCompressResult, isServiceMeImageFormat, isServiceMeImageInfo, isServiceMeImageValidationResult, isServiceMeProjectExtractTemplateInput, isServiceMeProjectExtractTemplateResult, isServiceMeProjectGitInitResult, isServiceMeProjectInstallDepsResult, isServiceMeProjectMakeScriptsExecutableResult, isServiceMeProjectScaffoldPruneResult, isServicemeErrorCode, isServicemeErrorDetails, isSkillMarketplaceState, isSkillMutationRequest, isSkillMutationResult, isSkillPublishableResult, isSkillReconcileResult, isSkillRepoConvertToSymlinkParams, isSkillRepoConvertToSymlinkResult, isSkillRepoDraftCommitResult, isSkillRepoDraftCreateResult, isSkillRepoDraftDeleteResult, isSkillRepoDraftListResult, isSkillRepoGetParams, isSkillRepoGetResult, isSkillRepoInstallParams, isSkillRepoInstallResult, isSkillRepoListLinkedParams, isSkillRepoListLinkedResult, isSkillRepoListParams, isSkillRepoListResult, isSkillRepoSetEntryEnabledParams, isSkillRepoSetEntryEnabledResult, isSkillRepoUninstallParams, isSkillRepoUninstallResult, isSystemHelloResult, isSystemPingResult, isSystemShutdownResult, isTaskCancelResult, isTaskCancelledEventParams, isTaskCompletedEventParams, isTaskExecuteResult, isTaskExecutionLog, isTaskFailedEventParams, isTaskListRunningResult, isTaskOutputEventParams, isTaskStartedEventParams, isTaskWorkspaceRef, isToolCheckResult, isToolboxAddParams, isToolboxAddResult, isToolboxList, isToolboxListParams, isToolboxRemoveParams, isToolboxRemoveResult, isToolboxScope, isToolboxUpdateParams, isToolboxUpdateResult, migrateTaskV1ToV2, migrateV1ToV2, normalizeBridgeMethod, normalizeServicemeError };
|