@elevasis/sdk 1.45.0 → 1.46.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 (38) hide show
  1. package/dist/cli.cjs +36046 -31587
  2. package/dist/index.d.ts +833 -391
  3. package/dist/index.js +59 -59
  4. package/dist/node/index.d.ts +0 -84
  5. package/dist/node/index.js +2 -2
  6. package/dist/test-utils/index.d.ts +859 -331
  7. package/dist/test-utils/index.js +166 -134
  8. package/dist/worker/index.d.ts +897 -324
  9. package/dist/worker/index.js +68 -35
  10. package/package.json +4 -4
  11. package/reference/_navigation.md +11 -2
  12. package/reference/_reference-manifest.json +42 -0
  13. package/reference/core/exports.mdx +2 -0
  14. package/reference/packages/core/src/business/README.md +4 -1
  15. package/reference/packages/core/src/content/README.md +19 -0
  16. package/reference/packages/core/src/organization-model/README.md +148 -149
  17. package/reference/packages/core/src/organization-model/readiness/README.md +42 -0
  18. package/reference/packages/ui/src/features/README.md +28 -28
  19. package/reference/rules/shared-types.md +21 -0
  20. package/reference/scaffold/core/organization-graph.mdx +2 -3
  21. package/reference/scaffold/core/organization-model.mdx +2 -6
  22. package/reference/scaffold/operations/propagation-pipeline.md +15 -16
  23. package/reference/scaffold/operations/scaffold-maintenance.md +3 -2
  24. package/reference/scaffold/operations/workflow-recipes.md +2 -2
  25. package/reference/scaffold/recipes/customize-crm-actions.md +5 -5
  26. package/reference/scaffold/recipes/extend-content.md +265 -0
  27. package/reference/scaffold/recipes/extend-lead-gen.md +14 -16
  28. package/reference/scaffold/recipes/index.md +4 -1
  29. package/reference/scaffold/reference/contracts.md +18 -55
  30. package/reference/scaffold/reference/feature-registry.md +3 -0
  31. package/reference/scaffold/reference/glossary.md +1 -1
  32. package/reference/scaffold/ui/customization.md +2 -2
  33. package/reference/scaffold/ui/feature-shell.mdx +1 -3
  34. package/reference/sdk/cli-management.mdx +90 -5
  35. package/reference/sdk/cli.mdx +90 -13
  36. package/reference/sdk/framework/agent.mdx +6 -0
  37. package/reference/sdk/platform-tools/adapters-platform.mdx +3 -1
  38. package/reference/ui/exports.mdx +1 -0
@@ -638,13 +638,13 @@ var init_magic_string_es = __esm({
638
638
  }
639
639
  };
