@world-engines/agent-kit 0.1.0-alpha.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.
Files changed (77) hide show
  1. package/LICENSE +46 -0
  2. package/assets/README.md +58 -0
  3. package/assets/docs/development/README.md +25 -0
  4. package/assets/docs/development/authoring-bridge.md +52 -0
  5. package/assets/docs/development/authoring-workflows.md +48 -0
  6. package/assets/docs/development/chatplay-view.md +111 -0
  7. package/assets/docs/development/cli.md +145 -0
  8. package/assets/docs/development/desktop-transfer-security.md +46 -0
  9. package/assets/docs/development/generated/authoring-bridge-contract.json +598 -0
  10. package/assets/docs/development/generated/authoring-bridge-contract.md +660 -0
  11. package/assets/docs/development/generated/chatplay-sdk/SOURCE.json +10 -0
  12. package/assets/docs/development/generated/chatplay-sdk/chatplay-sdk.d.ts +309 -0
  13. package/assets/docs/development/generated/chatplay-sdk/descriptor.json +699 -0
  14. package/assets/docs/development/generated/chatplay-sdk/descriptor.md +363 -0
  15. package/assets/docs/development/installation-and-structure.md +70 -0
  16. package/assets/docs/development/local-gui.md +94 -0
  17. package/assets/docs/development/scene-authoring.md +74 -0
  18. package/assets/guides/long-form-ladybug-trigger.md +98 -0
  19. package/assets/launchers/worldengine-codex.ps1 +105 -0
  20. package/assets/launchers/worldengine-mcp.cmd +5 -0
  21. package/assets/launchers/worldengine-npm.cjs +18 -0
  22. package/assets/launchers/worldengine.cmd +39 -0
  23. package/assets/prompts/local-author-system.md +40 -0
  24. package/assets/skills/caveman/LICENSE.md +13 -0
  25. package/assets/skills/caveman/SKILL.md +50 -0
  26. package/assets/skills/caveman/SOURCE.md +9 -0
  27. package/assets/skills/diagnose/SKILL.md +118 -0
  28. package/assets/skills/diagnose/SOURCE.md +3 -0
  29. package/assets/skills/diagnose/scripts/hitl-loop.template.sh +41 -0
  30. package/assets/skills/i-have-adhd/LICENSE.md +9 -0
  31. package/assets/skills/i-have-adhd/SKILL.md +139 -0
  32. package/assets/skills/i-have-adhd/SOURCE.md +9 -0
  33. package/assets/skills/i-have-adhd/agents/gemini.toml +24 -0
  34. package/assets/skills/i-have-adhd/agents/openai.yaml +7 -0
  35. package/assets/skills/improve-codebase-architecture/DEEPENING.md +37 -0
  36. package/assets/skills/improve-codebase-architecture/INTERFACE-DESIGN.md +44 -0
  37. package/assets/skills/improve-codebase-architecture/LANGUAGE.md +53 -0
  38. package/assets/skills/improve-codebase-architecture/SKILL.md +72 -0
  39. package/assets/skills/improve-codebase-architecture/SOURCE.md +3 -0
  40. package/assets/skills/lossless-document-authoring/SKILL.md +45 -0
  41. package/assets/skills/lossless-document-authoring/references/d4f-workflow.md +155 -0
  42. package/assets/skills/platform-conversion/SKILL.md +23 -0
  43. package/assets/skills/platform-conversion/references/scenario-conversion.md +17 -0
  44. package/assets/skills/platform-conversion/references/view-conversion.md +19 -0
  45. package/assets/skills/setup-matt-pocock-skills/LICENSE.md +9 -0
  46. package/assets/skills/setup-matt-pocock-skills/SKILL.md +122 -0
  47. package/assets/skills/setup-matt-pocock-skills/SOURCE.md +11 -0
  48. package/assets/skills/setup-matt-pocock-skills/domain.md +51 -0
  49. package/assets/skills/setup-matt-pocock-skills/issue-tracker-github.md +22 -0
  50. package/assets/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +23 -0
  51. package/assets/skills/setup-matt-pocock-skills/issue-tracker-local.md +19 -0
  52. package/assets/skills/setup-matt-pocock-skills/triage-labels.md +15 -0
  53. package/assets/skills/tdd/SKILL.md +110 -0
  54. package/assets/skills/tdd/SOURCE.md +3 -0
  55. package/assets/skills/tdd/deep-modules.md +33 -0
  56. package/assets/skills/tdd/interface-design.md +31 -0
  57. package/assets/skills/tdd/mocking.md +59 -0
  58. package/assets/skills/tdd/refactoring.md +10 -0
  59. package/assets/skills/tdd/tests.md +61 -0
  60. package/assets/skills/to-issues/SKILL.md +90 -0
  61. package/assets/skills/to-issues/SOURCE.md +3 -0
  62. package/assets/skills/to-prd/SKILL.md +77 -0
  63. package/assets/skills/to-prd/SOURCE.md +3 -0
  64. package/assets/skills/triage/AGENT-BRIEF.md +168 -0
  65. package/assets/skills/triage/OUT-OF-SCOPE.md +101 -0
  66. package/assets/skills/triage/SKILL.md +104 -0
  67. package/assets/skills/triage/SOURCE.md +3 -0
  68. package/assets/skills/zoom-out/SKILL.md +8 -0
  69. package/assets/skills/zoom-out/SOURCE.md +3 -0
  70. package/assets/skills-disabled/chat-authority-recovery/SKILL.md +8 -0
  71. package/assets/skills-disabled/codepicker/SKILL.md +8 -0
  72. package/assets/skills-disabled/pacemaker/SKILL.md +8 -0
  73. package/assets/skills-disabled/project-spec-ticket-orchestration/SKILL.md +8 -0
  74. package/assets/skills-disabled/release-deployment-auditor/SKILL.md +8 -0
  75. package/dist/index.d.ts +132 -0
  76. package/dist/index.js +382 -0
  77. package/package.json +51 -0
