@inf-monkeys-tech/monkeys 1.1.54 → 1.1.56

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 (53) hide show
  1. package/lib/contracts/artifact-platform.d.ts +495 -0
  2. package/lib/contracts/artifact-platform.d.ts.map +1 -0
  3. package/lib/contracts/artifact-platform.js +311 -0
  4. package/lib/contracts/artifact-platform.js.map +1 -0
  5. package/lib/contracts/declarative-control-http.d.ts +398 -398
  6. package/lib/contracts/declarative-control.d.ts +41 -41
  7. package/lib/contracts/declarative-diagnostic.d.ts +2 -2
  8. package/lib/contracts/declarative-document-import.d.ts +7 -7
  9. package/lib/contracts/declarative-publication-job.d.ts +111 -111
  10. package/lib/contracts/declarative-publication-verification.d.ts +1 -1
  11. package/lib/contracts/design-board.d.ts +6 -6
  12. package/lib/contracts/index.d.ts +1 -0
  13. package/lib/contracts/index.d.ts.map +1 -1
  14. package/lib/contracts/index.js +1 -0
  15. package/lib/contracts/index.js.map +1 -1
  16. package/lib/contracts/render.d.ts +22 -22
  17. package/lib/contracts/tenant.d.ts +3 -3
  18. package/lib/contracts/theme.d.ts +1 -1
  19. package/lib/contracts/workflow-definition.d.ts +4 -4
  20. package/lib/esm/{chunk-RMZW3SVL.mjs → chunk-4LC3ZXUP.mjs} +3 -3
  21. package/lib/esm/chunk-4LC3ZXUP.mjs.map +1 -0
  22. package/lib/esm/{chunk-ITGLKSCE.mjs → chunk-74H5I3XN.mjs} +331 -3
  23. package/lib/esm/chunk-74H5I3XN.mjs.map +1 -0
  24. package/lib/esm/{chunk-E6YPJ4DR.mjs → chunk-DQJODDRF.mjs} +2 -2
  25. package/lib/esm/{chunk-DIIMDX7F.mjs → chunk-FIZWECL6.mjs} +2878 -2609
  26. package/lib/esm/chunk-FIZWECL6.mjs.map +1 -0
  27. package/lib/esm/{chunk-TROZIHS4.mjs → chunk-HJNQDSLC.mjs} +2 -2
  28. package/lib/esm/{chunk-66A4GGOV.mjs → chunk-Y7EZZ6IW.mjs} +2 -2
  29. package/lib/esm/contracts/index.mjs +42 -4
  30. package/lib/esm/index.mjs +56 -6
  31. package/lib/esm/index.mjs.map +1 -1
  32. package/lib/esm/runtime/index.mjs +15 -3
  33. package/lib/esm/schemas/index.mjs +39 -3
  34. package/lib/runtime/artifact-session.d.ts +51 -0
  35. package/lib/runtime/artifact-session.d.ts.map +1 -0
  36. package/lib/runtime/artifact-session.js +335 -0
  37. package/lib/runtime/artifact-session.js.map +1 -0
  38. package/lib/runtime/index.d.ts +1 -0
  39. package/lib/runtime/index.d.ts.map +1 -1
  40. package/lib/runtime/index.js +1 -0
  41. package/lib/runtime/index.js.map +1 -1
  42. package/lib/runtime/runtime-definition-wire.d.ts +44 -44
  43. package/lib/schemas/index.d.ts +41 -40
  44. package/lib/schemas/index.d.ts.map +1 -1
  45. package/lib/schemas/index.js +27 -8
  46. package/lib/schemas/index.js.map +1 -1
  47. package/package.json +2 -2
  48. package/lib/esm/chunk-DIIMDX7F.mjs.map +0 -1
  49. package/lib/esm/chunk-ITGLKSCE.mjs.map +0 -1
  50. package/lib/esm/chunk-RMZW3SVL.mjs.map +0 -1
  51. /package/lib/esm/{chunk-E6YPJ4DR.mjs.map → chunk-DQJODDRF.mjs.map} +0 -0
  52. /package/lib/esm/{chunk-TROZIHS4.mjs.map → chunk-HJNQDSLC.mjs.map} +0 -0
  53. /package/lib/esm/{chunk-66A4GGOV.mjs.map → chunk-Y7EZZ6IW.mjs.map} +0 -0
