@imgly/codesign-mcp 0.1.0 → 0.1.2

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 (128) hide show
  1. package/assets/docs/handbook/SKILL.md +6 -0
  2. package/dist/assets/inline.generated.js +1 -1
  3. package/dist/assets/inline.generated.js.map +1 -1
  4. package/dist/cli/http.d.ts.map +1 -1
  5. package/dist/cli/http.js +4 -0
  6. package/dist/cli/http.js.map +1 -1
  7. package/dist/cli/stdio.d.ts.map +1 -1
  8. package/dist/cli/stdio.js +55 -18
  9. package/dist/cli/stdio.js.map +1 -1
  10. package/dist/engine/cesdk-adapter.d.ts +7 -1
  11. package/dist/engine/cesdk-adapter.d.ts.map +1 -1
  12. package/dist/engine/cesdk-adapter.js +7 -1
  13. package/dist/engine/cesdk-adapter.js.map +1 -1
  14. package/dist/engine/unsplash-source.d.ts +8 -0
  15. package/dist/engine/unsplash-source.d.ts.map +1 -0
  16. package/dist/engine/unsplash-source.js +77 -0
  17. package/dist/engine/unsplash-source.js.map +1 -0
  18. package/dist/http/server.d.ts.map +1 -1
  19. package/dist/http/server.js +0 -1
  20. package/dist/http/server.js.map +1 -1
  21. package/dist/server.d.ts +0 -2
  22. package/dist/server.d.ts.map +1 -1
  23. package/dist/server.js.map +1 -1
  24. package/dist/test/test/cli/redirect-console.test.d.ts +2 -0
  25. package/dist/test/test/cli/redirect-console.test.d.ts.map +1 -0
  26. package/dist/test/test/cli/redirect-console.test.js +47 -0
  27. package/dist/test/test/cli/redirect-console.test.js.map +1 -0
  28. package/dist/test/test/cli/resolve-license.test.d.ts +2 -0
  29. package/dist/test/test/cli/resolve-license.test.d.ts.map +1 -0
  30. package/dist/test/test/cli/resolve-license.test.js +20 -0
  31. package/dist/test/test/cli/resolve-license.test.js.map +1 -0
  32. package/dist/test/test/cli/stdio-license.test.d.ts +2 -0
  33. package/dist/test/test/cli/stdio-license.test.d.ts.map +1 -0
  34. package/dist/test/test/cli/stdio-license.test.js +19 -0
  35. package/dist/test/test/cli/stdio-license.test.js.map +1 -0
  36. package/dist/test/test/config.test.d.ts +2 -0
  37. package/dist/test/test/config.test.d.ts.map +1 -0
  38. package/dist/test/test/config.test.js +91 -0
  39. package/dist/test/test/config.test.js.map +1 -0
  40. package/dist/test/test/engine/asset-sources.test.d.ts +2 -0
  41. package/dist/test/test/engine/asset-sources.test.d.ts.map +1 -0
  42. package/dist/test/test/engine/asset-sources.test.js +100 -0
  43. package/dist/test/test/engine/asset-sources.test.js.map +1 -0
  44. package/dist/test/test/engine/mutex.test.d.ts +2 -0
  45. package/dist/test/test/engine/mutex.test.d.ts.map +1 -0
  46. package/dist/test/test/engine/mutex.test.js +63 -0
  47. package/dist/test/test/engine/mutex.test.js.map +1 -0
  48. package/dist/test/test/engine/session.test.js +15 -0
  49. package/dist/test/test/engine/session.test.js.map +1 -1
  50. package/dist/test/test/engine/unsplash-source.test.d.ts +2 -0
  51. package/dist/test/test/engine/unsplash-source.test.d.ts.map +1 -0
  52. package/dist/test/test/engine/unsplash-source.test.js +129 -0
  53. package/dist/test/test/engine/unsplash-source.test.js.map +1 -0
  54. package/dist/test/test/handbook-contract.test.js +8 -4
  55. package/dist/test/test/handbook-contract.test.js.map +1 -1
  56. package/dist/test/test/http/server.test.js +129 -0
  57. package/dist/test/test/http/server.test.js.map +1 -1
  58. package/dist/test/test/http/session-id-header.test.d.ts +2 -0
  59. package/dist/test/test/http/session-id-header.test.d.ts.map +1 -0
  60. package/dist/test/test/http/session-id-header.test.js +76 -0
  61. package/dist/test/test/http/session-id-header.test.js.map +1 -0
  62. package/dist/test/test/http/session-manager.test.js +14 -0
  63. package/dist/test/test/http/session-manager.test.js.map +1 -1
  64. package/dist/test/test/http/workspace-auth.test.d.ts +2 -0
  65. package/dist/test/test/http/workspace-auth.test.d.ts.map +1 -0
  66. package/dist/test/test/http/workspace-auth.test.js +41 -0
  67. package/dist/test/test/http/workspace-auth.test.js.map +1 -0
  68. package/dist/test/test/metrics/mount.test.d.ts +2 -0
  69. package/dist/test/test/metrics/mount.test.d.ts.map +1 -0
  70. package/dist/test/test/metrics/mount.test.js +59 -0
  71. package/dist/test/test/metrics/mount.test.js.map +1 -0
  72. package/dist/test/test/metrics/recorder.test.d.ts +2 -0
  73. package/dist/test/test/metrics/recorder.test.d.ts.map +1 -0
  74. package/dist/test/test/metrics/recorder.test.js +118 -0
  75. package/dist/test/test/metrics/recorder.test.js.map +1 -0
  76. package/dist/test/test/revisions/store.test.js +81 -11
  77. package/dist/test/test/revisions/store.test.js.map +1 -1
  78. package/dist/test/test/server.metrics.test.d.ts +2 -0
  79. package/dist/test/test/server.metrics.test.d.ts.map +1 -0
  80. package/dist/test/test/server.metrics.test.js +87 -0
  81. package/dist/test/test/server.metrics.test.js.map +1 -0
  82. package/dist/test/test/server.test.js +33 -4
  83. package/dist/test/test/server.test.js.map +1 -1
  84. package/dist/test/test/tools/asset-search.test.d.ts +2 -0
  85. package/dist/test/test/tools/asset-search.test.d.ts.map +1 -0
  86. package/dist/test/test/tools/asset-search.test.js +121 -0
  87. package/dist/test/test/tools/asset-search.test.js.map +1 -0
  88. package/dist/test/test/tools/edit.test.js +71 -9
  89. package/dist/test/test/tools/edit.test.js.map +1 -1
  90. package/dist/test/test/tools/export.test.js +60 -30
  91. package/dist/test/test/tools/export.test.js.map +1 -1
  92. package/dist/test/test/tools/index.test.d.ts +2 -0
  93. package/dist/test/test/tools/index.test.d.ts.map +1 -0
  94. package/dist/test/test/tools/index.test.js +55 -0
  95. package/dist/test/test/tools/index.test.js.map +1 -0
  96. package/dist/test/test/tools/metrics.test.d.ts +2 -0
  97. package/dist/test/test/tools/metrics.test.d.ts.map +1 -0
  98. package/dist/test/test/tools/metrics.test.js +29 -0
  99. package/dist/test/test/tools/metrics.test.js.map +1 -0
  100. package/dist/test/test/tools/preview.test.js +6 -4
  101. package/dist/test/test/tools/preview.test.js.map +1 -1
  102. package/dist/test/test/tools/rename.test.js +1 -2
  103. package/dist/test/test/tools/rename.test.js.map +1 -1
  104. package/dist/test/test/tools/save.test.d.ts +2 -0
  105. package/dist/test/test/tools/save.test.d.ts.map +1 -0
  106. package/dist/test/test/tools/save.test.js +137 -0
  107. package/dist/test/test/tools/save.test.js.map +1 -0
  108. package/dist/test/test/viewer/router.test.js +56 -0
  109. package/dist/test/test/viewer/router.test.js.map +1 -1
  110. package/dist/test/test/viewer/session-mount.test.d.ts +2 -0
  111. package/dist/test/test/viewer/session-mount.test.d.ts.map +1 -0
  112. package/dist/test/test/viewer/session-mount.test.js +52 -0
  113. package/dist/test/test/viewer/session-mount.test.js.map +1 -0
  114. package/dist/test/test/viewer/url-builder.test.js +76 -9
  115. package/dist/test/test/viewer/url-builder.test.js.map +1 -1
  116. package/dist/test/test/workspace/s3.test.d.ts +2 -0
  117. package/dist/test/test/workspace/s3.test.d.ts.map +1 -0
  118. package/dist/test/test/workspace/s3.test.js +153 -0
  119. package/dist/test/test/workspace/s3.test.js.map +1 -0
  120. package/dist/test/test/workspace/scoped.test.d.ts +2 -0
  121. package/dist/test/test/workspace/scoped.test.d.ts.map +1 -0
  122. package/dist/test/test/workspace/scoped.test.js +59 -0
  123. package/dist/test/test/workspace/scoped.test.js.map +1 -0
  124. package/dist/test/tsconfig.test.tsbuildinfo +1 -1
  125. package/dist/tools/index.d.ts.map +1 -1
  126. package/dist/tools/index.js +14 -4
  127. package/dist/tools/index.js.map +1 -1
  128. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,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,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAiBzD,MAAM,WAAW,mCAAmC,CAAC,CAAC,GAAG,OAAO;IAC9D,EAAE,EAAE,WAAW,CAAC;IAChB,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC1B;;;;;OAKG;IACH,UAAU,EAAE,KAAK,CAAC;IAClB,OAAO,EAAE,aAAa,CAAC;IACvB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,uFAAuF;IACvF,YAAY,EAAE,OAAO,CAAC;IACtB,uEAAuE;IACvE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QACtB,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;KACtB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,gFAAgF;IAChF,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,CAAC,CAAC;KACX,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CAC3B;AAED,wBAAgB,4BAA4B,CAAC,CAAC,GAAG,OAAO,EACtD,IAAI,EAAE,mCAAmC,CAAC,CAAC,CAAC,GAC3C,2BAA2B,EAAE,CA2D/B"}