package/dist/index.js ADDED
@@ -0,0 +1,382 @@
1
+ import { readFile, readdir } from "node:fs/promises";
2
+ import { fileURLToPath } from "node:url";
3
+ import { join, relative, sep } from "node:path";
4
+ import { computeCanonicalFileTreeDigest } from "@world-engines/project-format";
5
+ /** Host MCP initialize 的唯一短 instructions;调用方不得另维护摘要或改写语义。 */
6
+ export const PROJECT_HOST_MCP_INSTRUCTIONS = "作者工作先读 docs/authoring/development/cli.md 与 authoring-workflows.md,并以 tools/list/schema 为准。外部 harness 自己处理 next.request.structuredRequest 的 messages/jsonSchema;Host 只负责原文窗口、校验、checkpoint 与 commit。首次来源身份由 local_scenario_id 与项目相对文件路径稳定推导,冲突才询问。查书先说明登录与余额计费并执行 recall prepare;ask 只返回 candidates/graphPaths/pathOptions/evidence,由 harness 依据证据回答。MCP 只供开发,iframe 只用 ChatPlay SDK。禁止 provider key、静默迁移及记录讨论废案。";
7
+ /** Codex 只转发 proxy/callback capability;不分发 provider key。 */
8
+ export const CODEX_MCP_ENV_VARS = Object.freeze([
9
+ "NO_PROXY",
10
+ "HTTP_PROXY",
11
+ "HTTPS_PROXY",
12
+ "ALL_PROXY",
13
+ "NODE_USE_ENV_PROXY",
14
+ "WORLDENGINE_HARNESS_CALLBACK_PIPE",
15
+ "WORLDENGINE_HARNESS_CALLBACK_CHALLENGE_ID",
16
+ "WORLDENGINE_HARNESS_CALLBACK_CHALLENGE",
17
+ "WORLDENGINE_HARNESS_CALLBACK_EXPIRES_AT_MS",
18
+ ]);
19
+ /**
20
+ * initializer 的唯一链接输入。这里只描述项目根内的相对 link graph;实际创建前仍须由
21
+ * coordinator 验证 canonical root、同卷 hardlink 与既有 reparse point,不能回退到 copy。
22
+ */
23
+ export const AGENT_KIT_ROOT_LINKS = Object.freeze([
24
+ { path: "AGENTS.md", kind: "hardlink", target: "docs/authoring/system-prompt.md" },
25
+ { path: "AGENT.md", kind: "hardlink", target: "docs/authoring/system-prompt.md" },
26
+ { path: "CLAUDE.md", kind: "hardlink", target: "docs/authoring/system-prompt.md" },
27
+ { path: ".codex/config.toml", kind: "hardlink", target: "docs/authoring/configs/codex.toml" },
28
+ { path: ".claude/settings.json", kind: "hardlink", target: "docs/authoring/configs/claude-settings.json" },
29
+ { path: ".mcp.json", kind: "hardlink", target: "docs/authoring/configs/mcp.json" },
30
+ { path: "worldengine.cmd", kind: "hardlink", target: "docs/authoring/launchers/worldengine.cmd" },
31
+ { path: "worldengine-npm.cjs", kind: "hardlink", target: "docs/authoring/launchers/worldengine-npm.cjs" },
32
+ { path: "worldengine-codex.ps1", kind: "hardlink", target: "docs/authoring/launchers/worldengine-codex.ps1" },
33
+ { path: "worldengine-mcp.cmd", kind: "hardlink", target: "docs/authoring/launchers/worldengine-mcp.cmd" },
34
+ { path: ".agents/skills", kind: "junction", target: "docs/authoring/skills" },
35
+ { path: ".codex/skills", kind: "junction", target: "docs/authoring/skills" },
36
+ { path: ".claude/skills", kind: "junction", target: "docs/authoring/skills" },
37
+ ]);
38
+ export const HARNESS_INTEGRATIONS = Object.freeze([
39
+ {
40
+ name: "codex",
41
+ instruction_entrypoint: "AGENTS.md",
42
+ skill_entrypoint: ".agents/skills",
43
+ mcp_entrypoint: ".codex/config.toml",
44
+ system_prompt: "docs/authoring/system-prompt.md",
45
+ system_prompt_consumption: "project-instructions-auto",
46
+ integration_mode: "native-project-discovery",
47
+ activation_requirement: "trusted-project",
48
+ explicit_launcher: "worldengine-codex.ps1",
49
+ },
50
+ {
51
+ name: "claude-code",
52
+ instruction_entrypoint: "CLAUDE.md",
53
+ skill_entrypoint: ".claude/skills",
54
+ mcp_entrypoint: ".mcp.json",
55
+ system_prompt: "docs/authoring/system-prompt.md",
56
+ system_prompt_consumption: "project-instructions-auto",
57
+ integration_mode: "native-project-discovery",
58
+ },
59
+ {
60
+ name: "deepseek-harness",
61
+ instruction_entrypoint: "AGENT.md",
62
+ skill_entrypoint: ".agents/skills",
63
+ mcp_entrypoint: ".mcp.json",
64
+ system_prompt: "docs/authoring/system-prompt.md",
65
+ system_prompt_consumption: "manual-import",
66
+ integration_mode: "generic-mcp-or-cli",
67
+ },
68
+ {
69
+ name: "generic-cli",
70
+ instruction_entrypoint: "AGENT.md",
71
+ skill_entrypoint: ".agents/skills",
72
+ system_prompt: "docs/authoring/system-prompt.md",
73
+ system_prompt_consumption: "manual-import",
74
+ integration_mode: "cli-only",
75
+ },
76
+ ]);
77
+ const PROJECT_SKILLS = [
78
+ {
79
+ name: "chatplay-view-development",
80
+ content: `---
81
+ name: chatplay-view-development
82
+ description: 检查、截图定位、预览或修改 Local Author Project 的 view/ ChatPlay 前端;不用于一般项目审计。
83
+ ---
84
+
85
+ 适用范围是 \`view/\` 的宿主交互、截图/视觉问题、预览和前端改动,不做无关的项目审计或 Scenario 作者源工作。
86
+
87
+ - 先读 \`docs/authoring/development/chatplay-view.md\` 与当前随包的 ChatPlay SDK descriptor;成品 sandboxed iframe 只调用其中公开的正式 SDK wrapper,不读取 top window、cookie、AuthoringBridge 或项目文件系统,也不把 MCP 打包或探测为运行时依赖。
88
+ - 只读检查、截图定位或预览:检查已有 View、真实截图和可用预览证据即可;不要因此强制编辑、build 或 smoke。预览只做不改变业务状态的查看、定位或滚动;发送、表单提交等交互仍须有用户授权。
89
+ - 修改:只编辑 \`view/\`,不要把 Scenario 数据复制进 View。先消费当前真实截图并与目标逐项比较;改后运行与改动相称的现有最小验证,必要时使用 \`.\\worldengine.cmd npm run typecheck\`、\`build\` 或 \`smoke:view\`,并取得更新后的截图。报告相关 console、network、runtime error 与 PC/mobile viewport 结果。
90
+ `,
91
+ },
92
+ {
93
+ name: "scenario-authoring",
94
+ content: `---
95
+ name: scenario-authoring
96
+ description: 通过 ProjectHost MCP 修改 Ladybug、Trigger、布局、Retrieval 与 Spatial World 作者源。
97
+ ---
98
+
99
+ 1. 先读取 \`docs/authoring/development/cli.md\`、\`docs/authoring/development/authoring-workflows.md\`、\`worldengine.project.json\` 的当前 project revision,并从 MCP \`tools/list\` 获取本次 runtime 的真实工具面;不要维护另一份 tool 列表。
100
+ 2. 全文工作先以当前 CLI help/schema 为准。外部 harness 使用自己已选择的模型完成结构化抽取与分段语义;Host 只准备原文窗口/schema、校验 checkpoint 与 commit,并保持原文 bytes 和无向量 raw graph,不代配 harness 模型。
101
+ 3. 核对 source/graph receipt、coverage 与 provenance;partial 不称完整。恢复必须沿用原 operation/checkpoint,不能把旧方法静默迁移成新方法。需要 embedding 时必须先具备桌面 ProjectAuthBroker,并登录本机 \`127.0.0.1:11450\`,由账户余额结算;不得索取、配置或分发 DeepSeek/OpenRouter provider key。
102
+ 4. Trigger 依次执行 schema/read、candidate validate、apply、readback 与 simulate;effect 携带稳定 \`operation_id\` 与当前 \`expected_project_revision\`,只引用已读回的 entity 或 stable \`spatial_ref\`。
103
+ 5. 遇到 stale revision 时先重读并形成合并后的新意图,不能直接改 \`scenario/source.wes\`,也不能只替换 revision 盲重试。
104
+
105
+ Scene 工作另读 \`docs/authoring/development/scene-authoring.md\`:从 \`world_schema.scene\` 发现 9 个 \`scene.*\` operation,从 \`trigger_schema.local_effect_capabilities\` 取 registered argument schema,经 \`world_apply\` 写入并用 \`world_get.metadata.initial_scene\` 读回。Scene 在场对象可为任意现存 node;空间引用绑定地图自身 revision。\`scene.note.add\` 只保存逐字 writer manuscript,lifetime 为 \`once|scene_end\`,不能充当 system prompt 或永久属性。
106
+
107
+ 完整步骤见 \`docs/authoring/guides/long-form-ladybug-trigger.md\`;任何接口在使用前先查
108
+ \`docs/authoring/development/\` 与当前 MCP \`tools/list\`,文档没有声明的接口不得猜测。
109
+ `,
110
+ },
111
+ ];
112
+ const BUNDLED_EXTERNAL_SKILLS = [
113
+ "caveman",
114
+ "diagnose",
115
+ "i-have-adhd",
116
+ "improve-codebase-architecture",
117
+ "lossless-document-authoring",
118
+ "platform-conversion",
119
+ "setup-matt-pocock-skills",
120
+ "tdd",
121
+ "to-issues",
122
+ "to-prd",
123
+ "triage",
124
+ "zoom-out",
125
+ ];
126
+ const ASSET_SKILLS_ROOT = fileURLToPath(new URL("../assets/skills", import.meta.url));
127
+ const ASSET_DEVELOPMENT_DOCS_ROOT = fileURLToPath(new URL("../assets/docs/development", import.meta.url));
128
+ const DISABLED_ASSET_SKILLS_ROOT = fileURLToPath(new URL("../assets/skills-disabled", import.meta.url));
129
+ const LOCAL_AUTHOR_SYSTEM_PROMPT = fileURLToPath(new URL("../assets/prompts/local-author-system.md", import.meta.url));
130
+ const LONG_FORM_AUTHORING_GUIDE = fileURLToPath(new URL("../assets/guides/long-form-ladybug-trigger.md", import.meta.url));
131
+ const AGENT_KIT_README = fileURLToPath(new URL("../assets/README.md", import.meta.url));
132
+ const CODEX_LAUNCHER = fileURLToPath(new URL("../assets/launchers/worldengine-codex.ps1", import.meta.url));
133
+ const MCP_LAUNCHER = fileURLToPath(new URL("../assets/launchers/worldengine-mcp.cmd", import.meta.url));
134
+ const CLI_LAUNCHER = fileURLToPath(new URL("../assets/launchers/worldengine.cmd", import.meta.url));
135
+ const NPM_LAUNCHER = fileURLToPath(new URL("../assets/launchers/worldengine-npm.cjs", import.meta.url));
136
+ const CODEX_ENVIRONMENT_PLACEHOLDER = "__WORLDENGINE_ENV_VARS_TOML__";
137
+ const PROJECT_HOST_MCP_ARGS = ["/d", "/s", "/c", "worldengine-mcp.cmd"];
138
+ const CODEX_MCP_CONFIG = `[mcp_servers.worldengine]
139
+ command = "cmd.exe"
140
+ args = [${PROJECT_HOST_MCP_ARGS.map((value) => `"${value}"`).join(", ")}]
141
+ cwd = "."
142
+ env_vars = [${CODEX_MCP_ENV_VARS.map((name) => `"${name}"`).join(", ")}]
143
+ default_tools_approval_mode = "writes"
144
+ `;
145
+ const GENERIC_MCP_CONFIG = `${JSON.stringify({
146
+ mcpServers: {
147
+ worldengine: { command: "cmd.exe", args: PROJECT_HOST_MCP_ARGS, cwd: "." },
148
+ },
149
+ }, null, 2)}\n`;
150
+ const CLAUDE_SETTINGS = `${JSON.stringify({ enableAllProjectMcpServers: true }, null, 2)}\n`;
151
+ const BUNDLED_DISABLED_SKILLS = [
152
+ "chat-authority-recovery",
153
+ "codepicker",
154
+ "pacemaker",
155
+ "project-spec-ticket-orchestration",
156
+ "release-deployment-auditor",
157
+ ];
158
+ const SUPPORTED_HARNESSES = ["codex", "claude-code", "deepseek-harness", "generic-cli"];
159
+ const USER_PROVIDED_LICENSE_HOLD = "LicenseRef-User-Provided:未取得权利方可分发许可,保持分发 HOLD。";
160
+ async function readSkillTree(skillName, assetsRoot, installRoot, directory = join(assetsRoot, skillName)) {
161
+ const files = [];
162
+ for (const entry of await readdir(directory, { withFileTypes: true })) {
163
+ const path = join(directory, entry.name);
164
+ if (entry.isDirectory()) {
165
+ files.push(...(await readSkillTree(skillName, assetsRoot, installRoot, path)));
166
+ }
167
+ else if (entry.isFile()) {
168
+ const skillRelativePath = relative(join(assetsRoot, skillName), path)
169
+ .split(sep)
170
+ .join("/");
171
+ files.push({
172
+ path: `${installRoot}/${skillName}/${skillRelativePath}`,
173
+ content: await readFile(path, "utf8"),
174
+ });
175
+ }
176
+ }
177
+ return files.sort((left, right) => left.path.localeCompare(right.path, "en"));
178
+ }
179
+ async function readDevelopmentDocumentation(directory = ASSET_DEVELOPMENT_DOCS_ROOT) {
180
+ let entries;
181
+ try {
182
+ entries = await readdir(directory, { withFileTypes: true });
183
+ }
184
+ catch (error) {
185
+ if (error.code === "ENOENT")
186
+ return [];
187
+ throw error;
188
+ }
189
+ const files = [];
190
+ for (const entry of entries) {
191
+ const path = join(directory, entry.name);
192
+ if (entry.isSymbolicLink()) {
193
+ throw new Error(`agent-kit development 文档不允许符号链接:${entry.name}`);
194
+ }
195
+ if (entry.isDirectory()) {
196
+ files.push(...(await readDevelopmentDocumentation(path)));
197
+ continue;
198
+ }
199
+ if (!entry.isFile()) {
200
+ throw new Error(`agent-kit development 文档必须是普通文件:${entry.name}`);
201
+ }
202
+ if (!(entry.name.endsWith(".md") || entry.name.endsWith(".json") || entry.name.endsWith(".d.ts"))) {
203
+ throw new Error(`agent-kit development 文档类型不受支持:${entry.name}`);
204
+ }
205
+ const content = await readFile(path, "utf8");
206
+ if (/-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----|\bsk-[A-Za-z0-9_-]{20,}/.test(content)) {
207
+ throw new Error(`agent-kit development 文档疑似包含 secret:${entry.name}`);
208
+ }
209
+ const assetRelativePath = relative(ASSET_DEVELOPMENT_DOCS_ROOT, path).split(sep).join("/");
210
+ if (assetRelativePath.startsWith("../") || assetRelativePath === "..") {
211
+ throw new Error(`agent-kit development 文档越出 assets root:${entry.name}`);
212
+ }
213
+ files.push({ path: `development/${assetRelativePath}`, content });
214
+ }
215
+ return files.sort((left, right) => left.path.localeCompare(right.path, "en"));
216
+ }
217
+ function frontmatterLicense(skillContent) {
218
+ return /^license:\s*([^\r\n]+)$/m.exec(skillContent)?.[1]?.trim() ?? "LicenseRef-User-Provided";
219
+ }
220
+ async function fullTreeDigest(files, skillName, installRoot) {
221
+ const prefix = `${installRoot}/${skillName}/`;
222
+ return computeCanonicalFileTreeDigest(files.map((file) => ({
223
+ path: file.path.slice(prefix.length),
224
+ bytes: new TextEncoder().encode(file.content),
225
+ })));
226
+ }
227
+ function distributionFor(license, enabledByDefault) {
228
+ if (license === "LicenseRef-User-Provided") {
229
+ return { status: "hold", hold_reason: USER_PROVIDED_LICENSE_HOLD };
230
+ }
231
+ if (!enabledByDefault) {
232
+ return { status: "hold", hold_reason: "Chat 平台内部 Skill,不向普通作者项目默认暴露。" };
233
+ }
234
+ return { status: "ready" };
235
+ }
236
+ function sourceForExternalSkill(name) {
237
+ if (name === "lossless-document-authoring" || name === "platform-conversion")
238
+ return "worldengine";
239
+ if (name === "i-have-adhd")
240
+ return "local-codex-skill";
241
+ if (name === "caveman")
242
+ return "local-claude-skill";
243
+ return "matt-pocock-skill-suite-local-copy";
244
+ }
245
+ export async function materializeAgentKit() {
246
+ const [readme, systemPrompt, longFormGuide, codexLauncherTemplate, cliLauncher, npmLauncher, mcpLauncher, developmentDocumentation] = await Promise.all([
247
+ readFile(AGENT_KIT_README, "utf8"),
248
+ readFile(LOCAL_AUTHOR_SYSTEM_PROMPT, "utf8"),
249
+ readFile(LONG_FORM_AUTHORING_GUIDE, "utf8"),
250
+ readFile(CODEX_LAUNCHER, "utf8"),
251
+ readFile(CLI_LAUNCHER, "utf8"),
252
+ readFile(NPM_LAUNCHER, "utf8"),
253
+ readFile(MCP_LAUNCHER, "utf8"),
254
+ readDevelopmentDocumentation(),
255
+ ]);
256
+ if (codexLauncherTemplate.split(CODEX_ENVIRONMENT_PLACEHOLDER).length !== 2) {
257
+ throw new Error("agent-kit Codex launcher env placeholder mismatch");
258
+ }
259
+ const codexLauncher = codexLauncherTemplate.replace(CODEX_ENVIRONMENT_PLACEHOLDER, CODEX_MCP_ENV_VARS.map((name) => `"${name}"`).join(","));
260
+ const builtInTrees = PROJECT_SKILLS.map((skill) => [
261
+ { path: `skills/${skill.name}/SKILL.md`, content: skill.content },
262
+ ]);
263
+ const builtInIdentities = await Promise.all(PROJECT_SKILLS.map(async (skill, index) => {
264
+ const tree = builtInTrees[index];
265
+ if (tree === undefined)
266
+ throw new Error("agent-kit built-in skill tree mismatch");
267
+ const sha256 = await fullTreeDigest(tree, skill.name, "skills");
268
+ return {
269
+ name: skill.name,
270
+ enabled_by_default: true,
271
+ install_path: `skills/${skill.name}`,
272
+ source: "worldengine",
273
+ source_revision: "0.1.0-alpha.0",
274
+ sha256,
275
+ license: "LicenseRef-WorldEngine-Project",
276
+ distribution: distributionFor("LicenseRef-WorldEngine-Project", true),
277
+ local_patches: [],
278
+ supported_harnesses: SUPPORTED_HARNESSES,
279
+ };
280
+ }));
281
+ const externalTrees = await Promise.all(BUNDLED_EXTERNAL_SKILLS.map(async (skillName) => {
282
+ const tree = await readSkillTree(skillName, ASSET_SKILLS_ROOT, "skills");
283
+ const skillFile = tree.find(({ path }) => path === `skills/${skillName}/SKILL.md`);
284
+ if (skillFile === undefined)
285
+ throw new Error(`agent-kit skill missing SKILL.md: ${skillName}`);
286
+ if (frontmatterLicense(skillFile.content) !== "LicenseRef-User-Provided")
287
+ return tree;
288
+ return tree.map((file) => ({
289
+ ...file,
290
+ path: file.path.replace(/^skills\//, "skills-disabled/"),
291
+ }));
292
+ }));
293
+ const externalIdentities = await Promise.all(externalTrees.map(async (tree, index) => {
294
+ const name = BUNDLED_EXTERNAL_SKILLS[index];
295
+ if (name === undefined)
296
+ throw new Error("agent-kit external skill identity mismatch");
297
+ const installRoot = tree[0]?.path.startsWith("skills-disabled/")
298
+ ? "skills-disabled"
299
+ : "skills";
300
+ const skillFile = tree.find(({ path }) => path === `${installRoot}/${name}/SKILL.md`);
301
+ if (skillFile === undefined)
302
+ throw new Error(`agent-kit skill missing SKILL.md: ${name}`);
303
+ const treeDigest = await fullTreeDigest(tree, name, installRoot);
304
+ const license = frontmatterLicense(skillFile.content);
305
+ const enabledByDefault = installRoot === "skills";
306
+ return {
307
+ name,
308
+ enabled_by_default: enabledByDefault,
309
+ install_path: `${installRoot}/${name}`,
310
+ source: sourceForExternalSkill(name),
311
+ source_revision: treeDigest,
312
+ sha256: treeDigest,
313
+ license,
314
+ distribution: distributionFor(license, enabledByDefault),
315
+ local_patches: [],
316
+ supported_harnesses: SUPPORTED_HARNESSES,
317
+ };
318
+ }));
319
+ const disabledTrees = await Promise.all(BUNDLED_DISABLED_SKILLS.map((skillName) => readSkillTree(skillName, DISABLED_ASSET_SKILLS_ROOT, "skills-disabled")));
320
+ const disabledIdentities = await Promise.all(disabledTrees.map(async (tree, index) => {
321
+ const name = BUNDLED_DISABLED_SKILLS[index];
322
+ if (name === undefined)
323
+ throw new Error("agent-kit disabled skill identity mismatch");
324
+ const skillFile = tree.find(({ path }) => path === `skills-disabled/${name}/SKILL.md`);
325
+ if (skillFile === undefined)
326
+ throw new Error(`agent-kit disabled skill missing SKILL.md: ${name}`);
327
+ const license = frontmatterLicense(skillFile.content);
328
+ const treeDigest = await fullTreeDigest(tree, name, "skills-disabled");
329
+ return {
330
+ name,
331
+ enabled_by_default: false,
332
+ install_path: `skills-disabled/${name}`,
333
+ source: "worldengine-chat-internal",
334
+ source_revision: treeDigest,
335
+ sha256: treeDigest,
336
+ license,
337
+ distribution: distributionFor(license, false),
338
+ local_patches: [],
339
+ supported_harnesses: SUPPORTED_HARNESSES,
340
+ };
341
+ }));
342
+ const identities = [...builtInIdentities, ...externalIdentities, ...disabledIdentities].sort((left, right) => left.name.localeCompare(right.name, "en"));
343
+ return [
344
+ { path: "README.md", content: readme },
345
+ { path: "system-prompt.md", content: systemPrompt },
346
+ ...developmentDocumentation,
347
+ { path: "guides/long-form-ladybug-trigger.md", content: longFormGuide },
348
+ { path: "configs/codex.toml", content: CODEX_MCP_CONFIG },
349
+ { path: "configs/claude-settings.json", content: CLAUDE_SETTINGS },
350
+ { path: "configs/mcp.json", content: GENERIC_MCP_CONFIG },
351
+ { path: "launchers/worldengine.cmd", content: cliLauncher },
352
+ { path: "launchers/worldengine-npm.cjs", content: npmLauncher },
353
+ { path: "launchers/worldengine-codex.ps1", content: codexLauncher },
354
+ { path: "launchers/worldengine-mcp.cmd", content: mcpLauncher },
355
+ ...builtInTrees.flat(),
356
+ ...externalTrees.flat(),
357
+ ...disabledTrees.flat(),
358
+ {
359
+ path: "manifest.json",
360
+ content: `${JSON.stringify({
361
+ schema_version: 1,
362
+ instructions: {
363
+ system_prompt_path: "system-prompt.md",
364
+ development_path: "development",
365
+ authoring_guide_path: "guides/long-form-ladybug-trigger.md",
366
+ },
367
+ root_links: AGENT_KIT_ROOT_LINKS,
368
+ harnesses: HARNESS_INTEGRATIONS,
369
+ authoring: {
370
+ contract: "@world-engines/authoring-bridge runtime tools/list",
371
+ mcp_server: "worldengine",
372
+ cli: ".\\worldengine.cmd tool <tool-name> <input-json> [operation_id expected_project_revision]",
373
+ custom_harness_included: false,
374
+ extraction_owner: "external-harness-model",
375
+ host_responsibilities: ["raw-source-windows", "schema", "validation", "checkpoint", "commit"],
376
+ embedding_service: "authenticated-http://127.0.0.1:11450",
377
+ },
378
+ skills: identities,
379
+ }, null, 2)}\n`,
380
+ },
381
+ ];
382
+ }
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@world-engines/agent-kit",
3
+ "version": "0.1.0-alpha.0",
4
+ "license": "SEE LICENSE IN LICENSE",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ }
11
+ },
12
+ "files": [
13
+ "assets",
14
+ "dist"
15
+ ],
16
+ "dependencies": {
17
+ "@world-engines/project-format": "0.1.0-alpha.0"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "worldengine_source_sha256": "f8bae60990f3cb81f3ba59dd72b6a54d2138ca3a10da0590eb5f50058183e42b",
23
+ "worldengine_source_identity_provenance": {
24
+ "schema": "worldengine-public-namespace-projection/v1",
25
+ "kind": "composite-source-identity; namespace projection; not-full-source-recompile",
26
+ "original_name": "@worldengine/agent-kit",
27
+ "original_archive_sha256": "157fb887223ef5e4378bfc59de3194dd42118aa8850d9238280ec77f24d0d913",
28
+ "original_source_sha256": "c9c41276c4f14b200dc99810288e0678771b966b7c5ee7756b26fa3b13ecb7af",
29
+ "projected_name": "@world-engines/agent-kit",
30
+ "package_name_mapping": {
31
+ "@chat/blocks-editor": "@world-engines/blocks-editor",
32
+ "@chat/ladybug-bridge": "@world-engines/ladybug-bridge",
33
+ "@chat/monaco-host": "@world-engines/monaco-host",
34
+ "@chat/protocol-ts": "@world-engines/protocol-ts",
35
+ "@chat/scenario-author-source": "@world-engines/scenario-author-source",
36
+ "@chat/scenario-review-snapshot": "@world-engines/scenario-review-snapshot",
37
+ "@chat/tmw": "@world-engines/tmw",
38
+ "@chat/view-exposure": "@world-engines/view-exposure",
39
+ "@world-engines/chatplay-vite-plugin": "@world-engines/chatplay-vite-plugin",
40
+ "@worldengine/agent-kit": "@world-engines/agent-kit",
41
+ "@worldengine/authoring-bridge": "@world-engines/authoring-bridge",
42
+ "@worldengine/authoring-ui": "@world-engines/authoring-ui",
43
+ "@worldengine/create-project": "@world-engines/create-project",
44
+ "@worldengine/project-format": "@world-engines/project-format",
45
+ "@worldengine/project-host": "@world-engines/project-host",
46
+ "@worldengine/project-setup": "@world-engines/project-setup",
47
+ "@worldengine/spatial-authoring": "@world-engines/spatial-authoring",
48
+ "@worldengine/view-sdk": "@world-engines/view-sdk"
49
+ }
50
+ }
51
+ }