@@ -4,13 +4,14 @@ import {
4
4
  PAGE_STREAM_MAX_FRAME_BYTES,
5
5
  PageStreamDescriptorSchema,
6
6
  PageStreamEventSchema
7
- } from "./chunk-TROZIHS4.mjs";
7
+ } from "./chunk-HJNQDSLC.mjs";
8
8
  import {
9
9
  AccessPolicySchema,
10
10
  ActionProgramDefinitionSchema,
11
11
  AgentSessionEventSchema,
12
12
  AgentSessionViewModelSchema,
13
13
  ApplicationHandoffSchema,
14
+ ArtifactProfileSchema,
14
15
  CapabilityManifestSchema,
15
16
  CapabilityRegistryDocumentSchema,
16
17
  CapabilityRegistrySourceSchema,
@@ -87,6 +88,7 @@ import {
87
88
  TenantRuntimeConfigSchema,
88
89
  TenantScopeSchema,
89
90
  ViewProviderDescriptorSchema,
91
+ ViewSpecSchema,
90
92
  WorkbenchReleaseSchema,
91
93
  WorkbenchRuntimeBundleSchema,
92
94
  WorkbenchSchema,
@@ -115,7 +117,7 @@ import {
115
117
  require_validation,
116
118
  require_validation_error,
117
119
  resolveThemeTokens
118
- } from "./chunk-DIIMDX7F.mjs";
120
+ } from "./chunk-FIZWECL6.mjs";
119
121
  import {
120
122
  __commonJS,
121
123
  __toESM
@@ -1073,6 +1075,326 @@ var compileCapabilityRegistry = (sources) => {
1073
1075
  });
1074
1076
  };
1075
1077
 