@@ -1,9 +1,11 @@
1
1
  // packages/codesign-mcp/src/tools/index.ts
2
2
  //
3
3
  // Builds the design + workspace tool registrations from a fully-DI'd set of
4
- // primitives: nine always-on tools, plus `asset_generate` only when the
5
- // gateway is actually usable (Local: API_KEY set). A hidden tool never shows
6
- // up in tools/list, so the model won't attempt a call that can only fail.
4
+ // primitives: the always-on design + workspace tools, plus `asset_generate`
5
+ // currently hidden for the beta (see ASSET_GENERATE_ENABLED below), and
6
+ // otherwise gated on a usable gateway (Local: API_KEY set). A hidden tool
7
+ // never shows up in tools/list, so the model won't attempt a call that can
8
+ // only fail.
7
9
  // Each variant's CLI bootstrap (cli/stdio.ts, cli/http.ts)
8
10
  // constructs these primitives once and passes them in; this file owns no
9
11
  // engine bootstrap, no FS bootstrap, no gateway selection.
@@ -18,6 +20,9 @@ import { createOpenEditorTool } from './open-editor.js';
18
20
  import { createPreviewTool } from './preview.js';
19
21
  import { createRenameTool } from './rename.js';
20
22
  import { createSaveTool } from './save.js';
