@serviceme/devtools-protocol 0.1.4 → 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 +223 -4
- package/dist/index.d.ts +223 -4
- package/dist/index.js +252 -47
- package/dist/index.mjs +242 -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") {
|
|
@@ -203,23 +387,24 @@ var KNOWN_ENVIRONMENT_TOOLS = [
|
|
|
203
387
|
"pnpm",
|
|
204
388
|
"nvm",
|
|
205
389
|
"nrm",
|
|
390
|
+
"rtk",
|
|
206
391
|
"dotnet",
|
|
207
392
|
"nuget"
|
|
208
393
|
];
|
|
209
|
-
function
|
|
394
|
+
function isRecord6(value) {
|
|
210
395
|
return typeof value === "object" && value !== null;
|
|
211
396
|
}
|
|
212
397
|
function isKnownEnvironmentTool(value) {
|
|
213
398
|
return KNOWN_ENVIRONMENT_TOOLS.includes(value);
|
|
214
399
|
}
|
|
215
400
|
function isToolCheckResult(value) {
|
|
216
|
-
if (!
|
|
401
|
+
if (!isRecord6(value)) {
|
|
217
402
|
return false;
|
|
218
403
|
}
|
|
219
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");
|
|
220
405
|
}
|
|
221
406
|
function isEnvironmentCheckResult(value) {
|
|
222
|
-
if (!
|
|
407
|
+
if (!isRecord6(value)) {
|
|
223
408
|
return false;
|
|
224
409
|
}
|
|
225
410
|
return KNOWN_ENVIRONMENT_TOOLS.every(
|
|
@@ -268,14 +453,14 @@ var RETRYABLE_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
268
453
|
"executor_timeout",
|
|
269
454
|
"internal_error"
|
|
270
455
|
]);
|
|
271
|
-
function
|
|
456
|
+
function isRecord7(value) {
|
|
272
457
|
return typeof value === "object" && value !== null;
|
|
273
458
|
}
|
|
274
459
|
function isServicemeErrorCode(value) {
|
|
275
460
|
return typeof value === "string" && SERVICEME_ERROR_CODES.includes(value);
|
|
276
461
|
}
|
|
277
462
|
function isServicemeErrorDetails(value) {
|
|
278
|
-
if (!
|
|
463
|
+
if (!isRecord7(value)) {
|
|
279
464
|
return false;
|
|
280
465
|
}
|
|
281
466
|
return isServicemeErrorCode(value.code) && typeof value.message === "string" && typeof value.retryable === "boolean";
|
|
@@ -315,7 +500,7 @@ function normalizeServicemeError(error, fallbackCode = "internal_error") {
|
|
|
315
500
|
if (isServicemeErrorDetails(error)) {
|
|
316
501
|
return error;
|
|
317
502
|
}
|
|
318
|
-
if (
|
|
503
|
+
if (isRecord7(error)) {
|
|
319
504
|
const code = isServicemeErrorCode(error.code) ? error.code : fallbackCode;
|
|
320
505
|
const message = typeof error.message === "string" ? error.message : "Unexpected serviceme error.";
|
|
321
506
|
const retryable = typeof error.retryable === "boolean" ? error.retryable : isRetryableErrorCode(code);
|
|
@@ -346,32 +531,32 @@ var SERVICEME_IMAGE_FORMATS = [
|
|
|
346
531
|
"png",
|
|
347
532
|
"webp"
|
|
348
533
|
];
|
|
349
|
-
function
|
|
534
|
+
function isRecord8(value) {
|
|
350
535
|
return typeof value === "object" && value !== null;
|
|
351
536
|
}
|
|
352
537
|
function isServiceMeImageFormat(value) {
|
|
353
538
|
return typeof value === "string" && SERVICEME_IMAGE_FORMATS.includes(value);
|
|
354
539
|
}
|
|
355
540
|
function isServiceMeImageCompressOptions(value) {
|
|
356
|
-
if (!
|
|
541
|
+
if (!isRecord8(value)) {
|
|
357
542
|
return false;
|
|
358
543
|
}
|
|
359
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");
|
|
360
545
|
}
|
|
361
546
|
function isServiceMeImageCompressResult(value) {
|
|
362
|
-
if (!
|
|
547
|
+
if (!isRecord8(value)) {
|
|
363
548
|
return false;
|
|
364
549
|
}
|
|
365
550
|
return typeof value.originalSize === "number" && typeof value.compressedSize === "number" && typeof value.compressionRatio === "number" && typeof value.outputPath === "string";
|
|
366
551
|
}
|
|
367
552
|
function isServiceMeImageInfo(value) {
|
|
368
|
-
if (!
|
|
553
|
+
if (!isRecord8(value)) {
|
|
369
554
|
return false;
|
|
370
555
|
}
|
|
371
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");
|
|
372
557
|
}
|
|
373
558
|
function isServiceMeImageValidationResult(value) {
|
|
374
|
-
return
|
|
559
|
+
return isRecord8(value) && typeof value.valid === "boolean";
|
|
375
560
|
}
|
|
376
561
|
|
|
377
562
|
// src/json.ts
|
|
@@ -390,7 +575,7 @@ var DEFAULT_JSON_SORT_OPTIONS = {
|
|
|
390
575
|
sortOrder: "asc",
|
|
391
576
|
sortAlgo: "default"
|
|
392
577
|
};
|
|
393
|
-
function
|
|
578
|
+
function isRecord9(value) {
|
|
394
579
|
return typeof value === "object" && value !== null;
|
|
395
580
|
}
|
|
396
581
|
function isJsonSortAlgorithm(value) {
|
|
@@ -400,18 +585,18 @@ function isJsonSortOrder(value) {
|
|
|
400
585
|
return typeof value === "string" && JSON_SORT_ORDERS.includes(value);
|
|
401
586
|
}
|
|
402
587
|
function isJsonSortOptions(value) {
|
|
403
|
-
return
|
|
588
|
+
return isRecord9(value) && isJsonSortOrder(value.sortOrder) && isJsonSortAlgorithm(value.sortAlgo);
|
|
404
589
|
}
|
|
405
590
|
function isJsonValidationResult(value) {
|
|
406
|
-
return
|
|
591
|
+
return isRecord9(value) && typeof value.valid === "boolean" && (value.error === void 0 || typeof value.error === "string");
|
|
407
592
|
}
|
|
408
593
|
function isJsonOutputResult(value) {
|
|
409
|
-
return
|
|
594
|
+
return isRecord9(value) && typeof value.output === "string";
|
|
410
595
|
}
|
|
411
596
|
|
|
412
597
|
// src/metadata.ts
|
|
413
598
|
var SERVICEME_CLI_NAME = "serviceme";
|
|
414
|
-
var SERVICEME_CLI_VERSION = "0.1.
|
|
599
|
+
var SERVICEME_CLI_VERSION = "0.1.6";
|
|
415
600
|
var SERVICEME_CLI_CAPABILITIES = {
|
|
416
601
|
bridge: true,
|
|
417
602
|
tasks: 1,
|
|
@@ -422,32 +607,32 @@ var SERVICEME_CLI_CAPABILITIES = {
|
|
|
422
607
|
};
|
|
423
608
|
|
|
424
609
|
// src/project.ts
|
|
425
|
-
function
|
|
610
|
+
function isRecord10(value) {
|
|
426
611
|
return typeof value === "object" && value !== null;
|
|
427
612
|
}
|
|
428
613
|
function isServiceMeProjectScaffoldPruneResult(value) {
|
|
429
|
-
if (!
|
|
614
|
+
if (!isRecord10(value)) {
|
|
430
615
|
return false;
|
|
431
616
|
}
|
|
432
617
|
return typeof value.applied === "boolean" && typeof value.preset === "string" && Array.isArray(value.commands) && value.commands.every((command) => typeof command === "string");
|
|
433
618
|
}
|
|
434
619
|
function isServiceMeProjectGitInitResult(value) {
|
|
435
|
-
return
|
|
620
|
+
return isRecord10(value) && typeof value.initialized === "boolean" && typeof value.command === "string";
|
|
436
621
|
}
|
|
437
622
|
function isServiceMeProjectMakeScriptsExecutableResult(value) {
|
|
438
|
-
if (!
|
|
623
|
+
if (!isRecord10(value)) {
|
|
439
624
|
return false;
|
|
440
625
|
}
|
|
441
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");
|
|
442
627
|
}
|
|
443
628
|
function isServiceMeProjectInstallDepsResult(value) {
|
|
444
|
-
return
|
|
629
|
+
return isRecord10(value) && typeof value.installed === "boolean" && typeof value.command === "string";
|
|
445
630
|
}
|
|
446
631
|
function isServiceMeProjectExtractTemplateInput(value) {
|
|
447
|
-
return
|
|
632
|
+
return isRecord10(value) && typeof value.extractedDirName === "string" && typeof value.projectFilePattern === "string";
|
|
448
633
|
}
|
|
449
634
|
function isServiceMeProjectExtractTemplateResult(value) {
|
|
450
|
-
return
|
|
635
|
+
return isRecord10(value) && typeof value.actualDirName === "string";
|
|
451
636
|
}
|
|
452
637
|
export {
|
|
453
638
|
BRIDGE_EVENTS,
|
|
@@ -470,6 +655,11 @@ export {
|
|
|
470
655
|
createServicemeError,
|
|
471
656
|
getBridgeEventParamsValidator,
|
|
472
657
|
getBridgeResultValidator,
|
|
658
|
+
isAgentMarketplaceState,
|
|
659
|
+
isAgentMutationRequest,
|
|
660
|
+
isAgentMutationResult,
|
|
661
|
+
isAgentPermissionSummary,
|
|
662
|
+
isAgentPermissionsResult,
|
|
473
663
|
isAgentSessionStatus,
|
|
474
664
|
isBridgeCapabilities,
|
|
475
665
|
isBridgeEvent,
|
|
@@ -502,6 +692,11 @@ export {
|
|
|
502
692
|
isServiceMeProjectScaffoldPruneResult,
|
|
503
693
|
isServicemeErrorCode,
|
|
504
694
|
isServicemeErrorDetails,
|
|
695
|
+
isSkillMarketplaceState,
|
|
696
|
+
isSkillMutationRequest,
|
|
697
|
+
isSkillMutationResult,
|
|
698
|
+
isSkillPublishableResult,
|
|
699
|
+
isSkillReconcileResult,
|
|
505
700
|
isSystemHelloResult,
|
|
506
701
|
isSystemPingResult,
|
|
507
702
|
isSystemShutdownResult,
|
package/package.json
CHANGED