1078
+ // src/runtime/artifact-session.ts
1079
+ function buildArtifactCollabRoomId(key) {
1080
+ const tenant = key.tenantId ? `${key.tenantId}:` : "";
1081
+ return `artifact:${tenant}${key.teamId}:${key.ontologyId}:${key.artifactKind}:${key.recordId}`;
1082
+ }
1083
+ function compileViewSpecToRenderTree(specInput, options = {}) {
1084
+ const spec = ViewSpecSchema.parse(specInput);
1085
+ const product = options.product ?? "studio";
1086
+ const ownerRepo = options.ownerRepo ?? "monkeys-studio";
1087
+ const rootNodeId = `view.${spec.viewId}`;
1088
+ const pageRef = { kind: "page", id: rootNodeId, ownerRepo };
1089
+ const defaultSurface = { frameOwner: "host", density: "default" };
1090
+ const defaultScroll = { owner: "surface", axis: "y", virtualizationBoundary: false };
1091
+ const defaultLifecycle = {
1092
+ mountPolicy: "when-active",
1093
+ queryPolicy: "when-active",
1094
+ retainOnDeactivate: true,
1095
+ deepLink: true,
1096
+ focusReturn: false
1097
+ };
1098
+ const blockNodes = spec.blocks.map((block) => ({
1099
+ contract: "RenderNode",
1100
+ nodeId: `${rootNodeId}.block.${block.blockId}`,
1101
+ kind: block.dataSource.kind === "artifact.body" ? "professional-provider" : block.dataSource.kind === "record.fields" ? "record" : "view",
1102
+ version: 1,
1103
+ ownerRepo,
1104
+ parentNodeId: rootNodeId,
1105
+ children: [],
1106
+ slot: block.slot,
1107
+ pageRef,
1108
+ capabilityRef: {
1109
+ kind: "capability",
1110
+ id: block.capability,
1111
+ version: 1,
1112
+ ownerRepo
1113
+ },
1114
+ surface: defaultSurface,
1115
+ scroll: block.dataSource.kind === "artifact.body" ? { owner: "provider", axis: "none", virtualizationBoundary: false } : defaultScroll,
1116
+ activation: { activationId: `${rootNodeId}.activate.${block.blockId}`, mode: "inline" },
1117
+ lifecycle: defaultLifecycle,
1118
+ layout: { mode: "flex", direction: "column" },
1119
+ responsive: [],
1120
+ state: "idle",
1121
+ renderModel: {
1122
+ blockId: block.blockId,
1123
+ dataSource: block.dataSource,
1124
+ config: block.config,
1125
+ ...block.title ? { title: block.title } : {}
1126
+ }
1127
+ }));
1128
+ const rootLayout = spec.layout.mode === "split-horizontal" || spec.layout.mode === "three-pane" ? { mode: "flex", direction: "row" } : { mode: "flex", direction: "column" };
1129
+ const rootNode = {
1130
+ contract: "RenderNode",
1131
+ nodeId: rootNodeId,
1132
+ kind: "view",
1133
+ version: 1,
1134
+ ownerRepo,
1135
+ children: blockNodes.map((node) => node.nodeId),
1136
+ pageRef,
1137
+ capabilityRef: {
1138
+ kind: "capability",
1139
+ id: "monkeys.view.host",
1140
+ version: 1,
1141
+ ownerRepo
1142
+ },
1143
+ surface: defaultSurface,
1144
+ scroll: { owner: "page", axis: "none", virtualizationBoundary: false },
1145
+ activation: { activationId: `${rootNodeId}.activate`, mode: "inline" },
1146
+ lifecycle: defaultLifecycle,
1147
+ layout: rootLayout,
1148
+ responsive: [],
1149
+ state: "idle",
1150
+ renderModel: {
1151
+ viewId: spec.viewId,
1152
+ title: spec.title,
1153
+ subject: spec.subject,
1154
+ ...spec.query ? { query: spec.query } : {},
1155
+ layout: spec.layout,
1156
+ wiring: spec.wiring
1157
+ }
1158
+ };
1159
+ return RenderTreeSchema.parse({
1160
+ contract: "RenderTree",
1161
+ treeId: `tree.${spec.viewId}`,
1162
+ product,
1163
+ rootNodeId,
1164
+ nodes: [rootNode, ...blockNodes]
1165
+ });
1166
+ }
1167
+ var DESIGN_BOARD_ARTIFACT_PROFILE = ArtifactProfileSchema.parse({
1168
+ contract: "ArtifactProfile",
1169
+ schemaVersion: 1,
1170
+ artifactKind: "board",
1171
+ bodySchemaRef: "design-board-document@1",
1172
+ storageMode: "loro-aggregate",
1173
+ crdtCodec: "loro-v1",
1174
+ defaultViewId: "board.canvas",
1175
+ views: [
1176
+ {
1177
+ contract: "ViewSpec",
1178
+ schemaVersion: 1,
1179
+ viewId: "board.canvas",
1180
+ title: { "zh-CN": "\u753B\u677F\u89C6\u56FE", "en-US": "Canvas View" },
1181
+ subject: {
1182
+ kind: "artifact",
1183
+ ontologyId: "DesignProjects",
1184
+ artifactKind: "board",
1185
+ recordIdParam: "designBoardId"
1186
+ },
1187
+ query: { source: "self" },
1188
+ layout: { mode: "single", regions: [{ id: "main", slot: "main" }] },
1189
+ blocks: [
1190
+ {
1191
+ blockId: "canvas",
1192
+ capability: "monkeys.design-board.editor",
1193
+ slot: "main",
1194
+ dataSource: { kind: "artifact.body", session: "loro" },
1195
+ config: {}
1196
+ }
1197
+ ],
1198
+ wiring: []
1199
+ },
1200
+ {
1201
+ contract: "ViewSpec",
1202
+ schemaVersion: 1,
1203
+ viewId: "board.linesheet",
1204
+ title: { "zh-CN": "Linesheet \u89C6\u56FE", "en-US": "Linesheet View" },
1205
+ subject: {
1206
+ kind: "artifact",
1207
+ ontologyId: "DesignProjects",
1208
+ artifactKind: "board",
1209
+ recordIdParam: "designBoardId"
1210
+ },
1211
+ query: { source: "relation", relationPath: "linesheet_items" },
1212
+ layout: { mode: "single", regions: [{ id: "main", slot: "main" }] },
1213
+ blocks: [
1214
+ {
1215
+ blockId: "linesheet",
1216
+ capability: "studio.capability.workflow-page.linesheet",
1217
+ slot: "main",
1218
+ dataSource: { kind: "artifact.body", session: "loro", slice: "linesheet" },
1219
+ config: {}
1220
+ }
1221
+ ],
1222
+ wiring: []
1223
+ },
1224
+ {
1225
+ contract: "ViewSpec",
1226
+ schemaVersion: 1,
1227
+ viewId: "board.properties",
1228
+ title: { "zh-CN": "\u5C5E\u6027\u4E0E\u7248\u672C", "en-US": "Properties & History" },
1229
+ subject: {
1230
+ kind: "artifact",
1231
+ ontologyId: "DesignProjects",
1232
+ artifactKind: "board",
1233
+ recordIdParam: "designBoardId"
1234
+ },
1235
+ query: { source: "self" },
1236
+ layout: {
1237
+ mode: "split-horizontal",
1238
+ regions: [
1239
+ { id: "properties", slot: "left", size: "50%" },
1240
+ { id: "history", slot: "right", size: "50%" }
1241
+ ]
1242
+ },
1243
+ blocks: [
1244
+ {
1245
+ blockId: "properties",
1246
+ capability: "monkeys.design.record-detail",
1247
+ slot: "left",
1248
+ dataSource: { kind: "record.fields", recordRef: "subject" },
1249
+ config: {}
1250
+ },
1251
+ {
1252
+ blockId: "history",
1253
+ capability: "monkeys.design.record-history",
1254
+ slot: "right",
1255
+ dataSource: { kind: "record.fields", recordRef: "subject" },
1256
+ config: {}
1257
+ }
1258
+ ],
1259
+ wiring: []
1260
+ }
1261
+ ]
1262
+ });
1263
+ var WORKFLOW_ARTIFACT_PROFILE = ArtifactProfileSchema.parse({
1264
+ contract: "ArtifactProfile",
1265
+ schemaVersion: 1,
1266
+ artifactKind: "workflow",
1267
+ bodySchemaRef: "workflow-definition@1",
1268
+ storageMode: "loro-aggregate",
1269
+ crdtCodec: "loro-v1",
1270
+ defaultViewId: "workflow.process",
1271
+ views: [
1272
+ {
1273
+ contract: "ViewSpec",
1274
+ schemaVersion: 1,
1275
+ viewId: "workflow.process",
1276
+ title: { "zh-CN": "\u6D41\u7A0B\u89C6\u56FE", "en-US": "Process View" },
1277
+ subject: {
1278
+ kind: "artifact",
1279
+ ontologyId: "workflow-definitions",
1280
+ artifactKind: "workflow",
1281
+ recordIdParam: "workflowId"
1282
+ },
1283
+ query: { source: "self" },
1284
+ layout: { mode: "single", regions: [{ id: "main", slot: "main" }] },
1285
+ blocks: [
1286
+ {
1287
+ blockId: "flow-dag",
1288
+ capability: "studio.capability.workflow-page.process",
1289
+ slot: "main",
1290
+ dataSource: { kind: "artifact.body", session: "loro" },
1291
+ config: {}
1292
+ }
1293
+ ],
1294
+ wiring: []
1295
+ },
1296
+ {
1297
+ contract: "ViewSpec",
1298
+ schemaVersion: 1,
1299
+ viewId: "workflow.preview",
1300
+ title: { "zh-CN": "\u8868\u5355\u89C6\u56FE", "en-US": "Form View" },
1301
+ subject: {
1302
+ kind: "artifact",
1303
+ ontologyId: "workflow-definitions",
1304
+ artifactKind: "workflow",
1305
+ recordIdParam: "workflowId"
1306
+ },
1307
+ query: { source: "relation", relationPath: "runs" },
1308
+ layout: {
1309
+ mode: "split-horizontal",
1310
+ regions: [
1311
+ { id: "form", slot: "left", size: "34%", minSize: 320, collapsible: true },
1312
+ { id: "waterfall", slot: "right", size: "66%" }
1313
+ ]
1314
+ },
1315
+ blocks: [
1316
+ {
1317
+ blockId: "run-form",
1318
+ capability: "studio.capability.workflow-run-form",
1319
+ slot: "left",
1320
+ dataSource: { kind: "collection.query", queryRef: "view.query", relationPath: "runs", mode: "create" },
1321
+ config: {}
1322
+ },
1323
+ {
1324
+ blockId: "run-waterfall",
1325
+ capability: "studio.capability.workflow-run-waterfall",
1326
+ slot: "right",
1327
+ dataSource: { kind: "collection.query", queryRef: "view.query", relationPath: "runs", mode: "read" },
1328
+ config: {}
1329
+ }
1330
+ ],
1331
+ wiring: [
1332
+ {
1333
+ sourceBlockId: "run-form",
1334
+ event: "run.started",
1335
+ targetBlockId: "run-waterfall",
1336
+ action: "collection.prependPlaceholder"
1337
+ }
1338
+ ]
1339
+ },
1340
+ {
1341
+ contract: "ViewSpec",
1342
+ schemaVersion: 1,
1343
+ viewId: "workflow.log",
1344
+ title: { "zh-CN": "\u65E5\u5FD7\u89C6\u56FE", "en-US": "Log View" },
1345
+ subject: {
1346
+ kind: "artifact",
1347
+ ontologyId: "workflow-definitions",
1348
+ artifactKind: "workflow",
1349
+ recordIdParam: "workflowId"
1350
+ },
1351
+ query: { source: "relation", relationPath: "runs" },
1352
+ layout: { mode: "single", regions: [{ id: "main", slot: "main" }] },
1353
+ blocks: [
1354
+ {
1355
+ blockId: "run-log-table",
1356
+ capability: "studio.capability.workflow-page.log",
1357
+ slot: "main",
1358
+ dataSource: { kind: "collection.query", queryRef: "view.query", relationPath: "runs", mode: "read" },
1359
+ config: {}
1360
+ }
1361
+ ],
1362
+ wiring: []
1363
+ },
1364
+ {
1365
+ contract: "ViewSpec",
1366
+ schemaVersion: 1,
1367
+ viewId: "workflow.chat",
1368
+ title: { "zh-CN": "\u5BF9\u8BDD\u89C6\u56FE", "en-US": "Chat View" },
1369
+ subject: {
1370
+ kind: "artifact",
1371
+ ontologyId: "workflow-definitions",
1372
+ artifactKind: "workflow",
1373
+ recordIdParam: "workflowId"
1374
+ },
1375
+ query: { source: "relation", relationPath: "sessions" },
1376
+ layout: { mode: "single", regions: [{ id: "main", slot: "main" }] },
1377
+ blocks: [
1378
+ {
1379
+ blockId: "chat-stream",
1380
+ capability: "studio.capability.workflow-page.chat",
1381
+ slot: "main",
1382
+ dataSource: { kind: "collection.query", queryRef: "view.query", relationPath: "sessions", mode: "read-write" },
1383
+ config: {}
1384
+ }
1385
+ ],
1386
+ wiring: []
1387
+ }
1388
+ ]
1389
+ });
1390
+ var BUILTIN_ARTIFACT_PROFILES = Object.freeze({
1391
+ board: DESIGN_BOARD_ARTIFACT_PROFILE,
1392
+ workflow: WORKFLOW_ARTIFACT_PROFILE
1393
+ });
1394
+ function resolveBuiltinArtifactProfile(artifactKind) {
1395
+ return BUILTIN_ARTIFACT_PROFILES[artifactKind];
1396
+ }
1397
+
1076
1398
  // src/runtime/agent-session-projector.ts
1077
1399
  function createAgentSessionEventProjection(sessionId) {
1078
1400
  return {
@@ -7640,6 +7962,12 @@ export {
7640
7962
  createOpenApiCapabilityRegistrySource,
7641
7963
  createWorkflowCapabilityManifest,
7642
7964
  compileCapabilityRegistry,
7965
+ buildArtifactCollabRoomId,
7966
+ compileViewSpecToRenderTree,
7967
+ DESIGN_BOARD_ARTIFACT_PROFILE,
7968
+ WORKFLOW_ARTIFACT_PROFILE,
7969
+ BUILTIN_ARTIFACT_PROFILES,
7970
+ resolveBuiltinArtifactProfile,
7643
7971
  createAgentSessionEventProjection,
7644
7972
  projectAgentSessionEvents,
7645
7973
  toAgentSessionViewModel,
@@ -7775,4 +8103,4 @@ export {
7775
8103
  pageMountParentHref,
7776
8104
  nativePageMountPlan
7777
8105
  };
7778
- //# sourceMappingURL=chunk-ITGLKSCE.mjs.map
8106
+ //# sourceMappingURL=chunk-74H5I3XN.mjs.map