@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.
Files changed (5) hide show
  1. package/dist/index.d.mts +1651 -1676
  2. package/dist/index.d.ts +1651 -1676
  3. package/dist/index.js +1195 -1534
  4. package/dist/index.mjs +1008 -1321
  5. package/package.json +6 -6
package/dist/index.mjs CHANGED
@@ -1,1772 +1,1459 @@
1
- // src/agent.ts
2
- var VALID_AGENT_SCOPES = ["workspace", "user"];
3
- var VALID_AGENT_SCOPE_STATUSES = [
4
- "absent",
5
- "available",
6
- "installed",
7
- "blocked",
8
- "conflict"
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
- var VALID_AGENT_MUTATION_ACTIONS = [
11
- "install",
12
- "uninstall",
13
- "move",
14
- "removeExternal",
15
- "publish",
16
- "republish",
17
- "submit-to-official"
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
- var VALID_AGENT_TOOL_RISK_LEVELS = ["high", "medium", "low"];
20
- function isRecord(value) {
21
- return typeof value === "object" && value !== null;
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
- return Array.isArray(value) && value.every((item) => typeof item === "string");
27
+ function isStringArray$2(value) {
28
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
25
29
  }
26
30
  function isAgentScope(value) {
27
- return typeof value === "string" && VALID_AGENT_SCOPES.includes(value);
31
+ return typeof value === "string" && VALID_AGENT_SCOPES.includes(value);
28
32
  }
29
33
  function isAgentScopeStatus(value) {
30
- return typeof value === "string" && VALID_AGENT_SCOPE_STATUSES.includes(value);
34
+ return typeof value === "string" && VALID_AGENT_SCOPE_STATUSES.includes(value);
31
35
  }
32
36
  function isAgentMutationAction(value) {
33
- return typeof value === "string" && VALID_AGENT_MUTATION_ACTIONS.includes(value);
37
+ return typeof value === "string" && VALID_AGENT_MUTATION_ACTIONS.includes(value);
34
38
  }
35
- function isSafeResourceId(value) {
36
- if (typeof value !== "string" || value.length === 0 || value.includes("\\")) {
37
- return false;
38
- }
39
- const segments = value.split("/");
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
- if (!isRecord(value)) {
49
- return false;
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
- if (!isRecord(value)) {
55
- return false;
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
- if (!isRecord(value)) {
61
- return false;
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
- return isRecord(value) && isSafeResourceId(value.agentId) && isAgentScope(value.targetScope) && isAgentMutationAction(value.action) && (value.confirmed === void 0 || typeof value.confirmed === "boolean");
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
- return isRecord(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(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");
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
- return isRecord(value) && typeof value.tool === "string" && typeof value.riskLevel === "string" && VALID_AGENT_TOOL_RISK_LEVELS.includes(value.riskLevel);
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
- return isRecord(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";
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
- return isRecord(value) && typeof value.agentId === "string" && isAgentPermissionSummary(value.summary);
70
+ return isRecord$14(value) && typeof value.agentId === "string" && isAgentPermissionSummary(value.summary);
79
71
  }
80
-
81
- // src/auth.ts
82
- var AUTH_PROVIDERS = ["github", "microsoft"];
83
- function isRecord2(value) {
84
- return typeof value === "object" && value !== null;
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
- return value === "github" || value === "microsoft";
79
+ return value === "github" || value === "microsoft";
88
80
  }
89
- function isStringOrUndefined(value) {
90
- return value === void 0 || typeof value === "string";
81
+ function isStringOrUndefined$3(value) {
82
+ return value === void 0 || typeof value === "string";
91
83
  }
92
84
  function isNumberOrUndefined(value) {
93
- return value === void 0 || value === null || typeof value === "number" && Number.isFinite(value);
85
+ return value === void 0 || value === null || typeof value === "number" && Number.isFinite(value);
94
86
  }
95
87
  function isAuthAccountMeta(value) {
96
- if (!isRecord2(value)) return false;
97
- if (typeof value.id !== "string") return false;
98
- if (!isAuthProvider(value.provider)) return false;
99
- if (value.id.length === 0) return false;
100
- if (!isStringOrUndefined(value.displayName)) return false;
101
- if (!isStringOrUndefined(value.login)) return false;
102
- if (!isStringOrUndefined(value.email)) return false;
103
- if (!isStringOrUndefined(value.avatarUrl)) return false;
104
- if (!isNumberOrUndefined(value.expiresAt)) return false;
105
- return true;
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
- if (!isRecord2(value)) return false;
109
- if (!isAuthProvider(value.provider)) return false;
110
- if (value.deviceCode !== void 0 && typeof value.deviceCode !== "string") {
111
- return false;
112
- }
113
- if (value.userCode !== void 0 && typeof value.userCode !== "string") {
114
- return false;
115
- }
116
- if (value.verificationUrl !== void 0 && typeof value.verificationUrl !== "string") {
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
- if (!isRecord2(value)) return false;
130
- if (!isAuthProvider(value.provider)) return false;
131
- if (value.account !== void 0 && value.account !== null && !isAuthAccountMeta(value.account)) {
132
- return false;
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
- if (!isRecord2(value)) return false;
139
- if (value.activeProvider !== null && !isAuthProvider(value.activeProvider)) {
140
- return false;
141
- }
142
- if (!isRecord2(value.accounts)) return false;
143
- for (const [provider, account] of Object.entries(value.accounts)) {
144
- if (!isAuthProvider(provider)) return false;
145
- if (account !== void 0 && account !== null && !isAuthAccountMeta(account)) {
146
- return false;
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
- return isRecord2(value) && isAuthProvider(value.provider) && (value.force === void 0 || typeof value.force === "boolean");
130
+ return isRecord$13(value) && isAuthProvider(value.provider) && (value.force === void 0 || typeof value.force === "boolean");
155
131
  }
156
132
  function isAuthLogoutParams(value) {
157
- return isRecord2(value) && (value.provider === void 0 || isAuthProvider(value.provider));
133
+ return isRecord$13(value) && (value.provider === void 0 || isAuthProvider(value.provider));
158
134
  }
159
135
  function isAuthLogoutResult(value) {
160
- if (!isRecord2(value)) return false;
161
- if (value.provider !== null && !isAuthProvider(value.provider)) return false;
162
- if (typeof value.success !== "boolean") return false;
163
- return true;
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
- if (!isRecord2(value)) return false;
167
- if (value.provider !== null && !isAuthProvider(value.provider)) return false;
168
- if (!isStringOrUndefined(value.login)) return false;
169
- if (!isStringOrUndefined(value.name)) return false;
170
- if (!isStringOrUndefined(value.avatarUrl)) return false;
171
- if (!isStringOrUndefined(value.email)) return false;
172
- return true;
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
- return isRecord2(value) && isAuthProvider(value.provider);
151
+ return isRecord$13(value) && isAuthProvider(value.provider);
176
152
  }
177
153
  function isAuthSwitchResult(value) {
178
- if (!isRecord2(value)) return false;
179
- if (value.activeProvider !== null && !isAuthProvider(value.activeProvider)) {
180
- return false;
181
- }
182
- if (value.account !== null && !isAuthAccountMeta(value.account)) return false;
183
- return true;
184
- }
185
-
186
- // src/bridge-copilot-customizations.ts
187
- var PRIVATE_RESULT_KEYS = /* @__PURE__ */ new Set([
188
- "sourcePath",
189
- "configPath",
190
- "token",
191
- "secret",
192
- "approvalPayload"
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
- var SCOPES = /* @__PURE__ */ new Set(["workspace", "personal"]);
195
- var KINDS = /* @__PURE__ */ new Set(["agent", "skill", "prompt", "instruction", "mcp", "hook"]);
196
- var INTENTS = /* @__PURE__ */ new Set(["available", "selected", "moving", "removing"]);
197
- var HEALTH = /* @__PURE__ */ new Set([
198
- "healthy",
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
- var GATES = /* @__PURE__ */ new Set(["ready", "approval-required", "configuration-required"]);
206
- var STATUSES = /* @__PURE__ */ new Set(["healthy", "action-required", "blocked", "not-enabled"]);
207
- var SOURCE_TYPES = /* @__PURE__ */ new Set(["marketplace", "git", "local"]);
208
- var UPDATE_CAPABILITIES = /* @__PURE__ */ new Set(["pinned", "live", "none"]);
209
- function isRecord3(value) {
210
- return typeof value === "object" && value !== null && !Array.isArray(value);
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
- return typeof value === "string" && value.length > 0;
216
+ return typeof value === "string" && value.length > 0;
214
217
  }
215
218
  function isOptionalString(value) {
216
- return value === void 0 || typeof value === "string";
219
+ return value === void 0 || typeof value === "string";
217
220
  }
218
- function isStringArray2(value, allowEmpty = true) {
219
- return Array.isArray(value) && (allowEmpty || value.length > 0) && value.every((entry) => isString(entry));
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
- if (Array.isArray(value)) return value.some(hasPrivateResultKey);
223
- if (!isRecord3(value)) return false;
224
- return Object.entries(value).some(
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
- return typeof value === "string" && SCOPES.has(value);
230
+ return typeof value === "string" && SCOPES$1.has(value);
230
231
  }
231
232
  function hasOptionalWorkspaceDir(value) {
232
- return value.workspaceDir === void 0 || isString(value.workspaceDir);
233
+ return value.workspaceDir === void 0 || isString(value.workspaceDir);
233
234
  }
234
235
  function hasRequiredWorkspaceDirForWorkspaceScope(value) {
235
- return value.scope !== "workspace" || isString(value.workspaceDir);
236
+ return value.scope !== "workspace" || isString(value.workspaceDir);
236
237
  }
237
238
  function isArtifactState(value) {
238
- return isRecord3(value) && typeof value.intent === "string" && INTENTS.has(value.intent) && typeof value.health === "string" && HEALTH.has(value.health) && typeof value.gate === "string" && GATES.has(value.gate);
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
- return isRecord3(value) && isString(value.id) && isString(value.packageId) && typeof value.kind === "string" && KINDS.has(value.kind) && isString(value.displayName) && isOptionalString(value.description) && (value.installStrategy === "link" || value.installStrategy === "generated-config" || value.installStrategy === "approval-gated") && (value.risk === "none" || value.risk === "review-required");
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
- return isRecord3(value) && isString(value.packageId) && isScope(value.scope) && isStringArray2(value.selectedArtifactIds) && isOptionalString(value.pinnedVersion);
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
- return isRecord3(value) && isString(value.id) && isString(value.sourceId) && isString(value.displayName) && isOptionalString(value.description) && isOptionalString(value.version) && Array.isArray(value.artifacts) && value.artifacts.every(isArtifactSummary);
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
- return isRecord3(value) && isArtifactSummary(value.artifact) && isArtifactState(value.state);
251
+ return isRecord$12(value) && isArtifactSummary(value.artifact) && isArtifactState(value.state);
251
252
  }
252
253
  function isPackageView(value) {
253
- return isRecord3(value) && isDefinition(value.definition) && isInstallation(value.installation) && Array.isArray(value.artifacts) && value.artifacts.every(isArtifactView) && Number.isInteger(value.selectedArtifactCount) && value.selectedArtifactCount >= 0 && typeof value.status === "string" && STATUSES.has(value.status);
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
- return isRecord3(value) && isString(value.id) && (value.type === "marketplace" || value.type === "git" || value.type === "local") && isString(value.displayName) && (value.updateCapability === "pinned" || value.updateCapability === "live" || value.updateCapability === "none") && Array.isArray(value.packages) && value.packages.every(isPackageView);
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
- return isRecord3(value) && isString(value.id) && typeof value.type === "string" && SOURCE_TYPES.has(value.type) && isString(value.displayName) && typeof value.updateCapability === "string" && UPDATE_CAPABILITIES.has(value.updateCapability) && typeof value.available === "boolean" && Array.isArray(value.declaredIn) && value.declaredIn.every((entry) => entry === "workspace" || entry === "personal");
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
- return isRecord3(value) && isString(value.packageId) && isOptionalString(value.fromVersion) && isString(value.toVersion) && isStringArray2(value.addedArtifactIds) && isStringArray2(value.removedArtifactIds) && isStringArray2(value.changedArtifactIds) && isStringArray2(value.approvalInvalidatedArtifactIds);
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
- if (!isRecord3(value) || hasPrivateResultKey(value)) return false;
266
- const summary = value.summary;
267
- return isScope(value.scope) && isString(value.generatedAt) && Array.isArray(value.sources) && value.sources.every(isSourceView) && Array.isArray(value.packages) && value.packages.every(isPackageView) && Array.isArray(value.attention) && value.attention.every(isArtifactView) && isRecord3(summary) && Number.isInteger(summary.packageCount) && summary.packageCount >= 0 && Number.isInteger(summary.enabledArtifactCount) && summary.enabledArtifactCount >= 0 && Number.isInteger(summary.attentionCount) && summary.attentionCount >= 0 && (value.legacyMigration === void 0 || isRecord3(value.legacyMigration) && Number.isInteger(value.legacyMigration.count) && value.legacyMigration.count >= 0 && value.legacyMigration.sourceLabel === "~/.agents");
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
- return isRecord3(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value);
271
+ return isRecord$12(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value);
271
272
  }
272
273
  function isAvailablePackage(value) {
273
- return isRecord3(value) && isString(value.packageId) && isString(value.sourceId) && isString(value.displayName) && isOptionalString(value.description) && isOptionalString(value.version) && Array.isArray(value.artifacts) && value.artifacts.every(isArtifactSummary) && Array.isArray(value.installedScopes) && value.installedScopes.every(isScope);
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
- if (!isRecord3(value) || hasPrivateResultKey(value) || !isCopilotCustomizationViewPayload(value.view)) {
277
- return false;
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
- return isRecord3(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && hasRequiredWorkspaceDirForWorkspaceScope(value) && isString(value.sourceId) && isString(value.packageId) && isStringArray2(value.artifactIds, false) && isOptionalString(value.pinnedVersion) && (value.localMode === void 0 || value.localMode === "live" || value.localMode === "private-workspace-override");
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
- return isRecord3(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && hasRequiredWorkspaceDirForWorkspaceScope(value) && isString(value.packageId) && isStringArray2(value.artifactIds, false) && isOptionalString(value.pinnedVersion);
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
- return isRecord3(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && hasRequiredWorkspaceDirForWorkspaceScope(value) && isString(value.packageId);
287
+ return isRecord$12(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && hasRequiredWorkspaceDirForWorkspaceScope(value) && isString(value.packageId);
289
288
  }
290
289
  function isCopilotPackageMoveParams(value) {
291
- return isRecord3(value) && hasOptionalWorkspaceDir(value) && isString(value.packageId) && isScope(value.from) && isScope(value.to) && value.from !== value.to && isString(value.workspaceDir);
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
- return isRecord3(value) && hasOptionalWorkspaceDir(value);
293
+ return isRecord$12(value) && hasOptionalWorkspaceDir(value);
295
294
  }
296
295
  function isCopilotLegacyMigrateParams(value) {
297
- return isRecord3(value) && hasOptionalWorkspaceDir(value) && isStringArray2(value.artifactIds, false);
296
+ return isRecord$12(value) && hasOptionalWorkspaceDir(value) && isStringArray$1(value.artifactIds, false);
298
297
  }
299
298
  function isCopilotSourceListParams(value) {
300
- return isRecord3(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value);
299
+ return isRecord$12(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value);
301
300
  }
302
301
  function isCopilotSourceListResult(value) {
303
- return isRecord3(value) && !hasPrivateResultKey(value) && Array.isArray(value.sources) && value.sources.every(isSourceRecord);
302
+ return isRecord$12(value) && !hasPrivateResultKey(value) && Array.isArray(value.sources) && value.sources.every(isSourceRecord);
304
303
  }
305
304
  function isCopilotSourceRemoveParams(value) {
306
- return isRecord3(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && isString(value.sourceId);
305
+ return isRecord$12(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && isString(value.sourceId);
307
306
  }
308
307
  function isCopilotSourceRemoveResult(value) {
309
- return isRecord3(value) && !hasPrivateResultKey(value) && value.removed === true;
308
+ return isRecord$12(value) && !hasPrivateResultKey(value) && value.removed === true;
310
309
  }
311
310
  function isCopilotUpdatePreviewParams(value) {
312
- return isRecord3(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && isString(value.packageId) && isString(value.revision);
311
+ return isRecord$12(value) && isScope(value.scope) && hasOptionalWorkspaceDir(value) && isString(value.packageId) && isString(value.revision);
313
312
  }
314
313
  function isCopilotUpdatePreviewResult(value) {
315
- return isRecord3(value) && !hasPrivateResultKey(value) && isUpdatePreview(value.preview);
314
+ return isRecord$12(value) && !hasPrivateResultKey(value) && isUpdatePreview(value.preview);
316
315
  }
317
316
  function isCopilotLegacyPreviewResult(value) {
318
- return isRecord3(value) && !hasPrivateResultKey(value) && value.sourceLabel === "~/.agents" && Number.isInteger(value.count) && value.count >= 0 && Array.isArray(value.artifacts) && value.artifacts.every(isArtifactSummary);
319
- }
320
- var isCopilotPackageInstallResult = isCopilotCustomizationsListResult;
321
- var isCopilotPackageUpdateResult = isCopilotCustomizationsListResult;
322
- var isCopilotPackageUninstallResult = isCopilotCustomizationsListResult;
323
- var isCopilotPackageMoveResult = isCopilotCustomizationsListResult;
324
- var isCopilotLegacyMigrateResult = isCopilotCustomizationsListResult;
325
-
326
- // src/json.ts
327
- var JSON_SORT_ALGORITHMS = [
328
- "default",
329
- "keyLength",
330
- "alphaNum",
331
- "values",
332
- "type"
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
- var JSON_SORT_ORDERS = ["asc", "desc"];
335
- var DEFAULT_JSON_SORT_OPTIONS = {
336
- sortOrder: "asc",
337
- sortAlgo: "default"
333
+ const JSON_SORT_ORDERS = ["asc", "desc"];
334
+ const DEFAULT_JSON_SORT_OPTIONS = {
335
+ sortOrder: "asc",
336
+ sortAlgo: "default"
338
337
  };
339
- function isRecord4(value) {
340
- return typeof value === "object" && value !== null;
338
+ function isRecord(value) {
339
+ return typeof value === "object" && value !== null;
341
340
  }
342
341
  function isJsonSortAlgorithm(value) {
343
- return typeof value === "string" && JSON_SORT_ALGORITHMS.includes(value);
342
+ return typeof value === "string" && JSON_SORT_ALGORITHMS.includes(value);
344
343
  }
345
344
  function isJsonSortOrder(value) {
346
- return typeof value === "string" && JSON_SORT_ORDERS.includes(value);
345
+ return typeof value === "string" && JSON_SORT_ORDERS.includes(value);
347
346
  }
348
347
  function isJsonSortOptions(value) {
349
- return isRecord4(value) && isJsonSortOrder(value.sortOrder) && isJsonSortAlgorithm(value.sortAlgo);
348
+ return isRecord(value) && isJsonSortOrder(value.sortOrder) && isJsonSortAlgorithm(value.sortAlgo);
350
349
  }
351
350
  function isJsonValidationResult(value) {
352
- return isRecord4(value) && typeof value.valid === "boolean" && (value.error === void 0 || typeof value.error === "string");
351
+ return isRecord(value) && typeof value.valid === "boolean" && (value.error === void 0 || typeof value.error === "string");
353
352
  }
354
353
  function isJsonOutputResult(value) {
355
- return isRecord4(value) && typeof value.output === "string";
354
+ return isRecord(value) && typeof value.output === "string";
356
355
  }
357
-
358
- // src/bridge-copilot-plugins.ts
359
- var SCOPES2 = /* @__PURE__ */ new Set(["workspace", "personal"]);
356
+ //#endregion
357
+ //#region src/bridge-copilot-plugins.ts
358
+ const SCOPES = /* @__PURE__ */ new Set(["workspace", "personal"]);
360
359
  function isOptionalScope(value) {
361
- return value === void 0 || typeof value === "string" && SCOPES2.has(value);
360
+ return value === void 0 || typeof value === "string" && SCOPES.has(value);
362
361
  }
363
362
  function isScopeArray(value) {
364
- return Array.isArray(value) && value.every((s) => typeof s === "string" && SCOPES2.has(s));
363
+ return Array.isArray(value) && value.every((s) => typeof s === "string" && SCOPES.has(s));
365
364
  }
366
365
  function isRegistration(value) {
367
- return isRecord4(value) && typeof value.registrationId === "string" && typeof value.repoId === "string" && typeof value.pluginId === "string" && (value.displayName === void 0 || typeof value.displayName === "string") && (value.version === void 0 || typeof value.version === "string") && isScopeArray(value.scopes) && (value.enabled === void 0 || typeof value.enabled === "boolean") && Array.isArray(value.mcpServers) && value.mcpServers.every((s) => typeof s === "string") && typeof value.hasExtensions === "boolean";
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
- return isRecord4(value);
369
+ return isRecord(value);
371
370
  }
372
371
  function isCopilotPluginListResult(value) {
373
- return isRecord4(value) && Array.isArray(value.plugins) && value.plugins.every(isRegistration);
372
+ return isRecord(value) && Array.isArray(value.plugins) && value.plugins.every(isRegistration);
374
373
  }
375
374
  function isCopilotPluginRegisterParams(value) {
376
- return isRecord4(value) && isOptionalScope(value.scope) && (value.workspaceDir === void 0 || typeof value.workspaceDir === "string") && typeof value.repoId === "string" && typeof value.pluginId === "string";
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
- var isCopilotPluginRegisterResult = isCopilotPluginListResult;
377
+ const isCopilotPluginRegisterResult = isCopilotPluginListResult;
379
378
  function isCopilotPluginUnregisterParams(value) {
380
- return isRecord4(value) && isOptionalScope(value.scope) && (value.workspaceDir === void 0 || typeof value.workspaceDir === "string") && typeof value.registrationId === "string";
379
+ return isRecord(value) && isOptionalScope(value.scope) && (value.workspaceDir === void 0 || typeof value.workspaceDir === "string") && typeof value.registrationId === "string";
381
380
  }
382
- var isCopilotPluginUnregisterResult = isCopilotPluginListResult;
383
-
384
- // src/bridge-skill-repo.ts
385
- function isRecord5(value) {
386
- return typeof value === "object" && value !== null;
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 isStringOrUndefined2(value) {
389
- return value === void 0 || typeof value === "string";
387
+ function isStringOrUndefined$2(value) {
388
+ return value === void 0 || typeof value === "string";
390
389
  }
391
390
  function isBooleanOrUndefined(value) {
392
- return value === void 0 || typeof value === "boolean";
391
+ return value === void 0 || typeof value === "boolean";
393
392
  }
394
393
  function isSkillKindOrUndefined(value) {
395
- return value === void 0 || value === "skill" || value === "agent";
394
+ return value === void 0 || value === "skill" || value === "agent";
396
395
  }
397
396
  function isLinkScope(value) {
398
- return value === "workspace" || value === "user";
397
+ return value === "workspace" || value === "user";
399
398
  }
400
399
  function isLinkScopeOrUndefined(value) {
401
- return value === void 0 || isLinkScope(value);
400
+ return value === void 0 || isLinkScope(value);
402
401
  }
403
402
  function isLinkScopeFilterOrUndefined(value) {
404
- return value === void 0 || value === "workspace" || value === "user" || value === "all";
403
+ return value === void 0 || value === "workspace" || value === "user" || value === "all";
405
404
  }
406
405
  function isLinkModeOrUndefined(value) {
407
- return value === void 0 || value === "auto" || value === "symlink" || value === "junction" || value === "copy";
406
+ return value === void 0 || value === "auto" || value === "symlink" || value === "junction" || value === "copy";
408
407
  }
409
408
  function isLinkMode(value) {
410
- return value === "symlink" || value === "junction" || value === "copy";
409
+ return value === "symlink" || value === "junction" || value === "copy";
411
410
  }
412
411
  function isRepoEntry(value) {
413
- if (!isRecord5(value)) return false;
414
- if (typeof value.id !== "string") return false;
415
- if (typeof value.name !== "string") return false;
416
- if (typeof value.url !== "string") return false;
417
- if (typeof value.branch !== "string") return false;
418
- if (typeof value.enabled !== "boolean") return false;
419
- if (value.useProxy !== void 0 && typeof value.useProxy !== "boolean") return false;
420
- if (typeof value.writeEnabled !== "boolean") return false;
421
- if (value.source !== "default" && value.source !== "user") return false;
422
- if (typeof value.addedAt !== "string") return false;
423
- if (value.description !== void 0 && typeof value.description !== "string") return false;
424
- if (value.lastSyncAt !== void 0 && typeof value.lastSyncAt !== "string") return false;
425
- if (value.lastSyncCommitSha !== void 0 && typeof value.lastSyncCommitSha !== "string") {
426
- return false;
427
- }
428
- if (value.lastSyncStatus !== void 0 && value.lastSyncStatus !== "ok" && value.lastSyncStatus !== "error") {
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
- if (!isRecord5(value)) return false;
438
- if (typeof value.repoId !== "string") return false;
439
- if (typeof value.name !== "string") return false;
440
- if (value.kind !== "skill" && value.kind !== "agent") return false;
441
- if (typeof value.manifestPath !== "string") return false;
442
- if (typeof value.dir !== "string") return false;
443
- if (typeof value.frontmatter !== "object" || value.frontmatter === null) {
444
- return false;
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
- return isRecord5(value) && typeof value.path === "string" && typeof value.content === "string";
441
+ return isRecord$11(value) && typeof value.path === "string" && typeof value.content === "string";
451
442
  }
452
443
  function isLinkedSkill(value) {
453
- return isRecord5(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.linkPath === "string" && typeof value.targetPath === "string" && isLinkMode(value.mode) && isLinkScope(value.scope);
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
- return isRecord5(value) && typeof value.repoId === "string" && (value.status === "ok" || value.status === "error");
447
+ return isRecord$11(value) && typeof value.repoId === "string" && (value.status === "ok" || value.status === "error");
457
448
  }
458
449
  function isCopilotContentStatus(value) {
459
- return value === "restored" || value === "adopted" || value === "pending_approval" || value === "missing_source" || value === "conflict" || value === "drifted";
450
+ return value === "restored" || value === "adopted" || value === "pending_approval" || value === "missing_source" || value === "conflict" || value === "drifted";
460
451
  }
461
452
  function isCopilotContentEntry(value) {
462
- if (!isRecord5(value)) return false;
463
- if (typeof value.identity !== "string") return false;
464
- if (!isCopilotContentStatus(value.status)) return false;
465
- if (value.message !== void 0 && typeof value.message !== "string") return false;
466
- return true;
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
- return value === "mcp" || value === "hook";
460
+ return value === "mcp" || value === "hook";
470
461
  }
471
462
  function isCopilotContentIntegrationStatus(value) {
472
- return value === "active" || value === "inactive" || value === "pending_approval" || value === "missing_local_configuration";
463
+ return value === "active" || value === "inactive" || value === "pending_approval" || value === "missing_local_configuration";
473
464
  }
474
465
  function isCopilotContentIntegration(value) {
475
- if (!isRecord5(value)) return false;
476
- if (typeof value.identity !== "string") return false;
477
- if (!isCopilotContentIntegrationKind(value.kind)) return false;
478
- if (typeof value.configPath !== "string") return false;
479
- if (!Array.isArray(value.names) || value.names.some((name) => typeof name !== "string")) {
480
- return false;
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
- return isRecord5(value) && Array.isArray(value.entries) && value.entries.every(isSkillEntry);
474
+ return isRecord$11(value) && Array.isArray(value.entries) && value.entries.every(isSkillEntry);
486
475
  }
487
476
  function isSkillRepoGetResult(value) {
488
- return isRecord5(value) && typeof value.repoId === "string" && typeof value.name === "string" && (value.kind === "skill" || value.kind === "agent") && typeof value.manifestPath === "string" && typeof value.dir === "string" && typeof value.frontmatter === "object" && value.frontmatter !== null && typeof value.modifiedAt === "string" && Array.isArray(value.files) && value.files.every(isSkillFile);
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
- return isRecord5(value) && isLinkMode(value.mode) && typeof value.linkPath === "string" && typeof value.targetPath === "string";
480
+ return isRecord$11(value) && isLinkMode(value.mode) && typeof value.linkPath === "string" && typeof value.targetPath === "string";
492
481
  }
493
482
  function isSkillRepoConvertToSymlinkResult(value) {
494
- return isRecord5(value) && isLinkMode(value.mode) && typeof value.linkPath === "string" && typeof value.targetPath === "string";
483
+ return isRecord$11(value) && isLinkMode(value.mode) && typeof value.linkPath === "string" && typeof value.targetPath === "string";
495
484
  }
496
485
  function isSkillRepoUninstallResult(value) {
497
- return isRecord5(value) && value.removed === true;
486
+ return isRecord$11(value) && value.removed === true;
498
487
  }
499
488
  function isSkillRepoSetEntryEnabledResult(value) {
500
- return isRecord5(value) && typeof value.enabled === "boolean";
489
+ return isRecord$11(value) && typeof value.enabled === "boolean";
501
490
  }
502
491
  function isSkillKind(value) {
503
- return value === "skill" || value === "agent";
492
+ return value === "skill" || value === "agent";
504
493
  }
505
494
  function isCopilotContentDetectUnmanagedParams(value) {
506
- return isRecord5(value) && typeof value.workspaceDir === "string";
495
+ return isRecord$11(value) && typeof value.workspaceDir === "string";
507
496
  }
508
497
  function isCopilotContentDetectUnmanagedResult(value) {
509
- if (!isRecord5(value)) return false;
510
- if (!Array.isArray(value.adoptions) || !Array.isArray(value.ambiguous)) return false;
511
- if (!Array.isArray(value.integrations) || !Array.isArray(value.unmatched)) return false;
512
- return value.adoptions.every(
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
- if (!isRecord5(value) || typeof value.workspaceDir !== "string") return false;
524
- if (!Array.isArray(value.entries)) return false;
525
- if (!value.entries.every(
526
- (e) => isRecord5(e) && typeof e.repoId === "string" && typeof e.name === "string" && isSkillKind(e.kind) && (e.convertRealCopy === void 0 || typeof e.convertRealCopy === "boolean")
527
- )) {
528
- return false;
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
- if (!isRecord5(value) || typeof value.changed !== "boolean") return false;
540
- if (!Array.isArray(value.entries)) return false;
541
- return value.entries.every(
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
- return isRecord5(value) && Array.isArray(value.links) && value.links.every(isLinkedSkill);
517
+ return isRecord$11(value) && Array.isArray(value.links) && value.links.every(isLinkedSkill);
547
518
  }
548
519
  function isSkillRepoDraftCreateResult(value) {
549
- return isRecord5(value) && typeof value.id === "string";
520
+ return isRecord$11(value) && typeof value.id === "string";
550
521
  }
551
522
  function isSkillRepoDraftCommitResult(value) {
552
- return isRecord5(value) && typeof value.repoId === "string" && typeof value.skillName === "string" && typeof value.commitSha === "string" && isStringOrUndefined2(value.pushedRef) && isStringOrUndefined2(value.pushedSha);
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
- return isRecord5(value) && Array.isArray(value.drafts) && value.drafts.every(
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
- return isRecord5(value) && value.deleted === true;
529
+ return isRecord$11(value) && value.deleted === true;
561
530
  }
562
531
  function isRepoListResult(value) {
563
- return isRecord5(value) && Array.isArray(value.repos) && value.repos.every(isRepoEntry);
532
+ return isRecord$11(value) && Array.isArray(value.repos) && value.repos.every(isRepoEntry);
564
533
  }
565
534
  function isRepoAddResult(value) {
566
- return isRecord5(value) && isRepoEntry(value.repo) && typeof value.branch === "string" && typeof value.cloned === "boolean";
535
+ return isRecord$11(value) && isRepoEntry(value.repo) && typeof value.branch === "string" && typeof value.cloned === "boolean";
567
536
  }
568
537
  function isRepoRemoveResult(value) {
569
- return isRecord5(value) && value.removed === true;
538
+ return isRecord$11(value) && value.removed === true;
570
539
  }
571
540
  function isRepoEnableResult(value) {
572
- return isRecord5(value) && isRepoEntry(value.repo);
541
+ return isRecord$11(value) && isRepoEntry(value.repo);
573
542
  }
574
543
  function isRepoDisableResult(value) {
575
- return isRecord5(value) && isRepoEntry(value.repo);
544
+ return isRecord$11(value) && isRepoEntry(value.repo);
576
545
  }
577
546
  function isRepoUpdateResult(value) {
578
- return isRecord5(value) && isRepoEntry(value.repo);
547
+ return isRecord$11(value) && isRepoEntry(value.repo);
579
548
  }
580
549
  function isRepoSyncResult(value) {
581
- return isRecord5(value) && Array.isArray(value.pulls) && value.pulls.length >= 1 && value.pulls.every(isSyncPull);
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
- return isRecord5(value) && Array.isArray(value.pulls) && value.pulls.every(isSyncPull);
553
+ return isRecord$11(value) && Array.isArray(value.pulls) && value.pulls.every(isSyncPull);
585
554
  }
586
555
  function isCopilotContentRestoreResult(value) {
587
- return isRecord5(value) && typeof value.changed === "boolean" && Array.isArray(value.entries) && value.entries.every(isCopilotContentEntry);
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
- return isCopilotContentRestoreResult(value);
559
+ return isCopilotContentRestoreResult(value);
591
560
  }
592
561
  function isCopilotContentApproveResult(value) {
593
- return isCopilotContentRestoreResult(value);
562
+ return isCopilotContentRestoreResult(value);
594
563
  }
595
564
  function isCopilotContentMigrateLegacyResult(value) {
596
- return isRecord5(value) && Array.isArray(value.entries) && value.entries.every(isCopilotContentEntry);
565
+ return isRecord$11(value) && Array.isArray(value.entries) && value.entries.every(isCopilotContentEntry);
597
566
  }
598
567
  function isCopilotContentIntegrationStatusResult(value) {
599
- return isRecord5(value) && Array.isArray(value.integrations) && value.integrations.every(isCopilotContentIntegration);
568
+ return isRecord$11(value) && Array.isArray(value.integrations) && value.integrations.every(isCopilotContentIntegration);
600
569
  }
601
570
  function isSkillRepoListParams(value) {
602
- return isRecord5(value) && isStringOrUndefined2(value.repoId) && isSkillKindOrUndefined(value.kind) && isStringOrUndefined2(value.workspaceDir);
571
+ return isRecord$11(value) && isStringOrUndefined$2(value.repoId) && isSkillKindOrUndefined(value.kind) && isStringOrUndefined$2(value.workspaceDir);
603
572
  }
604
573
  function isSkillRepoGetParams(value) {
605
- return isRecord5(value) && typeof value.repoId === "string" && typeof value.name === "string";
574
+ return isRecord$11(value) && typeof value.repoId === "string" && typeof value.name === "string";
606
575
  }
607
576
  function isSkillRepoInstallParams(value) {
608
- return isRecord5(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkModeOrUndefined(value.mode) && isLinkScopeOrUndefined(value.scope);
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
- return isRecord5(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkModeOrUndefined(value.mode) && isLinkScopeOrUndefined(value.scope);
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
- return isRecord5(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkScopeOrUndefined(value.scope);
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
- return isRecord5(value) && typeof value.repoId === "string" && typeof value.name === "string" && typeof value.enabled === "boolean" && isSkillKindOrUndefined(value.kind) && isLinkScopeOrUndefined(value.scope) && (value.workspaceDir === void 0 || typeof value.workspaceDir === "string");
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
- return isRecord5(value) && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkScopeFilterOrUndefined(value.scope);
589
+ return isRecord$11(value) && typeof value.workspaceDir === "string" && isSkillKindOrUndefined(value.kind) && isLinkScopeFilterOrUndefined(value.scope);
621
590
  }
622
591
  function isRepoListParams(value) {
623
- return isRecord5(value) && (value.source === void 0 || value.source === "default" || value.source === "user");
592
+ return isRecord$11(value) && (value.source === void 0 || value.source === "default" || value.source === "user");
624
593
  }
625
594
  function isRepoAddParams(value) {
626
- return isRecord5(value) && typeof value.url === "string" && isStringOrUndefined2(value.branch) && isStringOrUndefined2(value.name) && isBooleanOrUndefined(value.useProxy);
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
- return isRecord5(value) && typeof value.repoId === "string";
598
+ return isRecord$11(value) && typeof value.repoId === "string";
630
599
  }
631
600
  function isRepoEnableParams(value) {
632
- return isRecord5(value) && typeof value.repoId === "string";
601
+ return isRecord$11(value) && typeof value.repoId === "string";
633
602
  }
634
603
  function isRepoDisableParams(value) {
635
- return isRecord5(value) && typeof value.repoId === "string";
604
+ return isRecord$11(value) && typeof value.repoId === "string";
636
605
  }
637
606
  function isRepoSyncParams(value) {
638
- return isRecord5(value) && typeof value.repoId === "string";
607
+ return isRecord$11(value) && typeof value.repoId === "string";
639
608
  }
640
609
  function isRepoSyncAllParams(value) {
641
- return isRecord5(value);
642
- }
643
-
644
- // src/device.ts
645
- var DEVICE_BINDING_STATES = [
646
- "anonymous",
647
- "pending",
648
- "claimed",
649
- "expired"
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 isRecord6(value) {
652
- return typeof value === "object" && value !== null;
620
+ function isRecord$10(value) {
621
+ return typeof value === "object" && value !== null;
653
622
  }
654
- function isStringOrUndefined3(value) {
655
- return value === void 0 || typeof value === "string";
623
+ function isStringOrUndefined$1(value) {
624
+ return value === void 0 || typeof value === "string";
656
625
  }
657
626
  function isDeviceBindingState(value) {
658
- return value === "anonymous" || value === "pending" || value === "claimed" || value === "expired";
627
+ return value === "anonymous" || value === "pending" || value === "claimed" || value === "expired";
659
628
  }
660
629
  function isDeviceIdentityState(value) {
661
- if (!isRecord6(value)) return false;
662
- if (typeof value.publicId !== "string") return false;
663
- if (value.publicId.length === 0) return false;
664
- if (typeof value.secretVersion !== "number") return false;
665
- if (!Number.isInteger(value.secretVersion)) return false;
666
- if (value.secretVersion < 0) return false;
667
- if (!isDeviceBindingState(value.bindingState)) return false;
668
- return true;
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
- if (!isRecord6(value)) return false;
672
- if (typeof value.installationId !== "string") return false;
673
- if (value.installationId.length === 0) return false;
674
- if (typeof value.machineId !== "string") return false;
675
- if (value.machineId.length === 0) return false;
676
- if (typeof value.platform !== "string") return false;
677
- if (value.platform.length === 0) return false;
678
- if (!isStringOrUndefined3(value.hostname)) return false;
679
- if (!isStringOrUndefined3(value.vscodeVersion)) return false;
680
- if (!isStringOrUndefined3(value.extensionVersion)) return false;
681
- return true;
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
- if (!isRecord6(value)) return false;
685
- if (!isDeviceBindingState(value.bindingState)) return false;
686
- if (value.identity !== void 0 && !isDeviceIdentityState(value.identity)) {
687
- return false;
688
- }
689
- if (value.metadata !== void 0 && !isDeviceMetadata(value.metadata)) {
690
- return false;
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
- return isRecord6(value) && (value.force === void 0 || typeof value.force === "boolean") && (value.requireAuth === void 0 || typeof value.requireAuth === "boolean");
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
- if (!isRecord6(value)) return false;
701
- if (typeof value.publicId !== "string") return false;
702
- if (value.publicId.length === 0) return false;
703
- if (!isDeviceBindingState(value.bindingState)) return false;
704
- if (!isStringOrUndefined3(value.expiresAt)) return false;
705
- return true;
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
- if (!isRecord6(value)) return false;
709
- if (value.gracePeriodDays !== void 0 && (typeof value.gracePeriodDays !== "number" || !Number.isInteger(value.gracePeriodDays) || value.gracePeriodDays < 0 || value.gracePeriodDays > 365)) {
710
- return false;
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
- if (!isRecord6(value)) return false;
716
- if (typeof value.publicId !== "string") return false;
717
- if (value.publicId.length === 0) return false;
718
- if (typeof value.secretVersion !== "number") return false;
719
- if (!Number.isInteger(value.secretVersion)) return false;
720
- if (value.secretVersion < 0) return false;
721
- if (typeof value.gracePeriodDays !== "number") return false;
722
- if (!Number.isInteger(value.gracePeriodDays)) return false;
723
- if (value.gracePeriodDays < 0) return false;
724
- if (!isStringOrUndefined3(value.gracePeriodEndsAt)) return false;
725
- return true;
726
- }
727
-
728
- // src/scheduled-tasks.ts
729
- var VALID_TASK_TYPES = [
730
- "command",
731
- "shell",
732
- "http_request",
733
- "github_copilot_cli"
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
- var VALID_SCHEDULE_TYPES = ["cron", "interval"];
736
- var VALID_TERMINAL_STATUSES = [
737
- "success",
738
- "failure",
739
- "timeout",
740
- "cancelled"
698
+ const VALID_SCHEDULE_TYPES = ["cron", "interval"];
699
+ const VALID_TERMINAL_STATUSES = [
700
+ "success",
701
+ "failure",
702
+ "timeout",
703
+ "cancelled"
741
704
  ];
742
- function isRecord7(value) {
743
- return typeof value === "object" && value !== null;
705
+ function isRecord$9(value) {
706
+ return typeof value === "object" && value !== null;
744
707
  }
745
708
  function isScheduledTaskType(value) {
746
- return typeof value === "string" && VALID_TASK_TYPES.includes(value);
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
- if (!isRecord7(value)) return false;
750
- return typeof value.id === "string" && typeof value.name === "string" && typeof value.enabled === "boolean" && VALID_SCHEDULE_TYPES.includes(value.scheduleType) && typeof value.schedule === "string" && isScheduledTaskType(value.taskType) && isRecord7(value.payload) && typeof value.createdAt === "string" && typeof value.updatedAt === "string";
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
- if (!isRecord7(value)) return false;
754
- if (typeof value.path !== "string" || value.path.length === 0) return false;
755
- if (typeof value.name !== "string" || value.name.length === 0) return false;
756
- if (value.gitRemote !== void 0 && typeof value.gitRemote !== "string") {
757
- return false;
758
- }
759
- if (value.gitBranch !== void 0 && typeof value.gitBranch !== "string") {
760
- return false;
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
- if (!isScheduledTaskV1(value)) return false;
769
- return isTaskWorkspaceRef(value.workspace);
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
- if (!isRecord7(value)) return false;
773
- if (value.version !== 2) return false;
774
- if (!Array.isArray(value.tasks)) return false;
775
- return value.tasks.every((t) => isScheduledTask(t));
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
- if (!isRecord7(value)) return false;
779
- if (value.version !== 1) return false;
780
- if (!Array.isArray(value.tasks)) return false;
781
- return value.tasks.every((t) => isScheduledTaskV1(t));
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
- if (!isRecord7(value)) return false;
785
- 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);
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
- if (!isRecord7(value)) return false;
789
- return typeof value.running === "boolean" && typeof value.tasksRegistered === "number" && typeof value.workspacePath === "string";
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
- return isRecord7(value) && typeof value.executionId === "string" && value.accepted === true;
758
+ return isRecord$9(value) && typeof value.executionId === "string" && value.accepted === true;
793
759
  }
794
760
  function isTaskCancelResult(value) {
795
- return isRecord7(value) && typeof value.executionId === "string" && typeof value.cancelled === "boolean";
761
+ return isRecord$9(value) && typeof value.executionId === "string" && typeof value.cancelled === "boolean";
796
762
  }
797
763
  function isTaskListRunningResult(value) {
798
- return isRecord7(value) && Array.isArray(value.executions);
764
+ return isRecord$9(value) && Array.isArray(value.executions);
799
765
  }
800
766
  function isTaskStartedEventParams(value) {
801
- return isRecord7(value) && typeof value.executionId === "string" && typeof value.taskId === "string" && typeof value.startedAt === "string";
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
- return isRecord7(value) && typeof value.executionId === "string" && (value.stream === "stdout" || value.stream === "stderr") && typeof value.data === "string";
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
- return isRecord7(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
773
+ return isRecord$9(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
808
774
  }
809
775
  function isTaskFailedEventParams(value) {
810
- return isRecord7(value) && typeof value.executionId === "string" && (value.status === "failure" || value.status === "timeout") && (value.reason === "error" || value.reason === "timeout") && isTaskExecutionLog(value.log);
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
- return isRecord7(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
779
+ return isRecord$9(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
814
780
  }
815
781
  function isAgentSessionStatus(value) {
816
- return value === "idle" || value === "running" || value === "needs-input" || value === "completed" || value === "failed" || value === "aborted";
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
- const issues = [];
820
- if (!isScheduledTaskType(v1.taskType)) {
821
- issues.push(`unknown taskType: ${String(v1.taskType)}`);
822
- }
823
- const task = {
824
- ...v1,
825
- workspace
826
- };
827
- return { task, issues };
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
- if (!isTaskWorkspaceRef(workspace)) {
831
- const w = workspace;
832
- throw new Error(
833
- `migrateV1ToV2: invalid workspace ref (path=${String(w.path)}, name=${String(w.name)})`
834
- );
835
- }
836
- const allIssues = [];
837
- const tasks = v1Config.tasks.map((t) => {
838
- const { task, issues } = migrateTaskV1ToV2(t, workspace);
839
- allIssues.push(...issues);
840
- return task;
841
- });
842
- return { config: { version: 2, tasks }, issues: allIssues };
843
- }
844
-
845
- // src/toolbox.ts
846
- var TOOLBOX_SCOPES = ["user", "workspace"];
847
- function isRecord8(value) {
848
- return typeof value === "object" && value !== null;
849
- }
850
- function isStringOrUndefined4(value) {
851
- return value === void 0 || typeof value === "string";
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
- return value === void 0 || typeof value === "number" && Number.isFinite(value);
841
+ return value === void 0 || typeof value === "number" && Number.isFinite(value);
855
842
  }
856
843
  function isToolboxScope(value) {
857
- return value === "user" || value === "workspace";
844
+ return value === "user" || value === "workspace";
858
845
  }
859
846
  function isExternalTool(value) {
860
- if (!isRecord8(value)) return false;
861
- if (typeof value.id !== "string") return false;
862
- if (value.id.length === 0) return false;
863
- if (typeof value.name !== "string") return false;
864
- if (value.name.length === 0) return false;
865
- if (typeof value.description !== "string") return false;
866
- if (typeof value.icon !== "string") return false;
867
- if (typeof value.url !== "string") return false;
868
- if (value.url.length === 0) return false;
869
- if (value.isDefault !== void 0 && typeof value.isDefault !== "boolean") {
870
- return false;
871
- }
872
- if (!isFiniteNumberOrUndefined(value.order)) return false;
873
- if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
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
- if (!isRecord8(value)) return false;
879
- if (value.name !== void 0) {
880
- if (typeof value.name !== "string" || value.name.length === 0) return false;
881
- }
882
- if (value.description !== void 0 && typeof value.description !== "string") {
883
- return false;
884
- }
885
- if (value.icon !== void 0 && typeof value.icon !== "string") return false;
886
- if (value.url !== void 0) {
887
- if (typeof value.url !== "string" || value.url.length === 0) return false;
888
- }
889
- if (value.isDefault !== void 0 && typeof value.isDefault !== "boolean") {
890
- return false;
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
- if (!isRecord8(value)) return false;
899
- if (!isToolboxScope(value.scope)) return false;
900
- if (!Array.isArray(value.tools)) return false;
901
- for (const tool of value.tools) {
902
- if (!isExternalTool(tool)) return false;
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
- return isRecord8(value) && (value.scope === void 0 || isToolboxScope(value.scope));
886
+ return isRecord$8(value) && (value.scope === void 0 || isToolboxScope(value.scope));
908
887
  }
909
888
  function isToolboxAddParams(value) {
910
- return isExternalTool(value);
889
+ return isExternalTool(value);
911
890
  }
912
891
  function isToolboxAddResult(value) {
913
- if (!isRecord8(value)) return false;
914
- if (!isToolboxScope(value.scope)) return false;
915
- if (!isExternalTool(value.tool)) return false;
916
- return true;
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
- if (!isRecord8(value)) return false;
920
- if (typeof value.id !== "string") return false;
921
- if (value.id.length === 0) return false;
922
- if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
923
- return true;
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
- if (!isRecord8(value)) return false;
927
- if (!isToolboxScope(value.scope)) return false;
928
- if (typeof value.toolId !== "string") return false;
929
- if (value.toolId.length === 0) return false;
930
- if (typeof value.success !== "boolean") return false;
931
- return true;
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
- if (!isRecord8(value)) return false;
935
- if (typeof value.id !== "string") return false;
936
- if (value.id.length === 0) return false;
937
- if (!isExternalToolPatch(value.patch)) return false;
938
- if (value.scope !== void 0 && !isToolboxScope(value.scope)) return false;
939
- return true;
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
- if (!isRecord8(value)) return false;
943
- if (!isToolboxScope(value.scope)) return false;
944
- if (!isExternalTool(value.tool)) return false;
945
- return true;
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
- // src/bridge.ts
949
- var SERVICEME_PROTOCOL_VERSION = 2;
950
- function isRecord9(value) {
951
- return typeof value === "object" && value !== null;
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
- return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= SERVICEME_PROTOCOL_VERSION;
933
+ return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= 2;
955
934
  }
956
935
  function isBridgeCapabilities(value) {
957
- return isRecord9(value) && value.bridge === true && value.json === 1 && value.env === 1 && (value.tasks === void 0 || value.tasks === 1) && (value.skillRepo === void 0 || value.skillRepo === 1) && (value.repoMgmt === void 0 || value.repoMgmt === 1) && (value.copilotContent === void 0 || value.copilotContent === 1) && (value.auth === void 0 || value.auth === 1) && (value.device === void 0 || value.device === 1) && (value.toolbox === void 0 || value.toolbox === 1) && (value["auth.tokenRead"] === void 0 || value["auth.tokenRead"] === 1);
958
- }
959
- var BRIDGE_METHODS = [
960
- "system.hello",
961
- "system.ping",
962
- "system.shutdown",
963
- "task.execute",
964
- "task.cancel",
965
- "task.list-running",
966
- "copilotContent.list",
967
- "copilotContent.get",
968
- "copilotContent.install",
969
- "copilotContent.convertToSymlink",
970
- "copilotContent.uninstall",
971
- "copilotContent.setEntryEnabled",
972
- "copilotContent.detectUnmanaged",
973
- "copilotContent.adoptUnmanaged",
974
- "copilotContent.listLinked",
975
- "copilotContent.draft.create",
976
- "copilotContent.draft.commit",
977
- "copilotContent.draft.list",
978
- "copilotContent.draft.delete",
979
- "skillRepo.list",
980
- "skillRepo.get",
981
- "skillRepo.install",
982
- "skillRepo.convertToSymlink",
983
- "skillRepo.uninstall",
984
- "skillRepo.setEntryEnabled",
985
- "skillRepo.listLinked",
986
- "skillRepo.draft.create",
987
- "skillRepo.draft.commit",
988
- "skillRepo.draft.list",
989
- "skillRepo.draft.delete",
990
- "repo.list",
991
- "repo.add",
992
- "repo.remove",
993
- "repo.enable",
994
- "repo.disable",
995
- "repo.update",
996
- "repo.sync",
997
- "repo.syncAll",
998
- "repo.resetParseCache",
999
- "copilotContent.status",
1000
- "copilotContent.restore",
1001
- "copilotContent.approve",
1002
- "copilotContent.migrateLegacy",
1003
- "copilotContent.integrationStatus",
1004
- "copilotContent.customizations.list",
1005
- "copilotContent.package.install",
1006
- "copilotContent.package.update",
1007
- "copilotContent.package.uninstall",
1008
- "copilotContent.package.move",
1009
- "copilotPlugin.list",
1010
- "copilotPlugin.register",
1011
- "copilotPlugin.unregister",
1012
- "copilotContent.legacy.preview",
1013
- "copilotContent.legacy.migrate",
1014
- "copilotContent.sources.list",
1015
- "copilotContent.sources.remove",
1016
- "copilotContent.package.previewUpdate",
1017
- "auth.status",
1018
- "auth.login",
1019
- "auth.logout",
1020
- "auth.whoami",
1021
- "auth.switch",
1022
- "device.status",
1023
- "device.enroll",
1024
- "device.rotate-secret",
1025
- "toolbox.list",
1026
- "toolbox.add",
1027
- "toolbox.remove",
1028
- "toolbox.update"
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
- var COPILOT_CONTENT_METHOD_ALIASES = {
1031
- "skillRepo.list": "copilotContent.list",
1032
- "skillRepo.get": "copilotContent.get",
1033
- "skillRepo.install": "copilotContent.install",
1034
- "skillRepo.convertToSymlink": "copilotContent.convertToSymlink",
1035
- "skillRepo.uninstall": "copilotContent.uninstall",
1036
- "skillRepo.setEntryEnabled": "copilotContent.setEntryEnabled",
1037
- "skillRepo.listLinked": "copilotContent.listLinked",
1038
- "skillRepo.draft.create": "copilotContent.draft.create",
1039
- "skillRepo.draft.commit": "copilotContent.draft.commit",
1040
- "skillRepo.draft.list": "copilotContent.draft.list",
1041
- "skillRepo.draft.delete": "copilotContent.draft.delete"
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
- return COPILOT_CONTENT_METHOD_ALIASES[method] ?? method;
1045
- }
1046
- var BRIDGE_EVENTS = [
1047
- "task.started",
1048
- "task.output",
1049
- "task.completed",
1050
- "task.failed",
1051
- "task.cancelled"
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
- return isRecord9(value) && typeof value.cliVersion === "string" && isValidProtocolVersion(value.protocolVersion) && isBridgeCapabilities(value.capabilities) && typeof value.pid === "number";
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
- return isRecord9(value) && typeof value.now === "string";
1047
+ return isRecord$7(value) && typeof value.now === "string";
1058
1048
  }
1059
1049
  function isSystemShutdownResult(value) {
1060
- return isRecord9(value) && value.shuttingDown === true;
1050
+ return isRecord$7(value) && value.shuttingDown === true;
1061
1051
  }
1062
1052
  function getBridgeResultValidator(method) {
1063
- switch (method) {
1064
- case "system.hello":
1065
- return isSystemHelloResult;
1066
- case "system.ping":
1067
- return isSystemPingResult;
1068
- case "system.shutdown":
1069
- return isSystemShutdownResult;
1070
- case "task.execute":
1071
- return isTaskExecuteResult;
1072
- case "task.cancel":
1073
- return isTaskCancelResult;
1074
- case "task.list-running":
1075
- return isTaskListRunningResult;
1076
- case "copilotContent.list":
1077
- case "skillRepo.list":
1078
- return isSkillRepoListResult;
1079
- case "copilotContent.get":
1080
- case "skillRepo.get":
1081
- return isSkillRepoGetResult;
1082
- case "copilotContent.install":
1083
- case "skillRepo.install":
1084
- return isSkillRepoInstallResult;
1085
- case "copilotContent.convertToSymlink":
1086
- case "skillRepo.convertToSymlink":
1087
- return isSkillRepoConvertToSymlinkResult;
1088
- case "copilotContent.uninstall":
1089
- case "skillRepo.uninstall":
1090
- return isSkillRepoUninstallResult;
1091
- case "copilotContent.setEntryEnabled":
1092
- case "skillRepo.setEntryEnabled":
1093
- return isSkillRepoSetEntryEnabledResult;
1094
- case "copilotContent.detectUnmanaged":
1095
- return isCopilotContentDetectUnmanagedResult;
1096
- case "copilotContent.adoptUnmanaged":
1097
- return isCopilotContentAdoptUnmanagedResult;
1098
- case "copilotContent.listLinked":
1099
- case "skillRepo.listLinked":
1100
- return isSkillRepoListLinkedResult;
1101
- case "copilotContent.draft.create":
1102
- case "skillRepo.draft.create":
1103
- return isSkillRepoDraftCreateResult;
1104
- case "copilotContent.draft.commit":
1105
- case "skillRepo.draft.commit":
1106
- return isSkillRepoDraftCommitResult;
1107
- case "copilotContent.draft.list":
1108
- case "skillRepo.draft.list":
1109
- return isSkillRepoDraftListResult;
1110
- case "copilotContent.draft.delete":
1111
- case "skillRepo.draft.delete":
1112
- return isSkillRepoDraftDeleteResult;
1113
- case "repo.list":
1114
- return isRepoListResult;
1115
- case "repo.add":
1116
- return isRepoAddResult;
1117
- case "repo.remove":
1118
- return isRepoRemoveResult;
1119
- case "repo.enable":
1120
- return isRepoEnableResult;
1121
- case "repo.disable":
1122
- return isRepoDisableResult;
1123
- case "repo.update":
1124
- return isRepoUpdateResult;
1125
- case "repo.sync":
1126
- return isRepoSyncResult;
1127
- case "repo.syncAll":
1128
- return isRepoSyncAllResult;
1129
- case "copilotContent.status":
1130
- return isCopilotContentStatusResult;
1131
- case "copilotContent.restore":
1132
- return isCopilotContentRestoreResult;
1133
- case "copilotContent.approve":
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
- switch (event) {
1195
- case "task.started":
1196
- return isTaskStartedEventParams;
1197
- case "task.output":
1198
- return isTaskOutputEventParams;
1199
- case "task.completed":
1200
- return isTaskCompletedEventParams;
1201
- case "task.failed":
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
- return typeof value === "string" && BRIDGE_METHODS.includes(value);
1136
+ return typeof value === "string" && BRIDGE_METHODS.includes(value);
1211
1137
  }
1212
1138
  function isBridgeEventName(value) {
1213
- return typeof value === "string" && BRIDGE_EVENTS.includes(value);
1139
+ return typeof value === "string" && BRIDGE_EVENTS.includes(value);
1214
1140
  }
1215
1141
  function isBridgeRequest(value) {
1216
- if (!isRecord9(value)) {
1217
- return false;
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
- if (!isRecord9(value)) {
1223
- return false;
1224
- }
1225
- if (!isValidProtocolVersion(value.protocolVersion) || value.kind !== "response" || typeof value.id !== "string" || typeof value.ok !== "boolean") {
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
- if (!isRecord9(value)) {
1235
- return false;
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
- // src/cli.ts
1241
- var SERVICEME_CLI_SCHEMA_VERSION = 1;
1242
- function isRecord10(value) {
1243
- return typeof value === "object" && value !== null;
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
- return {
1247
- schemaVersion: SERVICEME_CLI_SCHEMA_VERSION,
1248
- ok: true,
1249
- data
1250
- };
1162
+ return {
1163
+ schemaVersion: 1,
1164
+ ok: true,
1165
+ data
1166
+ };
1251
1167
  }
1252
1168
  function createCliFailure(error) {
1253
- return {
1254
- schemaVersion: SERVICEME_CLI_SCHEMA_VERSION,
1255
- ok: false,
1256
- error
1257
- };
1169
+ return {
1170
+ schemaVersion: 1,
1171
+ ok: false,
1172
+ error
1173
+ };
1258
1174
  }
1259
1175
  function isCliEnvelope(value) {
1260
- if (!isRecord10(value)) {
1261
- return false;
1262
- }
1263
- if (value.schemaVersion !== SERVICEME_CLI_SCHEMA_VERSION || typeof value.ok !== "boolean") {
1264
- return false;
1265
- }
1266
- if (value.ok) {
1267
- return "data" in value;
1268
- }
1269
- return "error" in value;
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
- // src/env.ts
1281
- var KNOWN_ENVIRONMENT_TOOLS = [
1282
- "git",
1283
- "node",
1284
- "npm",
1285
- "pnpm",
1286
- "nvm",
1287
- "nrm",
1288
- "rtk",
1289
- "codegraph",
1290
- "ocx",
1291
- "dotnet",
1292
- "nuget"
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 isRecord11(value) {
1295
- return typeof value === "object" && value !== null;
1204
+ function isRecord$5(value) {
1205
+ return typeof value === "object" && value !== null;
1296
1206
  }
1297
1207
  function isKnownEnvironmentTool(value) {
1298
- return KNOWN_ENVIRONMENT_TOOLS.includes(value);
1208
+ return KNOWN_ENVIRONMENT_TOOLS.includes(value);
1299
1209
  }
1300
1210
  function isToolCheckResult(value) {
1301
- if (!isRecord11(value)) {
1302
- return false;
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
- if (!isRecord11(value)) {
1308
- return false;
1309
- }
1310
- return KNOWN_ENVIRONMENT_TOOLS.every((tool) => isToolCheckResult(value[tool]));
1311
- }
1312
-
1313
- // src/errors.ts
1314
- var SERVICEME_ERROR_CODES = [
1315
- "protocol_mismatch",
1316
- "cli_not_found",
1317
- "cli_start_failed",
1318
- "command_timeout",
1319
- "request_cancelled",
1320
- "invalid_params",
1321
- "opencode_not_installed",
1322
- "opencode_startup_timeout",
1323
- "opencode_request_failed",
1324
- "opencode_backend_not_running",
1325
- "opencode_session_not_found",
1326
- "copilot_not_installed",
1327
- "copilot_auth_required",
1328
- "copilot_execution_failed",
1329
- "copilot_timeout",
1330
- "json_invalid_input",
1331
- "env_tool_not_found",
1332
- "task_not_found",
1333
- "task_already_exists",
1334
- "invalid_schedule",
1335
- "invalid_payload",
1336
- "confirmation_required",
1337
- "workspace_not_found",
1338
- "daemon_not_running",
1339
- "executor_timeout",
1340
- "executor_error",
1341
- "task_already_running",
1342
- "not_found",
1343
- "internal_error",
1344
- "auth_not_logged_in",
1345
- "auth_provider_not_registered",
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
- var RETRYABLE_ERROR_CODES = /* @__PURE__ */ new Set([
1350
- "command_timeout",
1351
- "request_cancelled",
1352
- "opencode_startup_timeout",
1353
- "opencode_request_failed",
1354
- "opencode_backend_not_running",
1355
- "copilot_timeout",
1356
- "executor_timeout",
1357
- "internal_error"
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 isRecord12(value) {
1360
- return typeof value === "object" && value !== null;
1265
+ function isRecord$4(value) {
1266
+ return typeof value === "object" && value !== null;
1361
1267
  }
1362
1268
  function isServicemeErrorCode(value) {
1363
- return typeof value === "string" && SERVICEME_ERROR_CODES.includes(value);
1269
+ return typeof value === "string" && SERVICEME_ERROR_CODES.includes(value);
1364
1270
  }
1365
1271
  function isServicemeErrorDetails(value) {
1366
- if (!isRecord12(value)) {
1367
- return false;
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
- return RETRYABLE_ERROR_CODES.has(code);
1276
+ return RETRYABLE_ERROR_CODES.has(code);
1373
1277
  }
1374
1278
  var ServicemeProtocolError = class extends Error {
1375
- constructor(input) {
1376
- super(input.message);
1377
- this.name = "ServicemeProtocolError";
1378
- this.code = input.code;
1379
- this.retryable = input.retryable ?? isRetryableErrorCode(input.code);
1380
- this.details = input.details;
1381
- Object.setPrototypeOf(this, new.target.prototype);
1382
- }
1383
- toJSON() {
1384
- return {
1385
- code: this.code,
1386
- message: this.message,
1387
- retryable: this.retryable,
1388
- details: this.details
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
- return new ServicemeProtocolError({
1394
- code,
1395
- message,
1396
- details
1397
- });
1297
+ return new ServicemeProtocolError({
1298
+ code,
1299
+ message,
1300
+ details
1301
+ });
1398
1302
  }
1399
1303
  function normalizeServicemeError(error, fallbackCode = "internal_error") {
1400
- if (error instanceof ServicemeProtocolError) {
1401
- return error.toJSON();
1402
- }
1403
- if (isServicemeErrorDetails(error)) {
1404
- return error;
1405
- }
1406
- if (isRecord12(error)) {
1407
- const code = isServicemeErrorCode(error.code) ? error.code : fallbackCode;
1408
- const message = typeof error.message === "string" ? error.message : "Unexpected serviceme error.";
1409
- const retryable = typeof error.retryable === "boolean" ? error.retryable : isRetryableErrorCode(code);
1410
- return {
1411
- code,
1412
- message,
1413
- retryable,
1414
- details: error.details
1415
- };
1416
- }
1417
- if (error instanceof Error) {
1418
- return {
1419
- code: fallbackCode,
1420
- message: error.message,
1421
- retryable: isRetryableErrorCode(fallbackCode)
1422
- };
1423
- }
1424
- return {
1425
- code: fallbackCode,
1426
- message: typeof error === "string" ? error : "Unexpected serviceme error.",
1427
- retryable: isRetryableErrorCode(fallbackCode)
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 isRecord13(value) {
1438
- return typeof value === "object" && value !== null;
1333
+ function isRecord$3(value) {
1334
+ return typeof value === "object" && value !== null;
1439
1335
  }
1440
1336
  function isServiceMeImageFormat(value) {
1441
- return typeof value === "string" && SERVICEME_IMAGE_FORMATS.includes(value);
1337
+ return typeof value === "string" && SERVICEME_IMAGE_FORMATS.includes(value);
1442
1338
  }
1443
1339
  function isServiceMeImageCompressOptions(value) {
1444
- if (!isRecord13(value)) {
1445
- return false;
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
- if (!isRecord13(value)) {
1451
- return false;
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
- if (!isRecord13(value)) {
1457
- return false;
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
- return isRecord13(value) && typeof value.valid === "boolean";
1463
- }
1464
-
1465
- // src/metadata.ts
1466
- var SERVICEME_CLI_NAME = "serviceme";
1467
- var SERVICEME_CLI_VERSION = "2.0.1";
1468
- var SERVICEME_CLI_CAPABILITIES = {
1469
- bridge: true,
1470
- tasks: 1,
1471
- json: 1,
1472
- env: 1,
1473
- image: 1,
1474
- project: 1
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
- // src/project.ts
1478
- function isRecord14(value) {
1479
- return typeof value === "object" && value !== null;
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
- if (!isRecord14(value)) {
1483
- return false;
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
- return isRecord14(value) && typeof value.initialized === "boolean" && typeof value.command === "string";
1376
+ return isRecord$2(value) && typeof value.initialized === "boolean" && typeof value.command === "string";
1489
1377
  }
1490
1378
  function isServiceMeProjectMakeScriptsExecutableResult(value) {
1491
- if (!isRecord14(value)) {
1492
- return false;
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
- return isRecord14(value) && typeof value.installed === "boolean" && typeof value.command === "string";
1383
+ return isRecord$2(value) && typeof value.installed === "boolean" && typeof value.command === "string";
1498
1384
  }
1499
1385
  function isServiceMeProjectExtractTemplateInput(value) {
1500
- return isRecord14(value) && typeof value.extractedDirName === "string" && typeof value.projectFilePattern === "string";
1386
+ return isRecord$2(value) && typeof value.extractedDirName === "string" && typeof value.projectFilePattern === "string";
1501
1387
  }
1502
1388
  function isServiceMeProjectExtractTemplateResult(value) {
1503
- return isRecord14(value) && typeof value.actualDirName === "string";
1504
- }
1505
-
1506
- // src/skill.ts
1507
- var VALID_SKILL_SCOPES = ["workspace", "user"];
1508
- var VALID_SKILL_SCOPE_STATUSES = [
1509
- "absent",
1510
- "available",
1511
- "installed",
1512
- "blocked",
1513
- "conflict"
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
- var VALID_SKILL_MUTATION_ACTIONS = [
1516
- "install",
1517
- "uninstall",
1518
- "move",
1519
- "removeExternal",
1520
- "publish",
1521
- "republish",
1522
- "submit-to-official"
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 isRecord15(value) {
1525
- return typeof value === "object" && value !== null;
1410
+ function isRecord$1(value) {
1411
+ return typeof value === "object" && value !== null;
1526
1412
  }
1527
1413
  function isSkillScope(value) {
1528
- return typeof value === "string" && VALID_SKILL_SCOPES.includes(value);
1414
+ return typeof value === "string" && VALID_SKILL_SCOPES.includes(value);
1529
1415
  }
1530
1416
  function isSkillScopeStatus(value) {
1531
- return typeof value === "string" && VALID_SKILL_SCOPE_STATUSES.includes(value);
1417
+ return typeof value === "string" && VALID_SKILL_SCOPE_STATUSES.includes(value);
1532
1418
  }
1533
1419
  function isSkillMutationAction(value) {
1534
- return typeof value === "string" && VALID_SKILL_MUTATION_ACTIONS.includes(value);
1535
- }
1536
- function isStringArray3(value) {
1537
- return Array.isArray(value) && value.every((item) => typeof item === "string");
1538
- }
1539
- function isSafeResourceId2(value) {
1540
- if (typeof value !== "string" || value.length === 0 || value.includes("\\")) {
1541
- return false;
1542
- }
1543
- const segments = value.split("/");
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
- if (!isRecord15(value)) {
1553
- return false;
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
- if (!isRecord15(value)) {
1559
- return false;
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
- if (!isRecord15(value)) {
1565
- return false;
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
- return isRecord15(value) && isSafeResourceId2(value.skillId) && isSkillScope(value.targetScope) && isSkillMutationAction(value.action) && (value.confirmed === void 0 || typeof value.confirmed === "boolean");
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
- return isRecord15(value) && isSkillMarketplaceState(value.state) && typeof value.skillId === "string" && isSkillScope(value.targetScope) && isSkillMutationAction(value.action) && typeof value.changed === "boolean" && (value.status === "success" || value.status === "blocked" || value.status === "requires_confirmation") && (value.message === void 0 || typeof value.message === "string") && (value.hasScripts === void 0 || typeof value.hasScripts === "boolean") && (value.hasHooks === void 0 || typeof value.hasHooks === "boolean") && (value.prUrl === void 0 || typeof value.prUrl === "string") && (value.fromVersion === void 0 || typeof value.fromVersion === "string") && (value.toVersion === void 0 || typeof value.toVersion === "string");
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
- return isRecord15(value) && isSkillMarketplaceState(value.state) && typeof value.changed === "boolean";
1450
+ return isRecord$1(value) && isSkillMarketplaceState(value.state) && typeof value.changed === "boolean";
1577
1451
  }
1578
1452
  function isPublishableSkillEntry(value) {
1579
- return isRecord15(value) && typeof value.id === "string" && typeof value.displayName === "string" && typeof value.path === "string" && (value.version === void 0 || typeof value.version === "string");
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
- return isRecord15(value) && Array.isArray(value.skills) && value.skills.every((entry) => isPublishableSkillEntry(entry));
1583
- }
1584
- export {
1585
- AUTH_PROVIDERS,
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 };