@serviceme/devtools-protocol 2.0.1 → 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 +1651 -1676
- package/dist/index.d.ts +1651 -1676
- package/dist/index.js +1195 -1534
- package/dist/index.mjs +1008 -1321
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -1,1772 +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"
|
|
193
176
|
]);
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
"missing",
|
|
200
|
-
"drifted",
|
|
201
|
-
"conflict",
|
|
202
|
-
"source-unavailable",
|
|
203
|
-
"unsupported"
|
|
177
|
+
const INTENTS = /* @__PURE__ */ new Set([
|
|
178
|
+
"available",
|
|
179
|
+
"selected",
|
|
180
|
+
"moving",
|
|
181
|
+
"removing"
|
|
204
182
|
]);
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
183
|
+
const HEALTH = /* @__PURE__ */ new Set([
|
|
184
|
+
"healthy",
|
|
185
|
+
"missing",
|
|
186
|
+
"drifted",
|
|
187
|
+
"conflict",
|
|
188
|
+
"source-unavailable",
|
|
189
|
+
"unsupported"
|
|
190
|
+
]);
|
|
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";
|
|
501
490
|
}
|
|
502
491
|
function isSkillKind(value) {
|
|
503
|
-
|
|
492
|
+
return value === "skill" || value === "agent";
|
|
504
493
|
}
|
|
505
494
|
function isCopilotContentDetectUnmanagedParams(value) {
|
|
506
|
-
|
|
495
|
+
return isRecord$11(value) && typeof value.workspaceDir === "string";
|
|
507
496
|
}
|
|
508
497
|
function isCopilotContentDetectUnmanagedResult(value) {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
(a) => isRecord5(a) && typeof a.repoId === "string" && typeof a.name === "string" && isSkillKind(a.kind) && (a.source === "symlink" || a.source === "fingerprint")
|
|
514
|
-
) && value.ambiguous.every(
|
|
515
|
-
(a) => isRecord5(a) && typeof a.name === "string" && isSkillKind(a.kind) && Array.isArray(a.candidates) && a.candidates.every((c) => typeof c === "string")
|
|
516
|
-
) && value.integrations.every(
|
|
517
|
-
(i) => isRecord5(i) && typeof i.repoId === "string" && typeof i.pluginId === "string" && (i.kind === "hook" || i.kind === "mcp")
|
|
518
|
-
) && value.unmatched.every(
|
|
519
|
-
(u) => isRecord5(u) && typeof u.name === "string" && typeof u.reason === "string"
|
|
520
|
-
);
|
|
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");
|
|
521
502
|
}
|
|
522
503
|
function isCopilotContentAdoptUnmanagedParams(value) {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
}
|
|
530
|
-
if (value.integrations !== void 0 && !Array.isArray(value.integrations)) return false;
|
|
531
|
-
if (Array.isArray(value.integrations)) {
|
|
532
|
-
return value.integrations.every(
|
|
533
|
-
(i) => isRecord5(i) && typeof i.repoId === "string" && typeof i.pluginId === "string" && (i.kind === "hook" || i.kind === "mcp")
|
|
534
|
-
);
|
|
535
|
-
}
|
|
536
|
-
return true;
|
|
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;
|
|
537
510
|
}
|
|
538
511
|
function isCopilotContentAdoptUnmanagedResult(value) {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
(e) => isRecord5(e) && typeof e.identity === "string" && typeof e.status === "string" && (e.message === void 0 || typeof e.message === "string")
|
|
543
|
-
);
|
|
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"));
|
|
544
515
|
}
|
|
545
516
|
function isSkillRepoListLinkedResult(value) {
|
|
546
|
-
|
|
517
|
+
return isRecord$11(value) && Array.isArray(value.links) && value.links.every(isLinkedSkill);
|
|
547
518
|
}
|
|
548
519
|
function isSkillRepoDraftCreateResult(value) {
|
|
549
|
-
|
|
520
|
+
return isRecord$11(value) && typeof value.id === "string";
|
|
550
521
|
}
|
|
551
522
|
function isSkillRepoDraftCommitResult(value) {
|
|
552
|
-
|
|
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);
|
|
553
524
|
}
|
|
554
525
|
function isSkillRepoDraftListResult(value) {
|
|
555
|
-
|
|
556
|
-
(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"
|
|
557
|
-
);
|
|
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");
|
|
558
527
|
}
|
|
559
528
|
function isSkillRepoDraftDeleteResult(value) {
|
|
560
|
-
|
|
529
|
+
return isRecord$11(value) && value.deleted === true;
|
|
561
530
|
}
|
|
562
531
|
function isRepoListResult(value) {
|
|
563
|
-
|
|
532
|
+
return isRecord$11(value) && Array.isArray(value.repos) && value.repos.every(isRepoEntry);
|
|
564
533
|
}
|
|
565
534
|
function isRepoAddResult(value) {
|
|
566
|
-
|
|
535
|
+
return isRecord$11(value) && isRepoEntry(value.repo) && typeof value.branch === "string" && typeof value.cloned === "boolean";
|
|
567
536
|
}
|
|
568
537
|
function isRepoRemoveResult(value) {
|
|
569
|
-
|
|
538
|
+
return isRecord$11(value) && value.removed === true;
|
|
570
539
|
}
|
|
571
540
|
function isRepoEnableResult(value) {
|
|
572
|
-
|
|
541
|
+
return isRecord$11(value) && isRepoEntry(value.repo);
|
|
573
542
|
}
|
|
574
543
|
function isRepoDisableResult(value) {
|
|
575
|
-
|
|
544
|
+
return isRecord$11(value) && isRepoEntry(value.repo);
|
|
576
545
|
}
|
|
577
546
|
function isRepoUpdateResult(value) {
|
|
578
|
-
|
|
547
|
+
return isRecord$11(value) && isRepoEntry(value.repo);
|
|
579
548
|
}
|
|
580
549
|
function isRepoSyncResult(value) {
|
|
581
|
-
|
|
550
|
+
return isRecord$11(value) && Array.isArray(value.pulls) && value.pulls.length >= 1 && value.pulls.every(isSyncPull);
|
|
582
551
|
}
|
|
583
552
|
function isRepoSyncAllResult(value) {
|
|
584
|
-
|
|
553
|
+
return isRecord$11(value) && Array.isArray(value.pulls) && value.pulls.every(isSyncPull);
|
|
585
554
|
}
|
|
586
555
|
function isCopilotContentRestoreResult(value) {
|
|
587
|
-
|
|
556
|
+
return isRecord$11(value) && typeof value.changed === "boolean" && Array.isArray(value.entries) && value.entries.every(isCopilotContentEntry);
|
|
588
557
|
}
|
|
589
558
|
function isCopilotContentStatusResult(value) {
|
|
590
|
-
|
|
559
|
+
return isCopilotContentRestoreResult(value);
|
|
591
560
|
}
|
|
592
561
|
function isCopilotContentApproveResult(value) {
|
|
593
|
-
|
|
562
|
+
return isCopilotContentRestoreResult(value);
|
|
594
563
|
}
|
|
595
564
|
function isCopilotContentMigrateLegacyResult(value) {
|
|
596
|
-
|
|
565
|
+
return isRecord$11(value) && Array.isArray(value.entries) && value.entries.every(isCopilotContentEntry);
|
|
597
566
|
}
|
|
598
567
|
function isCopilotContentIntegrationStatusResult(value) {
|
|
599
|
-
|
|
568
|
+
return isRecord$11(value) && Array.isArray(value.integrations) && value.integrations.every(isCopilotContentIntegration);
|
|
600
569
|
}
|
|
601
570
|
function isSkillRepoListParams(value) {
|
|
602
|
-
|
|
571
|
+
return isRecord$11(value) && isStringOrUndefined$2(value.repoId) && isSkillKindOrUndefined(value.kind) && isStringOrUndefined$2(value.workspaceDir);
|
|
603
572
|
}
|
|
604
573
|
function isSkillRepoGetParams(value) {
|
|
605
|
-
|
|
574
|
+
return isRecord$11(value) && typeof value.repoId === "string" && typeof value.name === "string";
|
|
606
575
|
}
|
|
607
576
|
function isSkillRepoInstallParams(value) {
|
|
608
|
-
|
|
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);
|
|
609
578
|
}
|
|
610
579
|
function isSkillRepoConvertToSymlinkParams(value) {
|
|
611
|
-
|
|
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);
|
|
612
581
|
}
|
|
613
582
|
function isSkillRepoUninstallParams(value) {
|
|
614
|
-
|
|
583
|
+
return isRecord$11(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkScopeOrUndefined(value.scope);
|
|
615
584
|
}
|
|
616
585
|
function isSkillRepoSetEntryEnabledParams(value) {
|
|
617
|
-
|
|
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");
|
|
618
587
|
}
|
|
619
588
|
function isSkillRepoListLinkedParams(value) {
|
|
620
|
-
|
|
589
|
+
return isRecord$11(value) && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkScopeFilterOrUndefined(value.scope);
|
|
621
590
|
}
|
|
622
591
|
function isRepoListParams(value) {
|
|
623
|
-
|
|
592
|
+
return isRecord$11(value) && (value.source === void 0 || value.source === "default" || value.source === "user");
|
|
624
593
|
}
|
|
625
594
|
function isRepoAddParams(value) {
|
|
626
|
-
|
|
595
|
+
return isRecord$11(value) && typeof value.url === "string" && isStringOrUndefined$2(value.branch) && isStringOrUndefined$2(value.name) && isBooleanOrUndefined(value.useProxy);
|
|
627
596
|
}
|
|
628
597
|
function isRepoRemoveParams(value) {
|
|
629
|
-
|
|
598
|
+
return isRecord$11(value) && typeof value.repoId === "string";
|
|
630
599
|
}
|
|
631
600
|
function isRepoEnableParams(value) {
|
|
632
|
-
|
|
601
|
+
return isRecord$11(value) && typeof value.repoId === "string";
|
|
633
602
|
}
|
|
634
603
|
function isRepoDisableParams(value) {
|
|
635
|
-
|
|
604
|
+
return isRecord$11(value) && typeof value.repoId === "string";
|
|
636
605
|
}
|
|
637
606
|
function isRepoSyncParams(value) {
|
|
638
|
-
|
|
607
|
+
return isRecord$11(value) && typeof value.repoId === "string";
|
|
639
608
|
}
|
|
640
609
|
function isRepoSyncAllParams(value) {
|
|
641
|
-
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
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"
|
|
650
619
|
];
|
|
651
|
-
function
|
|
652
|
-
|
|
620
|
+
function isRecord$10(value) {
|
|
621
|
+
return typeof value === "object" && value !== null;
|
|
653
622
|
}
|
|
654
|
-
function
|
|
655
|
-
|
|
623
|
+
function isStringOrUndefined$1(value) {
|
|
624
|
+
return value === void 0 || typeof value === "string";
|
|
656
625
|
}
|
|
657
626
|
function isDeviceBindingState(value) {
|
|
658
|
-
|
|
627
|
+
return value === "anonymous" || value === "pending" || value === "claimed" || value === "expired";
|
|
659
628
|
}
|
|
660
629
|
function isDeviceIdentityState(value) {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
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;
|
|
669
638
|
}
|
|
670
639
|
function isDeviceMetadata(value) {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
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;
|
|
682
651
|
}
|
|
683
652
|
function isDeviceStatus(value) {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
}
|
|
692
|
-
if (!isStringOrUndefined3(value.lastSyncAt)) return false;
|
|
693
|
-
if (!isStringOrUndefined3(value.lastSyncError)) return false;
|
|
694
|
-
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;
|
|
695
660
|
}
|
|
696
661
|
function isDeviceEnrollParams(value) {
|
|
697
|
-
|
|
662
|
+
return isRecord$10(value) && (value.force === void 0 || typeof value.force === "boolean") && (value.requireAuth === void 0 || typeof value.requireAuth === "boolean");
|
|
698
663
|
}
|
|
699
664
|
function isDeviceEnrollResult(value) {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
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;
|
|
706
671
|
}
|
|
707
672
|
function isDeviceRotateSecretParams(value) {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
}
|
|
712
|
-
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;
|
|
713
676
|
}
|
|
714
677
|
function isDeviceRotateSecretResult(value) {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
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"
|
|
734
697
|
];
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
698
|
+
const VALID_SCHEDULE_TYPES = ["cron", "interval"];
|
|
699
|
+
const VALID_TERMINAL_STATUSES = [
|
|
700
|
+
"success",
|
|
701
|
+
"failure",
|
|
702
|
+
"timeout",
|
|
703
|
+
"cancelled"
|
|
741
704
|
];
|
|
742
|
-
function
|
|
743
|
-
|
|
705
|
+
function isRecord$9(value) {
|
|
706
|
+
return typeof value === "object" && value !== null;
|
|
744
707
|
}
|
|
745
708
|
function isScheduledTaskType(value) {
|
|
746
|
-
|
|
709
|
+
return typeof value === "string" && VALID_TASK_TYPES.includes(value);
|
|
747
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
|
+
*/
|
|
748
716
|
function isScheduledTaskV1(value) {
|
|
749
|
-
|
|
750
|
-
|
|
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";
|
|
751
719
|
}
|
|
720
|
+
/** Validates a {@link TaskWorkspaceRef} payload. */
|
|
752
721
|
function isTaskWorkspaceRef(value) {
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
if (value.lastSeenAt !== void 0 && typeof value.lastSeenAt !== "string") {
|
|
763
|
-
return false;
|
|
764
|
-
}
|
|
765
|
-
return true;
|
|
766
|
-
}
|
|
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. */
|
|
767
731
|
function isScheduledTask(value) {
|
|
768
|
-
|
|
769
|
-
|
|
732
|
+
if (!isScheduledTaskV1(value)) return false;
|
|
733
|
+
return isTaskWorkspaceRef(value.workspace);
|
|
770
734
|
}
|
|
735
|
+
/** Validates a v2 {@link ScheduledTasksConfig} (version: 2). */
|
|
771
736
|
function isScheduledTasksConfig(value) {
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
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));
|
|
776
741
|
}
|
|
742
|
+
/** Validates a v1 {@link ScheduledTasksConfigV1} (version: 1). */
|
|
777
743
|
function isScheduledTasksConfigV1(value) {
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
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));
|
|
782
748
|
}
|
|
783
749
|
function isTaskExecutionLog(value) {
|
|
784
|
-
|
|
785
|
-
|
|
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);
|
|
786
752
|
}
|
|
787
753
|
function isSchedulerStatus(value) {
|
|
788
|
-
|
|
789
|
-
|
|
754
|
+
if (!isRecord$9(value)) return false;
|
|
755
|
+
return typeof value.running === "boolean" && typeof value.tasksRegistered === "number" && typeof value.workspacePath === "string";
|
|
790
756
|
}
|
|
791
757
|
function isTaskExecuteResult(value) {
|
|
792
|
-
|
|
758
|
+
return isRecord$9(value) && typeof value.executionId === "string" && value.accepted === true;
|
|
793
759
|
}
|
|
794
760
|
function isTaskCancelResult(value) {
|
|
795
|
-
|
|
761
|
+
return isRecord$9(value) && typeof value.executionId === "string" && typeof value.cancelled === "boolean";
|
|
796
762
|
}
|
|
797
763
|
function isTaskListRunningResult(value) {
|
|
798
|
-
|
|
764
|
+
return isRecord$9(value) && Array.isArray(value.executions);
|
|
799
765
|
}
|
|
800
766
|
function isTaskStartedEventParams(value) {
|
|
801
|
-
|
|
767
|
+
return isRecord$9(value) && typeof value.executionId === "string" && typeof value.taskId === "string" && typeof value.startedAt === "string";
|
|
802
768
|
}
|
|
803
769
|
function isTaskOutputEventParams(value) {
|
|
804
|
-
|
|
770
|
+
return isRecord$9(value) && typeof value.executionId === "string" && (value.stream === "stdout" || value.stream === "stderr") && typeof value.data === "string";
|
|
805
771
|
}
|
|
806
772
|
function isTaskCompletedEventParams(value) {
|
|
807
|
-
|
|
773
|
+
return isRecord$9(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
|
|
808
774
|
}
|
|
809
775
|
function isTaskFailedEventParams(value) {
|
|
810
|
-
|
|
776
|
+
return isRecord$9(value) && typeof value.executionId === "string" && (value.status === "failure" || value.status === "timeout") && (value.reason === "error" || value.reason === "timeout") && isTaskExecutionLog(value.log);
|
|
811
777
|
}
|
|
812
778
|
function isTaskCancelledEventParams(value) {
|
|
813
|
-
|
|
779
|
+
return isRecord$9(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
|
|
814
780
|
}
|
|
815
781
|
function isAgentSessionStatus(value) {
|
|
816
|
-
|
|
817
|
-
}
|
|
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
|
+
*/
|
|
818
793
|
function migrateTaskV1ToV2(v1, workspace) {
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
}
|
|
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
|
+
*/
|
|
829
813
|
function migrateV1ToV2(v1Config, workspace) {
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
function
|
|
851
|
-
|
|
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";
|
|
852
839
|
}
|
|
853
840
|
function isFiniteNumberOrUndefined(value) {
|
|
854
|
-
|
|
841
|
+
return value === void 0 || typeof value === "number" && Number.isFinite(value);
|
|
855
842
|
}
|
|
856
843
|
function isToolboxScope(value) {
|
|
857
|
-
|
|
844
|
+
return value === "user" || value === "workspace";
|
|
858
845
|
}
|
|
859
846
|
function isExternalTool(value) {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
if (!isStringOrUndefined4(value.lastUsedAt)) return false;
|
|
875
|
-
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;
|
|
876
861
|
}
|
|
877
862
|
function isExternalToolPatch(value) {
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
if (!isFiniteNumberOrUndefined(value.order)) return false;
|
|
893
|
-
if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
|
|
894
|
-
if (!isStringOrUndefined4(value.lastUsedAt)) return false;
|
|
895
|
-
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;
|
|
896
877
|
}
|
|
897
878
|
function isToolboxList(value) {
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
}
|
|
904
|
-
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;
|
|
905
884
|
}
|
|
906
885
|
function isToolboxListParams(value) {
|
|
907
|
-
|
|
886
|
+
return isRecord$8(value) && (value.scope === void 0 || isToolboxScope(value.scope));
|
|
908
887
|
}
|
|
909
888
|
function isToolboxAddParams(value) {
|
|
910
|
-
|
|
889
|
+
return isExternalTool(value);
|
|
911
890
|
}
|
|
912
891
|
function isToolboxAddResult(value) {
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
892
|
+
if (!isRecord$8(value)) return false;
|
|
893
|
+
if (!isToolboxScope(value.scope)) return false;
|
|
894
|
+
if (!isExternalTool(value.tool)) return false;
|
|
895
|
+
return true;
|
|
917
896
|
}
|
|
918
897
|
function isToolboxRemoveParams(value) {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
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;
|
|
924
903
|
}
|
|
925
904
|
function isToolboxRemoveResult(value) {
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
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;
|
|
932
911
|
}
|
|
933
912
|
function isToolboxUpdateParams(value) {
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
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;
|
|
940
919
|
}
|
|
941
920
|
function isToolboxUpdateResult(value) {
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
921
|
+
if (!isRecord$8(value)) return false;
|
|
922
|
+
if (!isToolboxScope(value.scope)) return false;
|
|
923
|
+
if (!isExternalTool(value.tool)) return false;
|
|
924
|
+
return true;
|
|
946
925
|
}
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
function
|
|
951
|
-
|
|
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;
|
|
952
931
|
}
|
|
953
932
|
function isValidProtocolVersion(value) {
|
|
954
|
-
|
|
933
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= 2;
|
|
955
934
|
}
|
|
956
935
|
function isBridgeCapabilities(value) {
|
|
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
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
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"
|
|
1029
1008
|
];
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
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"
|
|
1042
1028
|
};
|
|
1029
|
+
/**
|
|
1030
|
+
* Normalize a legacy `skillRepo.*` method name to its canonical
|
|
1031
|
+
* `copilotContent.*` spelling. Unknown names pass through unchanged.
|
|
1032
|
+
*/
|
|
1043
1033
|
function normalizeBridgeMethod(method) {
|
|
1044
|
-
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
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"
|
|
1052
1042
|
];
|
|
1053
1043
|
function isSystemHelloResult(value) {
|
|
1054
|
-
|
|
1044
|
+
return isRecord$7(value) && typeof value.cliVersion === "string" && isValidProtocolVersion(value.protocolVersion) && isBridgeCapabilities(value.capabilities) && typeof value.pid === "number";
|
|
1055
1045
|
}
|
|
1056
1046
|
function isSystemPingResult(value) {
|
|
1057
|
-
|
|
1047
|
+
return isRecord$7(value) && typeof value.now === "string";
|
|
1058
1048
|
}
|
|
1059
1049
|
function isSystemShutdownResult(value) {
|
|
1060
|
-
|
|
1050
|
+
return isRecord$7(value) && value.shuttingDown === true;
|
|
1061
1051
|
}
|
|
1062
1052
|
function getBridgeResultValidator(method) {
|
|
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
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
return isCopilotContentApproveResult;
|
|
1135
|
-
case "copilotContent.migrateLegacy":
|
|
1136
|
-
return isCopilotContentMigrateLegacyResult;
|
|
1137
|
-
case "copilotContent.integrationStatus":
|
|
1138
|
-
return isCopilotContentIntegrationStatusResult;
|
|
1139
|
-
case "copilotContent.customizations.list":
|
|
1140
|
-
return isCopilotCustomizationsListResult;
|
|
1141
|
-
case "copilotPlugin.list":
|
|
1142
|
-
return isCopilotPluginListResult;
|
|
1143
|
-
case "copilotPlugin.register":
|
|
1144
|
-
return isCopilotPluginRegisterResult;
|
|
1145
|
-
case "copilotPlugin.unregister":
|
|
1146
|
-
return isCopilotPluginUnregisterResult;
|
|
1147
|
-
case "copilotContent.package.install":
|
|
1148
|
-
return isCopilotPackageInstallResult;
|
|
1149
|
-
case "copilotContent.package.update":
|
|
1150
|
-
return isCopilotPackageUpdateResult;
|
|
1151
|
-
case "copilotContent.package.uninstall":
|
|
1152
|
-
return isCopilotPackageUninstallResult;
|
|
1153
|
-
case "copilotContent.package.move":
|
|
1154
|
-
return isCopilotPackageMoveResult;
|
|
1155
|
-
case "copilotContent.legacy.preview":
|
|
1156
|
-
return isCopilotLegacyPreviewResult;
|
|
1157
|
-
case "copilotContent.legacy.migrate":
|
|
1158
|
-
return isCopilotLegacyMigrateResult;
|
|
1159
|
-
case "copilotContent.sources.list":
|
|
1160
|
-
return isCopilotSourceListResult;
|
|
1161
|
-
case "copilotContent.sources.remove":
|
|
1162
|
-
return isCopilotSourceRemoveResult;
|
|
1163
|
-
case "copilotContent.package.previewUpdate":
|
|
1164
|
-
return isCopilotUpdatePreviewResult;
|
|
1165
|
-
case "auth.status":
|
|
1166
|
-
return isAuthStatus;
|
|
1167
|
-
case "auth.login":
|
|
1168
|
-
return isAuthLoginResult;
|
|
1169
|
-
case "auth.logout":
|
|
1170
|
-
return isAuthLogoutResult;
|
|
1171
|
-
case "auth.whoami":
|
|
1172
|
-
return isAuthWhoamiResult;
|
|
1173
|
-
case "auth.switch":
|
|
1174
|
-
return isAuthSwitchResult;
|
|
1175
|
-
case "device.status":
|
|
1176
|
-
return isDeviceStatus;
|
|
1177
|
-
case "device.enroll":
|
|
1178
|
-
return isDeviceEnrollResult;
|
|
1179
|
-
case "device.rotate-secret":
|
|
1180
|
-
return isDeviceRotateSecretResult;
|
|
1181
|
-
case "toolbox.list":
|
|
1182
|
-
return isToolboxList;
|
|
1183
|
-
case "toolbox.add":
|
|
1184
|
-
return isToolboxAddResult;
|
|
1185
|
-
case "toolbox.remove":
|
|
1186
|
-
return isToolboxRemoveResult;
|
|
1187
|
-
case "toolbox.update":
|
|
1188
|
-
return isToolboxUpdateResult;
|
|
1189
|
-
default:
|
|
1190
|
-
return void 0;
|
|
1191
|
-
}
|
|
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
|
+
}
|
|
1192
1124
|
}
|
|
1193
1125
|
function getBridgeEventParamsValidator(event) {
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
return isTaskFailedEventParams;
|
|
1203
|
-
case "task.cancelled":
|
|
1204
|
-
return isTaskCancelledEventParams;
|
|
1205
|
-
default:
|
|
1206
|
-
return void 0;
|
|
1207
|
-
}
|
|
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
|
+
}
|
|
1208
1134
|
}
|
|
1209
1135
|
function isBridgeMethod(value) {
|
|
1210
|
-
|
|
1136
|
+
return typeof value === "string" && BRIDGE_METHODS.includes(value);
|
|
1211
1137
|
}
|
|
1212
1138
|
function isBridgeEventName(value) {
|
|
1213
|
-
|
|
1139
|
+
return typeof value === "string" && BRIDGE_EVENTS.includes(value);
|
|
1214
1140
|
}
|
|
1215
1141
|
function isBridgeRequest(value) {
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
}
|
|
1219
|
-
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;
|
|
1220
1144
|
}
|
|
1221
1145
|
function isBridgeResponse(value) {
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
return false;
|
|
1227
|
-
}
|
|
1228
|
-
if (value.ok) {
|
|
1229
|
-
return "result" in value;
|
|
1230
|
-
}
|
|
1231
|
-
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;
|
|
1232
1150
|
}
|
|
1233
1151
|
function isBridgeEvent(value) {
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
}
|
|
1237
|
-
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;
|
|
1238
1154
|
}
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
function
|
|
1243
|
-
|
|
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;
|
|
1244
1160
|
}
|
|
1245
1161
|
function createCliSuccess(data) {
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1162
|
+
return {
|
|
1163
|
+
schemaVersion: 1,
|
|
1164
|
+
ok: true,
|
|
1165
|
+
data
|
|
1166
|
+
};
|
|
1251
1167
|
}
|
|
1252
1168
|
function createCliFailure(error) {
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1169
|
+
return {
|
|
1170
|
+
schemaVersion: 1,
|
|
1171
|
+
ok: false,
|
|
1172
|
+
error
|
|
1173
|
+
};
|
|
1258
1174
|
}
|
|
1259
1175
|
function isCliEnvelope(value) {
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
// src/copilot.ts
|
|
1273
|
-
var COPILOT_ERROR_CODES = {
|
|
1274
|
-
NOT_INSTALLED: "copilot_not_installed",
|
|
1275
|
-
AUTH_REQUIRED: "copilot_auth_required",
|
|
1276
|
-
EXECUTION_FAILED: "copilot_execution_failed",
|
|
1277
|
-
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"
|
|
1278
1188
|
};
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
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"
|
|
1293
1203
|
];
|
|
1294
|
-
function
|
|
1295
|
-
|
|
1204
|
+
function isRecord$5(value) {
|
|
1205
|
+
return typeof value === "object" && value !== null;
|
|
1296
1206
|
}
|
|
1297
1207
|
function isKnownEnvironmentTool(value) {
|
|
1298
|
-
|
|
1208
|
+
return KNOWN_ENVIRONMENT_TOOLS.includes(value);
|
|
1299
1209
|
}
|
|
1300
1210
|
function isToolCheckResult(value) {
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
}
|
|
1304
|
-
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");
|
|
1305
1213
|
}
|
|
1306
1214
|
function isEnvironmentCheckResult(value) {
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
"device_not_enrolled",
|
|
1347
|
-
"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"
|
|
1348
1254
|
];
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
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"
|
|
1358
1264
|
]);
|
|
1359
|
-
function
|
|
1360
|
-
|
|
1265
|
+
function isRecord$4(value) {
|
|
1266
|
+
return typeof value === "object" && value !== null;
|
|
1361
1267
|
}
|
|
1362
1268
|
function isServicemeErrorCode(value) {
|
|
1363
|
-
|
|
1269
|
+
return typeof value === "string" && SERVICEME_ERROR_CODES.includes(value);
|
|
1364
1270
|
}
|
|
1365
1271
|
function isServicemeErrorDetails(value) {
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
}
|
|
1369
|
-
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";
|
|
1370
1274
|
}
|
|
1371
1275
|
function isRetryableErrorCode(code) {
|
|
1372
|
-
|
|
1276
|
+
return RETRYABLE_ERROR_CODES.has(code);
|
|
1373
1277
|
}
|
|
1374
1278
|
var ServicemeProtocolError = class extends Error {
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
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
|
+
}
|
|
1391
1295
|
};
|
|
1392
1296
|
function createServicemeError(code, message, details) {
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1297
|
+
return new ServicemeProtocolError({
|
|
1298
|
+
code,
|
|
1299
|
+
message,
|
|
1300
|
+
details
|
|
1301
|
+
});
|
|
1398
1302
|
}
|
|
1399
1303
|
function normalizeServicemeError(error, fallbackCode = "internal_error") {
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
};
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
// src/image.ts
|
|
1432
|
-
var SERVICEME_IMAGE_FORMATS = [
|
|
1433
|
-
"jpeg",
|
|
1434
|
-
"png",
|
|
1435
|
-
"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"
|
|
1436
1332
|
];
|
|
1437
|
-
function
|
|
1438
|
-
|
|
1333
|
+
function isRecord$3(value) {
|
|
1334
|
+
return typeof value === "object" && value !== null;
|
|
1439
1335
|
}
|
|
1440
1336
|
function isServiceMeImageFormat(value) {
|
|
1441
|
-
|
|
1337
|
+
return typeof value === "string" && SERVICEME_IMAGE_FORMATS.includes(value);
|
|
1442
1338
|
}
|
|
1443
1339
|
function isServiceMeImageCompressOptions(value) {
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
}
|
|
1447
|
-
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");
|
|
1448
1342
|
}
|
|
1449
1343
|
function isServiceMeImageCompressResult(value) {
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
}
|
|
1453
|
-
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";
|
|
1454
1346
|
}
|
|
1455
1347
|
function isServiceMeImageInfo(value) {
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
}
|
|
1459
|
-
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");
|
|
1460
1350
|
}
|
|
1461
1351
|
function isServiceMeImageValidationResult(value) {
|
|
1462
|
-
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
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
|
|
1475
1365
|
};
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
function
|
|
1479
|
-
|
|
1366
|
+
//#endregion
|
|
1367
|
+
//#region src/project.ts
|
|
1368
|
+
function isRecord$2(value) {
|
|
1369
|
+
return typeof value === "object" && value !== null;
|
|
1480
1370
|
}
|
|
1481
1371
|
function isServiceMeProjectScaffoldPruneResult(value) {
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
}
|
|
1485
|
-
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");
|
|
1486
1374
|
}
|
|
1487
1375
|
function isServiceMeProjectGitInitResult(value) {
|
|
1488
|
-
|
|
1376
|
+
return isRecord$2(value) && typeof value.initialized === "boolean" && typeof value.command === "string";
|
|
1489
1377
|
}
|
|
1490
1378
|
function isServiceMeProjectMakeScriptsExecutableResult(value) {
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
}
|
|
1494
|
-
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");
|
|
1495
1381
|
}
|
|
1496
1382
|
function isServiceMeProjectInstallDepsResult(value) {
|
|
1497
|
-
|
|
1383
|
+
return isRecord$2(value) && typeof value.installed === "boolean" && typeof value.command === "string";
|
|
1498
1384
|
}
|
|
1499
1385
|
function isServiceMeProjectExtractTemplateInput(value) {
|
|
1500
|
-
|
|
1386
|
+
return isRecord$2(value) && typeof value.extractedDirName === "string" && typeof value.projectFilePattern === "string";
|
|
1501
1387
|
}
|
|
1502
1388
|
function isServiceMeProjectExtractTemplateResult(value) {
|
|
1503
|
-
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
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"
|
|
1514
1400
|
];
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1401
|
+
const VALID_SKILL_MUTATION_ACTIONS = [
|
|
1402
|
+
"install",
|
|
1403
|
+
"uninstall",
|
|
1404
|
+
"move",
|
|
1405
|
+
"removeExternal",
|
|
1406
|
+
"publish",
|
|
1407
|
+
"republish",
|
|
1408
|
+
"submit-to-official"
|
|
1523
1409
|
];
|
|
1524
|
-
function
|
|
1525
|
-
|
|
1410
|
+
function isRecord$1(value) {
|
|
1411
|
+
return typeof value === "object" && value !== null;
|
|
1526
1412
|
}
|
|
1527
1413
|
function isSkillScope(value) {
|
|
1528
|
-
|
|
1414
|
+
return typeof value === "string" && VALID_SKILL_SCOPES.includes(value);
|
|
1529
1415
|
}
|
|
1530
1416
|
function isSkillScopeStatus(value) {
|
|
1531
|
-
|
|
1417
|
+
return typeof value === "string" && VALID_SKILL_SCOPE_STATUSES.includes(value);
|
|
1532
1418
|
}
|
|
1533
1419
|
function isSkillMutationAction(value) {
|
|
1534
|
-
|
|
1535
|
-
}
|
|
1536
|
-
function
|
|
1537
|
-
|
|
1538
|
-
}
|
|
1539
|
-
function
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
if (segments.some((segment) => segment.length === 0)) {
|
|
1545
|
-
return false;
|
|
1546
|
-
}
|
|
1547
|
-
return segments.every(
|
|
1548
|
-
(segment) => segment !== "." && segment !== ".." && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(segment)
|
|
1549
|
-
);
|
|
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));
|
|
1550
1430
|
}
|
|
1551
1431
|
function isSkillScopeState(value) {
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
}
|
|
1555
|
-
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");
|
|
1556
1434
|
}
|
|
1557
1435
|
function isSkillMarketplaceEntry(value) {
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
}
|
|
1561
|
-
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);
|
|
1562
1438
|
}
|
|
1563
1439
|
function isSkillMarketplaceState(value) {
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
}
|
|
1567
|
-
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");
|
|
1568
1442
|
}
|
|
1569
1443
|
function isSkillMutationRequest(value) {
|
|
1570
|
-
|
|
1444
|
+
return isRecord$1(value) && isSafeResourceId(value.skillId) && isSkillScope(value.targetScope) && isSkillMutationAction(value.action) && (value.confirmed === void 0 || typeof value.confirmed === "boolean");
|
|
1571
1445
|
}
|
|
1572
1446
|
function isSkillMutationResult(value) {
|
|
1573
|
-
|
|
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");
|
|
1574
1448
|
}
|
|
1575
1449
|
function isSkillReconcileResult(value) {
|
|
1576
|
-
|
|
1450
|
+
return isRecord$1(value) && isSkillMarketplaceState(value.state) && typeof value.changed === "boolean";
|
|
1577
1451
|
}
|
|
1578
1452
|
function isPublishableSkillEntry(value) {
|
|
1579
|
-
|
|
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");
|
|
1580
1454
|
}
|
|
1581
1455
|
function isSkillPublishableResult(value) {
|
|
1582
|
-
|
|
1583
|
-
}
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
BRIDGE_EVENTS,
|
|
1587
|
-
BRIDGE_METHODS,
|
|
1588
|
-
COPILOT_CONTENT_METHOD_ALIASES,
|
|
1589
|
-
COPILOT_ERROR_CODES,
|
|
1590
|
-
DEFAULT_JSON_SORT_OPTIONS,
|
|
1591
|
-
DEVICE_BINDING_STATES,
|
|
1592
|
-
JSON_SORT_ALGORITHMS,
|
|
1593
|
-
JSON_SORT_ORDERS,
|
|
1594
|
-
KNOWN_ENVIRONMENT_TOOLS,
|
|
1595
|
-
SERVICEME_CLI_CAPABILITIES,
|
|
1596
|
-
SERVICEME_CLI_NAME,
|
|
1597
|
-
SERVICEME_CLI_SCHEMA_VERSION,
|
|
1598
|
-
SERVICEME_CLI_VERSION,
|
|
1599
|
-
SERVICEME_ERROR_CODES,
|
|
1600
|
-
SERVICEME_IMAGE_FORMATS,
|
|
1601
|
-
SERVICEME_PROTOCOL_VERSION,
|
|
1602
|
-
ServicemeProtocolError,
|
|
1603
|
-
TOOLBOX_SCOPES,
|
|
1604
|
-
createCliFailure,
|
|
1605
|
-
createCliSuccess,
|
|
1606
|
-
createServicemeError,
|
|
1607
|
-
getBridgeEventParamsValidator,
|
|
1608
|
-
getBridgeResultValidator,
|
|
1609
|
-
isAgentMarketplaceState,
|
|
1610
|
-
isAgentMutationRequest,
|
|
1611
|
-
isAgentMutationResult,
|
|
1612
|
-
isAgentPermissionSummary,
|
|
1613
|
-
isAgentPermissionsResult,
|
|
1614
|
-
isAgentSessionStatus,
|
|
1615
|
-
isAuthAccountMeta,
|
|
1616
|
-
isAuthLoginParams,
|
|
1617
|
-
isAuthLoginResult,
|
|
1618
|
-
isAuthLogoutParams,
|
|
1619
|
-
isAuthLogoutResult,
|
|
1620
|
-
isAuthProvider,
|
|
1621
|
-
isAuthSessionHandle,
|
|
1622
|
-
isAuthStatus,
|
|
1623
|
-
isAuthSwitchParams,
|
|
1624
|
-
isAuthSwitchResult,
|
|
1625
|
-
isAuthWhoamiResult,
|
|
1626
|
-
isBridgeCapabilities,
|
|
1627
|
-
isBridgeEvent,
|
|
1628
|
-
isBridgeEventName,
|
|
1629
|
-
isBridgeMethod,
|
|
1630
|
-
isBridgeRequest,
|
|
1631
|
-
isBridgeResponse,
|
|
1632
|
-
isCliEnvelope,
|
|
1633
|
-
isCopilotContentAdoptUnmanagedParams,
|
|
1634
|
-
isCopilotContentAdoptUnmanagedResult,
|
|
1635
|
-
isCopilotContentApproveResult,
|
|
1636
|
-
isCopilotContentDetectUnmanagedParams,
|
|
1637
|
-
isCopilotContentDetectUnmanagedResult,
|
|
1638
|
-
isCopilotContentIntegrationStatusResult,
|
|
1639
|
-
isCopilotContentMigrateLegacyResult,
|
|
1640
|
-
isCopilotContentRestoreResult,
|
|
1641
|
-
isCopilotContentStatusResult,
|
|
1642
|
-
isCopilotCustomizationViewPayload,
|
|
1643
|
-
isCopilotCustomizationsListParams,
|
|
1644
|
-
isCopilotCustomizationsListResult,
|
|
1645
|
-
isCopilotLegacyMigrateParams,
|
|
1646
|
-
isCopilotLegacyMigrateResult,
|
|
1647
|
-
isCopilotLegacyPreviewParams,
|
|
1648
|
-
isCopilotLegacyPreviewResult,
|
|
1649
|
-
isCopilotPackageInstallParams,
|
|
1650
|
-
isCopilotPackageInstallResult,
|
|
1651
|
-
isCopilotPackageMoveParams,
|
|
1652
|
-
isCopilotPackageMoveResult,
|
|
1653
|
-
isCopilotPackageUninstallParams,
|
|
1654
|
-
isCopilotPackageUninstallResult,
|
|
1655
|
-
isCopilotPackageUpdateParams,
|
|
1656
|
-
isCopilotPackageUpdateResult,
|
|
1657
|
-
isCopilotPluginListParams,
|
|
1658
|
-
isCopilotPluginListResult,
|
|
1659
|
-
isCopilotPluginRegisterParams,
|
|
1660
|
-
isCopilotPluginRegisterResult,
|
|
1661
|
-
isCopilotPluginUnregisterParams,
|
|
1662
|
-
isCopilotPluginUnregisterResult,
|
|
1663
|
-
isCopilotSourceListParams,
|
|
1664
|
-
isCopilotSourceListResult,
|
|
1665
|
-
isCopilotSourceRemoveParams,
|
|
1666
|
-
isCopilotSourceRemoveResult,
|
|
1667
|
-
isCopilotUpdatePreviewParams,
|
|
1668
|
-
isCopilotUpdatePreviewResult,
|
|
1669
|
-
isDeviceBindingState,
|
|
1670
|
-
isDeviceEnrollParams,
|
|
1671
|
-
isDeviceEnrollResult,
|
|
1672
|
-
isDeviceIdentityState,
|
|
1673
|
-
isDeviceMetadata,
|
|
1674
|
-
isDeviceRotateSecretParams,
|
|
1675
|
-
isDeviceRotateSecretResult,
|
|
1676
|
-
isDeviceStatus,
|
|
1677
|
-
isEnvironmentCheckResult,
|
|
1678
|
-
isExternalTool,
|
|
1679
|
-
isExternalToolPatch,
|
|
1680
|
-
isJsonOutputResult,
|
|
1681
|
-
isJsonSortAlgorithm,
|
|
1682
|
-
isJsonSortOptions,
|
|
1683
|
-
isJsonSortOrder,
|
|
1684
|
-
isJsonValidationResult,
|
|
1685
|
-
isKnownEnvironmentTool,
|
|
1686
|
-
isRecord4 as isRecord,
|
|
1687
|
-
isRepoAddParams,
|
|
1688
|
-
isRepoAddResult,
|
|
1689
|
-
isRepoDisableParams,
|
|
1690
|
-
isRepoDisableResult,
|
|
1691
|
-
isRepoEnableParams,
|
|
1692
|
-
isRepoEnableResult,
|
|
1693
|
-
isRepoListParams,
|
|
1694
|
-
isRepoListResult,
|
|
1695
|
-
isRepoRemoveParams,
|
|
1696
|
-
isRepoRemoveResult,
|
|
1697
|
-
isRepoSyncAllParams,
|
|
1698
|
-
isRepoSyncAllResult,
|
|
1699
|
-
isRepoSyncParams,
|
|
1700
|
-
isRepoSyncResult,
|
|
1701
|
-
isRepoUpdateResult,
|
|
1702
|
-
isRetryableErrorCode,
|
|
1703
|
-
isScheduledTask,
|
|
1704
|
-
isScheduledTaskType,
|
|
1705
|
-
isScheduledTaskV1,
|
|
1706
|
-
isScheduledTasksConfig,
|
|
1707
|
-
isScheduledTasksConfigV1,
|
|
1708
|
-
isSchedulerStatus,
|
|
1709
|
-
isServiceMeImageCompressOptions,
|
|
1710
|
-
isServiceMeImageCompressResult,
|
|
1711
|
-
isServiceMeImageFormat,
|
|
1712
|
-
isServiceMeImageInfo,
|
|
1713
|
-
isServiceMeImageValidationResult,
|
|
1714
|
-
isServiceMeProjectExtractTemplateInput,
|
|
1715
|
-
isServiceMeProjectExtractTemplateResult,
|
|
1716
|
-
isServiceMeProjectGitInitResult,
|
|
1717
|
-
isServiceMeProjectInstallDepsResult,
|
|
1718
|
-
isServiceMeProjectMakeScriptsExecutableResult,
|
|
1719
|
-
isServiceMeProjectScaffoldPruneResult,
|
|
1720
|
-
isServicemeErrorCode,
|
|
1721
|
-
isServicemeErrorDetails,
|
|
1722
|
-
isSkillMarketplaceState,
|
|
1723
|
-
isSkillMutationRequest,
|
|
1724
|
-
isSkillMutationResult,
|
|
1725
|
-
isSkillPublishableResult,
|
|
1726
|
-
isSkillReconcileResult,
|
|
1727
|
-
isSkillRepoConvertToSymlinkParams,
|
|
1728
|
-
isSkillRepoConvertToSymlinkResult,
|
|
1729
|
-
isSkillRepoDraftCommitResult,
|
|
1730
|
-
isSkillRepoDraftCreateResult,
|
|
1731
|
-
isSkillRepoDraftDeleteResult,
|
|
1732
|
-
isSkillRepoDraftListResult,
|
|
1733
|
-
isSkillRepoGetParams,
|
|
1734
|
-
isSkillRepoGetResult,
|
|
1735
|
-
isSkillRepoInstallParams,
|
|
1736
|
-
isSkillRepoInstallResult,
|
|
1737
|
-
isSkillRepoListLinkedParams,
|
|
1738
|
-
isSkillRepoListLinkedResult,
|
|
1739
|
-
isSkillRepoListParams,
|
|
1740
|
-
isSkillRepoListResult,
|
|
1741
|
-
isSkillRepoSetEntryEnabledParams,
|
|
1742
|
-
isSkillRepoSetEntryEnabledResult,
|
|
1743
|
-
isSkillRepoUninstallParams,
|
|
1744
|
-
isSkillRepoUninstallResult,
|
|
1745
|
-
isSystemHelloResult,
|
|
1746
|
-
isSystemPingResult,
|
|
1747
|
-
isSystemShutdownResult,
|
|
1748
|
-
isTaskCancelResult,
|
|
1749
|
-
isTaskCancelledEventParams,
|
|
1750
|
-
isTaskCompletedEventParams,
|
|
1751
|
-
isTaskExecuteResult,
|
|
1752
|
-
isTaskExecutionLog,
|
|
1753
|
-
isTaskFailedEventParams,
|
|
1754
|
-
isTaskListRunningResult,
|
|
1755
|
-
isTaskOutputEventParams,
|
|
1756
|
-
isTaskStartedEventParams,
|
|
1757
|
-
isTaskWorkspaceRef,
|
|
1758
|
-
isToolCheckResult,
|
|
1759
|
-
isToolboxAddParams,
|
|
1760
|
-
isToolboxAddResult,
|
|
1761
|
-
isToolboxList,
|
|
1762
|
-
isToolboxListParams,
|
|
1763
|
-
isToolboxRemoveParams,
|
|
1764
|
-
isToolboxRemoveResult,
|
|
1765
|
-
isToolboxScope,
|
|
1766
|
-
isToolboxUpdateParams,
|
|
1767
|
-
isToolboxUpdateResult,
|
|
1768
|
-
migrateTaskV1ToV2,
|
|
1769
|
-
migrateV1ToV2,
|
|
1770
|
-
normalizeBridgeMethod,
|
|
1771
|
-
normalizeServicemeError
|
|
1772
|
-
};
|
|
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 };
|