@kybernesis/kyberagent-extension-sdk 0.1.0-alpha
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/chunk-ZDAZ7Q2A.js +1680 -0
- package/dist/chunk-ZDAZ7Q2A.js.map +1 -0
- package/dist/index-M4tx9uKW.d.ts +666 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/testing/index.d.ts +234 -0
- package/dist/testing/index.js +967 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +25 -0
|
@@ -0,0 +1,1680 @@
|
|
|
1
|
+
// ../extension-contracts/src/kernel/assignments.ts
|
|
2
|
+
import { Schema as Schema2 } from "effect";
|
|
3
|
+
|
|
4
|
+
// ../extension-contracts/src/kernel/capability-attachments.ts
|
|
5
|
+
import { Schema } from "effect";
|
|
6
|
+
var TurnCapabilityAttachmentKind = Schema.Literal(
|
|
7
|
+
"skill",
|
|
8
|
+
"connector-tool",
|
|
9
|
+
"mcp-tool",
|
|
10
|
+
"cli-tool",
|
|
11
|
+
"default-prompt"
|
|
12
|
+
);
|
|
13
|
+
var TurnCapabilityAttachmentStatus = Schema.Literal(
|
|
14
|
+
"available",
|
|
15
|
+
"active",
|
|
16
|
+
"blocked",
|
|
17
|
+
"error"
|
|
18
|
+
);
|
|
19
|
+
var TurnCapabilityAttachment = Schema.Struct({
|
|
20
|
+
attachmentId: Schema.String,
|
|
21
|
+
pluginId: Schema.String,
|
|
22
|
+
kind: TurnCapabilityAttachmentKind,
|
|
23
|
+
skillId: Schema.optional(Schema.String),
|
|
24
|
+
connectorId: Schema.optional(Schema.String),
|
|
25
|
+
actionId: Schema.optional(Schema.String),
|
|
26
|
+
mcpServerId: Schema.optional(Schema.String),
|
|
27
|
+
cliToolId: Schema.optional(Schema.String),
|
|
28
|
+
toolName: Schema.optional(Schema.String),
|
|
29
|
+
runtimeSourceId: Schema.optional(Schema.String),
|
|
30
|
+
label: Schema.String,
|
|
31
|
+
insertText: Schema.String,
|
|
32
|
+
requiresAuth: Schema.Boolean,
|
|
33
|
+
status: TurnCapabilityAttachmentStatus,
|
|
34
|
+
disabledReason: Schema.optional(Schema.String)
|
|
35
|
+
});
|
|
36
|
+
var decodeTurnCapabilityAttachment = Schema.decodeUnknownSync(TurnCapabilityAttachment);
|
|
37
|
+
var encodeTurnCapabilityAttachment = Schema.encodeSync(TurnCapabilityAttachment);
|
|
38
|
+
|
|
39
|
+
// ../extension-contracts/src/kernel/assignments.ts
|
|
40
|
+
var KernelAssignmentTargetKind = Schema2.Literal("local", "remote");
|
|
41
|
+
var KernelAssignmentScope = Schema2.Struct({
|
|
42
|
+
agentName: Schema2.String,
|
|
43
|
+
workspaceId: Schema2.optional(Schema2.String)
|
|
44
|
+
});
|
|
45
|
+
var KernelAssignedSkill = Schema2.Struct({
|
|
46
|
+
skillId: Schema2.String,
|
|
47
|
+
displayName: Schema2.String,
|
|
48
|
+
sourcePluginId: Schema2.optional(Schema2.String),
|
|
49
|
+
sourcePath: Schema2.optional(Schema2.String),
|
|
50
|
+
enabled: Schema2.Boolean,
|
|
51
|
+
pushedAtMs: Schema2.optional(Schema2.NonNegativeInt)
|
|
52
|
+
});
|
|
53
|
+
var KernelAssignedPlugin = Schema2.Struct({
|
|
54
|
+
pluginId: Schema2.String,
|
|
55
|
+
displayName: Schema2.String,
|
|
56
|
+
lifecycleState: Schema2.Literal(
|
|
57
|
+
"available",
|
|
58
|
+
"assigned",
|
|
59
|
+
"installed",
|
|
60
|
+
"active",
|
|
61
|
+
"blocked",
|
|
62
|
+
"removed",
|
|
63
|
+
"enabled",
|
|
64
|
+
"disabled",
|
|
65
|
+
"auth-required",
|
|
66
|
+
"error"
|
|
67
|
+
),
|
|
68
|
+
assignedAtMs: Schema2.optional(Schema2.NonNegativeInt),
|
|
69
|
+
autoPushSkills: Schema2.Boolean,
|
|
70
|
+
assignedSkillIds: Schema2.Array(Schema2.String)
|
|
71
|
+
});
|
|
72
|
+
var KernelComposioSecretStatus = Schema2.Struct({
|
|
73
|
+
configured: Schema2.Boolean,
|
|
74
|
+
scope: Schema2.Literal("agent", "remote-agent", "daemon"),
|
|
75
|
+
source: Schema2.optional(Schema2.String),
|
|
76
|
+
keyTail: Schema2.optional(Schema2.String),
|
|
77
|
+
fingerprint: Schema2.optional(Schema2.String),
|
|
78
|
+
checkedAtMs: Schema2.optional(Schema2.NonNegativeInt),
|
|
79
|
+
lastError: Schema2.optional(Schema2.String),
|
|
80
|
+
slots: Schema2.optional(Schema2.Array(Schema2.Struct({
|
|
81
|
+
slot: Schema2.String,
|
|
82
|
+
configured: Schema2.Boolean,
|
|
83
|
+
source: Schema2.optional(Schema2.String),
|
|
84
|
+
keyTail: Schema2.optional(Schema2.String),
|
|
85
|
+
fingerprint: Schema2.optional(Schema2.String),
|
|
86
|
+
lastError: Schema2.optional(Schema2.String),
|
|
87
|
+
checkedAtMs: Schema2.optional(Schema2.NonNegativeInt)
|
|
88
|
+
})))
|
|
89
|
+
});
|
|
90
|
+
var KernelAssignmentTarget = Schema2.Struct({
|
|
91
|
+
agentName: Schema2.String,
|
|
92
|
+
displayName: Schema2.optional(Schema2.String),
|
|
93
|
+
kind: KernelAssignmentTargetKind,
|
|
94
|
+
remoteUrl: Schema2.optional(Schema2.String),
|
|
95
|
+
workspaceIds: Schema2.Array(Schema2.String),
|
|
96
|
+
assignedSkills: Schema2.Array(KernelAssignedSkill),
|
|
97
|
+
assignedPlugins: Schema2.Array(KernelAssignedPlugin),
|
|
98
|
+
auth: Schema2.Struct({
|
|
99
|
+
composio: KernelComposioSecretStatus
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
var KernelAssignmentSummary = Schema2.Struct({
|
|
103
|
+
generatedAtMs: Schema2.NonNegativeInt,
|
|
104
|
+
targets: Schema2.Array(KernelAssignmentTarget)
|
|
105
|
+
});
|
|
106
|
+
var KernelAssignmentPatch = Schema2.Struct({
|
|
107
|
+
workspaceId: Schema2.optional(Schema2.String),
|
|
108
|
+
assignedSkillIds: Schema2.optional(Schema2.Array(Schema2.String)),
|
|
109
|
+
assignedPluginIds: Schema2.optional(Schema2.Array(Schema2.String))
|
|
110
|
+
});
|
|
111
|
+
var KernelCapabilityManagedBy = Schema2.Literal("kyberagent-daemon");
|
|
112
|
+
var KernelCapabilityLifecycleStatus = Schema2.Literal(
|
|
113
|
+
"available",
|
|
114
|
+
"pushed",
|
|
115
|
+
"deps-installed",
|
|
116
|
+
"configured",
|
|
117
|
+
"active",
|
|
118
|
+
"blocked",
|
|
119
|
+
"error",
|
|
120
|
+
"removed"
|
|
121
|
+
);
|
|
122
|
+
var KernelCapabilityManifestSkill = Schema2.Struct({
|
|
123
|
+
skillId: Schema2.String,
|
|
124
|
+
displayName: Schema2.String,
|
|
125
|
+
sourcePluginId: Schema2.optional(Schema2.String),
|
|
126
|
+
sourceMarketplace: Schema2.optional(Schema2.String),
|
|
127
|
+
sourcePath: Schema2.optional(Schema2.String),
|
|
128
|
+
filesystemPath: Schema2.optional(Schema2.String),
|
|
129
|
+
managedBy: KernelCapabilityManagedBy,
|
|
130
|
+
pushedAtMs: Schema2.NonNegativeInt
|
|
131
|
+
});
|
|
132
|
+
var KernelCapabilityManifestPlugin = Schema2.Struct({
|
|
133
|
+
pluginId: Schema2.String,
|
|
134
|
+
displayName: Schema2.String,
|
|
135
|
+
version: Schema2.optional(Schema2.String),
|
|
136
|
+
sourceMarketplace: Schema2.optional(Schema2.String),
|
|
137
|
+
sourcePath: Schema2.optional(Schema2.String),
|
|
138
|
+
filesystemPath: Schema2.optional(Schema2.String),
|
|
139
|
+
managedBy: KernelCapabilityManagedBy,
|
|
140
|
+
status: KernelCapabilityLifecycleStatus,
|
|
141
|
+
assignedSkillIds: Schema2.Array(Schema2.String),
|
|
142
|
+
pushedAtMs: Schema2.optional(Schema2.NonNegativeInt),
|
|
143
|
+
activatedAtMs: Schema2.optional(Schema2.NonNegativeInt)
|
|
144
|
+
});
|
|
145
|
+
var KernelCapabilityManifestMcpServer = Schema2.Struct({
|
|
146
|
+
serverId: Schema2.String,
|
|
147
|
+
pluginId: Schema2.String,
|
|
148
|
+
runtimeSourceId: Schema2.optional(Schema2.String),
|
|
149
|
+
status: KernelCapabilityLifecycleStatus,
|
|
150
|
+
configPath: Schema2.optional(Schema2.String),
|
|
151
|
+
toolCount: Schema2.optional(Schema2.NonNegativeInt),
|
|
152
|
+
tools: Schema2.optional(Schema2.Array(Schema2.Struct({
|
|
153
|
+
toolName: Schema2.String,
|
|
154
|
+
slug: Schema2.String,
|
|
155
|
+
description: Schema2.optional(Schema2.String),
|
|
156
|
+
readOnly: Schema2.Boolean,
|
|
157
|
+
sandboxRequired: Schema2.Boolean
|
|
158
|
+
}))),
|
|
159
|
+
managedBy: KernelCapabilityManagedBy,
|
|
160
|
+
updatedAtMs: Schema2.NonNegativeInt
|
|
161
|
+
});
|
|
162
|
+
var KernelCapabilityManifestCliTool = Schema2.Struct({
|
|
163
|
+
toolId: Schema2.String,
|
|
164
|
+
pluginId: Schema2.String,
|
|
165
|
+
runtimeSourceId: Schema2.optional(Schema2.String),
|
|
166
|
+
command: Schema2.optional(Schema2.String),
|
|
167
|
+
args: Schema2.optional(Schema2.Array(Schema2.String)),
|
|
168
|
+
packageName: Schema2.optional(Schema2.String),
|
|
169
|
+
binName: Schema2.optional(Schema2.String),
|
|
170
|
+
status: KernelCapabilityLifecycleStatus,
|
|
171
|
+
managedBy: KernelCapabilityManagedBy,
|
|
172
|
+
updatedAtMs: Schema2.NonNegativeInt
|
|
173
|
+
});
|
|
174
|
+
var KernelCapabilityManifestApp = Schema2.Struct({
|
|
175
|
+
appId: Schema2.String,
|
|
176
|
+
pluginId: Schema2.String,
|
|
177
|
+
runtimeSourceId: Schema2.optional(Schema2.String),
|
|
178
|
+
status: KernelCapabilityLifecycleStatus,
|
|
179
|
+
connectorId: Schema2.optional(Schema2.String),
|
|
180
|
+
connectedAccountId: Schema2.optional(Schema2.String),
|
|
181
|
+
userId: Schema2.optional(Schema2.String),
|
|
182
|
+
accountLabel: Schema2.optional(Schema2.String),
|
|
183
|
+
toolCount: Schema2.optional(Schema2.NonNegativeInt),
|
|
184
|
+
tools: Schema2.optional(Schema2.Array(Schema2.Struct({
|
|
185
|
+
toolName: Schema2.String,
|
|
186
|
+
slug: Schema2.String,
|
|
187
|
+
description: Schema2.optional(Schema2.String),
|
|
188
|
+
readOnly: Schema2.Boolean,
|
|
189
|
+
sandboxRequired: Schema2.Boolean
|
|
190
|
+
}))),
|
|
191
|
+
managedBy: KernelCapabilityManagedBy,
|
|
192
|
+
updatedAtMs: Schema2.NonNegativeInt
|
|
193
|
+
});
|
|
194
|
+
var KernelCapabilityManifestClientConfig = Schema2.Struct({
|
|
195
|
+
clientId: Schema2.String,
|
|
196
|
+
pluginId: Schema2.String,
|
|
197
|
+
configPath: Schema2.String,
|
|
198
|
+
status: KernelCapabilityLifecycleStatus,
|
|
199
|
+
managedBy: KernelCapabilityManagedBy,
|
|
200
|
+
updatedAtMs: Schema2.NonNegativeInt
|
|
201
|
+
});
|
|
202
|
+
var KernelCapabilityManifest = Schema2.Struct({
|
|
203
|
+
version: Schema2.Literal(1),
|
|
204
|
+
generatedAtMs: Schema2.NonNegativeInt,
|
|
205
|
+
skills: Schema2.Array(KernelCapabilityManifestSkill),
|
|
206
|
+
plugins: Schema2.Array(KernelCapabilityManifestPlugin),
|
|
207
|
+
mcpServers: Schema2.Array(KernelCapabilityManifestMcpServer),
|
|
208
|
+
cliTools: Schema2.Array(KernelCapabilityManifestCliTool),
|
|
209
|
+
apps: Schema2.Array(KernelCapabilityManifestApp),
|
|
210
|
+
clientConfigs: Schema2.Array(KernelCapabilityManifestClientConfig)
|
|
211
|
+
});
|
|
212
|
+
var KernelPluginLifecycleInstallLogStatus = Schema2.Literal(
|
|
213
|
+
"pending",
|
|
214
|
+
"complete",
|
|
215
|
+
"blocked",
|
|
216
|
+
"error",
|
|
217
|
+
"skipped"
|
|
218
|
+
);
|
|
219
|
+
var KernelPluginLifecycleInstallLogEntry = Schema2.Struct({
|
|
220
|
+
stepId: Schema2.String,
|
|
221
|
+
status: KernelPluginLifecycleInstallLogStatus,
|
|
222
|
+
message: Schema2.String,
|
|
223
|
+
timestampMs: Schema2.NonNegativeInt,
|
|
224
|
+
touchedPaths: Schema2.Array(Schema2.String)
|
|
225
|
+
});
|
|
226
|
+
var KernelPluginLifecycleTargetState = Schema2.Struct({
|
|
227
|
+
agentName: Schema2.String,
|
|
228
|
+
displayName: Schema2.optional(Schema2.String),
|
|
229
|
+
kind: KernelAssignmentTargetKind,
|
|
230
|
+
remoteUrl: Schema2.optional(Schema2.String),
|
|
231
|
+
status: KernelCapabilityLifecycleStatus,
|
|
232
|
+
assignedSkillIds: Schema2.Array(Schema2.String),
|
|
233
|
+
mcpServers: Schema2.Array(Schema2.String),
|
|
234
|
+
cliTools: Schema2.Array(Schema2.String),
|
|
235
|
+
apps: Schema2.Array(Schema2.String),
|
|
236
|
+
diagnostics: Schema2.Array(Schema2.String),
|
|
237
|
+
pushedAtMs: Schema2.optional(Schema2.NonNegativeInt),
|
|
238
|
+
activatedAtMs: Schema2.optional(Schema2.NonNegativeInt)
|
|
239
|
+
});
|
|
240
|
+
var KernelPluginLifecycleOperation = Schema2.Literal(
|
|
241
|
+
"push",
|
|
242
|
+
"activate",
|
|
243
|
+
"disable",
|
|
244
|
+
"delete",
|
|
245
|
+
"repair"
|
|
246
|
+
);
|
|
247
|
+
var KernelPluginLifecycleOperationRequest = Schema2.Struct({
|
|
248
|
+
targets: Schema2.optional(Schema2.Array(Schema2.String)),
|
|
249
|
+
agent: Schema2.optional(Schema2.String),
|
|
250
|
+
installDependencies: Schema2.optional(Schema2.Boolean),
|
|
251
|
+
writeClientConfigs: Schema2.optional(Schema2.Boolean)
|
|
252
|
+
});
|
|
253
|
+
var KernelPluginLifecycleOperationTargetResult = Schema2.Struct({
|
|
254
|
+
agentName: Schema2.String,
|
|
255
|
+
kind: KernelAssignmentTargetKind,
|
|
256
|
+
ok: Schema2.Boolean,
|
|
257
|
+
status: KernelCapabilityLifecycleStatus,
|
|
258
|
+
diagnostics: Schema2.Array(Schema2.String),
|
|
259
|
+
touchedPaths: Schema2.Array(Schema2.String),
|
|
260
|
+
remote: Schema2.optional(Schema2.Boolean)
|
|
261
|
+
});
|
|
262
|
+
var KernelPluginLifecycleOperationResult = Schema2.Struct({
|
|
263
|
+
pluginId: Schema2.String,
|
|
264
|
+
operation: KernelPluginLifecycleOperation,
|
|
265
|
+
results: Schema2.Array(KernelPluginLifecycleOperationTargetResult)
|
|
266
|
+
});
|
|
267
|
+
var KernelComposerCapabilitySuggestion = Schema2.Struct({
|
|
268
|
+
id: Schema2.String,
|
|
269
|
+
kind: Schema2.Literal("skill", "connector-tool", "mcp-tool", "cli-tool", "default-prompt"),
|
|
270
|
+
label: Schema2.String,
|
|
271
|
+
description: Schema2.optional(Schema2.String),
|
|
272
|
+
pluginId: Schema2.optional(Schema2.String),
|
|
273
|
+
skillId: Schema2.optional(Schema2.String),
|
|
274
|
+
actionId: Schema2.optional(Schema2.String),
|
|
275
|
+
connectorId: Schema2.optional(Schema2.String),
|
|
276
|
+
mcpServerId: Schema2.optional(Schema2.String),
|
|
277
|
+
cliToolId: Schema2.optional(Schema2.String),
|
|
278
|
+
toolName: Schema2.optional(Schema2.String),
|
|
279
|
+
runtimeSourceId: Schema2.optional(Schema2.String),
|
|
280
|
+
insertText: Schema2.String,
|
|
281
|
+
confidence: Schema2.optional(Schema2.Number),
|
|
282
|
+
matchedKeywords: Schema2.optional(Schema2.Array(Schema2.String)),
|
|
283
|
+
requiresAuth: Schema2.Boolean,
|
|
284
|
+
unavailableReason: Schema2.optional(Schema2.String),
|
|
285
|
+
attachment: Schema2.optional(TurnCapabilityAttachment)
|
|
286
|
+
});
|
|
287
|
+
var KernelComposerCapabilitySearchResponse = Schema2.Struct({
|
|
288
|
+
agentName: Schema2.String,
|
|
289
|
+
workspaceId: Schema2.optional(Schema2.String),
|
|
290
|
+
query: Schema2.String,
|
|
291
|
+
suggestions: Schema2.Array(KernelComposerCapabilitySuggestion)
|
|
292
|
+
});
|
|
293
|
+
var decodeKernelAssignmentSummary = Schema2.decodeUnknownSync(KernelAssignmentSummary);
|
|
294
|
+
var encodeKernelAssignmentSummary = Schema2.encodeSync(KernelAssignmentSummary);
|
|
295
|
+
var decodeKernelAssignmentPatch = Schema2.decodeUnknownSync(KernelAssignmentPatch);
|
|
296
|
+
var decodeKernelPluginLifecycleOperationRequest = Schema2.decodeUnknownSync(
|
|
297
|
+
KernelPluginLifecycleOperationRequest
|
|
298
|
+
);
|
|
299
|
+
var encodeKernelPluginLifecycleOperationResult = Schema2.encodeSync(
|
|
300
|
+
KernelPluginLifecycleOperationResult
|
|
301
|
+
);
|
|
302
|
+
var decodeKernelComposerCapabilitySearchResponse = Schema2.decodeUnknownSync(
|
|
303
|
+
KernelComposerCapabilitySearchResponse
|
|
304
|
+
);
|
|
305
|
+
var encodeKernelComposerCapabilitySearchResponse = Schema2.encodeSync(
|
|
306
|
+
KernelComposerCapabilitySearchResponse
|
|
307
|
+
);
|
|
308
|
+
|
|
309
|
+
// ../extension-contracts/src/kernel/ecosystem.ts
|
|
310
|
+
import { Schema as Schema3 } from "effect";
|
|
311
|
+
var EcoAddonExtensionClass = Schema3.Literal("kyberagent-native", "kyberagent-hybrid", "codex-derived");
|
|
312
|
+
var EcoAddonStatus = Schema3.Literal("available", "installed", "ready", "authRequired", "disabled", "failed");
|
|
313
|
+
var EcoAddonPrimaryAction = Schema3.Literal("add", "remove", "ready", "configure");
|
|
314
|
+
var EcoAddonSourceScope = Schema3.Literal("desktop-bootstrap", "marketplace", "local-daemon", "remote-daemon", "bundled");
|
|
315
|
+
var PluginRuntimeSourceKind = Schema3.Literal("api", "mcp", "cli", "composio", "codex-apps", "sidecar");
|
|
316
|
+
var ProviderRuntimeProjectionTarget = Schema3.Literal("direct-api", "codex-app-server", "claude-agent-sdk", "pi-agent-core");
|
|
317
|
+
var ProviderRuntimeProjectionSurface = Schema3.Literal(
|
|
318
|
+
"tool-schema",
|
|
319
|
+
"dynamic-tool",
|
|
320
|
+
"mcp-server",
|
|
321
|
+
"skill-context",
|
|
322
|
+
"host-surface"
|
|
323
|
+
);
|
|
324
|
+
var ProviderRuntimeProjectionDescriptor = Schema3.Struct({
|
|
325
|
+
target: ProviderRuntimeProjectionTarget,
|
|
326
|
+
surface: ProviderRuntimeProjectionSurface,
|
|
327
|
+
runtimeSourceId: Schema3.optional(Schema3.String),
|
|
328
|
+
namespace: Schema3.optional(Schema3.String),
|
|
329
|
+
toolIds: Schema3.optional(Schema3.Array(Schema3.String)),
|
|
330
|
+
alwaysLoad: Schema3.optional(Schema3.Boolean),
|
|
331
|
+
notes: Schema3.optional(Schema3.Array(Schema3.String))
|
|
332
|
+
});
|
|
333
|
+
var PluginRuntimeSourceDescriptor = Schema3.Struct({
|
|
334
|
+
kind: PluginRuntimeSourceKind,
|
|
335
|
+
id: Schema3.String,
|
|
336
|
+
label: Schema3.String,
|
|
337
|
+
entrypoint: Schema3.optional(Schema3.String),
|
|
338
|
+
authRequired: Schema3.optional(Schema3.Boolean),
|
|
339
|
+
providerProjections: Schema3.optional(Schema3.Array(ProviderRuntimeProjectionDescriptor))
|
|
340
|
+
});
|
|
341
|
+
var EcoAddonTargetInstallStatus = Schema3.Literal("not-installed", "installing", "installed", "active", "blocked", "failed");
|
|
342
|
+
var EcoAddonInstallTargetState = Schema3.Struct({
|
|
343
|
+
agentKey: Schema3.String,
|
|
344
|
+
kind: Schema3.Literal("local", "remote"),
|
|
345
|
+
status: EcoAddonTargetInstallStatus,
|
|
346
|
+
daemonConfirmed: Schema3.Boolean,
|
|
347
|
+
threadUsable: Schema3.optional(Schema3.Boolean),
|
|
348
|
+
threadReadinessReason: Schema3.optional(Schema3.String),
|
|
349
|
+
remoteUrl: Schema3.optional(Schema3.String),
|
|
350
|
+
installedAtMs: Schema3.optional(Schema3.NonNegativeInt),
|
|
351
|
+
activatedAtMs: Schema3.optional(Schema3.NonNegativeInt),
|
|
352
|
+
reason: Schema3.optional(Schema3.String)
|
|
353
|
+
});
|
|
354
|
+
var EcoAddonActivationApp = Schema3.Struct({
|
|
355
|
+
appId: Schema3.String,
|
|
356
|
+
name: Schema3.String,
|
|
357
|
+
needsAuth: Schema3.Boolean,
|
|
358
|
+
tools: Schema3.Array(Schema3.String),
|
|
359
|
+
externalAppId: Schema3.optional(Schema3.String),
|
|
360
|
+
externalAppKind: Schema3.optional(Schema3.Literal("codex-connector", "codex-app-sdk", "unknown")),
|
|
361
|
+
replacementRuntimeRequired: Schema3.optional(Schema3.Boolean),
|
|
362
|
+
runtimeStatusReason: Schema3.optional(Schema3.String)
|
|
363
|
+
});
|
|
364
|
+
var EcoAddonActivationState = Schema3.Struct({
|
|
365
|
+
addonId: Schema3.String,
|
|
366
|
+
pluginName: Schema3.String,
|
|
367
|
+
scope: Schema3.String,
|
|
368
|
+
status: EcoAddonStatus,
|
|
369
|
+
ready: Schema3.Boolean,
|
|
370
|
+
installed: Schema3.Boolean,
|
|
371
|
+
enabled: Schema3.Boolean,
|
|
372
|
+
authRequired: Schema3.Boolean,
|
|
373
|
+
apps: Schema3.Array(EcoAddonActivationApp),
|
|
374
|
+
diagnostics: Schema3.Array(Schema3.String),
|
|
375
|
+
refreshedAt: Schema3.String
|
|
376
|
+
});
|
|
377
|
+
var KernelEcoAddon = Schema3.Struct({
|
|
378
|
+
addonId: Schema3.String,
|
|
379
|
+
pluginId: Schema3.String,
|
|
380
|
+
displayName: Schema3.String,
|
|
381
|
+
version: Schema3.String,
|
|
382
|
+
kind: Schema3.Literal("kyberagent-plugin", "composio-connector", "mcp-server", "skill-pack"),
|
|
383
|
+
provenance: EcoAddonExtensionClass,
|
|
384
|
+
extensionClass: EcoAddonExtensionClass,
|
|
385
|
+
sourceLabel: Schema3.String,
|
|
386
|
+
source: Schema3.String,
|
|
387
|
+
sourceScope: EcoAddonSourceScope,
|
|
388
|
+
uiPronounced: Schema3.Boolean,
|
|
389
|
+
enabled: Schema3.Boolean,
|
|
390
|
+
dependencyFlags: Schema3.Array(Schema3.String),
|
|
391
|
+
hostAffordances: Schema3.Array(Schema3.String),
|
|
392
|
+
skills: Schema3.Array(Schema3.String),
|
|
393
|
+
apps: Schema3.Array(EcoAddonActivationApp),
|
|
394
|
+
mcpServers: Schema3.Array(Schema3.String),
|
|
395
|
+
hooks: Schema3.Array(Schema3.String),
|
|
396
|
+
defaultPrompts: Schema3.Array(Schema3.String),
|
|
397
|
+
capabilities: Schema3.Array(Schema3.String),
|
|
398
|
+
sidecarRuntimes: Schema3.Array(Schema3.String),
|
|
399
|
+
permissions: Schema3.Array(Schema3.String),
|
|
400
|
+
runtimeSources: Schema3.optional(Schema3.Array(PluginRuntimeSourceDescriptor))
|
|
401
|
+
});
|
|
402
|
+
var EcoAddonCardSummary = Schema3.Struct({
|
|
403
|
+
addon: KernelEcoAddon,
|
|
404
|
+
state: EcoAddonActivationState,
|
|
405
|
+
description: Schema3.optional(Schema3.String),
|
|
406
|
+
developerName: Schema3.optional(Schema3.String),
|
|
407
|
+
marketplaceName: Schema3.optional(Schema3.String),
|
|
408
|
+
capabilityLabels: Schema3.Array(Schema3.String),
|
|
409
|
+
primaryAction: EcoAddonPrimaryAction,
|
|
410
|
+
capabilityShape: Schema3.Literal("connector-plus-skills", "connector-only", "skills-only", "mcp-server", "sidecar-helper", "mixed"),
|
|
411
|
+
runtimeSource: Schema3.Literal("kyberagent", "composio", "codex-apps", "mcp"),
|
|
412
|
+
toolCoverageCount: Schema3.NonNegativeInt,
|
|
413
|
+
provenance: EcoAddonExtensionClass,
|
|
414
|
+
extensionClass: EcoAddonExtensionClass,
|
|
415
|
+
sourceLabel: Schema3.String,
|
|
416
|
+
dependencyFlags: Schema3.Array(Schema3.String),
|
|
417
|
+
hostAffordances: Schema3.Array(Schema3.String),
|
|
418
|
+
parityGaps: Schema3.Array(Schema3.String),
|
|
419
|
+
installStateByTarget: Schema3.Array(EcoAddonInstallTargetState)
|
|
420
|
+
});
|
|
421
|
+
var EcoAddonInstallStep = Schema3.Struct({
|
|
422
|
+
stepId: Schema3.String,
|
|
423
|
+
kind: Schema3.Literal("plugin-install", "app-connect", "skill-config", "mcp-auth", "sidecar-grant", "ui-promotion"),
|
|
424
|
+
label: Schema3.String,
|
|
425
|
+
description: Schema3.String,
|
|
426
|
+
status: Schema3.Literal("pending", "complete", "blocked", "optional"),
|
|
427
|
+
actionLabel: Schema3.optional(Schema3.String),
|
|
428
|
+
targetId: Schema3.optional(Schema3.String)
|
|
429
|
+
});
|
|
430
|
+
var EcoAddonInstallPlan = Schema3.Struct({
|
|
431
|
+
addonId: Schema3.String,
|
|
432
|
+
title: Schema3.String,
|
|
433
|
+
steps: Schema3.Array(EcoAddonInstallStep),
|
|
434
|
+
blocked: Schema3.Boolean
|
|
435
|
+
});
|
|
436
|
+
var CapabilityPluginCatalogEntry = Schema3.Struct({
|
|
437
|
+
pluginId: Schema3.String,
|
|
438
|
+
name: Schema3.String,
|
|
439
|
+
description: Schema3.optional(Schema3.String),
|
|
440
|
+
kind: Schema3.Literal("kyberagent-plugin", "composio-connector", "codex-derived-plugin", "mcp"),
|
|
441
|
+
status: Schema3.String,
|
|
442
|
+
requiresAuth: Schema3.Boolean,
|
|
443
|
+
toolCount: Schema3.NonNegativeInt,
|
|
444
|
+
providesSkillTemplates: Schema3.Boolean
|
|
445
|
+
});
|
|
446
|
+
var CapabilitySkillInstallTarget = Schema3.Struct({
|
|
447
|
+
agentKey: Schema3.String,
|
|
448
|
+
kind: Schema3.optional(Schema3.Literal("local", "remote")),
|
|
449
|
+
installed: Schema3.Boolean,
|
|
450
|
+
ready: Schema3.Boolean,
|
|
451
|
+
status: Schema3.Literal("installed", "not-installed", "blocked"),
|
|
452
|
+
daemonConfirmed: Schema3.optional(Schema3.Boolean),
|
|
453
|
+
remoteUrl: Schema3.optional(Schema3.String),
|
|
454
|
+
reason: Schema3.optional(Schema3.String)
|
|
455
|
+
});
|
|
456
|
+
var CapabilitySkillCatalogEntry = Schema3.Struct({
|
|
457
|
+
skillId: Schema3.String,
|
|
458
|
+
name: Schema3.String,
|
|
459
|
+
description: Schema3.optional(Schema3.String),
|
|
460
|
+
provenance: Schema3.Literal("bundled-with-plugin", "bundled-with-extension", "standalone", "daemon-existing", "remote-existing"),
|
|
461
|
+
sourcePluginId: Schema3.optional(Schema3.String),
|
|
462
|
+
sourceExtensionId: Schema3.optional(Schema3.String),
|
|
463
|
+
requiresConnectors: Schema3.Array(Schema3.String),
|
|
464
|
+
requiresEnv: Schema3.Array(Schema3.String),
|
|
465
|
+
installTargets: Schema3.Array(CapabilitySkillInstallTarget)
|
|
466
|
+
});
|
|
467
|
+
var ConnectorCatalogEntry = Schema3.Struct({
|
|
468
|
+
connectorId: Schema3.String,
|
|
469
|
+
name: Schema3.String,
|
|
470
|
+
description: Schema3.optional(Schema3.String),
|
|
471
|
+
status: Schema3.Literal("available", "connected", "unavailable"),
|
|
472
|
+
binding: Schema3.Struct({
|
|
473
|
+
status: Schema3.Literal("available", "connected", "auth-required", "unavailable")
|
|
474
|
+
}),
|
|
475
|
+
tools: Schema3.Array(
|
|
476
|
+
Schema3.Struct({
|
|
477
|
+
toolName: Schema3.String,
|
|
478
|
+
description: Schema3.optional(Schema3.String)
|
|
479
|
+
})
|
|
480
|
+
)
|
|
481
|
+
});
|
|
482
|
+
var ComposioSettingsState = Schema3.Struct({
|
|
483
|
+
configured: Schema3.Boolean,
|
|
484
|
+
source: Schema3.String,
|
|
485
|
+
apiKeyRedacted: Schema3.optional(Schema3.String),
|
|
486
|
+
status: KernelComposioSecretStatus
|
|
487
|
+
});
|
|
488
|
+
var MarketplaceTrust = Schema3.Literal("official", "trusted", "restricted");
|
|
489
|
+
var PluginMarketplace = Schema3.Struct({
|
|
490
|
+
id: Schema3.String,
|
|
491
|
+
url: Schema3.String,
|
|
492
|
+
trust: MarketplaceTrust,
|
|
493
|
+
name: Schema3.String,
|
|
494
|
+
version: Schema3.optional(Schema3.String),
|
|
495
|
+
pluginCount: Schema3.NonNegativeInt,
|
|
496
|
+
refreshedAtMs: Schema3.optional(Schema3.NonNegativeInt)
|
|
497
|
+
});
|
|
498
|
+
var EcoAddonSkillConfigWriteRequest = Schema3.Struct({
|
|
499
|
+
skillId: Schema3.String,
|
|
500
|
+
agentKeys: Schema3.Array(Schema3.String),
|
|
501
|
+
action: Schema3.Literal("install", "remove"),
|
|
502
|
+
overwrite: Schema3.optional(Schema3.Boolean)
|
|
503
|
+
});
|
|
504
|
+
var EcoAddonTargetMutationRequest = Schema3.Struct({
|
|
505
|
+
addonId: Schema3.String,
|
|
506
|
+
targets: Schema3.optional(Schema3.Array(Schema3.String)),
|
|
507
|
+
agent: Schema3.optional(Schema3.String),
|
|
508
|
+
installSkills: Schema3.optional(Schema3.Boolean),
|
|
509
|
+
overwrite: Schema3.optional(Schema3.Boolean)
|
|
510
|
+
});
|
|
511
|
+
var decodeEcoAddonCardSummary = Schema3.decodeUnknownSync(EcoAddonCardSummary);
|
|
512
|
+
var decodeEcoAddonSkillConfigWriteRequest = Schema3.decodeUnknownSync(EcoAddonSkillConfigWriteRequest);
|
|
513
|
+
var decodeEcoAddonTargetMutationRequest = Schema3.decodeUnknownSync(EcoAddonTargetMutationRequest);
|
|
514
|
+
|
|
515
|
+
// ../extension-contracts/src/kernel/registry.ts
|
|
516
|
+
import { Schema as Schema5 } from "effect";
|
|
517
|
+
|
|
518
|
+
// ../extension-contracts/src/host/capabilities.ts
|
|
519
|
+
import { Schema as Schema4 } from "effect";
|
|
520
|
+
var HostKind = Schema4.Literal("desktop", "web", "cli", "sidecar", "bridge");
|
|
521
|
+
var HostCapabilityId = Schema4.Literal(
|
|
522
|
+
"host.windows",
|
|
523
|
+
"host.tray",
|
|
524
|
+
"host.notifications",
|
|
525
|
+
"host.embeddedViews",
|
|
526
|
+
"host.filePicker",
|
|
527
|
+
"host.localShell",
|
|
528
|
+
"host.secretPrompt",
|
|
529
|
+
"host.visualSelection",
|
|
530
|
+
"host.localFilesystem",
|
|
531
|
+
"host.terminal",
|
|
532
|
+
"host.globalInput",
|
|
533
|
+
"host.contextMenus",
|
|
534
|
+
"host.accessibility"
|
|
535
|
+
);
|
|
536
|
+
var HostIdentity = Schema4.Struct({
|
|
537
|
+
hostId: Schema4.String,
|
|
538
|
+
kind: HostKind,
|
|
539
|
+
displayName: Schema4.String
|
|
540
|
+
});
|
|
541
|
+
var HostRegistrationRequest = Schema4.Struct({
|
|
542
|
+
host: HostIdentity,
|
|
543
|
+
capabilities: Schema4.Array(HostCapabilityId),
|
|
544
|
+
heartbeatIntervalMs: Schema4.NonNegativeInt,
|
|
545
|
+
observedAtMs: Schema4.NonNegativeInt
|
|
546
|
+
});
|
|
547
|
+
var HostHeartbeatRequest = Schema4.Struct({
|
|
548
|
+
hostId: Schema4.String,
|
|
549
|
+
observedAtMs: Schema4.NonNegativeInt
|
|
550
|
+
});
|
|
551
|
+
var RegisteredHost = Schema4.Struct({
|
|
552
|
+
host: HostIdentity,
|
|
553
|
+
capabilities: Schema4.Array(HostCapabilityId),
|
|
554
|
+
heartbeatIntervalMs: Schema4.NonNegativeInt,
|
|
555
|
+
lastHeartbeatAtMs: Schema4.NonNegativeInt
|
|
556
|
+
});
|
|
557
|
+
var SurfaceCapabilityRequirement = Schema4.Struct({
|
|
558
|
+
surfaceId: Schema4.String,
|
|
559
|
+
requiredCapabilities: Schema4.Array(HostCapabilityId)
|
|
560
|
+
});
|
|
561
|
+
var SurfaceAvailability = Schema4.Struct({
|
|
562
|
+
surfaceId: Schema4.String,
|
|
563
|
+
available: Schema4.Boolean,
|
|
564
|
+
missingCapabilities: Schema4.Array(HostCapabilityId)
|
|
565
|
+
});
|
|
566
|
+
var HostCapabilityAvailabilitySnapshot = Schema4.Struct({
|
|
567
|
+
generatedAtMs: Schema4.NonNegativeInt,
|
|
568
|
+
hosts: Schema4.Array(RegisteredHost),
|
|
569
|
+
availableCapabilities: Schema4.Array(HostCapabilityId),
|
|
570
|
+
surfaces: Schema4.Array(SurfaceAvailability)
|
|
571
|
+
});
|
|
572
|
+
var decodeHostRegistrationRequest = Schema4.decodeUnknownSync(HostRegistrationRequest);
|
|
573
|
+
var encodeHostRegistrationRequest = Schema4.encodeSync(HostRegistrationRequest);
|
|
574
|
+
var decodeHostHeartbeatRequest = Schema4.decodeUnknownSync(HostHeartbeatRequest);
|
|
575
|
+
var encodeHostHeartbeatRequest = Schema4.encodeSync(HostHeartbeatRequest);
|
|
576
|
+
var decodeHostCapabilityAvailabilitySnapshot = Schema4.decodeUnknownSync(
|
|
577
|
+
HostCapabilityAvailabilitySnapshot
|
|
578
|
+
);
|
|
579
|
+
var encodeHostCapabilityAvailabilitySnapshot = Schema4.encodeSync(
|
|
580
|
+
HostCapabilityAvailabilitySnapshot
|
|
581
|
+
);
|
|
582
|
+
|
|
583
|
+
// ../extension-contracts/src/kernel/registry.ts
|
|
584
|
+
var KernelPrincipalKind = Schema5.Literal("daemon", "host", "plugin", "skill", "sidecar", "bridge", "user");
|
|
585
|
+
var KernelPermissionId = Schema5.Literal(
|
|
586
|
+
"kernel.registry.read",
|
|
587
|
+
"plugin.lifecycle.manage",
|
|
588
|
+
"host.capabilities.read",
|
|
589
|
+
"surface.render",
|
|
590
|
+
"composer.capabilities.read",
|
|
591
|
+
"composer.capabilities.invoke",
|
|
592
|
+
"sidecars.launch",
|
|
593
|
+
"threads.read",
|
|
594
|
+
"threads.write",
|
|
595
|
+
"settings.read",
|
|
596
|
+
"settings.write",
|
|
597
|
+
"artifacts.read",
|
|
598
|
+
"artifacts.write",
|
|
599
|
+
"screenshots.capture",
|
|
600
|
+
"brain.read",
|
|
601
|
+
// A1 shared-capability layer (docs/42 #2, KYB-124): an extension may read a
|
|
602
|
+
// serialized HOST-CONTEXT snapshot (the active agent, …) over the gated seam.
|
|
603
|
+
// The host stays the capability holder; the extension only gets a snapshot.
|
|
604
|
+
"host.context.read",
|
|
605
|
+
// A1 (docs/42 #2): an extension may REQUEST the host to run an allowlisted
|
|
606
|
+
// command by name (ext→host action). The host authorizes + runs it; the
|
|
607
|
+
// extension never acts directly — it asks the host by name.
|
|
608
|
+
"host.command.invoke",
|
|
609
|
+
// host.log (docs/76 · ADR-0054, KYB-214): an extension may WRITE a diagnostic
|
|
610
|
+
// log line into the host's durable log (ext→host). The host stamps the
|
|
611
|
+
// extension identity from the frame origin, clamps the level to debug/info/warn
|
|
612
|
+
// (never error/fatal), and rate/size-caps. Sandboxed iframes have no console;
|
|
613
|
+
// this is their gated, attributable diagnostic path.
|
|
614
|
+
"host.log.write"
|
|
615
|
+
);
|
|
616
|
+
var PluginContributionKind = Schema5.Literal(
|
|
617
|
+
"skillTemplate",
|
|
618
|
+
"composerCapability",
|
|
619
|
+
"surface",
|
|
620
|
+
"settingsPanel",
|
|
621
|
+
"sidecar",
|
|
622
|
+
"bridge",
|
|
623
|
+
"providerAdapter",
|
|
624
|
+
"contextualAction",
|
|
625
|
+
"dataEndpoint"
|
|
626
|
+
);
|
|
627
|
+
var ExtensionHostSlot = Schema5.Literal(
|
|
628
|
+
"nav.sidebar",
|
|
629
|
+
"workspace.surface",
|
|
630
|
+
"settings.extensions",
|
|
631
|
+
"chat.visual",
|
|
632
|
+
"thread.tab.contextMenu",
|
|
633
|
+
"companion.overlay",
|
|
634
|
+
"background.sidecar"
|
|
635
|
+
);
|
|
636
|
+
var WorkspaceTabContributionMetadata = Schema5.Struct({
|
|
637
|
+
defaultVisible: Schema5.optional(Schema5.Boolean),
|
|
638
|
+
defaultLabel: Schema5.optional(Schema5.String),
|
|
639
|
+
allowRename: Schema5.optional(Schema5.Boolean)
|
|
640
|
+
});
|
|
641
|
+
var PluginManifestContribution = Schema5.Struct({
|
|
642
|
+
contributionId: Schema5.String,
|
|
643
|
+
kind: PluginContributionKind,
|
|
644
|
+
displayName: Schema5.String,
|
|
645
|
+
requiredHostCapabilities: Schema5.Array(HostCapabilityId),
|
|
646
|
+
requiredKernelPermissions: Schema5.optional(Schema5.Array(KernelPermissionId)),
|
|
647
|
+
routeSegment: Schema5.optional(Schema5.String),
|
|
648
|
+
mount: Schema5.optional(Schema5.String),
|
|
649
|
+
presentationClass: Schema5.optional(Schema5.String),
|
|
650
|
+
hostSlots: Schema5.optional(Schema5.Array(ExtensionHostSlot)),
|
|
651
|
+
workspaceTab: Schema5.optional(WorkspaceTabContributionMetadata)
|
|
652
|
+
});
|
|
653
|
+
var PluginThemeTokenMode = Schema5.Literal("light", "dark");
|
|
654
|
+
var PluginThemeTokenSet = Schema5.Struct({
|
|
655
|
+
themeId: Schema5.String,
|
|
656
|
+
label: Schema5.String,
|
|
657
|
+
description: Schema5.optional(Schema5.String),
|
|
658
|
+
modes: Schema5.Array(PluginThemeTokenMode),
|
|
659
|
+
tokens: Schema5.Record({
|
|
660
|
+
key: PluginThemeTokenMode,
|
|
661
|
+
value: Schema5.Record({ key: Schema5.String, value: Schema5.String })
|
|
662
|
+
})
|
|
663
|
+
});
|
|
664
|
+
var PluginShipsState = Schema5.Literal("active", "inactive");
|
|
665
|
+
var PluginManifestSummary = Schema5.Struct({
|
|
666
|
+
pluginId: Schema5.String,
|
|
667
|
+
displayName: Schema5.String,
|
|
668
|
+
version: Schema5.String,
|
|
669
|
+
source: Schema5.Literal("bundled", "workspace", "user", "remote"),
|
|
670
|
+
manifestPath: Schema5.optional(Schema5.String),
|
|
671
|
+
contributions: Schema5.Array(PluginManifestContribution),
|
|
672
|
+
themeTokens: Schema5.optional(Schema5.Array(PluginThemeTokenSet)),
|
|
673
|
+
ships: Schema5.optional(PluginShipsState)
|
|
674
|
+
});
|
|
675
|
+
var PluginManifestDiscoveryCandidate = Schema5.Struct({
|
|
676
|
+
pluginRoot: Schema5.String,
|
|
677
|
+
manifestPath: Schema5.String,
|
|
678
|
+
source: Schema5.Literal("bundled", "workspace", "user", "remote")
|
|
679
|
+
});
|
|
680
|
+
var PluginEnablementState = Schema5.Literal("enabled", "disabled");
|
|
681
|
+
var PluginRuntimeState = Schema5.Literal("inactive", "active", "blocked", "error");
|
|
682
|
+
var KernelPluginRegistryEntry = Schema5.Struct({
|
|
683
|
+
manifest: PluginManifestSummary,
|
|
684
|
+
enablement: PluginEnablementState,
|
|
685
|
+
runtimeState: PluginRuntimeState,
|
|
686
|
+
grantedPermissions: Schema5.Array(KernelPermissionId),
|
|
687
|
+
deniedPermissions: Schema5.Array(KernelPermissionId)
|
|
688
|
+
});
|
|
689
|
+
var KernelSurfaceAvailability = Schema5.Struct({
|
|
690
|
+
surfaceId: Schema5.String,
|
|
691
|
+
pluginId: Schema5.String,
|
|
692
|
+
available: Schema5.Boolean,
|
|
693
|
+
hostSlots: Schema5.optional(Schema5.Array(ExtensionHostSlot)),
|
|
694
|
+
requiredHostCapabilities: Schema5.Array(HostCapabilityId),
|
|
695
|
+
requiredKernelPermissions: Schema5.optional(Schema5.Array(KernelPermissionId)),
|
|
696
|
+
missingHostCapabilities: Schema5.Array(HostCapabilityId),
|
|
697
|
+
missingKernelPermissions: Schema5.optional(Schema5.Array(KernelPermissionId)),
|
|
698
|
+
deniedKernelPermissions: Schema5.optional(Schema5.Array(KernelPermissionId))
|
|
699
|
+
});
|
|
700
|
+
var KernelContributionAvailability = Schema5.Struct({
|
|
701
|
+
contributionId: Schema5.String,
|
|
702
|
+
pluginId: Schema5.String,
|
|
703
|
+
kind: PluginContributionKind,
|
|
704
|
+
available: Schema5.Boolean,
|
|
705
|
+
hostSlots: Schema5.optional(Schema5.Array(ExtensionHostSlot)),
|
|
706
|
+
requiredHostCapabilities: Schema5.Array(HostCapabilityId),
|
|
707
|
+
requiredKernelPermissions: Schema5.Array(KernelPermissionId),
|
|
708
|
+
missingHostCapabilities: Schema5.Array(HostCapabilityId),
|
|
709
|
+
missingKernelPermissions: Schema5.Array(KernelPermissionId),
|
|
710
|
+
deniedKernelPermissions: Schema5.Array(KernelPermissionId)
|
|
711
|
+
});
|
|
712
|
+
var KernelRegistrySnapshot = Schema5.Struct({
|
|
713
|
+
generatedAtMs: Schema5.NonNegativeInt,
|
|
714
|
+
owner: Schema5.Literal("daemon/kernel"),
|
|
715
|
+
plugins: Schema5.Array(KernelPluginRegistryEntry),
|
|
716
|
+
permissions: Schema5.Array(
|
|
717
|
+
Schema5.Struct({
|
|
718
|
+
principalKind: KernelPrincipalKind,
|
|
719
|
+
principalId: Schema5.String,
|
|
720
|
+
granted: Schema5.Array(KernelPermissionId),
|
|
721
|
+
denied: Schema5.Array(KernelPermissionId)
|
|
722
|
+
})
|
|
723
|
+
),
|
|
724
|
+
availableHostCapabilities: Schema5.Array(HostCapabilityId),
|
|
725
|
+
contributions: Schema5.Array(KernelContributionAvailability),
|
|
726
|
+
surfaces: Schema5.Array(KernelSurfaceAvailability)
|
|
727
|
+
});
|
|
728
|
+
var decodeKernelRegistrySnapshot = Schema5.decodeUnknownSync(KernelRegistrySnapshot);
|
|
729
|
+
var encodeKernelRegistrySnapshot = Schema5.encodeSync(KernelRegistrySnapshot);
|
|
730
|
+
var decodePluginManifestDiscoveryCandidate = Schema5.decodeUnknownSync(
|
|
731
|
+
PluginManifestDiscoveryCandidate
|
|
732
|
+
);
|
|
733
|
+
var encodePluginManifestDiscoveryCandidate = Schema5.encodeSync(
|
|
734
|
+
PluginManifestDiscoveryCandidate
|
|
735
|
+
);
|
|
736
|
+
|
|
737
|
+
// ../extension-contracts/src/kernel/contribution-convention.ts
|
|
738
|
+
var CONTRIBUTION_ID_PREFIX_BY_KIND = {
|
|
739
|
+
surface: "surface",
|
|
740
|
+
settingsPanel: "settings",
|
|
741
|
+
composerCapability: "composer",
|
|
742
|
+
contextualAction: "contextualAction",
|
|
743
|
+
sidecar: "sidecar",
|
|
744
|
+
bridge: "bridge",
|
|
745
|
+
dataEndpoint: "data",
|
|
746
|
+
skillTemplate: "skill",
|
|
747
|
+
providerAdapter: "provider"
|
|
748
|
+
};
|
|
749
|
+
var HOST_OWNED_ID_PREFIXES = ["host", "brain"];
|
|
750
|
+
var CONVENTION_EXCEPTIONS = /* @__PURE__ */ new Set([
|
|
751
|
+
"gmail.search",
|
|
752
|
+
"gmail.send"
|
|
753
|
+
]);
|
|
754
|
+
function validateContributionId(contributionId2, kind) {
|
|
755
|
+
const id = contributionId2.trim();
|
|
756
|
+
if (!id) return { ok: false, error: "contributionId is required" };
|
|
757
|
+
if (CONVENTION_EXCEPTIONS.has(id)) return { ok: true };
|
|
758
|
+
const prefix = id.split(".")[0];
|
|
759
|
+
if (HOST_OWNED_ID_PREFIXES.includes(prefix)) {
|
|
760
|
+
return {
|
|
761
|
+
ok: false,
|
|
762
|
+
error: `contributionId "${id}" claims the host-owned namespace "${prefix}.": extensions may consume host capabilities via a permission but may never own this namespace`
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
const expected = CONTRIBUTION_ID_PREFIX_BY_KIND[kind];
|
|
766
|
+
if (expected && prefix !== expected) {
|
|
767
|
+
return {
|
|
768
|
+
ok: false,
|
|
769
|
+
error: `contributionId "${id}" must start with "${expected}." for kind "${kind}" (convention <kind>.<ext>.<name>), got "${prefix}."`
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
return { ok: true };
|
|
773
|
+
}
|
|
774
|
+
var CONTRIBUTION_KIND_BY_ID_PREFIX = Object.fromEntries(
|
|
775
|
+
Object.entries(CONTRIBUTION_ID_PREFIX_BY_KIND).map(
|
|
776
|
+
([kind, prefix]) => [prefix, kind]
|
|
777
|
+
)
|
|
778
|
+
);
|
|
779
|
+
var EXTERNAL_CONNECTOR_PROVIDERS = new Set(
|
|
780
|
+
[...CONVENTION_EXCEPTIONS].map((id) => id.split(".")[0]).filter(
|
|
781
|
+
(prefix) => !HOST_OWNED_ID_PREFIXES.includes(prefix) && !(prefix in CONTRIBUTION_KIND_BY_ID_PREFIX)
|
|
782
|
+
)
|
|
783
|
+
);
|
|
784
|
+
var hasDot = (value) => value.includes(".");
|
|
785
|
+
var isNonEmpty = (value) => typeof value === "string" && value.trim().length > 0;
|
|
786
|
+
function validateContributionKey(key) {
|
|
787
|
+
switch (key.owner) {
|
|
788
|
+
case "ext": {
|
|
789
|
+
if (!(key.kind in CONTRIBUTION_ID_PREFIX_BY_KIND)) {
|
|
790
|
+
return { ok: false, error: `unknown contribution kind "${key.kind}"` };
|
|
791
|
+
}
|
|
792
|
+
if (!isNonEmpty(key.ext)) return { ok: false, error: 'ext key requires a non-empty "ext" segment' };
|
|
793
|
+
if (hasDot(key.ext)) {
|
|
794
|
+
return { ok: false, error: `ext segment "${key.ext}" must not contain "." \u2014 it would smuggle hidden structure and break the derived\u2194parsed round-trip` };
|
|
795
|
+
}
|
|
796
|
+
if (key.name !== void 0 && (!isNonEmpty(key.name) || hasDot(key.name))) {
|
|
797
|
+
return { ok: false, error: `name segment "${key.name}" must be non-empty and contain no "."` };
|
|
798
|
+
}
|
|
799
|
+
const prefix = CONTRIBUTION_ID_PREFIX_BY_KIND[key.kind];
|
|
800
|
+
const derived = key.name ? `${prefix}.${key.ext}.${key.name}` : `${prefix}.${key.ext}`;
|
|
801
|
+
return validateContributionId(derived, key.kind);
|
|
802
|
+
}
|
|
803
|
+
case "host": {
|
|
804
|
+
if (!HOST_OWNED_ID_PREFIXES.includes(key.namespace)) {
|
|
805
|
+
return { ok: false, error: `host key namespace "${key.namespace}" must be one of: ${HOST_OWNED_ID_PREFIXES.join(", ")}` };
|
|
806
|
+
}
|
|
807
|
+
if (!isNonEmpty(key.resource)) return { ok: false, error: 'host key requires a non-empty "resource"' };
|
|
808
|
+
if (hasDot(key.resource)) return { ok: false, error: `host resource "${key.resource}" must not contain "."` };
|
|
809
|
+
return { ok: true };
|
|
810
|
+
}
|
|
811
|
+
case "external": {
|
|
812
|
+
if (!isNonEmpty(key.provider) || hasDot(key.provider)) {
|
|
813
|
+
return { ok: false, error: `external provider "${key.provider}" must be non-empty and contain no "."` };
|
|
814
|
+
}
|
|
815
|
+
if (!isNonEmpty(key.toolId)) return { ok: false, error: 'external key requires a non-empty "toolId"' };
|
|
816
|
+
return { ok: true };
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
function contributionId(key) {
|
|
821
|
+
const verdict = validateContributionKey(key);
|
|
822
|
+
if (!verdict.ok) throw new Error(`invalid ContributionKey: ${verdict.error}`);
|
|
823
|
+
switch (key.owner) {
|
|
824
|
+
case "ext": {
|
|
825
|
+
const prefix = CONTRIBUTION_ID_PREFIX_BY_KIND[key.kind];
|
|
826
|
+
return key.name ? `${prefix}.${key.ext}.${key.name}` : `${prefix}.${key.ext}`;
|
|
827
|
+
}
|
|
828
|
+
case "host":
|
|
829
|
+
return `${key.namespace}.${key.resource}`;
|
|
830
|
+
case "external":
|
|
831
|
+
return `${key.provider}.${key.toolId}`;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
function parseContributionId(rawId) {
|
|
835
|
+
const id = rawId.trim();
|
|
836
|
+
if (!id) throw new Error("contributionId is required");
|
|
837
|
+
const segments = id.split(".");
|
|
838
|
+
const prefix = segments[0];
|
|
839
|
+
if (HOST_OWNED_ID_PREFIXES.includes(prefix)) {
|
|
840
|
+
return {
|
|
841
|
+
owner: "host",
|
|
842
|
+
namespace: prefix,
|
|
843
|
+
resource: segments.slice(1).join(".")
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
const kind = CONTRIBUTION_KIND_BY_ID_PREFIX[prefix];
|
|
847
|
+
if (kind) {
|
|
848
|
+
const [, ext, ...rest] = segments;
|
|
849
|
+
return rest.length > 0 ? { owner: "ext", kind, ext, name: rest.join(".") } : { owner: "ext", kind, ext };
|
|
850
|
+
}
|
|
851
|
+
if (EXTERNAL_CONNECTOR_PROVIDERS.has(prefix)) {
|
|
852
|
+
return { owner: "external", provider: prefix, toolId: segments.slice(1).join(".") };
|
|
853
|
+
}
|
|
854
|
+
throw new Error(
|
|
855
|
+
`unrecognized contributionId prefix "${prefix}." in "${id}" \u2014 not a kind prefix, a host-owned namespace, or a declared external connector`
|
|
856
|
+
);
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
// ../extension-contracts/src/kernel/skills.ts
|
|
860
|
+
import { Schema as Schema6 } from "effect";
|
|
861
|
+
var KernelSkillOwnerKind = Schema6.Literal("bundled", "agent");
|
|
862
|
+
var KernelSkillInvocationMode = Schema6.Literal("pure", "queue_tool_call");
|
|
863
|
+
var KernelSkillIndexEntry = Schema6.Struct({
|
|
864
|
+
skillId: Schema6.String,
|
|
865
|
+
declaredSkillId: Schema6.optional(Schema6.String),
|
|
866
|
+
name: Schema6.String,
|
|
867
|
+
description: Schema6.String,
|
|
868
|
+
ownerKind: KernelSkillOwnerKind,
|
|
869
|
+
ownerId: Schema6.String,
|
|
870
|
+
invocationMode: KernelSkillInvocationMode,
|
|
871
|
+
invoke: Schema6.optional(Schema6.String),
|
|
872
|
+
sourcePluginId: Schema6.optional(Schema6.String),
|
|
873
|
+
sourcePath: Schema6.String
|
|
874
|
+
});
|
|
875
|
+
var KernelSkillIndexResponse = Schema6.Struct({
|
|
876
|
+
generatedAtMs: Schema6.NonNegativeInt,
|
|
877
|
+
owner: Schema6.Literal("daemon/kernel"),
|
|
878
|
+
skills: Schema6.Array(KernelSkillIndexEntry)
|
|
879
|
+
});
|
|
880
|
+
var decodeKernelSkillIndexResponse = Schema6.decodeUnknownSync(KernelSkillIndexResponse);
|
|
881
|
+
var encodeKernelSkillIndexResponse = Schema6.encodeSync(KernelSkillIndexResponse);
|
|
882
|
+
|
|
883
|
+
// ../extension-contracts/src/kernel/plugin-install.ts
|
|
884
|
+
import { Schema as Schema7 } from "effect";
|
|
885
|
+
var KernelPluginInstallRuntimeClass = Schema7.Literal(
|
|
886
|
+
"skills-only",
|
|
887
|
+
"composio-app",
|
|
888
|
+
"codex-app-tool",
|
|
889
|
+
"codex-app-sdk-replacement-ready",
|
|
890
|
+
"codex-app-sdk-replacement-missing",
|
|
891
|
+
"mcp",
|
|
892
|
+
"cli-package",
|
|
893
|
+
"mixed"
|
|
894
|
+
);
|
|
895
|
+
var KernelPluginInstallSkill = Schema7.Struct({
|
|
896
|
+
skillId: Schema7.String,
|
|
897
|
+
skillName: Schema7.optional(Schema7.String),
|
|
898
|
+
displayName: Schema7.String,
|
|
899
|
+
sourcePath: Schema7.String,
|
|
900
|
+
skillRoot: Schema7.optional(Schema7.String),
|
|
901
|
+
requiresConnectors: Schema7.optional(Schema7.Array(Schema7.String))
|
|
902
|
+
});
|
|
903
|
+
var KernelPluginConnectorBinding = Schema7.Struct({
|
|
904
|
+
connectorId: Schema7.String,
|
|
905
|
+
toolkitSlug: Schema7.String,
|
|
906
|
+
appId: Schema7.optional(Schema7.String),
|
|
907
|
+
externalAppId: Schema7.optional(Schema7.String),
|
|
908
|
+
externalAppKind: Schema7.optional(Schema7.Literal("codex-connector", "codex-app-sdk", "unknown")),
|
|
909
|
+
displayName: Schema7.String,
|
|
910
|
+
authRequired: Schema7.Boolean,
|
|
911
|
+
status: Schema7.Literal("mapped", "unmapped", "connected", "blocked"),
|
|
912
|
+
reason: Schema7.optional(Schema7.String)
|
|
913
|
+
});
|
|
914
|
+
var KernelPluginMcpServerBinding = Schema7.Struct({
|
|
915
|
+
serverId: Schema7.String,
|
|
916
|
+
runtimeSourceId: Schema7.optional(Schema7.String),
|
|
917
|
+
configPath: Schema7.optional(Schema7.String),
|
|
918
|
+
config: Schema7.optional(Schema7.Unknown),
|
|
919
|
+
status: Schema7.Literal("declared", "configured", "blocked"),
|
|
920
|
+
reason: Schema7.optional(Schema7.String)
|
|
921
|
+
});
|
|
922
|
+
var KernelPluginCliToolBinding = Schema7.Struct({
|
|
923
|
+
toolId: Schema7.String,
|
|
924
|
+
command: Schema7.optional(Schema7.String),
|
|
925
|
+
args: Schema7.optional(Schema7.Array(Schema7.String)),
|
|
926
|
+
packageName: Schema7.optional(Schema7.String),
|
|
927
|
+
packageRoot: Schema7.optional(Schema7.String),
|
|
928
|
+
binName: Schema7.optional(Schema7.String),
|
|
929
|
+
entrypoint: Schema7.optional(Schema7.String),
|
|
930
|
+
runtimeSourceId: Schema7.optional(Schema7.String),
|
|
931
|
+
packageManager: Schema7.optional(Schema7.String),
|
|
932
|
+
status: Schema7.Literal("declared", "installed", "blocked"),
|
|
933
|
+
reason: Schema7.optional(Schema7.String)
|
|
934
|
+
});
|
|
935
|
+
var KernelPluginPackageDependency = Schema7.Struct({
|
|
936
|
+
packageId: Schema7.String,
|
|
937
|
+
packageName: Schema7.String,
|
|
938
|
+
packageRoot: Schema7.String,
|
|
939
|
+
packageManager: Schema7.optional(Schema7.String),
|
|
940
|
+
installCommand: Schema7.optional(Schema7.String),
|
|
941
|
+
dependencies: Schema7.Array(Schema7.String),
|
|
942
|
+
devDependencies: Schema7.Array(Schema7.String)
|
|
943
|
+
});
|
|
944
|
+
var KernelPluginAuthRequirement = Schema7.Struct({
|
|
945
|
+
requirementId: Schema7.String,
|
|
946
|
+
kind: Schema7.Literal("composio", "mcp-oauth", "api-key", "none"),
|
|
947
|
+
targetId: Schema7.optional(Schema7.String),
|
|
948
|
+
status: Schema7.Literal("required", "satisfied", "blocked", "not-required"),
|
|
949
|
+
reason: Schema7.optional(Schema7.String)
|
|
950
|
+
});
|
|
951
|
+
var KernelPluginWorkflowStepStatus = Schema7.Literal(
|
|
952
|
+
"pending",
|
|
953
|
+
"complete",
|
|
954
|
+
"blocked",
|
|
955
|
+
"skipped",
|
|
956
|
+
"failed"
|
|
957
|
+
);
|
|
958
|
+
var KernelPluginWorkflowStep = Schema7.Struct({
|
|
959
|
+
stepId: Schema7.String,
|
|
960
|
+
label: Schema7.String,
|
|
961
|
+
kind: Schema7.Literal(
|
|
962
|
+
"discover",
|
|
963
|
+
"copy",
|
|
964
|
+
"skill",
|
|
965
|
+
"dependency",
|
|
966
|
+
"connector",
|
|
967
|
+
"mcp",
|
|
968
|
+
"cli",
|
|
969
|
+
"composer",
|
|
970
|
+
"chat",
|
|
971
|
+
"cleanup",
|
|
972
|
+
"validation"
|
|
973
|
+
),
|
|
974
|
+
status: KernelPluginWorkflowStepStatus,
|
|
975
|
+
reason: Schema7.optional(Schema7.String)
|
|
976
|
+
});
|
|
977
|
+
var KernelPluginValidationProbe = Schema7.Struct({
|
|
978
|
+
probeId: Schema7.String,
|
|
979
|
+
kind: Schema7.Literal("manifest", "push", "activation", "composer", "chat", "tool-discovery", "read-only-smoke", "write-dry-run"),
|
|
980
|
+
safeLive: Schema7.Boolean,
|
|
981
|
+
status: KernelPluginWorkflowStepStatus,
|
|
982
|
+
reason: Schema7.optional(Schema7.String)
|
|
983
|
+
});
|
|
984
|
+
var KernelPluginInstallManifest = Schema7.Struct({
|
|
985
|
+
pluginId: Schema7.String,
|
|
986
|
+
displayName: Schema7.String,
|
|
987
|
+
version: Schema7.String,
|
|
988
|
+
sourceMarketplace: Schema7.String,
|
|
989
|
+
sourcePath: Schema7.String,
|
|
990
|
+
runtimeClass: KernelPluginInstallRuntimeClass,
|
|
991
|
+
skills: Schema7.Array(KernelPluginInstallSkill),
|
|
992
|
+
runtimeSources: Schema7.Array(PluginRuntimeSourceDescriptor),
|
|
993
|
+
connectorBindings: Schema7.Array(KernelPluginConnectorBinding),
|
|
994
|
+
mcpServers: Schema7.Array(KernelPluginMcpServerBinding),
|
|
995
|
+
cliTools: Schema7.Array(KernelPluginCliToolBinding),
|
|
996
|
+
packageDependencies: Schema7.Array(KernelPluginPackageDependency),
|
|
997
|
+
authRequirements: Schema7.Array(KernelPluginAuthRequirement),
|
|
998
|
+
installSteps: Schema7.Array(KernelPluginWorkflowStep),
|
|
999
|
+
activationBlockers: Schema7.Array(Schema7.String),
|
|
1000
|
+
validationProbes: Schema7.Array(KernelPluginValidationProbe),
|
|
1001
|
+
uninstallCleanup: Schema7.Array(KernelPluginWorkflowStep)
|
|
1002
|
+
});
|
|
1003
|
+
var KernelPluginValidationStageStatus = Schema7.Literal(
|
|
1004
|
+
"pass",
|
|
1005
|
+
"partial",
|
|
1006
|
+
"blocked",
|
|
1007
|
+
"fail",
|
|
1008
|
+
"skipped"
|
|
1009
|
+
);
|
|
1010
|
+
var KernelPluginValidationReport = Schema7.Struct({
|
|
1011
|
+
pluginId: Schema7.String,
|
|
1012
|
+
status: Schema7.Literal("complete", "partial", "blocked", "failed"),
|
|
1013
|
+
discovered: KernelPluginValidationStageStatus,
|
|
1014
|
+
manifest: KernelPluginValidationStageStatus,
|
|
1015
|
+
push: KernelPluginValidationStageStatus,
|
|
1016
|
+
config: KernelPluginValidationStageStatus,
|
|
1017
|
+
activation: KernelPluginValidationStageStatus,
|
|
1018
|
+
composer: KernelPluginValidationStageStatus,
|
|
1019
|
+
chat: KernelPluginValidationStageStatus,
|
|
1020
|
+
smoke: KernelPluginValidationStageStatus,
|
|
1021
|
+
gaps: Schema7.Array(Schema7.String),
|
|
1022
|
+
evidence: Schema7.Array(Schema7.String),
|
|
1023
|
+
validatedAtMs: Schema7.NonNegativeInt
|
|
1024
|
+
});
|
|
1025
|
+
var decodeKernelPluginInstallManifest = Schema7.decodeUnknownSync(
|
|
1026
|
+
KernelPluginInstallManifest
|
|
1027
|
+
);
|
|
1028
|
+
var encodeKernelPluginInstallManifest = Schema7.encodeSync(
|
|
1029
|
+
KernelPluginInstallManifest
|
|
1030
|
+
);
|
|
1031
|
+
var decodeKernelPluginValidationReport = Schema7.decodeUnknownSync(
|
|
1032
|
+
KernelPluginValidationReport
|
|
1033
|
+
);
|
|
1034
|
+
var encodeKernelPluginValidationReport = Schema7.encodeSync(
|
|
1035
|
+
KernelPluginValidationReport
|
|
1036
|
+
);
|
|
1037
|
+
|
|
1038
|
+
// ../extension-contracts/src/kernel/plugin-contract.ts
|
|
1039
|
+
import { Schema as Schema10 } from "effect";
|
|
1040
|
+
|
|
1041
|
+
// ../extension-contracts/src/kernel/bridges.ts
|
|
1042
|
+
import { Schema as Schema8 } from "effect";
|
|
1043
|
+
var BridgeTransport = Schema8.Literal("stdio", "http", "websocket");
|
|
1044
|
+
var BridgeAdapterKind = Schema8.Literal("kyberbot", "generic");
|
|
1045
|
+
var BridgeDeclaration = Schema8.Struct({
|
|
1046
|
+
bridgeId: Schema8.String,
|
|
1047
|
+
displayName: Schema8.String,
|
|
1048
|
+
adapterKind: BridgeAdapterKind,
|
|
1049
|
+
pluginId: Schema8.optional(Schema8.String),
|
|
1050
|
+
transport: BridgeTransport,
|
|
1051
|
+
commandTypes: Schema8.Array(Schema8.String),
|
|
1052
|
+
eventTypes: Schema8.Array(Schema8.String)
|
|
1053
|
+
});
|
|
1054
|
+
var BridgePrincipal = Schema8.Struct({
|
|
1055
|
+
kind: KernelPrincipalKind,
|
|
1056
|
+
id: Schema8.String
|
|
1057
|
+
});
|
|
1058
|
+
var BridgePairingRequest = Schema8.Struct({
|
|
1059
|
+
bridgeId: Schema8.String,
|
|
1060
|
+
principal: BridgePrincipal,
|
|
1061
|
+
requestedByHostId: Schema8.optional(Schema8.String),
|
|
1062
|
+
requestedAtMs: Schema8.NonNegativeInt
|
|
1063
|
+
});
|
|
1064
|
+
var BridgeSessionState = Schema8.Literal("open", "closed", "error");
|
|
1065
|
+
var BridgeSessionRecord = Schema8.Struct({
|
|
1066
|
+
sessionId: Schema8.String,
|
|
1067
|
+
bridgeId: Schema8.String,
|
|
1068
|
+
principal: BridgePrincipal,
|
|
1069
|
+
transport: BridgeTransport,
|
|
1070
|
+
state: BridgeSessionState,
|
|
1071
|
+
openedAtMs: Schema8.NonNegativeInt
|
|
1072
|
+
});
|
|
1073
|
+
var BridgeCommandEnvelope = Schema8.Struct({
|
|
1074
|
+
envelopeId: Schema8.String,
|
|
1075
|
+
bridgeId: Schema8.String,
|
|
1076
|
+
sessionId: Schema8.String,
|
|
1077
|
+
type: Schema8.String,
|
|
1078
|
+
payload: Schema8.Record({ key: Schema8.String, value: Schema8.Unknown }),
|
|
1079
|
+
sentAtMs: Schema8.NonNegativeInt
|
|
1080
|
+
});
|
|
1081
|
+
var BridgeEventEnvelope = Schema8.Struct({
|
|
1082
|
+
envelopeId: Schema8.String,
|
|
1083
|
+
bridgeId: Schema8.String,
|
|
1084
|
+
sessionId: Schema8.String,
|
|
1085
|
+
type: Schema8.String,
|
|
1086
|
+
payload: Schema8.Record({ key: Schema8.String, value: Schema8.Unknown }),
|
|
1087
|
+
observedAtMs: Schema8.NonNegativeInt
|
|
1088
|
+
});
|
|
1089
|
+
var BridgeSessionResponse = Schema8.Struct({
|
|
1090
|
+
owner: Schema8.Literal("daemon/kernel"),
|
|
1091
|
+
session: BridgeSessionRecord,
|
|
1092
|
+
events: Schema8.Array(BridgeEventEnvelope)
|
|
1093
|
+
});
|
|
1094
|
+
var BridgeCommandResponse = Schema8.Struct({
|
|
1095
|
+
owner: Schema8.Literal("daemon/kernel"),
|
|
1096
|
+
accepted: Schema8.Boolean,
|
|
1097
|
+
command: BridgeCommandEnvelope,
|
|
1098
|
+
event: BridgeEventEnvelope
|
|
1099
|
+
});
|
|
1100
|
+
var decodeBridgeDeclaration = Schema8.decodeUnknownSync(BridgeDeclaration);
|
|
1101
|
+
var encodeBridgeDeclaration = Schema8.encodeSync(BridgeDeclaration);
|
|
1102
|
+
var decodeBridgePairingRequest = Schema8.decodeUnknownSync(BridgePairingRequest);
|
|
1103
|
+
var encodeBridgePairingRequest = Schema8.encodeSync(BridgePairingRequest);
|
|
1104
|
+
var decodeBridgeSessionResponse = Schema8.decodeUnknownSync(BridgeSessionResponse);
|
|
1105
|
+
var encodeBridgeSessionResponse = Schema8.encodeSync(BridgeSessionResponse);
|
|
1106
|
+
var decodeBridgeCommandEnvelope = Schema8.decodeUnknownSync(BridgeCommandEnvelope);
|
|
1107
|
+
var encodeBridgeCommandEnvelope = Schema8.encodeSync(BridgeCommandEnvelope);
|
|
1108
|
+
var decodeBridgeEventEnvelope = Schema8.decodeUnknownSync(BridgeEventEnvelope);
|
|
1109
|
+
var encodeBridgeEventEnvelope = Schema8.encodeSync(BridgeEventEnvelope);
|
|
1110
|
+
var decodeBridgeCommandResponse = Schema8.decodeUnknownSync(BridgeCommandResponse);
|
|
1111
|
+
var encodeBridgeCommandResponse = Schema8.encodeSync(BridgeCommandResponse);
|
|
1112
|
+
|
|
1113
|
+
// ../extension-contracts/src/kernel/sidecars.ts
|
|
1114
|
+
import { Schema as Schema9 } from "effect";
|
|
1115
|
+
var SidecarDeclaration = Schema9.Struct({
|
|
1116
|
+
sidecarId: Schema9.String,
|
|
1117
|
+
displayName: Schema9.String,
|
|
1118
|
+
pluginId: Schema9.optional(Schema9.String),
|
|
1119
|
+
transport: Schema9.Literal("stdio", "http", "websocket"),
|
|
1120
|
+
requestedHostCapabilities: Schema9.Array(HostCapabilityId)
|
|
1121
|
+
});
|
|
1122
|
+
var SidecarGrantPrincipal = Schema9.Struct({
|
|
1123
|
+
kind: KernelPrincipalKind,
|
|
1124
|
+
id: Schema9.String
|
|
1125
|
+
});
|
|
1126
|
+
var SidecarGrantRequest = Schema9.Struct({
|
|
1127
|
+
principal: SidecarGrantPrincipal,
|
|
1128
|
+
sidecarId: Schema9.String,
|
|
1129
|
+
requestedHostCapabilities: Schema9.Array(HostCapabilityId),
|
|
1130
|
+
requestedAtMs: Schema9.NonNegativeInt
|
|
1131
|
+
});
|
|
1132
|
+
var SidecarCapabilityGrantDecision = Schema9.Struct({
|
|
1133
|
+
capability: HostCapabilityId,
|
|
1134
|
+
decision: Schema9.Literal("granted", "denied"),
|
|
1135
|
+
reason: Schema9.String
|
|
1136
|
+
});
|
|
1137
|
+
var SidecarGrantRecord = Schema9.Struct({
|
|
1138
|
+
grantId: Schema9.String,
|
|
1139
|
+
sidecarId: Schema9.String,
|
|
1140
|
+
principal: SidecarGrantPrincipal,
|
|
1141
|
+
capabilities: Schema9.Array(HostCapabilityId),
|
|
1142
|
+
capabilityDecisions: Schema9.Array(SidecarCapabilityGrantDecision),
|
|
1143
|
+
issuedAtMs: Schema9.NonNegativeInt
|
|
1144
|
+
});
|
|
1145
|
+
var SidecarGrantResponse = Schema9.Struct({
|
|
1146
|
+
owner: Schema9.Literal("daemon/kernel"),
|
|
1147
|
+
decision: Schema9.Literal("granted", "denied"),
|
|
1148
|
+
grant: SidecarGrantRecord
|
|
1149
|
+
});
|
|
1150
|
+
var decodeSidecarDeclaration = Schema9.decodeUnknownSync(SidecarDeclaration);
|
|
1151
|
+
var encodeSidecarDeclaration = Schema9.encodeSync(SidecarDeclaration);
|
|
1152
|
+
var decodeSidecarGrantRequest = Schema9.decodeUnknownSync(SidecarGrantRequest);
|
|
1153
|
+
var encodeSidecarGrantRequest = Schema9.encodeSync(SidecarGrantRequest);
|
|
1154
|
+
var decodeSidecarGrantResponse = Schema9.decodeUnknownSync(SidecarGrantResponse);
|
|
1155
|
+
var encodeSidecarGrantResponse = Schema9.encodeSync(SidecarGrantResponse);
|
|
1156
|
+
|
|
1157
|
+
// ../extension-contracts/src/kernel/plugin-contract.ts
|
|
1158
|
+
var NormalizedPluginContractSourceKind = Schema10.Literal(
|
|
1159
|
+
"kyberagent-native",
|
|
1160
|
+
"codex-marketplace",
|
|
1161
|
+
"local-marketplace",
|
|
1162
|
+
"remote-marketplace",
|
|
1163
|
+
"bundled"
|
|
1164
|
+
);
|
|
1165
|
+
var NormalizedPluginContractSource = Schema10.Struct({
|
|
1166
|
+
kind: NormalizedPluginContractSourceKind,
|
|
1167
|
+
marketplace: Schema10.optional(Schema10.String),
|
|
1168
|
+
path: Schema10.optional(Schema10.String),
|
|
1169
|
+
manifestPath: Schema10.optional(Schema10.String),
|
|
1170
|
+
provenance: EcoAddonExtensionClass
|
|
1171
|
+
});
|
|
1172
|
+
var NormalizedPluginSkillDeclaration = Schema10.Struct({
|
|
1173
|
+
skillId: Schema10.String,
|
|
1174
|
+
skillName: Schema10.optional(Schema10.String),
|
|
1175
|
+
displayName: Schema10.String,
|
|
1176
|
+
description: Schema10.optional(Schema10.String),
|
|
1177
|
+
sourcePath: Schema10.optional(Schema10.String),
|
|
1178
|
+
skillRoot: Schema10.optional(Schema10.String),
|
|
1179
|
+
requiresConnectors: Schema10.Array(Schema10.String)
|
|
1180
|
+
});
|
|
1181
|
+
var NormalizedPluginToolDeclaration = Schema10.Struct({
|
|
1182
|
+
toolId: Schema10.String,
|
|
1183
|
+
runtimeSourceId: Schema10.String,
|
|
1184
|
+
connectorId: Schema10.optional(Schema10.String),
|
|
1185
|
+
mcpServerId: Schema10.optional(Schema10.String),
|
|
1186
|
+
cliToolId: Schema10.optional(Schema10.String),
|
|
1187
|
+
slug: Schema10.optional(Schema10.String),
|
|
1188
|
+
displayName: Schema10.String,
|
|
1189
|
+
description: Schema10.optional(Schema10.String),
|
|
1190
|
+
readOnly: Schema10.optional(Schema10.Boolean),
|
|
1191
|
+
sandboxRequired: Schema10.optional(Schema10.Boolean),
|
|
1192
|
+
inputSchema: Schema10.optional(Schema10.Unknown)
|
|
1193
|
+
});
|
|
1194
|
+
var NormalizedPluginExtensionContributionSet = Schema10.Struct({
|
|
1195
|
+
surfaces: Schema10.Array(PluginManifestContribution),
|
|
1196
|
+
settingsPanels: Schema10.Array(PluginManifestContribution),
|
|
1197
|
+
contributions: Schema10.Array(PluginManifestContribution),
|
|
1198
|
+
sidecars: Schema10.Array(SidecarDeclaration),
|
|
1199
|
+
bridges: Schema10.Array(BridgeDeclaration),
|
|
1200
|
+
permissions: Schema10.Array(KernelPermissionId),
|
|
1201
|
+
deniedPermissions: Schema10.Array(KernelPermissionId),
|
|
1202
|
+
themeTokens: Schema10.Array(PluginThemeTokenSet),
|
|
1203
|
+
hostCapabilities: Schema10.Array(HostCapabilityId),
|
|
1204
|
+
providerProjections: Schema10.Array(ProviderRuntimeProjectionDescriptor),
|
|
1205
|
+
// Path C (docs/80 §5, KYB-209): the origins this extension's OWN backend lives
|
|
1206
|
+
// at. ONE declared surface feeding two enforcement points — the per-frame CSP
|
|
1207
|
+
// connect-src (Lane A, direct) and the daemon broker allowlist (Lane B,
|
|
1208
|
+
// brokered). Always emitted (default []); validated by validateOutboundOrigin.
|
|
1209
|
+
outboundOrigins: Schema10.Array(Schema10.String),
|
|
1210
|
+
// KYB-202 (ADR-0060 §5): the declared default-activation state carried from the
|
|
1211
|
+
// SDK ExtensionDefinition through to the generated manifest. Optional/omitted
|
|
1212
|
+
// means inactive (default-deny); only the core surfaces declare `active`.
|
|
1213
|
+
ships: Schema10.optional(PluginShipsState)
|
|
1214
|
+
});
|
|
1215
|
+
var NormalizedPluginCompatibility = Schema10.Struct({
|
|
1216
|
+
legacyCodexManifest: Schema10.Boolean,
|
|
1217
|
+
sdkBacked: Schema10.Boolean,
|
|
1218
|
+
sourceManifestVersion: Schema10.optional(Schema10.String),
|
|
1219
|
+
notes: Schema10.optional(Schema10.Array(Schema10.String))
|
|
1220
|
+
});
|
|
1221
|
+
var NormalizedPluginContract = Schema10.Struct({
|
|
1222
|
+
contractVersion: Schema10.Literal(1),
|
|
1223
|
+
pluginId: Schema10.String,
|
|
1224
|
+
displayName: Schema10.String,
|
|
1225
|
+
version: Schema10.String,
|
|
1226
|
+
description: Schema10.optional(Schema10.String),
|
|
1227
|
+
source: NormalizedPluginContractSource,
|
|
1228
|
+
runtimeSources: Schema10.Array(PluginRuntimeSourceDescriptor),
|
|
1229
|
+
skills: Schema10.Array(NormalizedPluginSkillDeclaration),
|
|
1230
|
+
connectors: Schema10.Array(KernelPluginConnectorBinding),
|
|
1231
|
+
mcpServers: Schema10.Array(KernelPluginMcpServerBinding),
|
|
1232
|
+
cliTools: Schema10.Array(KernelPluginCliToolBinding),
|
|
1233
|
+
toolDeclarations: Schema10.Array(NormalizedPluginToolDeclaration),
|
|
1234
|
+
extension: NormalizedPluginExtensionContributionSet,
|
|
1235
|
+
authRequirements: Schema10.Array(KernelPluginAuthRequirement),
|
|
1236
|
+
validationProbes: Schema10.Array(KernelPluginValidationProbe),
|
|
1237
|
+
compatibility: NormalizedPluginCompatibility
|
|
1238
|
+
});
|
|
1239
|
+
var decodeNormalizedPluginContract = Schema10.decodeUnknownSync(NormalizedPluginContract);
|
|
1240
|
+
var encodeNormalizedPluginContract = Schema10.encodeSync(NormalizedPluginContract);
|
|
1241
|
+
|
|
1242
|
+
// ../extension-contracts/src/kernel/outbound-origins.ts
|
|
1243
|
+
var ALLOWED_SCHEMES = ["https", "http", "wss", "ws"];
|
|
1244
|
+
var PORT_WILDCARD_SUFFIX = ":*";
|
|
1245
|
+
function validateOutboundOrigin(entry) {
|
|
1246
|
+
if (typeof entry !== "string" || entry.trim() !== entry || entry === "") {
|
|
1247
|
+
return `outboundOrigins entry ${JSON.stringify(entry)} must be a non-empty, untrimmed origin string`;
|
|
1248
|
+
}
|
|
1249
|
+
const portWildcard = entry.endsWith(PORT_WILDCARD_SUFFIX);
|
|
1250
|
+
const probe = portWildcard ? `${entry.slice(0, -PORT_WILDCARD_SUFFIX.length)}:1` : entry;
|
|
1251
|
+
let url;
|
|
1252
|
+
try {
|
|
1253
|
+
url = new URL(probe);
|
|
1254
|
+
} catch {
|
|
1255
|
+
return `outboundOrigins entry ${JSON.stringify(entry)} is not a valid origin`;
|
|
1256
|
+
}
|
|
1257
|
+
const scheme = url.protocol.replace(/:$/, "");
|
|
1258
|
+
if (!ALLOWED_SCHEMES.includes(scheme)) {
|
|
1259
|
+
return `outboundOrigins entry ${JSON.stringify(entry)}: scheme must be one of ${ALLOWED_SCHEMES.join("/")}`;
|
|
1260
|
+
}
|
|
1261
|
+
if (url.username || url.password) {
|
|
1262
|
+
return `outboundOrigins entry ${JSON.stringify(entry)} must not include userinfo`;
|
|
1263
|
+
}
|
|
1264
|
+
if (url.pathname !== "/" && url.pathname !== "") {
|
|
1265
|
+
return `outboundOrigins entry ${JSON.stringify(entry)} must be an origin only \u2014 no path`;
|
|
1266
|
+
}
|
|
1267
|
+
if (url.search || url.hash) {
|
|
1268
|
+
return `outboundOrigins entry ${JSON.stringify(entry)} must be an origin only \u2014 no query or fragment`;
|
|
1269
|
+
}
|
|
1270
|
+
if (url.hostname.startsWith("*")) {
|
|
1271
|
+
return `outboundOrigins entry ${JSON.stringify(entry)} must not use a subdomain wildcard`;
|
|
1272
|
+
}
|
|
1273
|
+
if (!portWildcard && url.origin !== entry) {
|
|
1274
|
+
return `outboundOrigins entry ${JSON.stringify(entry)} must be a bare origin (got canonical ${url.origin})`;
|
|
1275
|
+
}
|
|
1276
|
+
return null;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
// ../extension-contracts/src/kernel/seam.ts
|
|
1280
|
+
import { Schema as Schema11 } from "effect";
|
|
1281
|
+
var AgentId = Schema11.String.pipe(Schema11.brand("AgentId"));
|
|
1282
|
+
function makeAgentId(attestedName) {
|
|
1283
|
+
const trimmed = attestedName.trim().toLowerCase();
|
|
1284
|
+
if (!trimmed) throw new Error("makeAgentId: agent name must be a non-empty host-attested string");
|
|
1285
|
+
return trimmed;
|
|
1286
|
+
}
|
|
1287
|
+
var MACHINE_AGENT = makeAgentId("__machine__");
|
|
1288
|
+
var ExtensionId = Schema11.String.pipe(Schema11.brand("ExtensionId"));
|
|
1289
|
+
var SeamAttestation = Schema11.Literal("frame-origin", "session", "host");
|
|
1290
|
+
var SeamPrincipal = Schema11.Struct({
|
|
1291
|
+
...BridgePrincipal.fields,
|
|
1292
|
+
attestedBy: SeamAttestation
|
|
1293
|
+
});
|
|
1294
|
+
var SeamOp = Schema11.Literal("echo", "query", "describe", "invoke");
|
|
1295
|
+
var SeamContext = Schema11.Struct({
|
|
1296
|
+
principal: SeamPrincipal,
|
|
1297
|
+
// The addressed extension this op routes + gates against (was a top-level, self-
|
|
1298
|
+
// assertable SeamRequest field pre-KYB-177). REQUIRED + branded: the daemon stamps
|
|
1299
|
+
// it host-side — from the open-session route (from what the trusted host attested)
|
|
1300
|
+
// or via {@link mintSeamContext} for a host-internal dispatch — so a payload-supplied
|
|
1301
|
+
// extension id can never reach a handler. For an extension-ORIGINATED call it equals
|
|
1302
|
+
// {@link SeamPrincipal.id} (the extension is the principal); for a host-internal call
|
|
1303
|
+
// the principal is the host but this still names the addressed extension.
|
|
1304
|
+
extensionId: ExtensionId,
|
|
1305
|
+
hostId: Schema11.optional(Schema11.String),
|
|
1306
|
+
requestedAtMs: Schema11.NonNegativeInt,
|
|
1307
|
+
// The active agent the request is scoped to, as the host attested it (the
|
|
1308
|
+
// X-Kyberagent-Agent header the desktop host sets from the user's selection),
|
|
1309
|
+
// threaded by the dispatch route so a handler answers for the active agent
|
|
1310
|
+
// (e.g. host.context) without re-deriving it. REQUIRED + branded (KYB-228):
|
|
1311
|
+
// "no specific agent" is the explicit {@link MACHINE_AGENT} sentinel, never a
|
|
1312
|
+
// dropped/undefined field — that is the structural fix for DIV-6.
|
|
1313
|
+
activeAgent: AgentId
|
|
1314
|
+
});
|
|
1315
|
+
var SeamRequest = Schema11.Struct({
|
|
1316
|
+
// NO top-level `extensionId` (removed KYB-177): the addressed extension is carried
|
|
1317
|
+
// host-attested in {@link SeamContext.extensionId} — read it via {@link seamExtensionId},
|
|
1318
|
+
// never a payload field, so a self-asserted id can't reach the router or the gate.
|
|
1319
|
+
contributionId: Schema11.String,
|
|
1320
|
+
op: SeamOp,
|
|
1321
|
+
payload: Schema11.optional(Schema11.Record({ key: Schema11.String, value: Schema11.Unknown })),
|
|
1322
|
+
ctx: SeamContext
|
|
1323
|
+
});
|
|
1324
|
+
var SeamQueryPayload = Schema11.Struct({
|
|
1325
|
+
filter: Schema11.optional(Schema11.Record({ key: Schema11.String, value: Schema11.Unknown })),
|
|
1326
|
+
limit: Schema11.optional(Schema11.NonNegativeInt)
|
|
1327
|
+
});
|
|
1328
|
+
var SeamDescribePayload = Schema11.Struct({
|
|
1329
|
+
model: Schema11.optional(Schema11.String),
|
|
1330
|
+
mode: Schema11.optional(Schema11.String)
|
|
1331
|
+
});
|
|
1332
|
+
var SeamInvokePayload = Schema11.Struct({
|
|
1333
|
+
commandId: Schema11.String,
|
|
1334
|
+
args: Schema11.optional(Schema11.Record({ key: Schema11.String, value: Schema11.Unknown }))
|
|
1335
|
+
});
|
|
1336
|
+
var SeamError = Schema11.Struct({
|
|
1337
|
+
code: Schema11.String,
|
|
1338
|
+
message: Schema11.String,
|
|
1339
|
+
details: Schema11.optional(Schema11.Unknown)
|
|
1340
|
+
});
|
|
1341
|
+
var SeamResponse = Schema11.Union(
|
|
1342
|
+
Schema11.Struct({ ok: Schema11.Literal(true), data: Schema11.Unknown }),
|
|
1343
|
+
Schema11.Struct({ ok: Schema11.Literal(false), error: SeamError })
|
|
1344
|
+
);
|
|
1345
|
+
var SeamEvent = Schema11.Struct({
|
|
1346
|
+
extensionId: Schema11.String,
|
|
1347
|
+
contributionId: Schema11.String,
|
|
1348
|
+
type: Schema11.String,
|
|
1349
|
+
payload: Schema11.Record({ key: Schema11.String, value: Schema11.Unknown }),
|
|
1350
|
+
observedAtMs: Schema11.NonNegativeInt
|
|
1351
|
+
});
|
|
1352
|
+
var Subscription = Schema11.Struct({
|
|
1353
|
+
subscriptionId: Schema11.String,
|
|
1354
|
+
extensionId: Schema11.String,
|
|
1355
|
+
contributionId: Schema11.String,
|
|
1356
|
+
eventTypes: Schema11.optional(Schema11.Array(Schema11.String))
|
|
1357
|
+
});
|
|
1358
|
+
var decodeSeamRequest = Schema11.decodeUnknownSync(SeamRequest);
|
|
1359
|
+
var encodeSeamRequest = Schema11.encodeSync(SeamRequest);
|
|
1360
|
+
var decodeSeamQueryPayload = Schema11.decodeUnknownSync(SeamQueryPayload);
|
|
1361
|
+
var encodeSeamQueryPayload = Schema11.encodeSync(SeamQueryPayload);
|
|
1362
|
+
var decodeSeamDescribePayload = Schema11.decodeUnknownSync(SeamDescribePayload);
|
|
1363
|
+
var encodeSeamDescribePayload = Schema11.encodeSync(SeamDescribePayload);
|
|
1364
|
+
var decodeSeamInvokePayload = Schema11.decodeUnknownSync(SeamInvokePayload);
|
|
1365
|
+
var encodeSeamInvokePayload = Schema11.encodeSync(SeamInvokePayload);
|
|
1366
|
+
var decodeSeamResponse = Schema11.decodeUnknownSync(SeamResponse);
|
|
1367
|
+
var encodeSeamResponse = Schema11.encodeSync(SeamResponse);
|
|
1368
|
+
var decodeSeamEvent = Schema11.decodeUnknownSync(SeamEvent);
|
|
1369
|
+
var encodeSeamEvent = Schema11.encodeSync(SeamEvent);
|
|
1370
|
+
var decodeSubscription = Schema11.decodeUnknownSync(Subscription);
|
|
1371
|
+
var encodeSubscription = Schema11.encodeSync(Subscription);
|
|
1372
|
+
|
|
1373
|
+
// src/contribution-id-deprecation.ts
|
|
1374
|
+
var rawContributionIdUsageSet = /* @__PURE__ */ new Set();
|
|
1375
|
+
function recordRawContributionId(id, kind) {
|
|
1376
|
+
if (rawContributionIdUsageSet.has(id)) return;
|
|
1377
|
+
rawContributionIdUsageSet.add(id);
|
|
1378
|
+
console.warn(
|
|
1379
|
+
`[extension-sdk] contributionId "${id}" was passed as a raw string. Pass typed fields instead \u2014 { ext, name? } for kind "${kind}" \u2014 and the SDK derives the id. The raw-string path is deprecated and will be removed in SPEC 2 Stage 4.`
|
|
1380
|
+
);
|
|
1381
|
+
}
|
|
1382
|
+
function rawContributionIdUsages() {
|
|
1383
|
+
return [...rawContributionIdUsageSet];
|
|
1384
|
+
}
|
|
1385
|
+
function clearRawContributionIdUsages() {
|
|
1386
|
+
rawContributionIdUsageSet.clear();
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
// src/seam-ports.ts
|
|
1390
|
+
function makeSeamCallContext(parts) {
|
|
1391
|
+
return parts;
|
|
1392
|
+
}
|
|
1393
|
+
var SeamPermissionDenied = class extends Error {
|
|
1394
|
+
constructor(permission) {
|
|
1395
|
+
super(`seam.permission_denied: missing grant for ${permission}`);
|
|
1396
|
+
this.permission = permission;
|
|
1397
|
+
this.name = "SeamPermissionDenied";
|
|
1398
|
+
}
|
|
1399
|
+
permission;
|
|
1400
|
+
code = "seam.permission_denied";
|
|
1401
|
+
};
|
|
1402
|
+
var gatedHostPort = (inner, grants) => ({
|
|
1403
|
+
ctx: inner.ctx,
|
|
1404
|
+
get brain() {
|
|
1405
|
+
if (!grants.has("brain.read")) throw new SeamPermissionDenied("brain.read");
|
|
1406
|
+
return inner.brain;
|
|
1407
|
+
},
|
|
1408
|
+
get context() {
|
|
1409
|
+
if (!grants.has("host.context.read")) throw new SeamPermissionDenied("host.context.read");
|
|
1410
|
+
return inner.context;
|
|
1411
|
+
},
|
|
1412
|
+
get command() {
|
|
1413
|
+
if (!grants.has("host.command.invoke")) throw new SeamPermissionDenied("host.command.invoke");
|
|
1414
|
+
return inner.command;
|
|
1415
|
+
},
|
|
1416
|
+
events: inner.events
|
|
1417
|
+
});
|
|
1418
|
+
|
|
1419
|
+
// src/index.ts
|
|
1420
|
+
var EXTENSION_HOST_SLOTS = [
|
|
1421
|
+
"nav.sidebar",
|
|
1422
|
+
"workspace.surface",
|
|
1423
|
+
"settings.extensions",
|
|
1424
|
+
"chat.visual",
|
|
1425
|
+
"thread.tab.contextMenu",
|
|
1426
|
+
"companion.overlay",
|
|
1427
|
+
"background.sidecar"
|
|
1428
|
+
];
|
|
1429
|
+
function resolveContributionId(kind, input) {
|
|
1430
|
+
if (input.ext !== void 0) {
|
|
1431
|
+
return contributionId({ owner: "ext", kind, ext: input.ext, name: input.name });
|
|
1432
|
+
}
|
|
1433
|
+
if (input.contributionId !== void 0) {
|
|
1434
|
+
recordRawContributionId(input.contributionId, kind);
|
|
1435
|
+
return input.contributionId;
|
|
1436
|
+
}
|
|
1437
|
+
throw new Error(`define(${kind}): provide typed { ext, name? } or a legacy contributionId string`);
|
|
1438
|
+
}
|
|
1439
|
+
function defineSurface(surface) {
|
|
1440
|
+
const { ext, name, contributionId: contributionId2, ...rest } = surface;
|
|
1441
|
+
return { ...rest, requiredHostCapabilities: canonicalHostCapabilities(rest.requiredHostCapabilities), contributionId: resolveContributionId("surface", { ext, name, contributionId: contributionId2 }), kind: "surface" };
|
|
1442
|
+
}
|
|
1443
|
+
function defineSettingsPanel(panel) {
|
|
1444
|
+
const { ext, name, contributionId: contributionId2, ...rest } = panel;
|
|
1445
|
+
return { ...rest, requiredHostCapabilities: canonicalHostCapabilities(rest.requiredHostCapabilities), contributionId: resolveContributionId("settingsPanel", { ext, name, contributionId: contributionId2 }), kind: "settingsPanel" };
|
|
1446
|
+
}
|
|
1447
|
+
function defineComposerCapability(capability) {
|
|
1448
|
+
const { ext, name, contributionId: contributionId2, ...rest } = capability;
|
|
1449
|
+
return { ...rest, requiredHostCapabilities: canonicalHostCapabilities(rest.requiredHostCapabilities), contributionId: resolveContributionId("composerCapability", { ext, name, contributionId: contributionId2 }), kind: "composerCapability" };
|
|
1450
|
+
}
|
|
1451
|
+
function defineContextualAction(action) {
|
|
1452
|
+
const { ext, name, contributionId: contributionId2, ...rest } = action;
|
|
1453
|
+
return { ...rest, requiredHostCapabilities: canonicalHostCapabilities(rest.requiredHostCapabilities), contributionId: resolveContributionId("contextualAction", { ext, name, contributionId: contributionId2 }), kind: "contextualAction" };
|
|
1454
|
+
}
|
|
1455
|
+
function defineSidecarContribution(sidecar) {
|
|
1456
|
+
const { ext, name, contributionId: contributionId2, ...rest } = sidecar;
|
|
1457
|
+
return { ...rest, requiredHostCapabilities: canonicalHostCapabilities(rest.requiredHostCapabilities), contributionId: resolveContributionId("sidecar", { ext, name, contributionId: contributionId2 }), kind: "sidecar" };
|
|
1458
|
+
}
|
|
1459
|
+
function defineBridgeContribution(bridge) {
|
|
1460
|
+
const { ext, name, contributionId: contributionId2, ...rest } = bridge;
|
|
1461
|
+
return { ...rest, requiredHostCapabilities: canonicalHostCapabilities(rest.requiredHostCapabilities), contributionId: resolveContributionId("bridge", { ext, name, contributionId: contributionId2 }), kind: "bridge" };
|
|
1462
|
+
}
|
|
1463
|
+
function defineDataEndpoint(endpoint) {
|
|
1464
|
+
const { ext, name, contributionId: contributionId2, ...rest } = endpoint;
|
|
1465
|
+
return {
|
|
1466
|
+
...rest,
|
|
1467
|
+
requiredHostCapabilities: canonicalHostCapabilities(rest.requiredHostCapabilities),
|
|
1468
|
+
contributionId: resolveContributionId("dataEndpoint", { ext, name, contributionId: contributionId2 }),
|
|
1469
|
+
kind: "dataEndpoint"
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
function defineSidecar(sidecar) {
|
|
1473
|
+
return sidecar;
|
|
1474
|
+
}
|
|
1475
|
+
function defineBridge(bridge) {
|
|
1476
|
+
return bridge;
|
|
1477
|
+
}
|
|
1478
|
+
function defineThemeTokens(themeTokens) {
|
|
1479
|
+
return themeTokens;
|
|
1480
|
+
}
|
|
1481
|
+
function defineProviderRuntimeProjection(projection) {
|
|
1482
|
+
return projection;
|
|
1483
|
+
}
|
|
1484
|
+
function defineExtension(definition) {
|
|
1485
|
+
return definition;
|
|
1486
|
+
}
|
|
1487
|
+
function emitExtensionContributionSet(definition) {
|
|
1488
|
+
const surfaces = [...definition.surfaces ?? []];
|
|
1489
|
+
const settingsPanels = [...definition.settingsPanels ?? []];
|
|
1490
|
+
const composerCapabilities = [...definition.composerCapabilities ?? []];
|
|
1491
|
+
const contextualActions = [...definition.contextualActions ?? []];
|
|
1492
|
+
const sidecarContributions = [...definition.sidecarContributions ?? []];
|
|
1493
|
+
const bridgeContributions = [...definition.bridgeContributions ?? []];
|
|
1494
|
+
const dataEndpoints = [...definition.dataEndpoints ?? []];
|
|
1495
|
+
return {
|
|
1496
|
+
surfaces,
|
|
1497
|
+
settingsPanels,
|
|
1498
|
+
contributions: [...definition.contributions ?? [
|
|
1499
|
+
...surfaces,
|
|
1500
|
+
...settingsPanels,
|
|
1501
|
+
...composerCapabilities,
|
|
1502
|
+
...contextualActions,
|
|
1503
|
+
...sidecarContributions,
|
|
1504
|
+
...bridgeContributions,
|
|
1505
|
+
...dataEndpoints
|
|
1506
|
+
]],
|
|
1507
|
+
sidecars: [...definition.sidecars ?? []],
|
|
1508
|
+
bridges: [...definition.bridges ?? []],
|
|
1509
|
+
permissions: [...definition.permissions ?? []],
|
|
1510
|
+
deniedPermissions: [...definition.deniedPermissions ?? []],
|
|
1511
|
+
themeTokens: [...definition.themeTokens ?? []],
|
|
1512
|
+
hostCapabilities: [...definition.hostCapabilities ?? []],
|
|
1513
|
+
providerProjections: [...definition.providerProjections ?? []],
|
|
1514
|
+
outboundOrigins: [...definition.outboundOrigins ?? []],
|
|
1515
|
+
...definition.ships ? { ships: definition.ships } : {}
|
|
1516
|
+
};
|
|
1517
|
+
}
|
|
1518
|
+
var VALID_HOST_CAPABILITY_IDS = new Set(HostCapabilityId.literals);
|
|
1519
|
+
var VALID_KERNEL_PERMISSION_IDS = new Set(KernelPermissionId.literals);
|
|
1520
|
+
function requiresHostCapabilities(...capabilities) {
|
|
1521
|
+
for (const capability of capabilities) {
|
|
1522
|
+
if (!VALID_HOST_CAPABILITY_IDS.has(capability)) {
|
|
1523
|
+
throw new Error(`requiresHostCapabilities: unknown host capability id "${capability}"`);
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
return capabilities;
|
|
1527
|
+
}
|
|
1528
|
+
function canonicalHostCapabilities(value) {
|
|
1529
|
+
if (!value || value.length === 0) return [];
|
|
1530
|
+
return value.filter((capability, index) => value.indexOf(capability) === index);
|
|
1531
|
+
}
|
|
1532
|
+
function requiresKernelPermissions(...permissions) {
|
|
1533
|
+
for (const permission of permissions) {
|
|
1534
|
+
if (!VALID_KERNEL_PERMISSION_IDS.has(permission)) {
|
|
1535
|
+
throw new Error(`requiresKernelPermissions: unknown kernel permission id "${permission}"`);
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
return permissions;
|
|
1539
|
+
}
|
|
1540
|
+
function hostSlots(...slots) {
|
|
1541
|
+
return slots;
|
|
1542
|
+
}
|
|
1543
|
+
function workspaceTab(tab = {}) {
|
|
1544
|
+
return {
|
|
1545
|
+
defaultVisible: tab.defaultVisible ?? true,
|
|
1546
|
+
...tab.defaultLabel ? { defaultLabel: tab.defaultLabel } : {},
|
|
1547
|
+
allowRename: tab.allowRename ?? true
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
function validateExtensionDefinition(definition) {
|
|
1551
|
+
const errors = [];
|
|
1552
|
+
if (!definition.pluginId.trim()) errors.push("pluginId is required");
|
|
1553
|
+
if (!definition.displayName.trim()) errors.push("displayName is required");
|
|
1554
|
+
for (const origin of definition.outboundOrigins ?? []) {
|
|
1555
|
+
const err = validateOutboundOrigin(origin);
|
|
1556
|
+
if (err) errors.push(err);
|
|
1557
|
+
}
|
|
1558
|
+
const contributionIds = /* @__PURE__ */ new Set();
|
|
1559
|
+
const sidecarIds = new Set((definition.sidecars ?? []).map((sidecar) => sidecar.sidecarId));
|
|
1560
|
+
const bridgeIds = new Set((definition.bridges ?? []).map((bridge) => bridge.bridgeId));
|
|
1561
|
+
for (const contribution of allContributionDefinitions(definition)) {
|
|
1562
|
+
validateContributionBase(contribution, errors, contributionIds);
|
|
1563
|
+
}
|
|
1564
|
+
for (const surface of definition.surfaces ?? []) {
|
|
1565
|
+
if (!surface.contributionId.trim()) errors.push("surface contributionId is required");
|
|
1566
|
+
if (!surface.mount?.trim()) errors.push(`surface ${surface.contributionId || "<missing>"} mount is required`);
|
|
1567
|
+
}
|
|
1568
|
+
for (const panel of definition.settingsPanels ?? []) {
|
|
1569
|
+
if (!panel.contributionId.trim()) errors.push("settings panel contributionId is required");
|
|
1570
|
+
if (!panel.mount?.trim()) errors.push(`settings panel ${panel.contributionId || "<missing>"} mount is required`);
|
|
1571
|
+
}
|
|
1572
|
+
for (const sidecarContribution of definition.sidecarContributions ?? []) {
|
|
1573
|
+
if (!sidecarIds.has(sidecarContribution.contributionId)) {
|
|
1574
|
+
errors.push(`sidecar contribution ${sidecarContribution.contributionId} must have a matching sidecar declaration`);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
for (const bridgeContribution of definition.bridgeContributions ?? []) {
|
|
1578
|
+
if (!bridgeIds.has(bridgeContribution.contributionId)) {
|
|
1579
|
+
errors.push(`bridge contribution ${bridgeContribution.contributionId} must have a matching bridge declaration`);
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
for (const sidecar of definition.sidecars ?? []) {
|
|
1583
|
+
if (!sidecar.sidecarId.trim()) errors.push("sidecar sidecarId is required");
|
|
1584
|
+
if (sidecar.pluginId !== definition.pluginId) errors.push(`sidecar ${sidecar.sidecarId} pluginId must match ${definition.pluginId}`);
|
|
1585
|
+
}
|
|
1586
|
+
for (const bridge of definition.bridges ?? []) {
|
|
1587
|
+
if (!bridge.bridgeId.trim()) errors.push("bridge bridgeId is required");
|
|
1588
|
+
if (bridge.pluginId !== definition.pluginId) errors.push(`bridge ${bridge.bridgeId} pluginId must match ${definition.pluginId}`);
|
|
1589
|
+
}
|
|
1590
|
+
errors.push(...validateDefinitionCrossRefs(definition));
|
|
1591
|
+
return errors;
|
|
1592
|
+
}
|
|
1593
|
+
function validateDefinitionCrossRefs(definition) {
|
|
1594
|
+
const errors = [];
|
|
1595
|
+
const declaredPermissions = /* @__PURE__ */ new Set([
|
|
1596
|
+
...definition.permissions ?? [],
|
|
1597
|
+
...definition.deniedPermissions ?? []
|
|
1598
|
+
]);
|
|
1599
|
+
for (const contribution of allContributionDefinitions(definition)) {
|
|
1600
|
+
const id = contribution.contributionId || "<missing>";
|
|
1601
|
+
for (const permission of contribution.requiredKernelPermissions ?? []) {
|
|
1602
|
+
if (!declaredPermissions.has(permission)) {
|
|
1603
|
+
errors.push(
|
|
1604
|
+
`contribution ${id} requires kernel permission "${permission}" the extension declares nowhere (neither granted nor denied \u2014 contribution \u2286 extension)`
|
|
1605
|
+
);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
return errors;
|
|
1610
|
+
}
|
|
1611
|
+
function deriveExtensionHostCapabilities(definition) {
|
|
1612
|
+
const union = [...definition.hostCapabilities ?? []];
|
|
1613
|
+
for (const contribution of allContributionDefinitions(definition)) {
|
|
1614
|
+
for (const capability of contribution.requiredHostCapabilities ?? []) union.push(capability);
|
|
1615
|
+
}
|
|
1616
|
+
return canonicalHostCapabilities(union);
|
|
1617
|
+
}
|
|
1618
|
+
function allContributionDefinitions(definition) {
|
|
1619
|
+
return [
|
|
1620
|
+
...definition.contributions ?? [],
|
|
1621
|
+
...definition.surfaces ?? [],
|
|
1622
|
+
...definition.settingsPanels ?? [],
|
|
1623
|
+
...definition.composerCapabilities ?? [],
|
|
1624
|
+
...definition.contextualActions ?? [],
|
|
1625
|
+
...definition.sidecarContributions ?? [],
|
|
1626
|
+
...definition.bridgeContributions ?? [],
|
|
1627
|
+
...definition.dataEndpoints ?? []
|
|
1628
|
+
];
|
|
1629
|
+
}
|
|
1630
|
+
function validateContributionBase(contribution, errors, contributionIds) {
|
|
1631
|
+
const id = contribution.contributionId?.trim();
|
|
1632
|
+
if (!id) {
|
|
1633
|
+
errors.push("contributionId is required");
|
|
1634
|
+
return;
|
|
1635
|
+
}
|
|
1636
|
+
if (contributionIds.has(id)) errors.push(`duplicate contributionId ${id}`);
|
|
1637
|
+
contributionIds.add(id);
|
|
1638
|
+
const conventionVerdict = validateContributionId(id, contribution.kind);
|
|
1639
|
+
if (!conventionVerdict.ok) errors.push(conventionVerdict.error);
|
|
1640
|
+
if (!contribution.displayName?.trim()) errors.push(`contribution ${id} displayName is required`);
|
|
1641
|
+
for (const slot of contribution.hostSlots ?? []) {
|
|
1642
|
+
if (!EXTENSION_HOST_SLOTS.includes(slot)) errors.push(`contribution ${id} has unknown host slot ${slot}`);
|
|
1643
|
+
}
|
|
1644
|
+
if (contribution.workspaceTab && !contribution.hostSlots?.includes("workspace.surface")) {
|
|
1645
|
+
errors.push(`contribution ${id} declares workspaceTab without workspace.surface`);
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
export {
|
|
1650
|
+
parseContributionId,
|
|
1651
|
+
makeAgentId,
|
|
1652
|
+
rawContributionIdUsages,
|
|
1653
|
+
clearRawContributionIdUsages,
|
|
1654
|
+
makeSeamCallContext,
|
|
1655
|
+
SeamPermissionDenied,
|
|
1656
|
+
gatedHostPort,
|
|
1657
|
+
EXTENSION_HOST_SLOTS,
|
|
1658
|
+
defineSurface,
|
|
1659
|
+
defineSettingsPanel,
|
|
1660
|
+
defineComposerCapability,
|
|
1661
|
+
defineContextualAction,
|
|
1662
|
+
defineSidecarContribution,
|
|
1663
|
+
defineBridgeContribution,
|
|
1664
|
+
defineDataEndpoint,
|
|
1665
|
+
defineSidecar,
|
|
1666
|
+
defineBridge,
|
|
1667
|
+
defineThemeTokens,
|
|
1668
|
+
defineProviderRuntimeProjection,
|
|
1669
|
+
defineExtension,
|
|
1670
|
+
emitExtensionContributionSet,
|
|
1671
|
+
requiresHostCapabilities,
|
|
1672
|
+
canonicalHostCapabilities,
|
|
1673
|
+
requiresKernelPermissions,
|
|
1674
|
+
hostSlots,
|
|
1675
|
+
workspaceTab,
|
|
1676
|
+
validateExtensionDefinition,
|
|
1677
|
+
validateDefinitionCrossRefs,
|
|
1678
|
+
deriveExtensionHostCapabilities
|
|
1679
|
+
};
|
|
1680
|
+
//# sourceMappingURL=chunk-ZDAZ7Q2A.js.map
|