640
640
  Chunk = class _Chunk {
641
- constructor(start, end, content) {
641
+ constructor(start, end, content2) {
642
642
  this.start = start;
643
643
  this.end = end;
644
- this.original = content;
644
+ this.original = content2;
645
645
  this.intro = "";
646
646
  this.outro = "";
647
- this.content = content;
647
+ this.content = content2;
648
648
  this.storeName = false;
649
649
  this.edited = false;
650
650
  {
@@ -652,11 +652,11 @@ var init_magic_string_es = __esm({
652
652
  this.next = null;
653
653
  }
654
654
  }
655
- appendLeft(content) {
656
- this.outro += content;
655
+ appendLeft(content2) {
656
+ this.outro += content2;
657
657
  }
658
- appendRight(content) {
659
- this.intro = this.intro + content;
658
+ appendRight(content2) {
659
+ this.intro = this.intro + content2;
660
660
  }
661
661
  clone() {
662
662
  const chunk = new _Chunk(this.start, this.end, this.original);
@@ -684,8 +684,8 @@ var init_magic_string_es = __esm({
684
684
  chunk = chunk.previous;
685
685
  }
686
686
  }
687
- edit(content, storeName, contentOnly) {
688
- this.content = content;
687
+ edit(content2, storeName, contentOnly) {
688
+ this.content = content2;
689
689
  if (!contentOnly) {
690
690
  this.intro = "";
691
691
  this.outro = "";
@@ -694,11 +694,11 @@ var init_magic_string_es = __esm({
694
694
  this.edited = true;
695
695
  return this;
696
696
  }
697
- prependLeft(content) {
698
- this.outro = content + this.outro;
697
+ prependLeft(content2) {
698
+ this.outro = content2 + this.outro;
699
699
  }
700
- prependRight(content) {
701
- this.intro = content + this.intro;
700
+ prependRight(content2) {
701
+ this.intro = content2 + this.intro;
702
702
  }
703
703
  reset() {
704
704
  this.intro = "";
@@ -805,10 +805,10 @@ var init_magic_string_es = __esm({
805
805
  this.rawSegments = this.raw[this.generatedCodeLine] = [];
806
806
  this.pending = null;
807
807
  }
808
- addEdit(sourceIndex, content, loc, nameIndex) {
809
- if (content.length) {
810
- const contentLengthMinusOne = content.length - 1;
811
- let contentLineEnd = content.indexOf("\n", 0);
808
+ addEdit(sourceIndex, content2, loc, nameIndex) {
809
+ if (content2.length) {
810
+ const contentLengthMinusOne = content2.length - 1;
811
+ let contentLineEnd = content2.indexOf("\n", 0);
812
812
  let previousContentLineEnd = -1;
813
813
  while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {
814
814
  const segment2 = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
@@ -820,17 +820,17 @@ var init_magic_string_es = __esm({
820
820
  this.raw[this.generatedCodeLine] = this.rawSegments = [];
821
821
  this.generatedCodeColumn = 0;
822
822
  previousContentLineEnd = contentLineEnd;
823
- contentLineEnd = content.indexOf("\n", contentLineEnd + 1);
823
+ contentLineEnd = content2.indexOf("\n", contentLineEnd + 1);
824
824
  }
825
825
  const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
826
826
  if (nameIndex >= 0) {
827
827
  segment.push(nameIndex);
828
828
  }
829
829
  this.rawSegments.push(segment);
830
- this.advance(content.slice(previousContentLineEnd + 1));
830
+ this.advance(content2.slice(previousContentLineEnd + 1));
831
831
  } else if (this.pending) {
832
832
  this.rawSegments.push(this.pending);
833
- this.advance(content);
833
+ this.advance(content2);
834
834
  }
835
835
  this.pending = null;
836
836
  }
@@ -917,32 +917,32 @@ var init_magic_string_es = __esm({
917
917
  addSourcemapLocation(char) {
918
918
  this.sourcemapLocations.add(char);
919
919
  }
920
- append(content) {
921
- if (typeof content !== "string") throw new TypeError("outro content must be a string");
922
- this.outro += content;
920
+ append(content2) {
921
+ if (typeof content2 !== "string") throw new TypeError("outro content must be a string");
922
+ this.outro += content2;
923
923
  return this;
924
924
  }
925
- appendLeft(index2, content) {
925
+ appendLeft(index2, content2) {
926
926
  index2 = index2 + this.offset;
927
- if (typeof content !== "string") throw new TypeError("inserted content must be a string");
927
+ if (typeof content2 !== "string") throw new TypeError("inserted content must be a string");
928
928
  this._split(index2);
929
929
  const chunk = this.byEnd[index2];
930
930
  if (chunk) {
931
- chunk.appendLeft(content);
931
+ chunk.appendLeft(content2);
932
932
  } else {
933
- this.intro += content;
933
+ this.intro += content2;
934
934
  }
935
935
  return this;
936
936
  }
937
- appendRight(index2, content) {
937
+ appendRight(index2, content2) {
938
938
  index2 = index2 + this.offset;
939
- if (typeof content !== "string") throw new TypeError("inserted content must be a string");
939
+ if (typeof content2 !== "string") throw new TypeError("inserted content must be a string");
940
940
  this._split(index2);
941
941
  const chunk = this.byStart[index2];
942
942
  if (chunk) {
943
- chunk.appendRight(content);
943
+ chunk.appendRight(content2);
944
944
  } else {
945
- this.outro += content;
945
+ this.outro += content2;
946
946
  }
947
947
  return this;
948
948
  }
@@ -1096,23 +1096,23 @@ var init_magic_string_es = __esm({
1096
1096
  "magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)"
1097
1097
  );
1098
1098
  }
1099
- insertLeft(index2, content) {
1099
+ insertLeft(index2, content2) {
1100
1100
  if (!warned.insertLeft) {
1101
1101
  console.warn(
1102
1102
  "magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"
1103
1103
  );
1104
1104
  warned.insertLeft = true;
1105
1105
  }
1106
- return this.appendLeft(index2, content);
1106
+ return this.appendLeft(index2, content2);
1107
1107
  }
1108
- insertRight(index2, content) {
1108
+ insertRight(index2, content2) {
1109
1109
  if (!warned.insertRight) {
1110
1110
  console.warn(
1111
1111
  "magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"
1112
1112
  );
1113
1113
  warned.insertRight = true;
1114
1114
  }
1115
- return this.prependRight(index2, content);
1115
+ return this.prependRight(index2, content2);
1116
1116
  }
1117
1117
  move(start, end, index2) {
1118
1118
  start = start + this.offset;
@@ -1144,14 +1144,14 @@ var init_magic_string_es = __esm({
1144
1144
  if (!newRight) this.lastChunk = last;
1145
1145
  return this;
1146
1146
  }
1147
- overwrite(start, end, content, options) {
1147
+ overwrite(start, end, content2, options) {
1148
1148
  options = options || {};
1149
- return this.update(start, end, content, { ...options, overwrite: !options.contentOnly });
1149
+ return this.update(start, end, content2, { ...options, overwrite: !options.contentOnly });
1150
1150
  }
1151
- update(start, end, content, options) {
1151
+ update(start, end, content2, options) {
1152
1152
  start = start + this.offset;
1153
1153
  end = end + this.offset;
1154
- if (typeof content !== "string") throw new TypeError("replacement content must be a string");
1154
+ if (typeof content2 !== "string") throw new TypeError("replacement content must be a string");
1155
1155
  if (this.original.length !== 0) {
1156
1156
  while (start < 0) start += this.original.length;
1157
1157
  while (end < 0) end += this.original.length;
@@ -1193,40 +1193,40 @@ var init_magic_string_es = __esm({
1193
1193
  chunk = chunk.next;
1194
1194
  chunk.edit("", false);
1195
1195
  }
1196
- first.edit(content, storeName, !overwrite);
1196
+ first.edit(content2, storeName, !overwrite);
1197
1197
  } else {
1198
- const newChunk = new Chunk(start, end, "").edit(content, storeName);
1198
+ const newChunk = new Chunk(start, end, "").edit(content2, storeName);
1199
1199
  last.next = newChunk;
1200
1200
  newChunk.previous = last;
1201
1201
  }
1202
1202
  return this;
1203
1203
  }
1204
- prepend(content) {
1205
- if (typeof content !== "string") throw new TypeError("outro content must be a string");
1206
- this.intro = content + this.intro;
1204
+ prepend(content2) {
1205
+ if (typeof content2 !== "string") throw new TypeError("outro content must be a string");
1206
+ this.intro = content2 + this.intro;
1207
1207
  return this;
1208
1208
  }
1209
- prependLeft(index2, content) {
1209
+ prependLeft(index2, content2) {
1210
1210
  index2 = index2 + this.offset;
1211
- if (typeof content !== "string") throw new TypeError("inserted content must be a string");
1211
+ if (typeof content2 !== "string") throw new TypeError("inserted content must be a string");
1212
1212
  this._split(index2);
1213
1213
  const chunk = this.byEnd[index2];
1214
1214
  if (chunk) {
1215
- chunk.prependLeft(content);
1215
+ chunk.prependLeft(content2);
1216
1216
  } else {
1217
- this.intro = content + this.intro;
1217
+ this.intro = content2 + this.intro;
1218
1218
  }
1219
1219
  return this;
1220
1220
  }
1221
- prependRight(index2, content) {
1221
+ prependRight(index2, content2) {
1222
1222
  index2 = index2 + this.offset;
1223
- if (typeof content !== "string") throw new TypeError("inserted content must be a string");
1223
+ if (typeof content2 !== "string") throw new TypeError("inserted content must be a string");
1224
1224
  this._split(index2);
1225
1225
  const chunk = this.byStart[index2];
1226
1226
  if (chunk) {
1227
- chunk.prependRight(content);
1227
+ chunk.prependRight(content2);
1228
1228
  } else {
1229
- this.outro = content + this.outro;
1229
+ this.outro = content2 + this.outro;
1230
1230
  }
1231
1231
  return this;
1232
1232
  }
@@ -4966,8 +4966,8 @@ function preview(text, n2 = 120) {
4966
4966
  // ../core/src/platform/utils/token-counter.ts
4967
4967
  var CHARS_PER_TOKEN = 3.5;
4968
4968
  function estimateTokens(text) {
4969
- const content = typeof text === "string" ? text : JSON.stringify(text);
4970
- const chars4 = content.length;
4969
+ const content2 = typeof text === "string" ? text : JSON.stringify(text);
4970
+ const chars4 = content2.length;
4971
4971
  return Math.ceil(chars4 / CHARS_PER_TOKEN);
4972
4972
  }
4973
4973
  function truncationCharBudget(maxTokens, noticeLength = 0) {
@@ -5007,7 +5007,7 @@ function buildUntrustedDataPolicy(securityLevel) {
5007
5007
  }
5008
5008
  function buildAgentMessages(systemPrompt, memory, currentInput, securityLevel, conversationHistory = []) {
5009
5009
  const policy = buildUntrustedDataPolicy(securityLevel);
5010
- const historyMessages = conversationHistory.map(({ role, content }) => ({ role, content }));
5010
+ const historyMessages = conversationHistory.map(({ role, content: content2 }) => ({ role, content: content2 }));
5011
5011
  if (historyMessages.length > 0) {
5012
5012
  historyMessages[historyMessages.length - 1].cacheBreakpoint = true;
5013
5013
  }
@@ -5521,11 +5521,11 @@ function safeStructuralPrefix(raw, cutAt) {
5521
5521
  const base = stripDanglingTail(raw.slice(0, cutPoint), stack[stack.length - 1] === "}");
5522
5522
  return base + [...stack].reverse().join("");
5523
5523
  }
5524
- function truncateContent(content, maxTokens) {
5525
- const estimated = estimateTokens(content);
5526
- if (estimated <= maxTokens) return { content };
5524
+ function truncateContent(content2, maxTokens) {
5525
+ const estimated = estimateTokens(content2);
5526
+ if (estimated <= maxTokens) return { content: content2 };
5527
5527
  const cutAt = truncationCharBudget(maxTokens, CLOSING_BRACKET_RESERVE);
5528
- const safeContent = safeStructuralPrefix(content, cutAt);
5528
+ const safeContent = safeStructuralPrefix(content2, cutAt);
5529
5529
  const omittedTokens = estimated - maxTokens;
5530
5530
  return { content: safeContent, truncated: { omittedTokens } };
5531
5531
  }
@@ -5621,9 +5621,9 @@ async function executeToolCall(iterationContext, action) {
5621
5621
  const validatedResult = tool.outputSchema.parse(rawResult);
5622
5622
  let boundedResult = validatedResult;
5623
5623
  if (tool.maxOutputTokens !== void 0) {
5624
- const { content, truncated } = truncateContent(JSON.stringify(validatedResult), tool.maxOutputTokens);
5624
+ const { content: content2, truncated } = truncateContent(JSON.stringify(validatedResult), tool.maxOutputTokens);
5625
5625
  if (truncated) {
5626
- boundedResult = content;
5626
+ boundedResult = content2;
5627
5627
  }
5628
5628
  }
5629
5629
  const toolEndTime = Date.now();
@@ -5932,7 +5932,7 @@ async function processMemory(memoryManager, response, logger, iteration) {
5932
5932
  if (!response.memoryOps) return;
5933
5933
  const { memoryOps } = response;
5934
5934
  if (memoryOps.set) {
5935
- for (const [key, content] of Object.entries(memoryOps.set)) {
5935
+ for (const [key, content2] of Object.entries(memoryOps.set)) {
5936
5936
  if (!validateMemoryKeyOwnership(key, logger, iteration)) {
5937
5937
  continue;
5938
5938
  }
@@ -5940,7 +5940,7 @@ async function processMemory(memoryManager, response, logger, iteration) {
5940
5940
  "memory-set",
5941
5941
  iteration,
5942
5942
  // Auto-stringify non-string values (arrays, objects, etc.)
5943
- () => memoryManager.set(key, typeof content === "string" ? content : JSON.stringify(content)),
5943
+ () => memoryManager.set(key, typeof content2 === "string" ? content2 : JSON.stringify(content2)),
5944
5944
  () => `Set: ${key}`
5945
5945
  );
5946
5946
  }
@@ -6060,13 +6060,13 @@ var MAX_TOOL_RESULT_TOKENS = 4e3;
6060
6060
 
6061
6061
  // ../core/src/execution/engine/agent/memory/manager.ts
6062
6062
  var ENVELOPE_FULL_RESULT_WINDOW = 3;
6063
- function parseIfJson(content) {
6064
- const trimmed = content.trim();
6065
- if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) return content;
6063
+ function parseIfJson(content2) {
6064
+ const trimmed = content2.trim();
6065
+ if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) return content2;
6066
6066
  try {
6067
- return JSON.parse(content);
6067
+ return JSON.parse(content2);
6068
6068
  } catch {
6069
- return content;
6069
+ return content2;
6070
6070
  }
6071
6071
  }
6072
6072
  function isInTurnScope(entry, currentTurn) {
@@ -6129,8 +6129,8 @@ var MemoryManager = class {
6129
6129
  * @param key - Session memory key
6130
6130
  * @param content - String content from agent
6131
6131
  */
6132
- set(key, content, source = "model") {
6133
- const entryTokens = estimateTokens(content);
6132
+ set(key, content2, source = "model") {
6133
+ const entryTokens = estimateTokens(content2);
6134
6134
  let truncated;
6135
6135
  if (entryTokens > MAX_SINGLE_ENTRY_TOKENS) {
6136
6136
  const truncateTime = Date.now();
@@ -6142,13 +6142,13 @@ var MemoryManager = class {
6142
6142
  truncateTime,
6143
6143
  0
6144
6144
  );
6145
- const result = truncateContent(content, MAX_SINGLE_ENTRY_TOKENS);
6146
- content = result.content;
6145
+ const result = truncateContent(content2, MAX_SINGLE_ENTRY_TOKENS);
6146
+ content2 = result.content;
6147
6147
  truncated = result.truncated;
6148
6148
  }
6149
6149
  this.memory.sessionMemory[key] = {
6150
6150
  type: "context",
6151
- content,
6151
+ content: content2,
6152
6152
  timestamp: Date.now(),
6153
6153
  turnNumber: null,
6154
6154
  // Session memory entries are not turn-specific
@@ -6158,7 +6158,7 @@ var MemoryManager = class {
6158
6158
  ...truncated && { truncated },
6159
6159
  // Screened once, here, instead of by re-scanning the whole envelope on every iteration this
6160
6160
  // key gets re-sent for — see `MemoryEntry.warnings`.
6161
- warnings: sanitizeUserInput(content).warnings
6161
+ warnings: sanitizeUserInput(content2).warnings
6162
6162
  };
6163
6163
  }
6164
6164
  /**
@@ -6196,14 +6196,14 @@ var MemoryManager = class {
6196
6196
  iterationNumber: entry.iterationNumber
6197
6197
  });
6198
6198
  }
6199
- let content = entry.content;
6199
+ let content2 = entry.content;
6200
6200
  let truncated;
6201
6201
  if (entry.type === "tool-result" || entry.type === "error") {
6202
- const before = content;
6203
- const result = truncateContent(content, MAX_TOOL_RESULT_TOKENS);
6204
- content = result.content;
6202
+ const before = content2;
6203
+ const result = truncateContent(content2, MAX_TOOL_RESULT_TOKENS);
6204
+ content2 = result.content;
6205
6205
  truncated = result.truncated;
6206
- if (content !== before) {
6206
+ if (content2 !== before) {
6207
6207
  const truncateTime = Date.now();
6208
6208
  this.logger?.action(
6209
6209
  "memory-tool-result-truncate",
@@ -6217,12 +6217,12 @@ var MemoryManager = class {
6217
6217
  }
6218
6218
  this.memory.history.push({
6219
6219
  ...entry,
6220
- content,
6220
+ content: content2,
6221
6221
  timestamp: Date.now(),
6222
6222
  ...truncated && { truncated },
6223
6223
  // Screened once, here, instead of by re-scanning the whole accumulated envelope on every
6224
6224
  // iteration this entry gets re-sent for — see `MemoryEntry.warnings`.
6225
- warnings: sanitizeUserInput(content).warnings
6225
+ warnings: sanitizeUserInput(content2).warnings
6226
6226
  });
6227
6227
  this.autoCompact();
6228
6228
  }
@@ -8147,28 +8147,42 @@ z.object({
8147
8147
  limit: z.number().int(),
8148
8148
  offset: z.number().int()
8149
8149
  });
8150
- var AcqArtifactOwnerKindSchema = z.enum(["company", "contact", "deal", "list", "list_member"]);
8150
+ var AcqArtifactOwnerKindSchema = z.enum(["company", "contact", "deal", "list", "list_member", "organization"]);
8151
8151
  z.object({
8152
8152
  ownerKind: AcqArtifactOwnerKindSchema,
8153
- ownerId: UuidSchema
8153
+ ownerId: UuidSchema.optional()
8154
8154
  }).strict();
8155
+ var PipelineIdSchema = z.string().trim().min(1).max(255);
8155
8156
  z.object({
8156
8157
  ownerKind: AcqArtifactOwnerKindSchema,
8157
- ownerId: UuidSchema,
8158
+ // Nullable + optional: an org-owned artifact (ownerKind: 'organization') has no
8159
+ // single owning entity row. See the comment on AcqArtifactOwnerKindSchema above.
8160
+ ownerId: UuidSchema.nullable().optional(),
8158
8161
  kind: z.string().trim().min(1).max(255),
8159
8162
  content: z.record(z.string(), z.unknown()),
8160
- sourceExecutionId: UuidSchema.optional()
8163
+ sourceExecutionId: UuidSchema.optional(),
8164
+ // Nullable + optional: acquisition's own artifacts (audits, proposals, ICP docs) predate the
8165
+ // pipeline concept and have none. `getActiveArtifact` filters on it, so any artifact meant to
8166
+ // be resolvable as "the active document for pipeline X" MUST supply it -- artifacts-platform-tool
8167
+ // .mdx Step 3 defect 1.
8168
+ pipelineId: PipelineIdSchema.nullable().optional()
8161
8169
  }).strict();
8162
8170
  var AcqArtifactResponseSchema = z.object({
8163
8171
  id: z.string(),
8164
8172
  organizationId: z.string(),
8165
8173
  ownerKind: z.string(),
8166
- ownerId: z.string(),
8174
+ // Nullable as of content-pipeline-foundation D14: an org-owned artifact has no owning entity row.
8175
+ // CreateArtifactRequestSchema already accepted a null ownerId; this response schema not doing so
8176
+ // was Step 3 defect 2 -- an org-owned artifact inserted fine and then failed serialization.
8177
+ ownerId: z.string().nullable(),
8167
8178
  kind: z.string(),
8179
+ pipelineId: z.string().nullable(),
8168
8180
  content: z.record(z.string(), z.unknown()),
8169
8181
  sourceExecutionId: z.string().nullable(),
8170
8182
  createdBy: z.string().nullable(),
8171
8183
  createdAt: z.string(),
8184
+ updatedAt: z.string(),
8185
+ isActive: z.boolean(),
8172
8186
  version: z.number().int()
8173
8187
  });
8174
8188
  z.object({
@@ -8634,6 +8648,25 @@ createAdapter("list", [
8634
8648
  "listPendingContactIds"
8635
8649
  ]);
8636
8650
 
8651
+ // src/worker/adapters/artifacts.ts
8652
+ createAdapter("artifacts", [
8653
+ "listArtifacts",
8654
+ "createArtifact",
8655
+ "getActive"
8656
+ ]);
8657
+
8658
+ // src/worker/adapters/content.ts
8659
+ createAdapter("content", [
8660
+ "createItem",
8661
+ "getItem",
8662
+ "listItems",
8663
+ "updateItem",
8664
+ "createAttempt",
8665
+ "listAttempts",
8666
+ "createDistribution",
8667
+ "updateDistribution"
8668
+ ]);
8669
+
8637
8670
  // src/worker/adapters/pdf.ts
8638
8671
  createAdapter("pdf", ["render", "renderToBuffer"]);
8639
8672
 
@@ -8960,9 +8993,23 @@ function compileOrganizationOntology(model) {
8960
8993
  addLegacyActionProjections(ontology, diagnostics, sourcesById, model.actions ?? {}, model.entities ?? {});
8961
8994
  return { ontology: sortResolvedOntologyIndex(ontology), diagnostics };
8962
8995
  }
8996
+
8997
+ // ../core/src/organization-model/readiness/profile-registry.ts
8998
+ var _builtInProfileValidators = /* @__PURE__ */ new Map();
8999
+ function getBuiltInReadinessProfile(profileId) {
9000
+ return _builtInProfileValidators.get(profileId);
9001
+ }
9002
+ var _interfaceMarkerResolvers = /* @__PURE__ */ new Map();
9003
+ function interfaceMarkerKey(systemPath, interfaceKey) {
9004
+ return `${systemPath}::${interfaceKey}`;
9005
+ }
9006
+ function resolveReadinessInterfaceMarker(model, systemPath, interfaceKey) {
9007
+ return _interfaceMarkerResolvers.get(interfaceMarkerKey(systemPath, interfaceKey))?.(model);
9008
+ }
9009
+
9010
+ // ../core/src/organization-model/domains/systems.ts
8963
9011
  var SystemKindSchema = z.enum(["product", "operational", "platform", "diagnostic"]).meta({ label: "System kind", color: "blue" });
8964
9012
  var SystemLifecycleSchema = z.enum(["draft", "beta", "active", "deprecated", "archived"]).meta({ label: "Lifecycle", color: "teal" });
8965
- var SystemStatusSchema = z.enum(["active", "deprecated", "archived"]).meta({ label: "Status", color: "teal" });
8966
9013
  var SystemIdSchema = ModelIdSchema;
8967
9014
  var SystemPathSchema = z.string().trim().min(1).regex(
8968
9015
  /^[a-z0-9][a-z0-9-]*(?:\.[a-z0-9][a-z0-9-]*)*$/,
@@ -8976,8 +9023,7 @@ z.string().trim().min(1).max(200).regex(
8976
9023
  var SystemUiSchema = z.object({
8977
9024
  path: PathSchema,
8978
9025
  surfaces: ReferenceIdsSchema,
8979
- icon: IconNameSchema.optional(),
8980
- order: z.number().int().optional()
9026
+ icon: IconNameSchema.optional()
8981
9027
  });
8982
9028
  var SystemInterfaceKeySchema = ModelIdSchema;
8983
9029
  var SystemInterfaceLifecycleSchema = z.enum(["draft", "active", "disabled", "deprecated", "archived"]).meta({ label: "System interface lifecycle", color: "teal" });
@@ -9037,14 +9083,11 @@ var SystemApiInterfaceSchema = z.object({
9037
9083
  */
9038
9084
  readinessContract: SystemApiInterfaceReadinessContractSchema.optional()
9039
9085
  }).strict();
9040
- var _profileRegistry = new Map(
9041
- SYSTEM_INTERFACE_READINESS_PROFILES.map((profileId) => [
9042
- profileId,
9043
- { profileId, kind: "built-in" }
9044
- ])
9045
- );
9086
+ function isReservedPlatformProfileId(profileId) {
9087
+ return SYSTEM_INTERFACE_READINESS_PROFILES.includes(profileId);
9088
+ }
9046
9089
  function isBuiltInReadinessProfile(profileId) {
9047
- return _profileRegistry.get(profileId)?.kind === "built-in";
9090
+ return isReservedPlatformProfileId(profileId) || getBuiltInReadinessProfile(profileId) !== void 0;
9048
9091
  }
9049
9092
  z.object({
9050
9093
  systemPath: SystemPathSchema,
@@ -9076,7 +9119,7 @@ var SystemEntrySchema = z.object({
9076
9119
  parentSystemId: SystemIdSchema.optional(),
9077
9120
  /** Optional UI presence. Systems without UI omit this. */
9078
9121
  ui: SystemUiSchema.optional(),
9079
- /** Canonical lifecycle state. Replaces Feature.enabled/devOnly and System.status. */
9122
+ /** Canonical lifecycle state. `beta` is what gates a System to dev-mode viewers. */
9080
9123
  lifecycle: SystemLifecycleSchema.optional(),
9081
9124
  /** Optional role responsible for this system. */
9082
9125
  responsibleRoleId: ModelIdSchema.meta({ ref: "role" }).optional(),
@@ -9084,14 +9127,10 @@ var SystemEntrySchema = z.object({
9084
9127
  governedByKnowledge: z.array(ModelIdSchema.meta({ ref: "knowledge" })).default([]).optional(),
9085
9128
  /** Optional actions this system exposes or consumes. */
9086
9129
  actions: z.array(ActionRefSchema).optional(),
9087
- /** Optional operational policies that apply to this system. */
9088
- policies: z.array(ModelIdSchema.meta({ ref: "policy" })).default([]).optional(),
9089
9130
  /** Optional goals this system contributes to. */
9090
9131
  drivesGoals: z.array(ModelIdSchema.meta({ ref: "goal" })).default([]).optional(),
9091
9132
  /** Thin API runtime-boundary marker. Readiness is derived from scoped resources and topology. */
9092
9133
  apiInterface: SystemApiInterfaceSchema.optional(),
9093
- /** @deprecated Use lifecycle. Accepted for one publish cycle. */
9094
- status: SystemStatusSchema.optional(),
9095
9134
  /** @deprecated Use ui.path. Kept for one-cycle Feature compatibility. */
9096
9135
  path: PathSchema.optional(),
9097
9136
  /** @deprecated Use ui.icon. Kept for one-cycle Feature compatibility. */
@@ -9100,9 +9139,6 @@ var SystemEntrySchema = z.object({
9100
9139
  uiPosition: UiPositionSchema.optional(),
9101
9140
  /** @deprecated Use lifecycle. */
9102
9141
  enabled: z.boolean().optional(),
9103
- /** @deprecated Use lifecycle: "beta". */
9104
- devOnly: z.boolean().optional(),
9105
- requiresAdmin: z.boolean().optional(),
9106
9142
  /** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
9107
9143
  order: z.number(),
9108
9144
  /**
@@ -9129,29 +9165,13 @@ var SystemEntrySchema = z.object({
9129
9165
  }).strict().refine((system) => system.label !== void 0 || system.title !== void 0, {
9130
9166
  path: ["label"],
9131
9167
  message: "System must provide label or title"
9132
- }).transform((system) => {
9133
- const normalizedSystem = system.systems !== void 0 && system.subsystems === void 0 ? { ...system, subsystems: system.systems } : system;
9134
- if (normalizedSystem.status === void 0) return normalizedSystem;
9135
- console.warn("[organization-model] System.status is deprecated; use System.lifecycle instead.");
9136
- return normalizedSystem.lifecycle === void 0 ? { ...normalizedSystem, lifecycle: normalizedSystem.status } : normalizedSystem;
9137
- });
9168
+ }).transform(
9169
+ (system) => system.systems !== void 0 && system.subsystems === void 0 ? { ...system, subsystems: system.systems } : system
9170
+ );
9138
9171
  z.record(z.string(), SystemEntrySchema).refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
9139
9172
  message: "Each system entry id must match its map key"
9140
9173
  }).default({});
9141
9174
 
9142
- // ../core/src/organization-model/readiness/profile-registry.ts
9143
- var _builtInProfileValidators = /* @__PURE__ */ new Map();
9144
- function getBuiltInReadinessProfile(profileId) {
9145
- return _builtInProfileValidators.get(profileId);
9146
- }
9147
- var _interfaceMarkerResolvers = /* @__PURE__ */ new Map();
9148
- function interfaceMarkerKey(systemPath, interfaceKey) {
9149
- return `${systemPath}::${interfaceKey}`;
9150
- }
9151
- function resolveReadinessInterfaceMarker(model, systemPath, interfaceKey) {
9152
- return _interfaceMarkerResolvers.get(interfaceMarkerKey(systemPath, interfaceKey))?.(model);
9153
- }
9154
-
9155
9175
  // ../core/src/organization-model/readiness/engine.ts
9156
9176
  function addReadinessIssue(issues, family, code, message, details = {}) {
9157
9177
  issues.push({
@@ -9854,14 +9874,12 @@ function addTopologyIssues(issues, orgName, deployment, organizationModel, syste
9854
9874
  const relationships = organizationModel.topology?.relationships;
9855
9875
  if (relationships === void 0) return;
9856
9876
  const rolesById = new Set(Object.keys(organizationModel.roles ?? {}));
9857
- const policiesById = new Set(Object.keys(organizationModel.policies ?? {}));
9858
9877
  const triggerIds = new Set(deployment.triggers?.map((trigger) => trigger.resourceId) ?? []);
9859
9878
  const humanCheckpointIds = new Set(deployment.humanCheckpoints?.map((checkpoint) => checkpoint.resourceId) ?? []);
9860
9879
  const externalResourceIds = new Set(deployment.externalResources?.map((external) => external.resourceId) ?? []);
9861
9880
  const topologyRefExists = (ref) => {
9862
9881
  if (ref.kind === "system") return systemsById.has(ref.id);
9863
9882
  if (ref.kind === "resource") return omResourcesById.has(ref.id);
9864
- if (ref.kind === "policy") return policiesById.has(ref.id);
9865
9883
  if (ref.kind === "role") return rolesById.has(ref.id);
9866
9884
  if (ref.kind === "trigger") return triggerIds.has(ref.id);
9867
9885
  if (ref.kind === "humanCheckpoint") return humanCheckpointIds.has(ref.id);
@@ -24273,14 +24291,14 @@ function keyToTestName(key) {
24273
24291
  }
24274
24292
  return key.replace(/ \d+$/, "");
24275
24293
  }
24276
- function getSnapshotData(content, options) {
24294
+ function getSnapshotData(content2, options) {
24277
24295
  const update = options.updateSnapshot;
24278
24296
  const data = /* @__PURE__ */ Object.create(null);
24279
24297
  let snapshotContents = "";
24280
24298
  let dirty = false;
24281
- if (content != null) {
24299
+ if (content2 != null) {
24282
24300
  try {
24283
- snapshotContents = content;
24301
+ snapshotContents = content2;
24284
24302
  const populate = new Function("exports", snapshotContents);
24285
24303
  populate(data);
24286
24304
  } catch {
@@ -24325,16 +24343,16 @@ function normalizeNewlines(string2) {
24325
24343
  }
24326
24344
  async function saveSnapshotFile(environment, snapshotData, snapshotPath) {
24327
24345
  const snapshots = Object.keys(snapshotData).sort(naturalCompare).map((key) => `exports[${printBacktickString(key)}] = ${printBacktickString(normalizeNewlines(snapshotData[key]))};`);
24328
- const content = `${environment.getHeader()}
24346
+ const content2 = `${environment.getHeader()}
24329
24347
 
24330
24348
  ${snapshots.join("\n\n")}
24331
24349
  `;
24332
24350
  const oldContent = await environment.readSnapshotFile(snapshotPath);
24333
- const skipWriting = oldContent != null && oldContent === content;
24351
+ const skipWriting = oldContent != null && oldContent === content2;
24334
24352
  if (skipWriting) {
24335
24353
  return;
24336
24354
  }
24337
- await environment.saveSnapshotFile(snapshotPath, content);
24355
+ await environment.saveSnapshotFile(snapshotPath, content2);
24338
24356
  }
24339
24357
  function deepMergeArray(target = [], source = []) {
24340
24358
  const mergedOutput = Array.from(target);
@@ -24485,8 +24503,8 @@ var SnapshotState = class _SnapshotState {
24485
24503
  }
24486
24504
  static async create(testFilePath, options) {
24487
24505
  const snapshotPath = await options.snapshotEnvironment.resolvePath(testFilePath);
24488
- const content = await options.snapshotEnvironment.readSnapshotFile(snapshotPath);
24489
- return new _SnapshotState(testFilePath, snapshotPath, content, options);
24506
+ const content2 = await options.snapshotEnvironment.readSnapshotFile(snapshotPath);
24507
+ return new _SnapshotState(testFilePath, snapshotPath, content2, options);
24490
24508
  }
24491
24509
  get environment() {
24492
24510
  return this._environment;
@@ -27715,6 +27733,20 @@ var mockList = (overrides) => createMockAdapter(
27715
27733
  ],
27716
27734
  overrides
27717
27735
  );
27736
+ var mockArtifacts = (overrides) => createMockAdapter(["listArtifacts", "createArtifact", "getActive"], overrides);
27737
+ var mockContent = (overrides) => createMockAdapter(
27738
+ [
27739
+ "createItem",
27740
+ "getItem",
27741
+ "listItems",
27742
+ "updateItem",
27743
+ "createAttempt",
27744
+ "listAttempts",
27745
+ "createDistribution",
27746
+ "updateDistribution"
27747
+ ],
27748
+ overrides
27749
+ );
27718
27750
  var mockPdf = (overrides) => createMockAdapter(["render", "renderToBuffer"], overrides);
27719
27751
  var mockApproval = (overrides) => createMockAdapter(["create", "deleteByMetadata"], overrides);
27720
27752
  var mockExecution = (overrides) => createMockAdapter(["trigger", "triggerAsync"], overrides);
@@ -28097,4 +28129,4 @@ chai/index.js:
28097
28129
  *)
28098
28130
  */
28099
28131
 
28100
- export { assertResourceRegistry, createMockAnymailfinder, createMockApify, createMockAttio, createMockDropbox, createMockGmail, createMockGoogleSheets, createMockInstantly, createMockMillionVerifier, createMockResend, createMockSignatureApi, createMockStripe, createMockTomba, mockAcqDb, mockApproval, mockCrm, mockEmail, mockExecution, mockList, mockLlm, mockNotifications, mockPdf, mockProjects, mockScheduler, mockStorage, runLinearWorkflow, runWorkflow };
28132
+ export { assertResourceRegistry, createMockAnymailfinder, createMockApify, createMockAttio, createMockDropbox, createMockGmail, createMockGoogleSheets, createMockInstantly, createMockMillionVerifier, createMockResend, createMockSignatureApi, createMockStripe, createMockTomba, mockAcqDb, mockApproval, mockArtifacts, mockContent, mockCrm, mockEmail, mockExecution, mockList, mockLlm, mockNotifications, mockPdf, mockProjects, mockScheduler, mockStorage, runLinearWorkflow, runWorkflow };