@mastra/editor 0.14.0-alpha.6 → 0.14.1-alpha.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,107 @@
1
1
  # @mastra/editor
2
2
 
3
+ ## 0.14.1-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed editor reads to preserve published versions after draft updates and honor draft, version ID, and version number selection. ([#22179](https://github.com/mastra-ai/mastra/pull/22179))
8
+
9
+ - Updated dependencies [[`ae8790c`](https://github.com/mastra-ai/mastra/commit/ae8790c4bfaa088d2ab279d1dcc06f326b9fd109), [`dfb7efa`](https://github.com/mastra-ai/mastra/commit/dfb7efa19e348b5a788be2d954362cbae12379d6), [`ee0c1a0`](https://github.com/mastra-ai/mastra/commit/ee0c1a097de3acebe7dfc8c136479d4cb5b5b451), [`befbfc2`](https://github.com/mastra-ai/mastra/commit/befbfc260d5ec5ece7cdb65a80e94292f428d4c9), [`04a815f`](https://github.com/mastra-ai/mastra/commit/04a815fc8971d29e97fcdcc5008a1eb472fc00ff), [`cced745`](https://github.com/mastra-ai/mastra/commit/cced745a056ec2225c5bc702e32d848847aa8b65)]:
10
+ - @mastra/core@1.62.0-alpha.7
11
+ - @mastra/mcp@1.17.2-alpha.2
12
+ - @mastra/memory@1.28.0-alpha.2
13
+
14
+ ## 0.14.1-alpha.1
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [[`65edab1`](https://github.com/mastra-ai/mastra/commit/65edab1c233d17b8f163bad12fca410d0e6f16b1), [`ab20a38`](https://github.com/mastra-ai/mastra/commit/ab20a38d0275f8d85e0f3833bd87ef487bcc609f), [`dbbfeb8`](https://github.com/mastra-ai/mastra/commit/dbbfeb85ec949dc9ebc0755e1ad262e4f5eba8db), [`3cc9d00`](https://github.com/mastra-ai/mastra/commit/3cc9d00b2b4333e0377a5e9df5eff92c17ce7630), [`733a537`](https://github.com/mastra-ai/mastra/commit/733a537489a858b5880b2e98809334fba895a221), [`d55807c`](https://github.com/mastra-ai/mastra/commit/d55807cb9f080f3f5d1db06aca02b8fe0992507e), [`9207dfa`](https://github.com/mastra-ai/mastra/commit/9207dfab8062e5fc68b751684797ff86fe0b4e70), [`12c61d2`](https://github.com/mastra-ai/mastra/commit/12c61d280c8cb208bc3c8dbcbe5dcc60cf9d1cd0), [`9a12ef3`](https://github.com/mastra-ai/mastra/commit/9a12ef3fccf3f4186db0f294f4ee1f02cf4d8db2)]:
19
+ - @mastra/core@1.62.0-alpha.5
20
+ - @mastra/memory@1.28.0-alpha.1
21
+
22
+ ## 0.14.1-alpha.0
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [[`2c85f42`](https://github.com/mastra-ai/mastra/commit/2c85f428e04ccd63ea31a7ec80b5b327afdad555), [`11bbeb9`](https://github.com/mastra-ai/mastra/commit/11bbeb9b108ef2264e05acefc6dafb9cbb342921), [`1a485f3`](https://github.com/mastra-ai/mastra/commit/1a485f3538f5ec64d58bd8b5e1e99de0c695c87b), [`0d37487`](https://github.com/mastra-ai/mastra/commit/0d37487d9f349388a3f1cef6a536cf9dcc4b6273), [`8661d7d`](https://github.com/mastra-ai/mastra/commit/8661d7d7179f0a024456aabdd8679bcecd09ac28), [`575e343`](https://github.com/mastra-ai/mastra/commit/575e343900451021d96110916497d334af7bc252), [`cacb839`](https://github.com/mastra-ai/mastra/commit/cacb8392d9e74189b56d857290b0615f98a2683d), [`b47b26e`](https://github.com/mastra-ai/mastra/commit/b47b26e6fe95cb8a3482be2c5e52de157fe59d0b), [`0d37487`](https://github.com/mastra-ai/mastra/commit/0d37487d9f349388a3f1cef6a536cf9dcc4b6273), [`9a3d352`](https://github.com/mastra-ai/mastra/commit/9a3d352a5ba0c2a9e4f7a9cc4f028a393bc74306), [`c46eb09`](https://github.com/mastra-ai/mastra/commit/c46eb09ce4987509af57a0ac582c61241a6dd2f1), [`30ed33e`](https://github.com/mastra-ai/mastra/commit/30ed33ee14084a26019aba15fceadda6d6ddefaf), [`91ad69d`](https://github.com/mastra-ai/mastra/commit/91ad69d64994c89199b0c55399e64ed91c61df2f), [`c4e2364`](https://github.com/mastra-ai/mastra/commit/c4e2364742bc37beebfa995db2d42efce6cfc7b8), [`8dc408d`](https://github.com/mastra-ai/mastra/commit/8dc408d34438f9e13297f792c11a5cfd6cf952e1), [`c92def1`](https://github.com/mastra-ai/mastra/commit/c92def10a13c822972c96f0a4ca6ffc1f4258aed), [`c5eaec5`](https://github.com/mastra-ai/mastra/commit/c5eaec5a860d80d0e3805e67db0414b87ac8cbed), [`e66b2ba`](https://github.com/mastra-ai/mastra/commit/e66b2ba100db63eaeab6e21e1ea34b113f2ec781)]:
27
+ - @mastra/core@1.62.0-alpha.3
28
+ - @mastra/memory@1.27.1-alpha.0
29
+ - @mastra/mcp@1.17.2-alpha.0
30
+
31
+ ## 0.14.0
32
+
33
+ ### Minor Changes
34
+
35
+ - Added a `durable` option to stored agents so agents created through the Agents API can run with durable execution — no code deployment required. ([#21715](https://github.com/mastra-ai/mastra/pull/21715))
36
+
37
+ ```typescript
38
+ await mastraClient.createStoredAgent({
39
+ id: 'helper',
40
+ name: 'Helper',
41
+ instructions: 'You are a helpful assistant.',
42
+ model: { provider: 'openai', name: 'gpt-5' },
43
+ durable: true,
44
+ });
45
+ ```
46
+
47
+ Pass `true` for defaults, or `{ maxSteps, cleanupTimeoutMs }` to tune the durable loop. Cache and pubsub are inherited from the server's Mastra instance, so configure distributed backends there for durability across replicas. Automatic recovery is still configured in code via `recovery.durableAgents`.
48
+
49
+ - Added authenticated-user execution and deterministic connected-account routing to ComposioToolProvider. Invoker-bound connections execute as the authenticated Composio user against the exact stored connected account, including accounts shared through Composio ACLs. ([#21783](https://github.com/mastra-ai/mastra/pull/21783))
50
+
51
+ Use userIdResolver when application user IDs need mapping to Composio user IDs:
52
+
53
+ ```typescript
54
+ import { MASTRA_USER_KEY } from '@mastra/server/auth';
55
+ import { ComposioToolProvider } from '@mastra/editor/composio';
56
+
57
+ const composio = new ComposioToolProvider({
58
+ apiKey: process.env.COMPOSIO_API_KEY!,
59
+ userIdResolver: ({ requestContext }) => {
60
+ const user = requestContext?.getRaw(MASTRA_USER_KEY);
61
+ if (!user || typeof user !== 'object' || !('id' in user) || typeof user.id !== 'string') return undefined;
62
+ return user.id;
63
+ },
64
+ });
65
+ ```
66
+
67
+ Pinned caller-supplied connections now route to their exact account instead of allowing Composio to auto-select one.
68
+
69
+ ### Patch Changes
70
+
71
+ - Fixed Composio tool results not being validated. Resolved Composio tools now keep the output schema supplied by Composio, so tool results are checked against it: real API responses (including null or extra fields) still pass, while structurally invalid output is rejected instead of being silently returned. This also lets Composio tools be used with APIs that require an output schema, like createStep(tool). ([#21511](https://github.com/mastra-ai/mastra/pull/21511))
72
+
73
+ - Fixed editor-owned agent instructions failing silently. Agents configured with `editor: { instructions: true }` now throw a clear error instead of running with empty instructions when no published version is available in Studio. This affected agents that were never provisioned, only had a draft version, were deleted, had a published version with no instructions, or hit a storage error while loading. Fixes https://github.com/mastra-ai/mastra/issues/21373 ([#21395](https://github.com/mastra-ai/mastra/pull/21395))
74
+
75
+ **Before:** the agent ran normally with an empty system prompt.
76
+
77
+ **After:** resolving or generating with the agent throws until a published version with instructions exists.
78
+
79
+ ```ts
80
+ // Agent definition — Studio owns the instructions:
81
+ export const agent = new Agent({
82
+ id: 'support-agent',
83
+ editor: { instructions: true },
84
+ model: 'openai/gpt-4o',
85
+ });
86
+ ```
87
+
88
+ ```ts
89
+ // Throws until a version is published in Studio:
90
+ const agent = client.getAgent('support-agent', { status: 'published' });
91
+ await agent.generate('hi');
92
+
93
+ // Use status: 'draft' to run against the latest draft instead, without publishing:
94
+ const draftAgent = client.getAgent('support-agent', { status: 'draft' });
95
+ await draftAgent.generate('hi');
96
+ ```
97
+
98
+ - Keep agent snapshot updates as drafts until explicitly published. ([#21528](https://github.com/mastra-ai/mastra/pull/21528))
99
+
100
+ - Updated dependencies [[`587f6ef`](https://github.com/mastra-ai/mastra/commit/587f6efcfc25880b93760a8607d1cd381ec612fe), [`7e096f0`](https://github.com/mastra-ai/mastra/commit/7e096f02f0dddbf09b85d306458351245ed2f886), [`d7e6745`](https://github.com/mastra-ai/mastra/commit/d7e67456954863c55440ea9c49bc6ceb9949972d), [`6223446`](https://github.com/mastra-ai/mastra/commit/6223446ddce6166e96e0ba5e00d628b615dee8ca), [`15101bb`](https://github.com/mastra-ai/mastra/commit/15101bb53c0d934f31af6b8813b88191e382a5e5), [`4e7a421`](https://github.com/mastra-ai/mastra/commit/4e7a421dce8a48742f785d1e93ad2f43a572b282), [`c2c3deb`](https://github.com/mastra-ai/mastra/commit/c2c3debcf670c7082d0a5e553aa99818a864698c), [`d8308a2`](https://github.com/mastra-ai/mastra/commit/d8308a2be3c07e777393d1017a381dcae3890d30), [`b0a2a07`](https://github.com/mastra-ai/mastra/commit/b0a2a07800d42bd9823292e7db832374ed084c9c), [`74e5bd3`](https://github.com/mastra-ai/mastra/commit/74e5bd315b8b3a1e04cb6cf480bb0f5fc4951dc8), [`242e324`](https://github.com/mastra-ai/mastra/commit/242e3241e73cbd5c9bb86a31ebb49ca0256488d4), [`217e967`](https://github.com/mastra-ai/mastra/commit/217e9672d8b3160eb729d8e9f0044949e88da239), [`d774e89`](https://github.com/mastra-ai/mastra/commit/d774e8930c781df8c9effe3763e6b501c099b6cc), [`9c27a53`](https://github.com/mastra-ai/mastra/commit/9c27a53cd9d3de4f3f025bc387d94ce371c33f95), [`8f0a332`](https://github.com/mastra-ai/mastra/commit/8f0a3321bf180368d76fe7b36aa1a8f60f00b6de), [`0b4f108`](https://github.com/mastra-ai/mastra/commit/0b4f1089aa8d92e67c2a8e99726822c5ee410784), [`9acb50f`](https://github.com/mastra-ai/mastra/commit/9acb50f71cec9c362f06820033f90ae6b1f8282f), [`46e9e3f`](https://github.com/mastra-ai/mastra/commit/46e9e3f73babe1bc70080a596cf2ac0b9da48519), [`b0a2a07`](https://github.com/mastra-ai/mastra/commit/b0a2a07800d42bd9823292e7db832374ed084c9c), [`3f9a190`](https://github.com/mastra-ai/mastra/commit/3f9a19057c027155867b9317294ee4ca7bd0581a), [`dff25a1`](https://github.com/mastra-ai/mastra/commit/dff25a1103fa72ee082a9b6f805ebeb5ce400753), [`6db7a5d`](https://github.com/mastra-ai/mastra/commit/6db7a5dd3dd2b6f7ef75dcd804fcffef5fa83963), [`217e967`](https://github.com/mastra-ai/mastra/commit/217e9672d8b3160eb729d8e9f0044949e88da239), [`583e235`](https://github.com/mastra-ai/mastra/commit/583e23519c13af16c1746f9c49722d011216611b), [`b098de9`](https://github.com/mastra-ai/mastra/commit/b098de9d7cb9f672e0883a5c716465a3a689693d), [`e8808e3`](https://github.com/mastra-ai/mastra/commit/e8808e3d8eb585a2565be53e56a7e0e1477352a4), [`694bd68`](https://github.com/mastra-ai/mastra/commit/694bd68fb427ee52e59aaab06167617f261b121c), [`a77f8d4`](https://github.com/mastra-ai/mastra/commit/a77f8d4740d2178a74c41e4bf678b4fcd8fa0bb2), [`7f78585`](https://github.com/mastra-ai/mastra/commit/7f785857e401570e2ffb316911f126ed363aa537), [`33374ba`](https://github.com/mastra-ai/mastra/commit/33374ba359e4fb13eaa918ae925fe167a3c55414), [`940bf5c`](https://github.com/mastra-ai/mastra/commit/940bf5ccf04f2c9ebd8a1390431733222a03b1cd), [`c549e2f`](https://github.com/mastra-ai/mastra/commit/c549e2f40edc1cac5d9e74e82f90da22b48df084), [`58c43d3`](https://github.com/mastra-ai/mastra/commit/58c43d3f7cb2eeaeb8ac733ae71dde822348e588), [`ef6e295`](https://github.com/mastra-ai/mastra/commit/ef6e295b59bc25a5b61b633a89c97bcfce9fb465), [`208e1b3`](https://github.com/mastra-ai/mastra/commit/208e1b39f30f4b386e494394e9d71d96f0f90241), [`c938d34`](https://github.com/mastra-ai/mastra/commit/c938d34739936c8ecbabd67ad6a4a4396f41c4c6), [`88ddc7c`](https://github.com/mastra-ai/mastra/commit/88ddc7ce01d40175f13a3228b789a906779680bd), [`f2a4afd`](https://github.com/mastra-ai/mastra/commit/f2a4afd7e37e809669001ed17724b341a5c1f45e), [`f2a4afd`](https://github.com/mastra-ai/mastra/commit/f2a4afd7e37e809669001ed17724b341a5c1f45e), [`d438148`](https://github.com/mastra-ai/mastra/commit/d438148e222c1e2fb3c652725ce75680962ebec4), [`ba05fe0`](https://github.com/mastra-ai/mastra/commit/ba05fe0738f70cb686777546e968237d09269142), [`eede4de`](https://github.com/mastra-ai/mastra/commit/eede4de104f59b391d28aa249659388e9a1cf558), [`40d358e`](https://github.com/mastra-ai/mastra/commit/40d358e29d55543803e64b49241122f598ffabc7), [`d26a8d4`](https://github.com/mastra-ai/mastra/commit/d26a8d4281f28414715b333c85bedaf70d0b2890), [`e80cd7e`](https://github.com/mastra-ai/mastra/commit/e80cd7e7683e7d732e1cc6784bcac1d2640d2ce3), [`ccbbcd9`](https://github.com/mastra-ai/mastra/commit/ccbbcd974eedff4367a54ed0e24c9ee742ab2f61), [`39ba1b9`](https://github.com/mastra-ai/mastra/commit/39ba1b9ce256a9a910a16f125cc6a59588185bfe), [`1d9a0ea`](https://github.com/mastra-ai/mastra/commit/1d9a0ea4a9901baee6cd56737243bd6d1f631ac0), [`677cdc6`](https://github.com/mastra-ai/mastra/commit/677cdc6af564dec29a13464d12b7ab2a4efc22e9), [`c549e2f`](https://github.com/mastra-ai/mastra/commit/c549e2f40edc1cac5d9e74e82f90da22b48df084), [`a7dd322`](https://github.com/mastra-ai/mastra/commit/a7dd32247d95afc539f483ca37f4594af0387f59), [`3f5c6f7`](https://github.com/mastra-ai/mastra/commit/3f5c6f728ea35da344248de9aa070f12849f3aa0), [`eede4de`](https://github.com/mastra-ai/mastra/commit/eede4de104f59b391d28aa249659388e9a1cf558), [`a318490`](https://github.com/mastra-ai/mastra/commit/a318490e17da32f338d50929c770d901a9b3dd72), [`b860493`](https://github.com/mastra-ai/mastra/commit/b86049391100e665d579f700c8a2034c036defc3), [`d4be8c1`](https://github.com/mastra-ai/mastra/commit/d4be8c1739d22d621e3f78790e1dd5eb5ecc3589), [`a5d2eb1`](https://github.com/mastra-ai/mastra/commit/a5d2eb10347eade1ae2816d88f466c25186c54a5), [`13d49d8`](https://github.com/mastra-ai/mastra/commit/13d49d82f434f319d4bd9a4234369d8186f8e102), [`0f53aeb`](https://github.com/mastra-ai/mastra/commit/0f53aeb119158bd9f83bd8ef667f1f675740e8f0), [`a97044b`](https://github.com/mastra-ai/mastra/commit/a97044b00cc79e189b07509701b2694c728dfeac), [`3667679`](https://github.com/mastra-ai/mastra/commit/3667679db057edfb086846d13369fdda4902ad65), [`49696e8`](https://github.com/mastra-ai/mastra/commit/49696e8e42f870674a0a58f5abcd22cc54dd2864), [`2ef2f23`](https://github.com/mastra-ai/mastra/commit/2ef2f230a7aed342e7dc3b2000cd42e4c43e08a7), [`763e0c6`](https://github.com/mastra-ai/mastra/commit/763e0c61e04d76ad9a9efd301aa57525ca0cbea9), [`20504b2`](https://github.com/mastra-ai/mastra/commit/20504b2ecebd0e077acda3d457ab57480a98ed3e), [`77e6b1b`](https://github.com/mastra-ai/mastra/commit/77e6b1bc4c46ce94fe501023fb4393c812ec6be3), [`c5f964d`](https://github.com/mastra-ai/mastra/commit/c5f964d3f77064e978f8066ec506eed77ba5c63c), [`23e0be2`](https://github.com/mastra-ai/mastra/commit/23e0be261381e49534b4ff3101c60ee64a946cbf), [`217e967`](https://github.com/mastra-ai/mastra/commit/217e9672d8b3160eb729d8e9f0044949e88da239), [`7fc8806`](https://github.com/mastra-ai/mastra/commit/7fc880627d3cbf995d31ea0e8b807bf15417e651), [`0e02eac`](https://github.com/mastra-ai/mastra/commit/0e02eacdb2e30e1697a41910b41163742a181dc1), [`4df174c`](https://github.com/mastra-ai/mastra/commit/4df174c32bddf093a82f273070b8380aef7c9e90), [`f7c25b5`](https://github.com/mastra-ai/mastra/commit/f7c25b5106ddfb48e591f98df7a51e0f2dd01dba), [`7aad631`](https://github.com/mastra-ai/mastra/commit/7aad631b43bc10db77d5b8c66b200d7a49d18bf2), [`512100a`](https://github.com/mastra-ai/mastra/commit/512100a7d8b7e9c920f2590c6b3612f5de0d3cff), [`e81744c`](https://github.com/mastra-ai/mastra/commit/e81744cd13c46619c142dc521dc0baac47607a84), [`f8f653f`](https://github.com/mastra-ai/mastra/commit/f8f653f10980d01a73706cc3c8689ca5e40ce808), [`dc09cc1`](https://github.com/mastra-ai/mastra/commit/dc09cc1083d861cde192c1cd235324dc75b8c731), [`7f78585`](https://github.com/mastra-ai/mastra/commit/7f785857e401570e2ffb316911f126ed363aa537), [`9ef432b`](https://github.com/mastra-ai/mastra/commit/9ef432b6faa534b57b0d182a610e13dd9a7123ff), [`36b4649`](https://github.com/mastra-ai/mastra/commit/36b4649045a3a380cbab8ceca866db4086223aff), [`b9cf308`](https://github.com/mastra-ai/mastra/commit/b9cf30846f97f99ac1906ee8a68f4f2d117b0378), [`2e1d098`](https://github.com/mastra-ai/mastra/commit/2e1d0984e325fd319d32ea182f596b3170be3847), [`377eb81`](https://github.com/mastra-ai/mastra/commit/377eb81ce43b964e3a6b541df172da74a8ff3716), [`1794a79`](https://github.com/mastra-ai/mastra/commit/1794a79178c418004a7261b1ad9114066f7ef01d), [`0cdc5dc`](https://github.com/mastra-ai/mastra/commit/0cdc5dc69024957815da4f51acc4119eb4f447d7), [`5740ec6`](https://github.com/mastra-ai/mastra/commit/5740ec60c760ffdfbfaa59d603d03b847c864e05)]:
101
+ - @mastra/core@1.60.0
102
+ - @mastra/memory@1.27.0
103
+ - @mastra/mcp@1.17.0
104
+
3
105
  ## 0.14.0-alpha.6
4
106
 
5
107
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -76,6 +76,7 @@ var CrudEditorNamespace = class extends EditorNamespace {
76
76
  }
77
77
  async getById(id, options) {
78
78
  this.ensureRegistered();
79
+ if (options?.versionId && options.versionNumber !== void 0) throw new Error("versionId and versionNumber cannot be used together");
79
80
  const isVersionRequest = options?.versionId || options?.versionNumber || options?.status;
80
81
  if (!isVersionRequest) {
81
82
  const cached = this._cache.get(id);
@@ -479,7 +480,21 @@ var EditorMCPNamespace = class EditorMCPNamespace extends CrudEditorNamespace {
479
480
  if (!store) throw new Error("MCP clients storage domain is not available");
480
481
  return {
481
482
  create: (input) => store.create({ mcpClient: input }),
482
- getByIdResolved: (id) => store.getByIdResolved(id),
483
+ getByIdResolved: async (id, options) => {
484
+ if (options?.versionId || options?.versionNumber !== void 0) {
485
+ const mcpClient = await store.getById(id);
486
+ if (!mcpClient) return null;
487
+ const version = options.versionId ? await store.getVersion(options.versionId) : await store.getVersionByNumber(id, options.versionNumber);
488
+ if (!version || version.mcpClientId !== id) return null;
489
+ const { id: versionId, mcpClientId: _mcpClientId, versionNumber: _versionNumber, changedFields: _changedFields, changeMessage: _changeMessage, createdAt: _createdAt, ...snapshot } = version;
490
+ return {
491
+ ...mcpClient,
492
+ ...snapshot,
493
+ resolvedVersionId: versionId
494
+ };
495
+ }
496
+ return store.getByIdResolved(id, options?.status ? { status: options.status } : void 0);
497
+ },
483
498
  update: (input) => store.update(input),
484
499
  delete: (id) => store.delete(id),
485
500
  list: (args) => store.list(args),
@@ -1709,7 +1724,21 @@ var EditorMCPServerNamespace = class extends CrudEditorNamespace {
1709
1724
  if (!store) throw new Error("MCP servers storage domain is not available");
1710
1725
  return {
1711
1726
  create: (input) => store.create({ mcpServer: input }),
1712
- getByIdResolved: (id) => store.getByIdResolved(id),
1727
+ getByIdResolved: async (id, options) => {
1728
+ if (options?.versionId || options?.versionNumber !== void 0) {
1729
+ const mcpServer = await store.getById(id);
1730
+ if (!mcpServer) return null;
1731
+ const version = options.versionId ? await store.getVersion(options.versionId) : await store.getVersionByNumber(id, options.versionNumber);
1732
+ if (!version || version.mcpServerId !== id) return null;
1733
+ const { id: versionId, mcpServerId: _mcpServerId, versionNumber: _versionNumber, changedFields: _changedFields, changeMessage: _changeMessage, createdAt: _createdAt, ...snapshot } = version;
1734
+ return {
1735
+ ...mcpServer,
1736
+ ...snapshot,
1737
+ resolvedVersionId: versionId
1738
+ };
1739
+ }
1740
+ return store.getByIdResolved(id, options?.status ? { status: options.status } : void 0);
1741
+ },
1713
1742
  update: (input) => store.update(input),
1714
1743
  delete: (id) => store.delete(id),
1715
1744
  list: (args) => store.list(args),
@@ -1810,7 +1839,21 @@ var EditorPromptNamespace = class extends CrudEditorNamespace {
1810
1839
  if (!store) throw new Error("Prompt blocks storage domain is not available");
1811
1840
  return {
1812
1841
  create: (input) => store.create({ promptBlock: input }),
1813
- getByIdResolved: (id) => store.getByIdResolved(id),
1842
+ getByIdResolved: async (id, options) => {
1843
+ if (options?.versionId || options?.versionNumber !== void 0) {
1844
+ const promptBlock = await store.getById(id);
1845
+ if (!promptBlock) return null;
1846
+ const version = options.versionId ? await store.getVersion(options.versionId) : await store.getVersionByNumber(id, options.versionNumber);
1847
+ if (!version || version.blockId !== id) return null;
1848
+ const { id: versionId, blockId: _blockId, versionNumber: _versionNumber, changedFields: _changedFields, changeMessage: _changeMessage, createdAt: _createdAt, ...snapshot } = version;
1849
+ return {
1850
+ ...promptBlock,
1851
+ ...snapshot,
1852
+ resolvedVersionId: versionId
1853
+ };
1854
+ }
1855
+ return store.getByIdResolved(id, options?.status ? { status: options.status } : void 0);
1856
+ },
1814
1857
  update: (input) => store.update(input),
1815
1858
  delete: (id) => store.delete(id),
1816
1859
  list: (args) => store.list(args),
@@ -1832,7 +1875,6 @@ var EditorPromptNamespace = class extends CrudEditorNamespace {
1832
1875
  this.onCacheEvict(input.id);
1833
1876
  const resolved = await store.getByIdResolved(input.id, { status: "draft" });
1834
1877
  if (!resolved) throw new Error(`Failed to resolve entity ${input.id} after update`);
1835
- this._cache.set(input.id, resolved);
1836
1878
  return resolved;
1837
1879
  }
1838
1880
  async preview(blocks, context) {
@@ -1870,7 +1912,21 @@ var EditorScorerNamespace = class extends CrudEditorNamespace {
1870
1912
  if (!store) throw new Error("Scorer definitions storage domain is not available");
1871
1913
  return {
1872
1914
  create: (input) => store.create({ scorerDefinition: input }),
1873
- getByIdResolved: (id) => store.getByIdResolved(id),
1915
+ getByIdResolved: async (id, options) => {
1916
+ if (options?.versionId || options?.versionNumber !== void 0) {
1917
+ const scorerDefinition = await store.getById(id);
1918
+ if (!scorerDefinition) return null;
1919
+ const version = options.versionId ? await store.getVersion(options.versionId) : await store.getVersionByNumber(id, options.versionNumber);
1920
+ if (!version || version.scorerDefinitionId !== id) return null;
1921
+ const { id: versionId, scorerDefinitionId: _scorerDefinitionId, versionNumber: _versionNumber, changedFields: _changedFields, changeMessage: _changeMessage, createdAt: _createdAt, ...snapshot } = version;
1922
+ return {
1923
+ ...scorerDefinition,
1924
+ ...snapshot,
1925
+ resolvedVersionId: versionId
1926
+ };
1927
+ }
1928
+ return store.getByIdResolved(id, options?.status ? { status: options.status } : void 0);
1929
+ },
1874
1930
  update: (input) => store.update(input),
1875
1931
  delete: (id) => store.delete(id),
1876
1932
  list: (args) => store.list(args),
@@ -2064,7 +2120,21 @@ var EditorWorkspaceNamespace = class extends CrudEditorNamespace {
2064
2120
  if (!store) throw new Error("Workspaces storage domain is not available");
2065
2121
  return {
2066
2122
  create: (input) => store.create({ workspace: input }),
2067
- getByIdResolved: (id) => store.getByIdResolved(id),
2123
+ getByIdResolved: async (id, options) => {
2124
+ if (options?.versionId || options?.versionNumber !== void 0) {
2125
+ const workspace = await store.getById(id);
2126
+ if (!workspace) return null;
2127
+ const version = options.versionId ? await store.getVersion(options.versionId) : await store.getVersionByNumber(id, options.versionNumber);
2128
+ if (!version || version.workspaceId !== id) return null;
2129
+ const { id: versionId, workspaceId: _workspaceId, versionNumber: _versionNumber, changedFields: _changedFields, changeMessage: _changeMessage, createdAt: _createdAt, ...snapshot } = version;
2130
+ return {
2131
+ ...workspace,
2132
+ ...snapshot,
2133
+ resolvedVersionId: versionId
2134
+ };
2135
+ }
2136
+ return store.getByIdResolved(id, options?.status ? { status: options.status } : void 0);
2137
+ },
2068
2138
  update: (input) => store.update(input),
2069
2139
  delete: (id) => store.delete(id),
2070
2140
  list: (args) => store.list(args),
@@ -2083,7 +2153,21 @@ var EditorSkillNamespace = class extends CrudEditorNamespace {
2083
2153
  if (!store) throw new Error("Skills storage domain is not available");
2084
2154
  return {
2085
2155
  create: (input) => store.create({ skill: input }),
2086
- getByIdResolved: (id) => store.getByIdResolved(id),
2156
+ getByIdResolved: async (id, options) => {
2157
+ if (options?.versionId || options?.versionNumber !== void 0) {
2158
+ const skill = await store.getById(id);
2159
+ if (!skill) return null;
2160
+ const version = options.versionId ? await store.getVersion(options.versionId) : await store.getVersionByNumber(id, options.versionNumber);
2161
+ if (!version || version.skillId !== id) return null;
2162
+ const { id: versionId, skillId: _skillId, versionNumber: _versionNumber, changedFields: _changedFields, changeMessage: _changeMessage, createdAt: _createdAt, ...snapshot } = version;
2163
+ return {
2164
+ ...skill,
2165
+ ...snapshot,
2166
+ resolvedVersionId: versionId
2167
+ };
2168
+ }
2169
+ return store.getByIdResolved(id, options?.status ? { status: options.status } : void 0);
2170
+ },
2087
2171
  update: (input) => store.update(input),
2088
2172
  delete: (id) => store.delete(id),
2089
2173
  list: (args) => store.list(args),