@kuznai/inception-engine 0.18.0 → 0.20.0
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/README.md +72 -43
- package/dist/{config → src/config}/agents.js +174 -24
- package/dist/src/core/adapters/agent-definitions.d.ts +8 -0
- package/dist/src/core/adapters/agent-definitions.js +162 -0
- package/dist/{core → src/core}/adapters/frontmatter.d.ts +10 -0
- package/dist/{core → src/core}/adapters/frontmatter.js +23 -6
- package/dist/{core → src/core}/adapters/index.d.ts +1 -1
- package/dist/{core → src/core}/adapters/index.js +4 -4
- package/dist/{core → src/core}/adapters/mcp.d.ts +2 -2
- package/dist/{core → src/core}/adapters/mcp.js +21 -24
- package/dist/{core → src/core}/adapters/permissions.js +16 -20
- package/dist/{core → src/core}/adapters/rules.d.ts +2 -2
- package/dist/src/core/adapters/rules.js +126 -0
- package/dist/src/core/capabilities.d.ts +47 -0
- package/dist/src/core/capabilities.js +280 -0
- package/dist/{core → src/core}/deploy.d.ts +1 -1
- package/dist/{core → src/core}/deploy.js +273 -92
- package/dist/{core → src/core}/init.js +126 -52
- package/dist/src/core/merge-patch.d.ts +4 -0
- package/dist/src/core/merge-patch.js +46 -0
- package/dist/{core → src/core}/ownership.d.ts +2 -2
- package/dist/{core → src/core}/ownership.js +13 -0
- package/dist/{core → src/core}/preflight.d.ts +1 -1
- package/dist/src/core/preflight.js +280 -0
- package/dist/{core → src/core}/resolve.d.ts +1 -1
- package/dist/{core → src/core}/resolve.js +7 -4
- package/dist/{core → src/core}/revert.js +95 -33
- package/dist/{core → src/core}/runtime-paths.d.ts +2 -1
- package/dist/{core → src/core}/runtime-paths.js +30 -23
- package/dist/{core → src/core}/validation.d.ts +10 -1
- package/dist/{core → src/core}/validation.js +75 -0
- package/dist/src/formatters.d.ts +5 -0
- package/dist/src/formatters.js +58 -0
- package/dist/{index.js → src/index.js} +8 -24
- package/dist/src/logger.js +62 -0
- package/dist/{schemas → src/schemas}/manifest.d.ts +22 -0
- package/dist/{schemas → src/schemas}/manifest.js +19 -5
- package/dist/{schemas → src/schemas}/registry.d.ts +74 -0
- package/dist/{schemas → src/schemas}/registry.js +18 -3
- package/dist/{types.d.ts → src/types.d.ts} +60 -0
- package/dist/test/helpers/fs.d.ts +2 -0
- package/dist/test/helpers/fs.js +17 -0
- package/dist/test/helpers/path.d.ts +10 -0
- package/dist/test/helpers/path.js +15 -0
- package/dist/test/helpers/skill-dir-scenarios.d.ts +7 -0
- package/dist/test/helpers/skill-dir-scenarios.js +206 -0
- package/dist/test/helpers/skill-dir.d.ts +7 -0
- package/dist/test/helpers/skill-dir.js +46 -0
- package/dist/test/os/cross-platform/cross-platform.test.d.ts +1 -0
- package/dist/test/os/cross-platform/cross-platform.test.js +328 -0
- package/dist/test/os/posix/skill-dir.test.d.ts +1 -0
- package/dist/test/os/posix/skill-dir.test.js +19 -0
- package/dist/test/os/windows/revert-integration.test.d.ts +1 -0
- package/dist/test/os/windows/revert-integration.test.js +72 -0
- package/dist/test/os/windows/skill-dir.test.d.ts +1 -0
- package/dist/test/os/windows/skill-dir.test.js +19 -0
- package/dist/test/unit/adapters.test.d.ts +1 -0
- package/dist/test/unit/adapters.test.js +947 -0
- package/dist/test/unit/capabilities.test.d.ts +1 -0
- package/dist/test/unit/capabilities.test.js +71 -0
- package/dist/test/unit/cli.test.d.ts +1 -0
- package/dist/test/unit/cli.test.js +834 -0
- package/dist/test/unit/deploy.test.d.ts +1 -0
- package/dist/test/unit/deploy.test.js +2481 -0
- package/dist/test/unit/detect.test.d.ts +1 -0
- package/dist/test/unit/detect.test.js +192 -0
- package/dist/test/unit/enterprise.test.d.ts +1 -0
- package/dist/test/unit/enterprise.test.js +106 -0
- package/dist/test/unit/frontmatter.test.d.ts +1 -0
- package/dist/test/unit/frontmatter.test.js +102 -0
- package/dist/test/unit/gemini-north-star.test.d.ts +1 -0
- package/dist/test/unit/gemini-north-star.test.js +243 -0
- package/dist/test/unit/manifest.test.d.ts +1 -0
- package/dist/test/unit/manifest.test.js +737 -0
- package/dist/test/unit/migration-golden.test.d.ts +1 -0
- package/dist/test/unit/migration-golden.test.js +197 -0
- package/dist/test/unit/ownership.test.d.ts +1 -0
- package/dist/test/unit/ownership.test.js +587 -0
- package/dist/test/unit/preflight.test.d.ts +1 -0
- package/dist/test/unit/preflight.test.js +501 -0
- package/dist/test/unit/resolve.test.d.ts +1 -0
- package/dist/test/unit/resolve.test.js +119 -0
- package/dist/test/unit/revert.test.d.ts +1 -0
- package/dist/test/unit/revert.test.js +1004 -0
- package/dist/test/unit/toml.test.d.ts +1 -0
- package/dist/test/unit/toml.test.js +55 -0
- package/package.json +1 -1
- package/dist/core/adapters/agent-definitions.d.ts +0 -20
- package/dist/core/adapters/agent-definitions.js +0 -90
- package/dist/core/adapters/rules.js +0 -103
- package/dist/core/preflight.js +0 -98
- package/dist/logger.js +0 -61
- /package/dist/{config → src/config}/agents.d.ts +0 -0
- /package/dist/{config → src/config}/manifest.d.ts +0 -0
- /package/dist/{config → src/config}/manifest.js +0 -0
- /package/dist/{core → src/core}/adapters/permissions.d.ts +0 -0
- /package/dist/{core → src/core}/adapters/toml.d.ts +0 -0
- /package/dist/{core → src/core}/adapters/toml.js +0 -0
- /package/dist/{core → src/core}/detect.d.ts +0 -0
- /package/dist/{core → src/core}/detect.js +0 -0
- /package/dist/{core → src/core}/init.d.ts +0 -0
- /package/dist/{core → src/core}/revert.d.ts +0 -0
- /package/dist/{errors.d.ts → src/errors.d.ts} +0 -0
- /package/dist/{errors.js → src/errors.js} +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{logger.d.ts → src/logger.d.ts} +0 -0
- /package/dist/{schemas → src/schemas}/errors.d.ts +0 -0
- /package/dist/{schemas → src/schemas}/errors.js +0 -0
- /package/dist/{types.js → src/types.js} +0 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { AGENT_REGISTRY_BY_ID } from "../config/agents.js";
|
|
2
|
+
function resolveAgentRulesSupport(agentId, scope) {
|
|
3
|
+
const agent = AGENT_REGISTRY_BY_ID[agentId];
|
|
4
|
+
if (scope === "repo") {
|
|
5
|
+
return agent?.agentRulesRepoSupport ?? agent?.agentRulesSupport;
|
|
6
|
+
}
|
|
7
|
+
if (scope === "workspace") {
|
|
8
|
+
return (agent?.agentRulesWorkspaceSupport ??
|
|
9
|
+
agent?.agentRulesRepoSupport ??
|
|
10
|
+
agent?.agentRulesSupport);
|
|
11
|
+
}
|
|
12
|
+
return agent?.agentRulesSupport;
|
|
13
|
+
}
|
|
14
|
+
function resolveMcpSupport(agentId, scope) {
|
|
15
|
+
const agent = AGENT_REGISTRY_BY_ID[agentId];
|
|
16
|
+
if (scope === "repo") {
|
|
17
|
+
return agent?.mcpRepoSupport ?? agent?.mcpSupport;
|
|
18
|
+
}
|
|
19
|
+
if (scope === "workspace") {
|
|
20
|
+
return (agent?.mcpWorkspaceSupport ?? agent?.mcpRepoSupport ?? agent?.mcpSupport);
|
|
21
|
+
}
|
|
22
|
+
return agent?.mcpSupport;
|
|
23
|
+
}
|
|
24
|
+
function resolveAgentDefinitionsSupport(agentId, scope) {
|
|
25
|
+
const agent = AGENT_REGISTRY_BY_ID[agentId];
|
|
26
|
+
if (scope === "repo") {
|
|
27
|
+
return agent?.agentDefinitionsRepoSupport ?? agent?.agentDefinitionsSupport;
|
|
28
|
+
}
|
|
29
|
+
if (scope === "workspace") {
|
|
30
|
+
return (agent?.agentDefinitionsWorkspaceSupport ??
|
|
31
|
+
agent?.agentDefinitionsRepoSupport ??
|
|
32
|
+
agent?.agentDefinitionsSupport);
|
|
33
|
+
}
|
|
34
|
+
return agent?.agentDefinitionsSupport;
|
|
35
|
+
}
|
|
36
|
+
function capabilityLabel(capability) {
|
|
37
|
+
switch (capability) {
|
|
38
|
+
case "skills":
|
|
39
|
+
return "skills";
|
|
40
|
+
case "mcpServers":
|
|
41
|
+
return "mcpServers";
|
|
42
|
+
case "agentRules":
|
|
43
|
+
return "agentRules";
|
|
44
|
+
case "permissions":
|
|
45
|
+
return "permissions";
|
|
46
|
+
case "agentDefinitions":
|
|
47
|
+
return "agentDefinitions";
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function capabilitySurfaceLabel(capability) {
|
|
51
|
+
switch (capability) {
|
|
52
|
+
case "skills":
|
|
53
|
+
return "skill";
|
|
54
|
+
case "mcpServers":
|
|
55
|
+
return "MCP";
|
|
56
|
+
case "agentRules":
|
|
57
|
+
return "rules";
|
|
58
|
+
case "permissions":
|
|
59
|
+
return "permissions";
|
|
60
|
+
case "agentDefinitions":
|
|
61
|
+
return "agent-definitions";
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function resolveSkillsCapability(agentId) {
|
|
65
|
+
const agent = AGENT_REGISTRY_BY_ID[agentId];
|
|
66
|
+
if (agent.skills) {
|
|
67
|
+
return {
|
|
68
|
+
agentId,
|
|
69
|
+
capability: "skills",
|
|
70
|
+
supportStatus: "supported",
|
|
71
|
+
confidence: agent.provenance.skills ?? "provisional",
|
|
72
|
+
schemaLabel: "dedicated skill directory",
|
|
73
|
+
surfaceKind: "agent-specific",
|
|
74
|
+
requiresPrimary: false,
|
|
75
|
+
canDeployDirectlyWhenPrimaryAbsent: true,
|
|
76
|
+
includeInInitByDefault: true,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const via = agent.skillsSurfaceKind?.via;
|
|
80
|
+
return {
|
|
81
|
+
agentId,
|
|
82
|
+
capability: "skills",
|
|
83
|
+
supportStatus: "supported",
|
|
84
|
+
confidence: agent.provenance.skills,
|
|
85
|
+
schemaLabel: "shared native skill directory",
|
|
86
|
+
surfaceKind: agent.skillsSurfaceKind?.kind === "shared-via" ? "shared-via" : "native",
|
|
87
|
+
sharedVia: via,
|
|
88
|
+
requiresPrimary: true,
|
|
89
|
+
canDeployDirectlyWhenPrimaryAbsent: false,
|
|
90
|
+
includeInInitByDefault: false,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function getSurfaceRecordAndConfidence(agentId, capability, scope) {
|
|
94
|
+
const agent = AGENT_REGISTRY_BY_ID[agentId];
|
|
95
|
+
if (capability === "mcpServers") {
|
|
96
|
+
return {
|
|
97
|
+
supportRecord: resolveMcpSupport(agentId, scope),
|
|
98
|
+
confidence: agent.provenance.mcpConfig,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (capability === "agentRules") {
|
|
102
|
+
return {
|
|
103
|
+
supportRecord: resolveAgentRulesSupport(agentId, scope),
|
|
104
|
+
confidence: agent.provenance.agentRules,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (capability === "permissions") {
|
|
108
|
+
return {
|
|
109
|
+
supportRecord: agent.permissionsSupport,
|
|
110
|
+
confidence: agent.provenance.permissions,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
supportRecord: resolveAgentDefinitionsSupport(agentId, scope),
|
|
115
|
+
confidence: agent.provenance.agentDefinitions,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function resolveUnsupportedSurface(agentId, capability, supportRecord, confidence) {
|
|
119
|
+
return {
|
|
120
|
+
agentId,
|
|
121
|
+
capability,
|
|
122
|
+
supportStatus: "unsupported",
|
|
123
|
+
supportRecord,
|
|
124
|
+
confidence,
|
|
125
|
+
schemaLabel: supportRecord?.schemaLabel ?? "an unsupported surface",
|
|
126
|
+
surfaceKind: "agent-specific",
|
|
127
|
+
requiresPrimary: false,
|
|
128
|
+
canDeployDirectlyWhenPrimaryAbsent: false,
|
|
129
|
+
includeInInitByDefault: false,
|
|
130
|
+
reason: supportRecord?.status === "unsupported"
|
|
131
|
+
? supportRecord.reason
|
|
132
|
+
: undefined,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function resolvePlannedSurface(agentId, capability, supportRecord, confidence) {
|
|
136
|
+
return {
|
|
137
|
+
agentId,
|
|
138
|
+
capability,
|
|
139
|
+
supportStatus: "planned",
|
|
140
|
+
supportRecord,
|
|
141
|
+
confidence,
|
|
142
|
+
schemaLabel: supportRecord.schemaLabel,
|
|
143
|
+
surfaceKind: "agent-specific",
|
|
144
|
+
requiresPrimary: false,
|
|
145
|
+
canDeployDirectlyWhenPrimaryAbsent: false,
|
|
146
|
+
includeInInitByDefault: false,
|
|
147
|
+
reason: supportRecord.reason,
|
|
148
|
+
plannedSurface: supportRecord.plannedSurface,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function resolveSupportedSurface(agentId, capability, supportRecord, confidence) {
|
|
152
|
+
const surfaceKind = supportRecord.surfaceKind?.kind ?? "agent-specific";
|
|
153
|
+
const sharedVia = supportRecord.surfaceKind?.kind === "shared-via"
|
|
154
|
+
? supportRecord.surfaceKind.via
|
|
155
|
+
: undefined;
|
|
156
|
+
const requiresPrimary = supportRecord.surfaceKind?.kind === "shared-via" &&
|
|
157
|
+
supportRecord.surfaceKind.requiresPrimary === true;
|
|
158
|
+
return {
|
|
159
|
+
agentId,
|
|
160
|
+
capability,
|
|
161
|
+
supportStatus: "supported",
|
|
162
|
+
support: supportRecord,
|
|
163
|
+
supportRecord,
|
|
164
|
+
confidence: confidence ?? "provisional",
|
|
165
|
+
schemaLabel: supportRecord.schemaLabel,
|
|
166
|
+
surfaceKind,
|
|
167
|
+
sharedVia,
|
|
168
|
+
requiresPrimary,
|
|
169
|
+
canDeployDirectlyWhenPrimaryAbsent: surfaceKind !== "shared-via" || !requiresPrimary,
|
|
170
|
+
includeInInitByDefault: surfaceKind === "agent-specific",
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
export function resolveCapabilitySurface(agentId, capability, scope = "global") {
|
|
174
|
+
if (capability === "skills")
|
|
175
|
+
return resolveSkillsCapability(agentId);
|
|
176
|
+
const { supportRecord, confidence } = getSurfaceRecordAndConfidence(agentId, capability, scope);
|
|
177
|
+
if (!supportRecord || supportRecord.status === "unsupported") {
|
|
178
|
+
return resolveUnsupportedSurface(agentId, capability, supportRecord, confidence);
|
|
179
|
+
}
|
|
180
|
+
if (supportRecord.status === "planned") {
|
|
181
|
+
return resolvePlannedSurface(agentId, capability, supportRecord, confidence);
|
|
182
|
+
}
|
|
183
|
+
return resolveSupportedSurface(agentId, capability, supportRecord, confidence);
|
|
184
|
+
}
|
|
185
|
+
function createSurfaceWarning(surface, entryName) {
|
|
186
|
+
const label = capabilityLabel(surface.capability);
|
|
187
|
+
if (surface.supportStatus === "unsupported") {
|
|
188
|
+
return {
|
|
189
|
+
kind: "confidence",
|
|
190
|
+
message: `${label}: agent "${surface.agentId}" uses ${surface.schemaLabel} (unsupported) and ${surface.reason ?? "does not expose a supported adapter"} — skipping "${entryName}"`,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
if (surface.supportStatus === "planned") {
|
|
194
|
+
return {
|
|
195
|
+
kind: "confidence",
|
|
196
|
+
message: `${label}: agent "${surface.agentId}" ${capabilitySurfaceLabel(surface.capability)} support is planned via ${surface.plannedSurface} — skipping "${entryName}" until that surface is implemented`,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
if (surface.surfaceKind === "shared-via" && surface.sharedVia) {
|
|
200
|
+
return {
|
|
201
|
+
kind: "confidence",
|
|
202
|
+
message: `${label}: agent "${surface.agentId}" reads this surface via "${surface.sharedVia}" — add "${surface.sharedVia}" to the entry's agents list to deploy to this surface, or deploy via the "${surface.sharedVia}" ${label} target instead`,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
kind: "confidence",
|
|
207
|
+
message: `${label}: agent "${surface.agentId}" does not expose a directly deployable surface — skipping "${entryName}"`,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
export function planCapabilityForDeploy(opts) {
|
|
211
|
+
const surface = resolveCapabilitySurface(opts.agentId, opts.capability, opts.scope);
|
|
212
|
+
if (surface.supportStatus !== "supported") {
|
|
213
|
+
return {
|
|
214
|
+
outcome: "warn",
|
|
215
|
+
warning: createSurfaceWarning(surface, opts.entryName),
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
if (surface.surfaceKind === "native") {
|
|
219
|
+
return { outcome: "native" };
|
|
220
|
+
}
|
|
221
|
+
if (surface.surfaceKind === "shared-via" && surface.sharedVia) {
|
|
222
|
+
if (opts.targetAgentIds.includes(surface.sharedVia)) {
|
|
223
|
+
return {
|
|
224
|
+
outcome: "redundant",
|
|
225
|
+
confidence: surface.confidence,
|
|
226
|
+
support: surface.support,
|
|
227
|
+
sharedVia: surface.sharedVia,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
if (!surface.canDeployDirectlyWhenPrimaryAbsent) {
|
|
231
|
+
return {
|
|
232
|
+
outcome: "warn",
|
|
233
|
+
warning: createSurfaceWarning(surface, opts.entryName),
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
outcome: "action",
|
|
239
|
+
confidence: surface.confidence,
|
|
240
|
+
support: surface.support,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
export function shouldInitIncludeAgent(agentId, capability, scope = "global") {
|
|
244
|
+
return resolveCapabilitySurface(agentId, capability, scope)
|
|
245
|
+
.includeInInitByDefault;
|
|
246
|
+
}
|
|
247
|
+
export function describeCapabilityConfidence(agentId, capability, scope = "global") {
|
|
248
|
+
const surface = resolveCapabilitySurface(agentId, capability, scope);
|
|
249
|
+
if (surface.supportStatus === "planned") {
|
|
250
|
+
return {
|
|
251
|
+
confidence: surface.confidence,
|
|
252
|
+
message: `Agent "${agentId}" ${capabilitySurfaceLabel(capability)} support remains planned via ${surface.plannedSurface}.`,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
if (surface.supportStatus === "unsupported") {
|
|
256
|
+
return {
|
|
257
|
+
confidence: surface.confidence,
|
|
258
|
+
message: `Agent "${agentId}" ${capabilitySurfaceLabel(capability)} surface is unsupported: ${surface.reason ?? surface.schemaLabel}.`,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
if (surface.surfaceKind === "shared-via" && surface.sharedVia) {
|
|
262
|
+
return {
|
|
263
|
+
confidence: surface.confidence,
|
|
264
|
+
message: `Agent "${agentId}" ${capabilitySurfaceLabel(capability)} surface is shared through "${surface.sharedVia}"${surface.requiresPrimary ? " and requires the primary target to deploy" : ""}.`,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
if (surface.confidence === "implementation-only") {
|
|
268
|
+
return {
|
|
269
|
+
confidence: surface.confidence,
|
|
270
|
+
message: `Agent "${agentId}" ${capabilitySurfaceLabel(capability)} support is implementation-only: behavior is based on registry inspection and local validation, not published documentation.`,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
if (surface.confidence === "provisional") {
|
|
274
|
+
return {
|
|
275
|
+
confidence: surface.confidence,
|
|
276
|
+
message: `Agent "${agentId}" ${capabilitySurfaceLabel(capability)} support is provisional: behavior has not been independently verified.`,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
return { confidence: surface.confidence, message: null };
|
|
280
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentId, DeployAction, Manifest, PlannedChange, PlanWarning, SkillDirDeployAction } from "../types.ts";
|
|
2
2
|
import { type RegistryPersistence } from "./ownership.ts";
|
|
3
|
-
export declare function planDeploy(manifest: Manifest, sourceDir: string, detectedAgents: AgentId[], home: string): Promise<{
|
|
3
|
+
export declare function planDeploy(manifest: Manifest, sourceDir: string, detectedAgents: AgentId[], home: string, repo?: string, workspace?: string): Promise<{
|
|
4
4
|
actions: DeployAction[];
|
|
5
5
|
warnings: PlanWarning[];
|
|
6
6
|
}>;
|