@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.mjs
CHANGED
|
@@ -1,3 +1,87 @@
|
|
|
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"
|
|
9
|
+
];
|
|
10
|
+
var VALID_AGENT_MUTATION_ACTIONS = [
|
|
11
|
+
"install",
|
|
12
|
+
"uninstall",
|
|
13
|
+
"move",
|
|
14
|
+
"removeExternal",
|
|
15
|
+
"publish",
|
|
16
|
+
"republish",
|
|
17
|
+
"submit-to-official"
|
|
18
|
+
];
|
|
19
|
+
var VALID_AGENT_TOOL_RISK_LEVELS = [
|
|
20
|
+
"high",
|
|
21
|
+
"medium",
|
|
22
|
+
"low"
|
|
23
|
+
];
|
|
24
|
+
function isRecord(value) {
|
|
25
|
+
return typeof value === "object" && value !== null;
|
|
26
|
+
}
|
|
27
|
+
function isStringArray(value) {
|
|
28
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
29
|
+
}
|
|
30
|
+
function isAgentScope(value) {
|
|
31
|
+
return typeof value === "string" && VALID_AGENT_SCOPES.includes(value);
|
|
32
|
+
}
|
|
33
|
+
function isAgentScopeStatus(value) {
|
|
34
|
+
return typeof value === "string" && VALID_AGENT_SCOPE_STATUSES.includes(value);
|
|
35
|
+
}
|
|
36
|
+
function isAgentMutationAction(value) {
|
|
37
|
+
return typeof value === "string" && VALID_AGENT_MUTATION_ACTIONS.includes(value);
|
|
38
|
+
}
|
|
39
|
+
function isSafeResourceId(value) {
|
|
40
|
+
if (typeof value !== "string" || value.length === 0 || value.includes("\\")) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
const segments = value.split("/");
|
|
44
|
+
if (segments.some((segment) => segment.length === 0)) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
return segments.every(
|
|
48
|
+
(segment) => segment !== "." && segment !== ".." && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(segment)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
function isAgentScopeState(value) {
|
|
52
|
+
if (!isRecord(value)) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
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");
|
|
56
|
+
}
|
|
57
|
+
function isAgentMarketplaceEntry(value) {
|
|
58
|
+
if (!isRecord(value)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
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);
|
|
62
|
+
}
|
|
63
|
+
function isAgentMarketplaceState(value) {
|
|
64
|
+
if (!isRecord(value)) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
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");
|
|
68
|
+
}
|
|
69
|
+
function isAgentMutationRequest(value) {
|
|
70
|
+
return isRecord(value) && isSafeResourceId(value.agentId) && isAgentScope(value.targetScope) && isAgentMutationAction(value.action) && (value.confirmed === void 0 || typeof value.confirmed === "boolean");
|
|
71
|
+
}
|
|
72
|
+
function isAgentMutationResult(value) {
|
|
73
|
+
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");
|
|
74
|
+
}
|
|
75
|
+
function isAgentToolPermission(value) {
|
|
76
|
+
return isRecord(value) && typeof value.tool === "string" && typeof value.riskLevel === "string" && VALID_AGENT_TOOL_RISK_LEVELS.includes(value.riskLevel);
|
|
77
|
+
}
|
|
78
|
+
function isAgentPermissionSummary(value) {
|
|
79
|
+
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";
|
|
80
|
+
}
|
|
81
|
+
function isAgentPermissionsResult(value) {
|
|
82
|
+
return isRecord(value) && typeof value.agentId === "string" && isAgentPermissionSummary(value.summary);
|
|
83
|
+
}
|
|
84
|
+
|
|
1
85
|
// src/scheduled-tasks.ts
|
|
2
86
|
var VALID_TASK_TYPES = [
|
|
3
87
|
"command",
|
|
@@ -7,64 +91,143 @@ var VALID_TASK_TYPES = [
|
|
|
7
91
|
];
|
|
8
92
|
var VALID_SCHEDULE_TYPES = ["cron", "interval"];
|
|
9
93
|
var VALID_TERMINAL_STATUSES = ["success", "failure", "timeout", "cancelled"];
|
|
10
|
-
function
|
|
94
|
+
function isRecord2(value) {
|
|
11
95
|
return typeof value === "object" && value !== null;
|
|
12
96
|
}
|
|
13
97
|
function isScheduledTaskType(value) {
|
|
14
98
|
return typeof value === "string" && VALID_TASK_TYPES.includes(value);
|
|
15
99
|
}
|
|
16
100
|
function isScheduledTask(value) {
|
|
17
|
-
if (!
|
|
18
|
-
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) &&
|
|
101
|
+
if (!isRecord2(value)) return false;
|
|
102
|
+
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";
|
|
19
103
|
}
|
|
20
104
|
function isTaskExecutionLog(value) {
|
|
21
|
-
if (!
|
|
105
|
+
if (!isRecord2(value)) return false;
|
|
22
106
|
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(
|
|
23
107
|
value.status
|
|
24
108
|
);
|
|
25
109
|
}
|
|
26
110
|
function isSchedulerStatus(value) {
|
|
27
|
-
if (!
|
|
111
|
+
if (!isRecord2(value)) return false;
|
|
28
112
|
return typeof value.running === "boolean" && typeof value.tasksRegistered === "number" && typeof value.workspacePath === "string";
|
|
29
113
|
}
|
|
30
114
|
function isTaskExecuteResult(value) {
|
|
31
|
-
return
|
|
115
|
+
return isRecord2(value) && typeof value.executionId === "string" && value.accepted === true;
|
|
32
116
|
}
|
|
33
117
|
function isTaskCancelResult(value) {
|
|
34
|
-
return
|
|
118
|
+
return isRecord2(value) && typeof value.executionId === "string" && typeof value.cancelled === "boolean";
|
|
35
119
|
}
|
|
36
120
|
function isTaskListRunningResult(value) {
|
|
37
|
-
return
|
|
121
|
+
return isRecord2(value) && Array.isArray(value.executions);
|
|
38
122
|
}
|
|
39
123
|
function isTaskStartedEventParams(value) {
|
|
40
|
-
return
|
|
124
|
+
return isRecord2(value) && typeof value.executionId === "string" && typeof value.taskId === "string" && typeof value.startedAt === "string";
|
|
41
125
|
}
|
|
42
126
|
function isTaskOutputEventParams(value) {
|
|
43
|
-
return
|
|
127
|
+
return isRecord2(value) && typeof value.executionId === "string" && (value.stream === "stdout" || value.stream === "stderr") && typeof value.data === "string";
|
|
44
128
|
}
|
|
45
129
|
function isTaskCompletedEventParams(value) {
|
|
46
|
-
return
|
|
130
|
+
return isRecord2(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
|
|
47
131
|
}
|
|
48
132
|
function isTaskFailedEventParams(value) {
|
|
49
|
-
return
|
|
133
|
+
return isRecord2(value) && typeof value.executionId === "string" && (value.status === "failure" || value.status === "timeout") && (value.reason === "error" || value.reason === "timeout") && isTaskExecutionLog(value.log);
|
|
50
134
|
}
|
|
51
135
|
function isTaskCancelledEventParams(value) {
|
|
52
|
-
return
|
|
136
|
+
return isRecord2(value) && typeof value.executionId === "string" && isTaskExecutionLog(value.log);
|
|
53
137
|
}
|
|
54
138
|
function isAgentSessionStatus(value) {
|
|
55
139
|
return value === "idle" || value === "running" || value === "needs-input" || value === "completed" || value === "failed" || value === "aborted";
|
|
56
140
|
}
|
|
57
141
|
|
|
142
|
+
// src/skill.ts
|
|
143
|
+
var VALID_SKILL_SCOPES = ["workspace", "user"];
|
|
144
|
+
var VALID_SKILL_SCOPE_STATUSES = [
|
|
145
|
+
"absent",
|
|
146
|
+
"available",
|
|
147
|
+
"installed",
|
|
148
|
+
"blocked",
|
|
149
|
+
"conflict"
|
|
150
|
+
];
|
|
151
|
+
var VALID_SKILL_MUTATION_ACTIONS = [
|
|
152
|
+
"install",
|
|
153
|
+
"uninstall",
|
|
154
|
+
"move",
|
|
155
|
+
"removeExternal",
|
|
156
|
+
"publish",
|
|
157
|
+
"republish",
|
|
158
|
+
"submit-to-official"
|
|
159
|
+
];
|
|
160
|
+
function isRecord3(value) {
|
|
161
|
+
return typeof value === "object" && value !== null;
|
|
162
|
+
}
|
|
163
|
+
function isSkillScope(value) {
|
|
164
|
+
return typeof value === "string" && VALID_SKILL_SCOPES.includes(value);
|
|
165
|
+
}
|
|
166
|
+
function isSkillScopeStatus(value) {
|
|
167
|
+
return typeof value === "string" && VALID_SKILL_SCOPE_STATUSES.includes(value);
|
|
168
|
+
}
|
|
169
|
+
function isSkillMutationAction(value) {
|
|
170
|
+
return typeof value === "string" && VALID_SKILL_MUTATION_ACTIONS.includes(value);
|
|
171
|
+
}
|
|
172
|
+
function isStringArray2(value) {
|
|
173
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
174
|
+
}
|
|
175
|
+
function isSafeResourceId2(value) {
|
|
176
|
+
if (typeof value !== "string" || value.length === 0 || value.includes("\\")) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
const segments = value.split("/");
|
|
180
|
+
if (segments.some((segment) => segment.length === 0)) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
return segments.every(
|
|
184
|
+
(segment) => segment !== "." && segment !== ".." && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(segment)
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
function isSkillScopeState(value) {
|
|
188
|
+
if (!isRecord3(value)) {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
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");
|
|
192
|
+
}
|
|
193
|
+
function isSkillMarketplaceEntry(value) {
|
|
194
|
+
if (!isRecord3(value)) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
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);
|
|
198
|
+
}
|
|
199
|
+
function isSkillMarketplaceState(value) {
|
|
200
|
+
if (!isRecord3(value)) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
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");
|
|
204
|
+
}
|
|
205
|
+
function isSkillMutationRequest(value) {
|
|
206
|
+
return isRecord3(value) && isSafeResourceId2(value.skillId) && isSkillScope(value.targetScope) && isSkillMutationAction(value.action) && (value.confirmed === void 0 || typeof value.confirmed === "boolean");
|
|
207
|
+
}
|
|
208
|
+
function isSkillMutationResult(value) {
|
|
209
|
+
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");
|
|
210
|
+
}
|
|
211
|
+
function isSkillReconcileResult(value) {
|
|
212
|
+
return isRecord3(value) && isSkillMarketplaceState(value.state) && typeof value.changed === "boolean";
|
|
213
|
+
}
|
|
214
|
+
function isPublishableSkillEntry(value) {
|
|
215
|
+
return isRecord3(value) && typeof value.id === "string" && typeof value.displayName === "string" && typeof value.path === "string" && (value.version === void 0 || typeof value.version === "string");
|
|
216
|
+
}
|
|
217
|
+
function isSkillPublishableResult(value) {
|
|
218
|
+
return isRecord3(value) && Array.isArray(value.skills) && value.skills.every((entry) => isPublishableSkillEntry(entry));
|
|
219
|
+
}
|
|
220
|
+
|
|
58
221
|
// src/bridge.ts
|
|
59
222
|
var SERVICEME_PROTOCOL_VERSION = 2;
|
|
60
|
-
function
|
|
223
|
+
function isRecord4(value) {
|
|
61
224
|
return typeof value === "object" && value !== null;
|
|
62
225
|
}
|
|
63
226
|
function isValidProtocolVersion(value) {
|
|
64
227
|
return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= SERVICEME_PROTOCOL_VERSION;
|
|
65
228
|
}
|
|
66
229
|
function isBridgeCapabilities(value) {
|
|
67
|
-
return
|
|
230
|
+
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);
|
|
68
231
|
}
|
|
69
232
|
var BRIDGE_METHODS = [
|
|
70
233
|
"system.hello",
|
|
@@ -72,7 +235,14 @@ var BRIDGE_METHODS = [
|
|
|
72
235
|
"system.shutdown",
|
|
73
236
|
"task.execute",
|
|
74
237
|
"task.cancel",
|
|
75
|
-
"task.list-running"
|
|
238
|
+
"task.list-running",
|
|
239
|
+
"skill.marketplace-state",
|
|
240
|
+
"skill.mutate",
|
|
241
|
+
"skill.reconcile",
|
|
242
|
+
"skill.publishable",
|
|
243
|
+
"agent.marketplace-state",
|
|
244
|
+
"agent.mutate",
|
|
245
|
+
"agent.permissions"
|
|
76
246
|
];
|
|
77
247
|
var BRIDGE_EVENTS = [
|
|
78
248
|
"task.started",
|
|
@@ -82,13 +252,13 @@ var BRIDGE_EVENTS = [
|
|
|
82
252
|
"task.cancelled"
|
|
83
253
|
];
|
|
84
254
|
function isSystemHelloResult(value) {
|
|
85
|
-
return
|
|
255
|
+
return isRecord4(value) && typeof value.cliVersion === "string" && isValidProtocolVersion(value.protocolVersion) && isBridgeCapabilities(value.capabilities) && typeof value.pid === "number";
|
|
86
256
|
}
|
|
87
257
|
function isSystemPingResult(value) {
|
|
88
|
-
return
|
|
258
|
+
return isRecord4(value) && typeof value.now === "string";
|
|
89
259
|
}
|
|
90
260
|
function isSystemShutdownResult(value) {
|
|
91
|
-
return
|
|
261
|
+
return isRecord4(value) && value.shuttingDown === true;
|
|
92
262
|
}
|
|
93
263
|
function getBridgeResultValidator(method) {
|
|
94
264
|
switch (method) {
|
|
@@ -104,6 +274,20 @@ function getBridgeResultValidator(method) {
|
|
|
104
274
|
return isTaskCancelResult;
|
|
105
275
|
case "task.list-running":
|
|
106
276
|
return isTaskListRunningResult;
|
|
277
|
+
case "skill.marketplace-state":
|
|
278
|
+
return isSkillMarketplaceState;
|
|
279
|
+
case "skill.mutate":
|
|
280
|
+
return isSkillMutationResult;
|
|
281
|
+
case "skill.reconcile":
|
|
282
|
+
return isSkillReconcileResult;
|
|
283
|
+
case "skill.publishable":
|
|
284
|
+
return isSkillPublishableResult;
|
|
285
|
+
case "agent.marketplace-state":
|
|
286
|
+
return isAgentMarketplaceState;
|
|
287
|
+
case "agent.mutate":
|
|
288
|
+
return isAgentMutationResult;
|
|
289
|
+
case "agent.permissions":
|
|
290
|
+
return isAgentPermissionSummary;
|
|
107
291
|
default:
|
|
108
292
|
return void 0;
|
|
109
293
|
}
|
|
@@ -131,13 +315,13 @@ function isBridgeEventName(value) {
|
|
|
131
315
|
return typeof value === "string" && BRIDGE_EVENTS.includes(value);
|
|
132
316
|
}
|
|
133
317
|
function isBridgeRequest(value) {
|
|
134
|
-
if (!
|
|
318
|
+
if (!isRecord4(value)) {
|
|
135
319
|
return false;
|
|
136
320
|
}
|
|
137
321
|
return isValidProtocolVersion(value.protocolVersion) && value.kind === "request" && typeof value.id === "string" && isBridgeMethod(value.method) && "params" in value;
|
|
138
322
|
}
|
|
139
323
|
function isBridgeResponse(value) {
|
|
140
|
-
if (!
|
|
324
|
+
if (!isRecord4(value)) {
|
|
141
325
|
return false;
|
|
142
326
|
}
|
|
143
327
|
if (!isValidProtocolVersion(value.protocolVersion) || value.kind !== "response" || typeof value.id !== "string" || typeof value.ok !== "boolean") {
|
|
@@ -149,7 +333,7 @@ function isBridgeResponse(value) {
|
|
|
149
333
|
return "error" in value;
|
|
150
334
|
}
|
|
151
335
|
function isBridgeEvent(value) {
|
|
152
|
-
if (!
|
|
336
|
+
if (!isRecord4(value)) {
|
|
153
337
|
return false;
|
|
154
338
|
}
|
|
155
339
|
return isValidProtocolVersion(value.protocolVersion) && value.kind === "event" && isBridgeEventName(value.event) && "params" in value;
|
|
@@ -157,7 +341,7 @@ function isBridgeEvent(value) {
|
|
|
157
341
|
|
|
158
342
|
// src/cli.ts
|
|
159
343
|
var SERVICEME_CLI_SCHEMA_VERSION = 1;
|
|
160
|
-
function
|
|
344
|
+
function isRecord5(value) {
|
|
161
345
|
return typeof value === "object" && value !== null;
|
|
162
346
|
}
|
|
163
347
|
function createCliSuccess(data) {
|
|
@@ -175,7 +359,7 @@ function createCliFailure(error) {
|
|
|
175
359
|
};
|
|
176
360
|
}
|
|
177
361
|
function isCliEnvelope(value) {
|
|
178
|
-
if (!
|
|
362
|
+
if (!isRecord5(value)) {
|
|
179
363
|
return false;
|
|
180
364
|
}
|
|
181
365
|
if (value.schemaVersion !== SERVICEME_CLI_SCHEMA_VERSION || typeof value.ok !== "boolean") {
|
|
@@ -207,20 +391,20 @@ var KNOWN_ENVIRONMENT_TOOLS = [
|
|
|
207
391
|
"dotnet",
|
|
208
392
|
"nuget"
|
|
209
393
|
];
|
|
210
|
-
function
|
|
394
|
+
function isRecord6(value) {
|
|
211
395
|
return typeof value === "object" && value !== null;
|
|
212
396
|
}
|
|
213
397
|
function isKnownEnvironmentTool(value) {
|
|
214
398
|
return KNOWN_ENVIRONMENT_TOOLS.includes(value);
|
|
215
399
|
}
|
|
216
400
|
function isToolCheckResult(value) {
|
|
217
|
-
if (!
|
|
401
|
+
if (!isRecord6(value)) {
|
|
218
402
|
return false;
|
|
219
403
|
}
|
|
220
404
|
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");
|
|
221
405
|
}
|
|
222
406
|
function isEnvironmentCheckResult(value) {
|
|
223
|
-
if (!
|
|
407
|
+
if (!isRecord6(value)) {
|
|
224
408
|
return false;
|
|
225
409
|
}
|
|
226
410
|
return KNOWN_ENVIRONMENT_TOOLS.every(
|
|
@@ -269,14 +453,14 @@ var RETRYABLE_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
269
453
|
"executor_timeout",
|
|
270
454
|
"internal_error"
|
|
271
455
|
]);
|
|
272
|
-
function
|
|
456
|
+
function isRecord7(value) {
|
|
273
457
|
return typeof value === "object" && value !== null;
|
|
274
458
|
}
|
|
275
459
|
function isServicemeErrorCode(value) {
|
|
276
460
|
return typeof value === "string" && SERVICEME_ERROR_CODES.includes(value);
|
|
277
461
|
}
|
|
278
462
|
function isServicemeErrorDetails(value) {
|
|
279
|
-
if (!
|
|
463
|
+
if (!isRecord7(value)) {
|
|
280
464
|
return false;
|
|
281
465
|
}
|
|
282
466
|
return isServicemeErrorCode(value.code) && typeof value.message === "string" && typeof value.retryable === "boolean";
|
|
@@ -316,7 +500,7 @@ function normalizeServicemeError(error, fallbackCode = "internal_error") {
|
|
|
316
500
|
if (isServicemeErrorDetails(error)) {
|
|
317
501
|
return error;
|
|
318
502
|
}
|
|
319
|
-
if (
|
|
503
|
+
if (isRecord7(error)) {
|
|
320
504
|
const code = isServicemeErrorCode(error.code) ? error.code : fallbackCode;
|
|
321
505
|
const message = typeof error.message === "string" ? error.message : "Unexpected serviceme error.";
|
|
322
506
|
const retryable = typeof error.retryable === "boolean" ? error.retryable : isRetryableErrorCode(code);
|
|
@@ -347,32 +531,32 @@ var SERVICEME_IMAGE_FORMATS = [
|
|
|
347
531
|
"png",
|
|
348
532
|
"webp"
|
|
349
533
|
];
|
|
350
|
-
function
|
|
534
|
+
function isRecord8(value) {
|
|
351
535
|
return typeof value === "object" && value !== null;
|
|
352
536
|
}
|
|
353
537
|
function isServiceMeImageFormat(value) {
|
|
354
538
|
return typeof value === "string" && SERVICEME_IMAGE_FORMATS.includes(value);
|
|
355
539
|
}
|
|
356
540
|
function isServiceMeImageCompressOptions(value) {
|
|
357
|
-
if (!
|
|
541
|
+
if (!isRecord8(value)) {
|
|
358
542
|
return false;
|
|
359
543
|
}
|
|
360
544
|
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");
|
|
361
545
|
}
|
|
362
546
|
function isServiceMeImageCompressResult(value) {
|
|
363
|
-
if (!
|
|
547
|
+
if (!isRecord8(value)) {
|
|
364
548
|
return false;
|
|
365
549
|
}
|
|
366
550
|
return typeof value.originalSize === "number" && typeof value.compressedSize === "number" && typeof value.compressionRatio === "number" && typeof value.outputPath === "string";
|
|
367
551
|
}
|
|
368
552
|
function isServiceMeImageInfo(value) {
|
|
369
|
-
if (!
|
|
553
|
+
if (!isRecord8(value)) {
|
|
370
554
|
return false;
|
|
371
555
|
}
|
|
372
556
|
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");
|
|
373
557
|
}
|
|
374
558
|
function isServiceMeImageValidationResult(value) {
|
|
375
|
-
return
|
|
559
|
+
return isRecord8(value) && typeof value.valid === "boolean";
|
|
376
560
|
}
|
|
377
561
|
|
|
378
562
|
// src/json.ts
|
|
@@ -391,7 +575,7 @@ var DEFAULT_JSON_SORT_OPTIONS = {
|
|
|
391
575
|
sortOrder: "asc",
|
|
392
576
|
sortAlgo: "default"
|
|
393
577
|
};
|
|
394
|
-
function
|
|
578
|
+
function isRecord9(value) {
|
|
395
579
|
return typeof value === "object" && value !== null;
|
|
396
580
|
}
|
|
397
581
|
function isJsonSortAlgorithm(value) {
|
|
@@ -401,18 +585,18 @@ function isJsonSortOrder(value) {
|
|
|
401
585
|
return typeof value === "string" && JSON_SORT_ORDERS.includes(value);
|
|
402
586
|
}
|
|
403
587
|
function isJsonSortOptions(value) {
|
|
404
|
-
return
|
|
588
|
+
return isRecord9(value) && isJsonSortOrder(value.sortOrder) && isJsonSortAlgorithm(value.sortAlgo);
|
|
405
589
|
}
|
|
406
590
|
function isJsonValidationResult(value) {
|
|
407
|
-
return
|
|
591
|
+
return isRecord9(value) && typeof value.valid === "boolean" && (value.error === void 0 || typeof value.error === "string");
|
|
408
592
|
}
|
|
409
593
|
function isJsonOutputResult(value) {
|
|
410
|
-
return
|
|
594
|
+
return isRecord9(value) && typeof value.output === "string";
|
|
411
595
|
}
|
|
412
596
|
|
|
413
597
|
// src/metadata.ts
|
|
414
598
|
var SERVICEME_CLI_NAME = "serviceme";
|
|
415
|
-
var SERVICEME_CLI_VERSION = "0.1.
|
|
599
|
+
var SERVICEME_CLI_VERSION = "0.1.6";
|
|
416
600
|
var SERVICEME_CLI_CAPABILITIES = {
|
|
417
601
|
bridge: true,
|
|
418
602
|
tasks: 1,
|
|
@@ -423,32 +607,32 @@ var SERVICEME_CLI_CAPABILITIES = {
|
|
|
423
607
|
};
|
|
424
608
|
|
|
425
609
|
// src/project.ts
|
|
426
|
-
function
|
|
610
|
+
function isRecord10(value) {
|
|
427
611
|
return typeof value === "object" && value !== null;
|
|
428
612
|
}
|
|
429
613
|
function isServiceMeProjectScaffoldPruneResult(value) {
|
|
430
|
-
if (!
|
|
614
|
+
if (!isRecord10(value)) {
|
|
431
615
|
return false;
|
|
432
616
|
}
|
|
433
617
|
return typeof value.applied === "boolean" && typeof value.preset === "string" && Array.isArray(value.commands) && value.commands.every((command) => typeof command === "string");
|
|
434
618
|
}
|
|
435
619
|
function isServiceMeProjectGitInitResult(value) {
|
|
436
|
-
return
|
|
620
|
+
return isRecord10(value) && typeof value.initialized === "boolean" && typeof value.command === "string";
|
|
437
621
|
}
|
|
438
622
|
function isServiceMeProjectMakeScriptsExecutableResult(value) {
|
|
439
|
-
if (!
|
|
623
|
+
if (!isRecord10(value)) {
|
|
440
624
|
return false;
|
|
441
625
|
}
|
|
442
626
|
return typeof value.processedCount === "number" && typeof value.updatedCount === "number" && typeof value.platform === "string" && Array.isArray(value.scripts) && value.scripts.every((script) => typeof script === "string");
|
|
443
627
|
}
|
|
444
628
|
function isServiceMeProjectInstallDepsResult(value) {
|
|
445
|
-
return
|
|
629
|
+
return isRecord10(value) && typeof value.installed === "boolean" && typeof value.command === "string";
|
|
446
630
|
}
|
|
447
631
|
function isServiceMeProjectExtractTemplateInput(value) {
|
|
448
|
-
return
|
|
632
|
+
return isRecord10(value) && typeof value.extractedDirName === "string" && typeof value.projectFilePattern === "string";
|
|
449
633
|
}
|
|
450
634
|
function isServiceMeProjectExtractTemplateResult(value) {
|
|
451
|
-
return
|
|
635
|
+
return isRecord10(value) && typeof value.actualDirName === "string";
|
|
452
636
|
}
|
|
453
637
|
export {
|
|
454
638
|
BRIDGE_EVENTS,
|
|
@@ -471,6 +655,11 @@ export {
|
|
|
471
655
|
createServicemeError,
|
|
472
656
|
getBridgeEventParamsValidator,
|
|
473
657
|
getBridgeResultValidator,
|
|
658
|
+
isAgentMarketplaceState,
|
|
659
|
+
isAgentMutationRequest,
|
|
660
|
+
isAgentMutationResult,
|
|
661
|
+
isAgentPermissionSummary,
|
|
662
|
+
isAgentPermissionsResult,
|
|
474
663
|
isAgentSessionStatus,
|
|
475
664
|
isBridgeCapabilities,
|
|
476
665
|
isBridgeEvent,
|
|
@@ -503,6 +692,11 @@ export {
|
|
|
503
692
|
isServiceMeProjectScaffoldPruneResult,
|
|
504
693
|
isServicemeErrorCode,
|
|
505
694
|
isServicemeErrorDetails,
|
|
695
|
+
isSkillMarketplaceState,
|
|
696
|
+
isSkillMutationRequest,
|
|
697
|
+
isSkillMutationResult,
|
|
698
|
+
isSkillPublishableResult,
|
|
699
|
+
isSkillReconcileResult,
|
|
506
700
|
isSystemHelloResult,
|
|
507
701
|
isSystemPingResult,
|
|
508
702
|
isSystemShutdownResult,
|
package/package.json
CHANGED