23
+ // Beta kill-switch for asset_generate. Off for the beta (the feature isn't
24
+ // supported yet); set to true to re-expose the tool once it ships.
25
+ const ASSET_GENERATE_ENABLED = false;
21
26
  export function buildDesignToolRegistrations(opts) {
22
27
  const registrations = [
23
28
  createEditTool({
@@ -59,8 +64,13 @@ export function buildDesignToolRegistrations(opts) {
59
64
  engineLock: opts.engineLock
60
65
  })
61
66
  ];
67
+ // BETA: asset_generate is hidden for the beta — not supported yet, and we
68
+ // don't want the model to see a tool it can't use. The implementation
69
+ // (asset-generate.ts, gateway plumbing) is intentionally kept intact; flip
70
+ // ASSET_GENERATE_ENABLED back to true to re-expose it. Hiding the tool also
71
+ // drops the handbook/instructions hint, which keys off tool presence.
62
72
  // Opt-in: only expose asset_generate when the gateway can fulfil a request.
63
- if (opts.gateway.available) {
73
+ if (ASSET_GENERATE_ENABLED && opts.gateway.available) {
64
74
  registrations.push(createAssetGenerateTool({
65
75
  gateway: opts.gateway,
66
76
  fs: opts.fs,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,EAAE;AACF,4EAA4E;AAC5E,wEAAwE;AACxE,6EAA6E;AAC7E,0EAA0E;AAC1E,2DAA2D;AAC3D,yEAAyE;AACzE,2DAA2D;AAS3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,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KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;SAChC,CAAC;QACF,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACrC,iBAAiB,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACxC,iBAAiB,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACxC,gBAAgB,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACvC,oBAAoB,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACxE,qBAAqB,CAAC;YACpB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC;KACH,CAAC;IAEF,4EAA4E;IAC5E,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QAC3B,aAAa,CAAC,IAAI,CAChB,uBAAuB,CAAC;YACtB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["// packages/codesign-mcp/src/tools/index.ts\n//\n// Builds the design + workspace tool registrations from a fully-DI'd set of\n// primitives: nine always-on tools, plus `asset_generate` only when the\n// gateway is actually usable (Local: API_KEY set). A hidden tool never shows\n// up in tools/list, so the model won't attempt a call that can only fail.\n// Each variant's CLI bootstrap (cli/stdio.ts, cli/http.ts)\n// constructs these primitives once and passes them in; this file owns no\n// engine bootstrap, no FS bootstrap, no gateway selection.\n\nimport type { Mutex } from '../engine/mutex.js';\nimport type { EngineSession } from '../engine/session.js';\nimport type { GatewayClient } from '../gateway/types.js';\nimport type { RevisionStore } from '../revisions/store.js';\nimport type { CodesignMcpToolRegistration } from '../server.js';\nimport type { ViewerUrlBuilder } from '../viewer/url-builder.js';\nimport type { WorkspaceFS } from '../workspace/types.js';\nimport { createAssetGenerateTool } from './asset-generate.js';\nimport { createAssetSearchTool } from './asset-search.js';\nimport { createEditTool } from './edit.js';\nimport { createExportTool } from './export.js';\nimport { createHistoryTool } from './history.js';\nimport { createInspectTool } from './inspect.js';\nimport { createListTool } from './list.js';\nimport { createOpenEditorTool } from './open-editor.js';\nimport { createPreviewTool } from './preview.js';\nimport { createRenameTool } from './rename.js';\nimport { createSaveTool } from './save.js';\n\nexport interface BuildDesignToolRegistrationsOptions<E = unknown> {\n fs: WorkspaceFS;\n store: RevisionStore;\n session: EngineSession<E>;\n /**\n * Serializes access to the shared CE.SDK engine across the edit/preview/\n * export tools. One engine today (process singleton) ⇒ one lock shared by\n * every session. See engine/mutex.ts and the bootstrap (cli/http.ts,\n * cli/stdio.ts) for where it is created.\n */\n engineLock: Mutex;\n gateway: GatewayClient;\n urlBuilder: ViewerUrlBuilder;\n /** True on Local (the `outPath?` escape hatch is allowed); false on Hosted/sandbox. */\n allowOutPath: boolean;\n /** Called when `edit` writes a new leaf revision (viewer SSE hook). */\n onLeafWritten?: (event: {\n revision: string;\n rootRevision: string;\n }) => void | Promise<void>;\n /** Render a thumbnail for a newly committed revision. Optional; best-effort. */\n renderThumbnail?: (event: {\n revision: string;\n engine: E;\n }) => Promise<Uint8Array>;\n}\n\nexport function buildDesignToolRegistrations<E = unknown>(\n opts: BuildDesignToolRegistrationsOptions<E>\n): CodesignMcpToolRegistration[] {\n const registrations: CodesignMcpToolRegistration[] = [\n createEditTool({\n store: opts.store,\n session: opts.session,\n engineLock: opts.engineLock,\n onLeafWritten: opts.onLeafWritten,\n renderThumbnail: opts.renderThumbnail,\n fs: opts.fs\n }),\n createPreviewTool({\n store: opts.store,\n session: opts.session,\n engineLock: opts.engineLock\n }),\n createExportTool({\n fs: opts.fs,\n store: opts.store,\n session: opts.session,\n engineLock: opts.engineLock,\n urlBuilder: opts.urlBuilder,\n allowOutPath: opts.allowOutPath\n }),\n createSaveTool({\n fs: opts.fs,\n store: opts.store,\n session: opts.session,\n engineLock: opts.engineLock,\n urlBuilder: opts.urlBuilder,\n allowOutPath: opts.allowOutPath\n }),\n createListTool({ store: opts.store }),\n createHistoryTool({ store: opts.store }),\n createInspectTool({ store: opts.store }),\n createRenameTool({ store: opts.store }),\n createOpenEditorTool({ urlBuilder: opts.urlBuilder, store: opts.store }),\n createAssetSearchTool({\n session: opts.session,\n engineLock: opts.engineLock\n })\n ];\n\n // Opt-in: only expose asset_generate when the gateway can fulfil a request.\n if (opts.gateway.available) {\n registrations.push(\n createAssetGenerateTool({\n gateway: opts.gateway,\n fs: opts.fs,\n urlBuilder: opts.urlBuilder\n })\n );\n }\n\n return registrations;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,0EAA0E;AAC1E,0EAA0E;AAC1E,2EAA2E;AAC3E,aAAa;AACb,2DAA2D;AAC3D,yEAAyE;AACzE,2DAA2D;AAS3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW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QACF,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACrC,iBAAiB,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACxC,iBAAiB,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACxC,gBAAgB,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACvC,oBAAoB,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACxE,qBAAqB,CAAC;YACpB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC;KACH,CAAC;IAEF,0EAA0E;IAC1E,sEAAsE;IACtE,2EAA2E;IAC3E,4EAA4E;IAC5E,sEAAsE;IACtE,4EAA4E;IAC5E,IAAI,sBAAsB,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QACrD,aAAa,CAAC,IAAI,CAChB,uBAAuB,CAAC;YACtB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["// packages/codesign-mcp/src/tools/index.ts\n//\n// Builds the design + workspace tool registrations from a fully-DI'd set of\n// primitives: the always-on design + workspace tools, plus `asset_generate`\n// currently hidden for the beta (see ASSET_GENERATE_ENABLED below), and\n// otherwise gated on a usable gateway (Local: API_KEY set). A hidden tool\n// never shows up in tools/list, so the model won't attempt a call that can\n// only fail.\n// Each variant's CLI bootstrap (cli/stdio.ts, cli/http.ts)\n// constructs these primitives once and passes them in; this file owns no\n// engine bootstrap, no FS bootstrap, no gateway selection.\n\nimport type { Mutex } from '../engine/mutex.js';\nimport type { EngineSession } from '../engine/session.js';\nimport type { GatewayClient } from '../gateway/types.js';\nimport type { RevisionStore } from '../revisions/store.js';\nimport type { CodesignMcpToolRegistration } from '../server.js';\nimport type { ViewerUrlBuilder } from '../viewer/url-builder.js';\nimport type { WorkspaceFS } from '../workspace/types.js';\nimport { createAssetGenerateTool } from './asset-generate.js';\nimport { createAssetSearchTool } from './asset-search.js';\nimport { createEditTool } from './edit.js';\nimport { createExportTool } from './export.js';\nimport { createHistoryTool } from './history.js';\nimport { createInspectTool } from './inspect.js';\nimport { createListTool } from './list.js';\nimport { createOpenEditorTool } from './open-editor.js';\nimport { createPreviewTool } from './preview.js';\nimport { createRenameTool } from './rename.js';\nimport { createSaveTool } from './save.js';\n\n// Beta kill-switch for asset_generate. Off for the beta (the feature isn't\n// supported yet); set to true to re-expose the tool once it ships.\nconst ASSET_GENERATE_ENABLED = false;\n\nexport interface BuildDesignToolRegistrationsOptions<E = unknown> {\n fs: WorkspaceFS;\n store: RevisionStore;\n session: EngineSession<E>;\n /**\n * Serializes access to the shared CE.SDK engine across the edit/preview/\n * export tools. One engine today (process singleton) ⇒ one lock shared by\n * every session. See engine/mutex.ts and the bootstrap (cli/http.ts,\n * cli/stdio.ts) for where it is created.\n */\n engineLock: Mutex;\n gateway: GatewayClient;\n urlBuilder: ViewerUrlBuilder;\n /** True on Local (the `outPath?` escape hatch is allowed); false on Hosted/sandbox. */\n allowOutPath: boolean;\n /** Called when `edit` writes a new leaf revision (viewer SSE hook). */\n onLeafWritten?: (event: {\n revision: string;\n rootRevision: string;\n }) => void | Promise<void>;\n /** Render a thumbnail for a newly committed revision. Optional; best-effort. */\n renderThumbnail?: (event: {\n revision: string;\n engine: E;\n }) => Promise<Uint8Array>;\n}\n\nexport function buildDesignToolRegistrations<E = unknown>(\n opts: BuildDesignToolRegistrationsOptions<E>\n): CodesignMcpToolRegistration[] {\n const registrations: CodesignMcpToolRegistration[] = [\n createEditTool({\n store: opts.store,\n session: opts.session,\n engineLock: opts.engineLock,\n onLeafWritten: opts.onLeafWritten,\n renderThumbnail: opts.renderThumbnail,\n fs: opts.fs\n }),\n createPreviewTool({\n store: opts.store,\n session: opts.session,\n engineLock: opts.engineLock\n }),\n createExportTool({\n fs: opts.fs,\n store: opts.store,\n session: opts.session,\n engineLock: opts.engineLock,\n urlBuilder: opts.urlBuilder,\n allowOutPath: opts.allowOutPath\n }),\n createSaveTool({\n fs: opts.fs,\n store: opts.store,\n session: opts.session,\n engineLock: opts.engineLock,\n urlBuilder: opts.urlBuilder,\n allowOutPath: opts.allowOutPath\n }),\n createListTool({ store: opts.store }),\n createHistoryTool({ store: opts.store }),\n createInspectTool({ store: opts.store }),\n createRenameTool({ store: opts.store }),\n createOpenEditorTool({ urlBuilder: opts.urlBuilder, store: opts.store }),\n createAssetSearchTool({\n session: opts.session,\n engineLock: opts.engineLock\n })\n ];\n\n // BETA: asset_generate is hidden for the beta — not supported yet, and we\n // don't want the model to see a tool it can't use. The implementation\n // (asset-generate.ts, gateway plumbing) is intentionally kept intact; flip\n // ASSET_GENERATE_ENABLED back to true to re-expose it. Hiding the tool also\n // drops the handbook/instructions hint, which keys off tool presence.\n // Opt-in: only expose asset_generate when the gateway can fulfil a request.\n if (ASSET_GENERATE_ENABLED && opts.gateway.available) {\n registrations.push(\n createAssetGenerateTool({\n gateway: opts.gateway,\n fs: opts.fs,\n urlBuilder: opts.urlBuilder\n })\n );\n }\n\n return registrations;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imgly/codesign-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Codesign MCP server: SYSTEM prompt, prompts, skills, design tools as MCP resources/prompts/tools.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "homepage": "https://github.com/imgly/imgly-codesign/tree/main/packages/codesign-mcp",