@serviceme/devtools-protocol 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +222 -3
- package/dist/index.d.ts +222 -3
- package/dist/index.js +251 -47
- package/dist/index.mjs +241 -47
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -40,6 +40,11 @@ __export(index_exports, {
|
|
|
40
40
|
createServicemeError: () => createServicemeError,
|
|
41
41
|
getBridgeEventParamsValidator: () => getBridgeEventParamsValidator,
|
|
42
42
|
getBridgeResultValidator: () => getBridgeResultValidator,
|
|
43
|
+
isAgentMarketplaceState: () => isAgentMarketplaceState,
|
|
44
|
+
isAgentMutationRequest: () => isAgentMutationRequest,
|
|
45
|
+
isAgentMutationResult: () => isAgentMutationResult,
|
|
46
|
+
isAgentPermissionSummary: () => isAgentPermissionSummary,
|
|
47
|
+
isAgentPermissionsResult: () => isAgentPermissionsResult,
|
|
43
48
|
isAgentSessionStatus: () => isAgentSessionStatus,
|
|
44
49
|
isBridgeCapabilities: () => isBridgeCapabilities,
|
|
45
50
|
isBridgeEvent: () => isBridgeEvent,
|
|
@@ -72,6 +77,11 @@ __export(index_exports, {
|
|
|
72
77
|
isServiceMeProjectScaffoldPruneResult: () => isServiceMeProjectScaffoldPruneResult,
|
|
73
78
|
isServicemeErrorCode: () => isServicemeErrorCode,
|
|
74
79
|
isServicemeErrorDetails: () => isServicemeErrorDetails,
|
|
80
|
+
isSkillMarketplaceState: () => isSkillMarketplaceState,
|
|
81
|
+
isSkillMutationRequest: () => isSkillMutationRequest,
|
|
82
|
+
isSkillMutationResult: () => isSkillMutationResult,
|
|
83
|
+
isSkillPublishableResult: () => isSkillPublishableResult,
|
|
84
|
+
isSkillReconcileResult: () => isSkillReconcileResult,
|
|
75
85
|
isSystemHelloResult: () => isSystemHelloResult,
|
|
76
86
|
isSystemPingResult: () => isSystemPingResult,
|
|
77
87
|
isSystemShutdownResult: () => isSystemShutdownResult,
|
|
@@ -89,6 +99,90 @@ __export(index_exports, {
|
|
|
89
99
|
});
|
|
90
100
|
module.exports = __toCommonJS(index_exports);
|
|
91
101
|
|
|
102
|
+
// src/agent.ts
|
|
103
|
+
var VALID_AGENT_SCOPES = ["workspace", "user"];
|
|
104
|
+
var VALID_AGENT_SCOPE_STATUSES = [
|
|
105
|
+
"absent",
|
|
106
|
+
"available",
|
|
107
|
+
"installed",
|
|
108
|
+
"blocked",
|
|
109
|
+
"conflict"
|
|
110
|
+
];
|
|
111
|
+
var VALID_AGENT_MUTATION_ACTIONS = [
|
|
112
|
+
"install",
|
|
113
|
+
"uninstall",
|
|
114
|
+
"move",
|
|
115
|
+
"removeExternal",
|
|
116
|
+
"publish",
|
|
117
|
+
"republish",
|
|
118
|
+
"submit-to-official"
|
|
119
|
+
];
|
|
120
|
+
var VALID_AGENT_TOOL_RISK_LEVELS = [
|
|
121
|
+
"high",
|
|
122
|
+
"medium",
|
|
123
|
+
"low"
|
|
124
|
+
];
|
|
125
|
+
function isRecord(value) {
|
|
126
|
+
return typeof value === "object" && value !== null;
|
|
127
|
+
}
|
|
128
|
+
function isStringArray(value) {
|
|
129
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
130
|
+
}
|
|
131
|
+
function isAgentScope(value) {
|
|
132
|
+
return typeof value === "string" && VALID_AGENT_SCOPES.includes(value);
|
|
133
|
+
}
|
|
134
|
+
function isAgentScopeStatus(value) {
|
|
135
|
+
return typeof value === "string" && VALID_AGENT_SCOPE_STATUSES.includes(value);
|
|
136
|
+
}
|
|
137
|
+
function isAgentMutationAction(value) {
|
|
138
|
+
return typeof value === "string" && VALID_AGENT_MUTATION_ACTIONS.includes(value);
|
|
139
|
+
}
|
|
140
|
+
function isSafeResourceId(value) {
|
|
141
|
+
if (typeof value !== "string" || value.length === 0 || value.includes("\\")) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
const segments = value.split("/");
|
|
145
|
+
if (segments.some((segment) => segment.length === 0)) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
return segments.every(
|
|
149
|
+
(segment) => segment !== "." && segment !== ".." && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(segment)
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
function isAgentScopeState(value) {
|
|
153
|
+
if (!isRecord(value)) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
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");
|
|
157
|
+
}
|
|
158
|
+
function isAgentMarketplaceEntry(value) {
|
|
159
|
+
if (!isRecord(value)) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
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);
|
|
163
|
+
}
|
|
164
|
+
function isAgentMarketplaceState(value) {
|
|
165
|
+
if (!isRecord(value)) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
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");
|
|
169
|
+
}
|
|
170
|
+
function isAgentMutationRequest(value) {
|
|
171
|
+
return isRecord(value) && isSafeResourceId(value.agentId) && isAgentScope(value.targetScope) && isAgentMutationAction(value.action) && (value.confirmed === void 0 || typeof value.confirmed === "boolean");
|
|
172
|
+
}
|
|
173
|
+
function isAgentMutationResult(value) {
|
|
174
|
+
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");
|
|
175
|
+
}
|
|
176
|
+
function isAgentToolPermission(value) {
|
|
177
|
+
return isRecord(value) && typeof value.tool === "string" && typeof value.riskLevel === "string" && VALID_AGENT_TOOL_RISK_LEVELS.includes(value.riskLevel);
|
|
178
|
+
}
|
|
179
|
+
function isAgentPermissionSummary(value) {
|
|
180
|
+
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";
|
|
181
|
+
}
|
|
182
|
+
function isAgentPermissionsResult(value) {
|
|
183
|
+
return isRecord(value) && typeof value.agentId === "string" && isAgentPermissionSummary(value.summary);
|
|
184
|
+
}
|
|
185
|
+
|
|
92
186
|
// src/scheduled-tasks.ts
|
|
93
187
|
var VALID_TASK_TYPES = [
|
|
94
188
|
"command",
|
|
@@ -98,64 +192,143 @@ var VALID_TASK_TYPES = [
|
|
|
98
192
|
];
|
|
99
193
|
var VALID_SCHEDULE_TYPES = ["cron", "interval"];
|
|
100
194
|
var VALID_TERMINAL_STATUSES = ["success", "failure", "timeout", "cancelled"];
|
|
101
|
-
function
|
|
195
|
+
function isRecord2(value) {
|
|
102
196
|
return typeof value === "object" && value !== null;
|
|
103
197
|
}
|
|
104
198
|
function isScheduledTaskType(value) {
|
|
105
199
|
return typeof value === "string" && VALID_TASK_TYPES.includes(value);
|
|
106
200
|
}
|
|
107
201
|
function isScheduledTask(value) {
|
|
108
|
-
if (!
|
|
109
|
-
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) &&
|
|
202
|
+
if (!isRecord2(value)) return false;
|
|
203
|
+
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) && isRecord2(value.payload) && typeof value.createdAt === "string" && typeof value.updatedAt === "string";
|
|
110
204
|
}
|
|
111
205
|
function isTaskExecutionLog(value) {
|
|
112
|
-
if (!
|
|
206
|
+
if (!isRecord2(value)) return false;
|
|
113
207
|
return typeof value.id === "string" && typeof value.taskId === "string" && typeof value.taskName === "string" && typeof value.startedAt === "string" && typeof value.finishedAt === "string" && VALID_TERMINAL_STATUSES.includes(
|
|
114
208
|
value.status
|
|
115
209
|
);
|
|
116
210
|
}
|
|
117
211
|
function isSchedulerStatus(value) {
|
|
118
|
-
if (!
|
|
212
|
+
if (!isRecord2(value)) return false;
|
|
119
213
|
return typeof value.running === "boolean" && typeof value.tasksRegistered === "number" && typeof value.workspacePath === "string";
|
|
120
214
|
}
|
|
121
215
|
function isTaskExecuteResult(value) {
|
|
122
|
-
return
|
|
216
|
+
return isRecord2(value) && typeof value.executionId === "string" && value.accepted === true;
|
|
123
217
|
}
|
|
124
218
|
function isTaskCancelResult(value) {
|
|
125
|
-
return
|
|
219
|
+
return isRecord2(value) && typeof value.executionId === "string" && typeof value.cancelled === "boolean";
|
|
126
220
|
}
|
|
127
221
|
function isTaskListRunningResult(value) {
|
|
128
|
-
return
|
|
222
|
+
return isRecord2(value) && Array.isArray(value.executions);
|
|
129
223
|
}
|
|
130
224
|
function isTaskStartedEventParams(value) {
|
|
131
|
-
return
|
|
225
|
+
return isRecord2(value) && typeof value.executionId === "string" && typeof value.taskId === "string" && typeof value.startedAt === "string";
|
|
132
226
|
}
|
|
133
227
|
function isTaskOutputEventParams(value) {
|
|
134
|
-
return
|
|
228
|
+
return isRecord2(value) && typeof value.executionId === "string" && (value.stream === "stdout" || value.stream === "stderr") && typeof value.data === "string";
|
|
135
229
|
}
|
|
136
230
|
function isTaskCompletedEventParams(value) {
|
|
137
|
-
return
|
|
231
|
+
return isRecord2(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
|
|
138
232
|
}
|
|
139
233
|
function isTaskFailedEventParams(value) {
|
|
140
|
-
return
|
|
234
|
+
return isRecord2(value) && typeof value.executionId === "string" && (value.status === "failure" || value.status === "timeout") && (value.reason === "error" || value.reason === "timeout") && isTaskExecutionLog(value.log);
|
|
141
235
|
}
|
|
142
236
|
function isTaskCancelledEventParams(value) {
|
|
143
|
-
return
|
|
237
|
+
return isRecord2(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
|
|
144
238
|
}
|
|
145
239
|
function isAgentSessionStatus(value) {
|
|
146
240
|
return value === "idle" || value === "running" || value === "needs-input" || value === "completed" || value === "failed" || value === "aborted";
|
|
147
241
|
}
|
|
148
242
|
|
|
243
|
+
// src/skill.ts
|
|
244
|
+
var VALID_SKILL_SCOPES = ["workspace", "user"];
|
|
245
|
+
var VALID_SKILL_SCOPE_STATUSES = [
|
|
246
|
+
"absent",
|
|
247
|
+
"available",
|
|
248
|
+
"installed",
|
|
249
|
+
"blocked",
|
|
250
|
+
"conflict"
|
|
251
|
+
];
|
|
252
|
+
var VALID_SKILL_MUTATION_ACTIONS = [
|
|
253
|
+
"install",
|
|
254
|
+
"uninstall",
|
|
255
|
+
"move",
|
|
256
|
+
"removeExternal",
|
|
257
|
+
"publish",
|
|
258
|
+
"republish",
|
|
259
|
+
"submit-to-official"
|
|
260
|
+
];
|
|
261
|
+
function isRecord3(value) {
|
|
262
|
+
return typeof value === "object" && value !== null;
|
|
263
|
+
}
|
|
264
|
+
function isSkillScope(value) {
|
|
265
|
+
return typeof value === "string" && VALID_SKILL_SCOPES.includes(value);
|
|
266
|
+
}
|
|
267
|
+
function isSkillScopeStatus(value) {
|
|
268
|
+
return typeof value === "string" && VALID_SKILL_SCOPE_STATUSES.includes(value);
|
|
269
|
+
}
|
|
270
|
+
function isSkillMutationAction(value) {
|
|
271
|
+
return typeof value === "string" && VALID_SKILL_MUTATION_ACTIONS.includes(value);
|
|
272
|
+
}
|
|
273
|
+
function isStringArray2(value) {
|
|
274
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
275
|
+
}
|
|
276
|
+
function isSafeResourceId2(value) {
|
|
277
|
+
if (typeof value !== "string" || value.length === 0 || value.includes("\\")) {
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
const segments = value.split("/");
|
|
281
|
+
if (segments.some((segment) => segment.length === 0)) {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
return segments.every(
|
|
285
|
+
(segment) => segment !== "." && segment !== ".." && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(segment)
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
function isSkillScopeState(value) {
|
|
289
|
+
if (!isRecord3(value)) {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
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");
|
|
293
|
+
}
|
|
294
|
+
function isSkillMarketplaceEntry(value) {
|
|
295
|
+
if (!isRecord3(value)) {
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
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);
|
|
299
|
+
}
|
|
300
|
+
function isSkillMarketplaceState(value) {
|
|
301
|
+
if (!isRecord3(value)) {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
return typeof value.configPath === "string" && typeof value.userSkillsPath === "string" && Array.isArray(value.skills) && value.skills.every((entry) => isSkillMarketplaceEntry(entry)) && (value.enabledSkillIds === void 0 || isStringArray2(value.enabledSkillIds)) && (value.recommendedSkillIds === void 0 || isStringArray2(value.recommendedSkillIds)) && typeof value.onboardingRequired === "boolean" && typeof value.hasPersistedSelection === "boolean" && (value.workspaceOpen === void 0 || typeof value.workspaceOpen === "boolean");
|
|
305
|
+
}
|
|
306
|
+
function isSkillMutationRequest(value) {
|
|
307
|
+
return isRecord3(value) && isSafeResourceId2(value.skillId) && isSkillScope(value.targetScope) && isSkillMutationAction(value.action) && (value.confirmed === void 0 || typeof value.confirmed === "boolean");
|
|
308
|
+
}
|
|
309
|
+
function isSkillMutationResult(value) {
|
|
310
|
+
return isRecord3(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");
|
|
311
|
+
}
|
|
312
|
+
function isSkillReconcileResult(value) {
|
|
313
|
+
return isRecord3(value) && isSkillMarketplaceState(value.state) && typeof value.changed === "boolean";
|
|
314
|
+
}
|
|
315
|
+
function isPublishableSkillEntry(value) {
|
|
316
|
+
return isRecord3(value) && typeof value.id === "string" && typeof value.displayName === "string" && typeof value.path === "string" && (value.version === void 0 || typeof value.version === "string");
|
|
317
|
+
}
|
|
318
|
+
function isSkillPublishableResult(value) {
|
|
319
|
+
return isRecord3(value) && Array.isArray(value.skills) && value.skills.every((entry) => isPublishableSkillEntry(entry));
|
|
320
|
+
}
|
|
321
|
+
|
|
149
322
|
// src/bridge.ts
|
|
150
323
|
var SERVICEME_PROTOCOL_VERSION = 2;
|
|
151
|
-
function
|
|
324
|
+
function isRecord4(value) {
|
|
152
325
|
return typeof value === "object" && value !== null;
|
|
153
326
|
}
|
|
154
327
|
function isValidProtocolVersion(value) {
|
|
155
328
|
return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= SERVICEME_PROTOCOL_VERSION;
|
|
156
329
|
}
|
|
157
330
|
function isBridgeCapabilities(value) {
|
|
158
|
-
return
|
|
331
|
+
return isRecord4(value) && value.bridge === true && value.json === 1 && value.env === 1 && (value.tasks === void 0 || value.tasks === 1) && (value.skills === void 0 || value.skills === 1) && (value.agents === void 0 || value.agents === 1);
|
|
159
332
|
}
|
|
160
333
|
var BRIDGE_METHODS = [
|
|
161
334
|
"system.hello",
|
|
@@ -163,7 +336,14 @@ var BRIDGE_METHODS = [
|
|
|
163
336
|
"system.shutdown",
|
|
164
337
|
"task.execute",
|
|
165
338
|
"task.cancel",
|
|
166
|
-
"task.list-running"
|
|
339
|
+
"task.list-running",
|
|
340
|
+
"skill.marketplace-state",
|
|
341
|
+
"skill.mutate",
|
|
342
|
+
"skill.reconcile",
|
|
343
|
+
"skill.publishable",
|
|
344
|
+
"agent.marketplace-state",
|
|
345
|
+
"agent.mutate",
|
|
346
|
+
"agent.permissions"
|
|
167
347
|
];
|
|
168
348
|
var BRIDGE_EVENTS = [
|
|
169
349
|
"task.started",
|
|
@@ -173,13 +353,13 @@ var BRIDGE_EVENTS = [
|
|
|
173
353
|
"task.cancelled"
|
|
174
354
|
];
|
|
175
355
|
function isSystemHelloResult(value) {
|
|
176
|
-
return
|
|
356
|
+
return isRecord4(value) && typeof value.cliVersion === "string" && isValidProtocolVersion(value.protocolVersion) && isBridgeCapabilities(value.capabilities) && typeof value.pid === "number";
|
|
177
357
|
}
|
|
178
358
|
function isSystemPingResult(value) {
|
|
179
|
-
return
|
|
359
|
+
return isRecord4(value) && typeof value.now === "string";
|
|
180
360
|
}
|
|
181
361
|
function isSystemShutdownResult(value) {
|
|
182
|
-
return
|
|
362
|
+
return isRecord4(value) && value.shuttingDown === true;
|
|
183
363
|
}
|
|
184
364
|
function getBridgeResultValidator(method) {
|
|
185
365
|
switch (method) {
|
|
@@ -195,6 +375,20 @@ function getBridgeResultValidator(method) {
|
|
|
195
375
|
return isTaskCancelResult;
|
|
196
376
|
case "task.list-running":
|
|
197
377
|
return isTaskListRunningResult;
|
|
378
|
+
case "skill.marketplace-state":
|
|
379
|
+
return isSkillMarketplaceState;
|
|
380
|
+
case "skill.mutate":
|
|
381
|
+
return isSkillMutationResult;
|
|
382
|
+
case "skill.reconcile":
|
|
383
|
+
return isSkillReconcileResult;
|
|
384
|
+
case "skill.publishable":
|
|
385
|
+
return isSkillPublishableResult;
|
|
386
|
+
case "agent.marketplace-state":
|
|
387
|
+
return isAgentMarketplaceState;
|
|
388
|
+
case "agent.mutate":
|
|
389
|
+
return isAgentMutationResult;
|
|
390
|
+
case "agent.permissions":
|
|
391
|
+
return isAgentPermissionSummary;
|
|
198
392
|
default:
|
|
199
393
|
return void 0;
|
|
200
394
|
}
|
|
@@ -222,13 +416,13 @@ function isBridgeEventName(value) {
|
|
|
222
416
|
return typeof value === "string" && BRIDGE_EVENTS.includes(value);
|
|
223
417
|
}
|
|
224
418
|
function isBridgeRequest(value) {
|
|
225
|
-
if (!
|
|
419
|
+
if (!isRecord4(value)) {
|
|
226
420
|
return false;
|
|
227
421
|
}
|
|
228
422
|
return isValidProtocolVersion(value.protocolVersion) && value.kind === "request" && typeof value.id === "string" && isBridgeMethod(value.method) && "params" in value;
|
|
229
423
|
}
|
|
230
424
|
function isBridgeResponse(value) {
|
|
231
|
-
if (!
|
|
425
|
+
if (!isRecord4(value)) {
|
|
232
426
|
return false;
|
|
233
427
|
}
|
|
234
428
|
if (!isValidProtocolVersion(value.protocolVersion) || value.kind !== "response" || typeof value.id !== "string" || typeof value.ok !== "boolean") {
|
|
@@ -240,7 +434,7 @@ function isBridgeResponse(value) {
|
|
|
240
434
|
return "error" in value;
|
|
241
435
|
}
|
|
242
436
|
function isBridgeEvent(value) {
|
|
243
|
-
if (!
|
|
437
|
+
if (!isRecord4(value)) {
|
|
244
438
|
return false;
|
|
245
439
|
}
|
|
246
440
|
return isValidProtocolVersion(value.protocolVersion) && value.kind === "event" && isBridgeEventName(value.event) && "params" in value;
|
|
@@ -248,7 +442,7 @@ function isBridgeEvent(value) {
|
|
|
248
442
|
|
|
249
443
|
// src/cli.ts
|
|
250
444
|
var SERVICEME_CLI_SCHEMA_VERSION = 1;
|
|
251
|
-
function
|
|
445
|
+
function isRecord5(value) {
|
|
252
446
|
return typeof value === "object" && value !== null;
|
|
253
447
|
}
|
|
254
448
|
function createCliSuccess(data) {
|
|
@@ -266,7 +460,7 @@ function createCliFailure(error) {
|
|
|
266
460
|
};
|
|
267
461
|
}
|
|
268
462
|
function isCliEnvelope(value) {
|
|
269
|
-
if (!
|
|
463
|
+
if (!isRecord5(value)) {
|
|
270
464
|
return false;
|
|
271
465
|
}
|
|
272
466
|
if (value.schemaVersion !== SERVICEME_CLI_SCHEMA_VERSION || typeof value.ok !== "boolean") {
|
|
@@ -298,20 +492,20 @@ var KNOWN_ENVIRONMENT_TOOLS = [
|
|
|
298
492
|
"dotnet",
|
|
299
493
|
"nuget"
|
|
300
494
|
];
|
|
301
|
-
function
|
|
495
|
+
function isRecord6(value) {
|
|
302
496
|
return typeof value === "object" && value !== null;
|
|
303
497
|
}
|
|
304
498
|
function isKnownEnvironmentTool(value) {
|
|
305
499
|
return KNOWN_ENVIRONMENT_TOOLS.includes(value);
|
|
306
500
|
}
|
|
307
501
|
function isToolCheckResult(value) {
|
|
308
|
-
if (!
|
|
502
|
+
if (!isRecord6(value)) {
|
|
309
503
|
return false;
|
|
310
504
|
}
|
|
311
505
|
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");
|
|
312
506
|
}
|
|
313
507
|
function isEnvironmentCheckResult(value) {
|
|
314
|
-
if (!
|
|
508
|
+
if (!isRecord6(value)) {
|
|
315
509
|
return false;
|
|
316
510
|
}
|
|
317
511
|
return KNOWN_ENVIRONMENT_TOOLS.every(
|
|
@@ -360,14 +554,14 @@ var RETRYABLE_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
360
554
|
"executor_timeout",
|
|
361
555
|
"internal_error"
|
|
362
556
|
]);
|
|
363
|
-
function
|
|
557
|
+
function isRecord7(value) {
|
|
364
558
|
return typeof value === "object" && value !== null;
|
|
365
559
|
}
|
|
366
560
|
function isServicemeErrorCode(value) {
|
|
367
561
|
return typeof value === "string" && SERVICEME_ERROR_CODES.includes(value);
|
|
368
562
|
}
|
|
369
563
|
function isServicemeErrorDetails(value) {
|
|
370
|
-
if (!
|
|
564
|
+
if (!isRecord7(value)) {
|
|
371
565
|
return false;
|
|
372
566
|
}
|
|
373
567
|
return isServicemeErrorCode(value.code) && typeof value.message === "string" && typeof value.retryable === "boolean";
|
|
@@ -407,7 +601,7 @@ function normalizeServicemeError(error, fallbackCode = "internal_error") {
|
|
|
407
601
|
if (isServicemeErrorDetails(error)) {
|
|
408
602
|
return error;
|
|
409
603
|
}
|
|
410
|
-
if (
|
|
604
|
+
if (isRecord7(error)) {
|
|
411
605
|
const code = isServicemeErrorCode(error.code) ? error.code : fallbackCode;
|
|
412
606
|
const message = typeof error.message === "string" ? error.message : "Unexpected serviceme error.";
|
|
413
607
|
const retryable = typeof error.retryable === "boolean" ? error.retryable : isRetryableErrorCode(code);
|
|
@@ -438,32 +632,32 @@ var SERVICEME_IMAGE_FORMATS = [
|
|
|
438
632
|
"png",
|
|
439
633
|
"webp"
|
|
440
634
|
];
|
|
441
|
-
function
|
|
635
|
+
function isRecord8(value) {
|
|
442
636
|
return typeof value === "object" && value !== null;
|
|
443
637
|
}
|
|
444
638
|
function isServiceMeImageFormat(value) {
|
|
445
639
|
return typeof value === "string" && SERVICEME_IMAGE_FORMATS.includes(value);
|
|
446
640
|
}
|
|
447
641
|
function isServiceMeImageCompressOptions(value) {
|
|
448
|
-
if (!
|
|
642
|
+
if (!isRecord8(value)) {
|
|
449
643
|
return false;
|
|
450
644
|
}
|
|
451
645
|
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");
|
|
452
646
|
}
|
|
453
647
|
function isServiceMeImageCompressResult(value) {
|
|
454
|
-
if (!
|
|
648
|
+
if (!isRecord8(value)) {
|
|
455
649
|
return false;
|
|
456
650
|
}
|
|
457
651
|
return typeof value.originalSize === "number" && typeof value.compressedSize === "number" && typeof value.compressionRatio === "number" && typeof value.outputPath === "string";
|
|
458
652
|
}
|
|
459
653
|
function isServiceMeImageInfo(value) {
|
|
460
|
-
if (!
|
|
654
|
+
if (!isRecord8(value)) {
|
|
461
655
|
return false;
|
|
462
656
|
}
|
|
463
657
|
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");
|
|
464
658
|
}
|
|
465
659
|
function isServiceMeImageValidationResult(value) {
|
|
466
|
-
return
|
|
660
|
+
return isRecord8(value) && typeof value.valid === "boolean";
|
|
467
661
|
}
|
|
468
662
|
|
|
469
663
|
// src/json.ts
|
|
@@ -482,7 +676,7 @@ var DEFAULT_JSON_SORT_OPTIONS = {
|
|
|
482
676
|
sortOrder: "asc",
|
|
483
677
|
sortAlgo: "default"
|
|
484
678
|
};
|
|
485
|
-
function
|
|
679
|
+
function isRecord9(value) {
|
|
486
680
|
return typeof value === "object" && value !== null;
|
|
487
681
|
}
|
|
488
682
|
function isJsonSortAlgorithm(value) {
|
|
@@ -492,18 +686,18 @@ function isJsonSortOrder(value) {
|
|
|
492
686
|
return typeof value === "string" && JSON_SORT_ORDERS.includes(value);
|
|
493
687
|
}
|
|
494
688
|
function isJsonSortOptions(value) {
|
|
495
|
-
return
|
|
689
|
+
return isRecord9(value) && isJsonSortOrder(value.sortOrder) && isJsonSortAlgorithm(value.sortAlgo);
|
|
496
690
|
}
|
|
497
691
|
function isJsonValidationResult(value) {
|
|
498
|
-
return
|
|
692
|
+
return isRecord9(value) && typeof value.valid === "boolean" && (value.error === void 0 || typeof value.error === "string");
|
|
499
693
|
}
|
|
500
694
|
function isJsonOutputResult(value) {
|
|
501
|
-
return
|
|
695
|
+
return isRecord9(value) && typeof value.output === "string";
|
|
502
696
|
}
|
|
503
697
|
|
|
504
698
|
// src/metadata.ts
|
|
505
699
|
var SERVICEME_CLI_NAME = "serviceme";
|
|
506
|
-
var SERVICEME_CLI_VERSION = "0.1.
|
|
700
|
+
var SERVICEME_CLI_VERSION = "0.1.6";
|
|
507
701
|
var SERVICEME_CLI_CAPABILITIES = {
|
|
508
702
|
bridge: true,
|
|
509
703
|
tasks: 1,
|
|
@@ -514,32 +708,32 @@ var SERVICEME_CLI_CAPABILITIES = {
|
|
|
514
708
|
};
|
|
515
709
|
|
|
516
710
|
// src/project.ts
|
|
517
|
-
function
|
|
711
|
+
function isRecord10(value) {
|
|
518
712
|
return typeof value === "object" && value !== null;
|
|
519
713
|
}
|
|
520
714
|
function isServiceMeProjectScaffoldPruneResult(value) {
|
|
521
|
-
if (!
|
|
715
|
+
if (!isRecord10(value)) {
|
|
522
716
|
return false;
|
|
523
717
|
}
|
|
524
718
|
return typeof value.applied === "boolean" && typeof value.preset === "string" && Array.isArray(value.commands) && value.commands.every((command) => typeof command === "string");
|
|
525
719
|
}
|
|
526
720
|
function isServiceMeProjectGitInitResult(value) {
|
|
527
|
-
return
|
|
721
|
+
return isRecord10(value) && typeof value.initialized === "boolean" && typeof value.command === "string";
|
|
528
722
|
}
|
|
529
723
|
function isServiceMeProjectMakeScriptsExecutableResult(value) {
|
|
530
|
-
if (!
|
|
724
|
+
if (!isRecord10(value)) {
|
|
531
725
|
return false;
|
|
532
726
|
}
|
|
533
727
|
return typeof value.processedCount === "number" && typeof value.updatedCount === "number" && typeof value.platform === "string" && Array.isArray(value.scripts) && value.scripts.every((script) => typeof script === "string");
|
|
534
728
|
}
|
|
535
729
|
function isServiceMeProjectInstallDepsResult(value) {
|
|
536
|
-
return
|
|
730
|
+
return isRecord10(value) && typeof value.installed === "boolean" && typeof value.command === "string";
|
|
537
731
|
}
|
|
538
732
|
function isServiceMeProjectExtractTemplateInput(value) {
|
|
539
|
-
return
|
|
733
|
+
return isRecord10(value) && typeof value.extractedDirName === "string" && typeof value.projectFilePattern === "string";
|
|
540
734
|
}
|
|
541
735
|
function isServiceMeProjectExtractTemplateResult(value) {
|
|
542
|
-
return
|
|
736
|
+
return isRecord10(value) && typeof value.actualDirName === "string";
|
|
543
737
|
}
|
|
544
738
|
// Annotate the CommonJS export names for ESM import in node:
|
|
545
739
|
0 && (module.exports = {
|
|
@@ -563,6 +757,11 @@ function isServiceMeProjectExtractTemplateResult(value) {
|
|
|
563
757
|
createServicemeError,
|
|
564
758
|
getBridgeEventParamsValidator,
|
|
565
759
|
getBridgeResultValidator,
|
|
760
|
+
isAgentMarketplaceState,
|
|
761
|
+
isAgentMutationRequest,
|
|
762
|
+
isAgentMutationResult,
|
|
763
|
+
isAgentPermissionSummary,
|
|
764
|
+
isAgentPermissionsResult,
|
|
566
765
|
isAgentSessionStatus,
|
|
567
766
|
isBridgeCapabilities,
|
|
568
767
|
isBridgeEvent,
|
|
@@ -595,6 +794,11 @@ function isServiceMeProjectExtractTemplateResult(value) {
|
|
|
595
794
|
isServiceMeProjectScaffoldPruneResult,
|
|
596
795
|
isServicemeErrorCode,
|
|
597
796
|
isServicemeErrorDetails,
|
|
797
|
+
isSkillMarketplaceState,
|
|
798
|
+
isSkillMutationRequest,
|
|
799
|
+
isSkillMutationResult,
|
|
800
|
+
isSkillPublishableResult,
|
|
801
|
+
isSkillReconcileResult,
|
|
598
802
|
isSystemHelloResult,
|
|
599
803
|
isSystemPingResult,
|
|
600
804
|
isSystemShutdownResult,
|