@useorgx/openclaw-plugin 0.4.8 → 0.7.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 (284) hide show
  1. package/README.md +35 -0
  2. package/dashboard/dist/assets/BJgZIVUQ.js +53 -0
  3. package/dashboard/dist/assets/BJgZIVUQ.js.br +0 -0
  4. package/dashboard/dist/assets/BJgZIVUQ.js.gz +0 -0
  5. package/dashboard/dist/assets/BXWDRGm-.js +1 -0
  6. package/dashboard/dist/assets/BXWDRGm-.js.br +0 -0
  7. package/dashboard/dist/assets/BXWDRGm-.js.gz +0 -0
  8. package/dashboard/dist/assets/BgOYB78t.js +4 -0
  9. package/dashboard/dist/assets/BgOYB78t.js.br +0 -0
  10. package/dashboard/dist/assets/BgOYB78t.js.gz +0 -0
  11. package/dashboard/dist/assets/C-KIc3Wc.js.br +0 -0
  12. package/dashboard/dist/assets/C-KIc3Wc.js.gz +0 -0
  13. package/dashboard/dist/assets/CE38zU4U.js +1 -0
  14. package/dashboard/dist/assets/CE38zU4U.js.br +0 -0
  15. package/dashboard/dist/assets/CE38zU4U.js.gz +0 -0
  16. package/dashboard/dist/assets/CFGKRAzG.js +1 -0
  17. package/dashboard/dist/assets/CFGKRAzG.js.br +0 -0
  18. package/dashboard/dist/assets/CFGKRAzG.js.gz +0 -0
  19. package/dashboard/dist/assets/CGGR2GZh.js +1 -0
  20. package/dashboard/dist/assets/CGGR2GZh.js.br +0 -0
  21. package/dashboard/dist/assets/CGGR2GZh.js.gz +0 -0
  22. package/dashboard/dist/assets/CL_wXqR7.js +1 -0
  23. package/dashboard/dist/assets/CL_wXqR7.js.br +0 -0
  24. package/dashboard/dist/assets/CL_wXqR7.js.gz +0 -0
  25. package/dashboard/dist/assets/CPFiTmlw.js +8 -0
  26. package/dashboard/dist/assets/CPFiTmlw.js.br +0 -0
  27. package/dashboard/dist/assets/CPFiTmlw.js.gz +0 -0
  28. package/dashboard/dist/assets/CZZTvkQZ.js +1 -0
  29. package/dashboard/dist/assets/CZZTvkQZ.js.br +0 -0
  30. package/dashboard/dist/assets/CZZTvkQZ.js.gz +0 -0
  31. package/dashboard/dist/assets/{CpJsfbXo.js → CxQ08qFN.js} +2 -2
  32. package/dashboard/dist/assets/CxQ08qFN.js.br +0 -0
  33. package/dashboard/dist/assets/CxQ08qFN.js.gz +0 -0
  34. package/dashboard/dist/assets/D-bf6hEI.js +213 -0
  35. package/dashboard/dist/assets/D-bf6hEI.js.br +0 -0
  36. package/dashboard/dist/assets/D-bf6hEI.js.gz +0 -0
  37. package/dashboard/dist/assets/DG6y9wJI.js +2 -0
  38. package/dashboard/dist/assets/DG6y9wJI.js.br +0 -0
  39. package/dashboard/dist/assets/DG6y9wJI.js.gz +0 -0
  40. package/dashboard/dist/assets/DNxKz-GV.js +1 -0
  41. package/dashboard/dist/assets/DNxKz-GV.js.br +0 -0
  42. package/dashboard/dist/assets/DNxKz-GV.js.gz +0 -0
  43. package/dashboard/dist/assets/DW_rKUic.js +11 -0
  44. package/dashboard/dist/assets/DW_rKUic.js.br +0 -0
  45. package/dashboard/dist/assets/DW_rKUic.js.gz +0 -0
  46. package/dashboard/dist/assets/DbNoijHm.js +1 -0
  47. package/dashboard/dist/assets/DbNoijHm.js.br +0 -0
  48. package/dashboard/dist/assets/DbNoijHm.js.gz +0 -0
  49. package/dashboard/dist/assets/DjcdE6jC.js +2 -0
  50. package/dashboard/dist/assets/DjcdE6jC.js.br +0 -0
  51. package/dashboard/dist/assets/DjcdE6jC.js.gz +0 -0
  52. package/dashboard/dist/assets/FZYuCDnt.js +1 -0
  53. package/dashboard/dist/assets/FZYuCDnt.js.br +0 -0
  54. package/dashboard/dist/assets/FZYuCDnt.js.gz +0 -0
  55. package/dashboard/dist/assets/PAUiij_z.js +1 -0
  56. package/dashboard/dist/assets/PAUiij_z.js.br +0 -0
  57. package/dashboard/dist/assets/PAUiij_z.js.gz +0 -0
  58. package/dashboard/dist/assets/cNrhgGc1.js +8 -0
  59. package/dashboard/dist/assets/cNrhgGc1.js.br +0 -0
  60. package/dashboard/dist/assets/cNrhgGc1.js.gz +0 -0
  61. package/dashboard/dist/assets/h5biQs2I.css +1 -0
  62. package/dashboard/dist/assets/h5biQs2I.css.br +0 -0
  63. package/dashboard/dist/assets/h5biQs2I.css.gz +0 -0
  64. package/dashboard/dist/assets/ic2FaMnh.js +1 -0
  65. package/dashboard/dist/assets/ic2FaMnh.js.br +0 -0
  66. package/dashboard/dist/assets/ic2FaMnh.js.gz +0 -0
  67. package/dashboard/dist/assets/nByHNHoW.js +1 -0
  68. package/dashboard/dist/assets/nByHNHoW.js.br +0 -0
  69. package/dashboard/dist/assets/nByHNHoW.js.gz +0 -0
  70. package/dashboard/dist/assets/qm8xLgv-.css +1 -0
  71. package/dashboard/dist/assets/qm8xLgv-.css.br +0 -0
  72. package/dashboard/dist/assets/qm8xLgv-.css.gz +0 -0
  73. package/dashboard/dist/assets/tS9mbYZi.js +1 -0
  74. package/dashboard/dist/assets/tS9mbYZi.js.br +0 -0
  75. package/dashboard/dist/assets/tS9mbYZi.js.gz +0 -0
  76. package/dashboard/dist/brand/anthropic-mark.svg.br +0 -0
  77. package/dashboard/dist/brand/anthropic-mark.svg.gz +0 -0
  78. package/dashboard/dist/brand/openai-mark.svg.br +0 -0
  79. package/dashboard/dist/brand/openai-mark.svg.gz +0 -0
  80. package/dashboard/dist/brand/openclaw-mark.svg.br +0 -0
  81. package/dashboard/dist/brand/openclaw-mark.svg.gz +0 -0
  82. package/dashboard/dist/brand/xandy-orchestrator.png +0 -0
  83. package/dashboard/dist/index.html +7 -5
  84. package/dashboard/dist/index.html.br +0 -0
  85. package/dashboard/dist/index.html.gz +0 -0
  86. package/dist/activity-actor-fields.js +26 -4
  87. package/dist/activity-store.js +38 -26
  88. package/dist/agent-context-store.js +84 -42
  89. package/dist/agent-run-store.js +49 -28
  90. package/dist/agent-suite.d.ts +9 -0
  91. package/dist/agent-suite.js +150 -17
  92. package/dist/artifacts/artifact-domain-schemas.d.ts +66 -0
  93. package/dist/artifacts/artifact-domain-schemas.js +357 -0
  94. package/dist/artifacts/register-artifact.d.ts +4 -3
  95. package/dist/artifacts/register-artifact.js +170 -57
  96. package/dist/auth/flows.d.ts +47 -0
  97. package/dist/auth/flows.js +169 -0
  98. package/dist/auth-store.js +6 -26
  99. package/dist/byok-store.js +5 -19
  100. package/dist/chat-store.d.ts +157 -0
  101. package/dist/chat-store.js +586 -0
  102. package/dist/cli/orgx.d.ts +66 -0
  103. package/dist/cli/orgx.js +102 -0
  104. package/dist/config/refresh.d.ts +32 -0
  105. package/dist/config/refresh.js +55 -0
  106. package/dist/config/resolution.d.ts +37 -0
  107. package/dist/config/resolution.js +178 -0
  108. package/dist/contracts/client.d.ts +43 -3
  109. package/dist/contracts/client.js +159 -30
  110. package/dist/contracts/retro-schema.d.ts +81 -0
  111. package/dist/contracts/retro-schema.js +80 -0
  112. package/dist/contracts/shared-types.d.ts +306 -0
  113. package/dist/contracts/shared-types.js +179 -0
  114. package/dist/contracts/skill-pack-schema.d.ts +192 -0
  115. package/dist/contracts/skill-pack-schema.js +180 -0
  116. package/dist/contracts/types.d.ts +224 -132
  117. package/dist/contracts/types.js +5 -0
  118. package/dist/entities/auto-assignment.d.ts +36 -0
  119. package/dist/entities/auto-assignment.js +141 -0
  120. package/dist/entity-comment-store.js +5 -25
  121. package/dist/event-sanitization.d.ts +11 -0
  122. package/dist/event-sanitization.js +113 -0
  123. package/dist/fs-utils.js +13 -1
  124. package/dist/gateway-watchdog.d.ts +5 -0
  125. package/dist/gateway-watchdog.js +50 -0
  126. package/dist/hash-utils.d.ts +2 -0
  127. package/dist/hash-utils.js +12 -0
  128. package/dist/hooks/post-reporting-event.mjs +1 -5
  129. package/dist/http/helpers/activity-headline.d.ts +10 -0
  130. package/dist/http/helpers/activity-headline.js +73 -0
  131. package/dist/http/helpers/artifact-fallback.d.ts +13 -0
  132. package/dist/http/helpers/artifact-fallback.js +148 -0
  133. package/dist/http/helpers/auto-continue-engine.d.ts +486 -0
  134. package/dist/http/helpers/auto-continue-engine.js +3563 -0
  135. package/dist/http/helpers/autopilot-operations.d.ts +176 -0
  136. package/dist/http/helpers/autopilot-operations.js +554 -0
  137. package/dist/http/helpers/autopilot-runtime.d.ts +43 -0
  138. package/dist/http/helpers/autopilot-runtime.js +607 -0
  139. package/dist/http/helpers/autopilot-slice-utils.d.ts +56 -0
  140. package/dist/http/helpers/autopilot-slice-utils.js +899 -0
  141. package/dist/http/helpers/decision-mapper.d.ts +52 -0
  142. package/dist/http/helpers/decision-mapper.js +260 -0
  143. package/dist/http/helpers/dispatch-lifecycle.d.ts +119 -0
  144. package/dist/http/helpers/dispatch-lifecycle.js +809 -0
  145. package/dist/http/helpers/hash-utils.d.ts +1 -0
  146. package/dist/http/helpers/hash-utils.js +1 -0
  147. package/dist/http/helpers/kickoff-context.d.ts +12 -0
  148. package/dist/http/helpers/kickoff-context.js +228 -0
  149. package/dist/http/helpers/llm-client.d.ts +47 -0
  150. package/dist/http/helpers/llm-client.js +256 -0
  151. package/dist/http/helpers/mission-control.d.ts +193 -0
  152. package/dist/http/helpers/mission-control.js +1383 -0
  153. package/dist/http/helpers/openclaw-cli.d.ts +37 -0
  154. package/dist/http/helpers/openclaw-cli.js +283 -0
  155. package/dist/http/helpers/runtime-sse.d.ts +20 -0
  156. package/dist/http/helpers/runtime-sse.js +110 -0
  157. package/dist/http/helpers/sentinel-catalog.d.ts +23 -0
  158. package/dist/http/helpers/sentinel-catalog.js +193 -0
  159. package/dist/http/helpers/session-classification.d.ts +9 -0
  160. package/dist/http/helpers/session-classification.js +564 -0
  161. package/dist/http/helpers/slice-experience-v2.d.ts +137 -0
  162. package/dist/http/helpers/slice-experience-v2.js +677 -0
  163. package/dist/http/helpers/slice-run-projections.d.ts +72 -0
  164. package/dist/http/helpers/slice-run-projections.js +860 -0
  165. package/dist/http/helpers/triage-mapper.d.ts +43 -0
  166. package/dist/http/helpers/triage-mapper.js +549 -0
  167. package/dist/http/helpers/value-utils.d.ts +6 -0
  168. package/dist/http/helpers/value-utils.js +72 -0
  169. package/dist/http/helpers/workspace-scope.d.ts +15 -0
  170. package/dist/http/helpers/workspace-scope.js +170 -0
  171. package/dist/http/index.d.ts +88 -0
  172. package/dist/http/index.js +3610 -0
  173. package/dist/http/router.d.ts +23 -0
  174. package/dist/http/router.js +23 -0
  175. package/dist/http/routes/agent-control.d.ts +79 -0
  176. package/dist/http/routes/agent-control.js +684 -0
  177. package/dist/http/routes/agent-suite.d.ts +38 -0
  178. package/dist/http/routes/agent-suite.js +397 -0
  179. package/dist/http/routes/agents-catalog.d.ts +40 -0
  180. package/dist/http/routes/agents-catalog.js +128 -0
  181. package/dist/http/routes/billing.d.ts +23 -0
  182. package/dist/http/routes/billing.js +55 -0
  183. package/dist/http/routes/chat.d.ts +19 -0
  184. package/dist/http/routes/chat.js +522 -0
  185. package/dist/http/routes/debug.d.ts +14 -0
  186. package/dist/http/routes/debug.js +21 -0
  187. package/dist/http/routes/decision-actions.d.ts +20 -0
  188. package/dist/http/routes/decision-actions.js +103 -0
  189. package/dist/http/routes/delegation.d.ts +19 -0
  190. package/dist/http/routes/delegation.js +32 -0
  191. package/dist/http/routes/dispatch-gateway-envelope.d.ts +25 -0
  192. package/dist/http/routes/dispatch-gateway-envelope.js +26 -0
  193. package/dist/http/routes/entities.d.ts +63 -0
  194. package/dist/http/routes/entities.js +440 -0
  195. package/dist/http/routes/entity-dynamic.d.ts +25 -0
  196. package/dist/http/routes/entity-dynamic.js +191 -0
  197. package/dist/http/routes/health.d.ts +22 -0
  198. package/dist/http/routes/health.js +49 -0
  199. package/dist/http/routes/live-legacy.d.ts +115 -0
  200. package/dist/http/routes/live-legacy.js +112 -0
  201. package/dist/http/routes/live-misc.d.ts +81 -0
  202. package/dist/http/routes/live-misc.js +426 -0
  203. package/dist/http/routes/live-snapshot.d.ts +136 -0
  204. package/dist/http/routes/live-snapshot.js +916 -0
  205. package/dist/http/routes/live-terminal.d.ts +11 -0
  206. package/dist/http/routes/live-terminal.js +261 -0
  207. package/dist/http/routes/live-triage.d.ts +61 -0
  208. package/dist/http/routes/live-triage.js +248 -0
  209. package/dist/http/routes/mission-control-actions.d.ts +131 -0
  210. package/dist/http/routes/mission-control-actions.js +1791 -0
  211. package/dist/http/routes/mission-control-read.d.ts +73 -0
  212. package/dist/http/routes/mission-control-read.js +1640 -0
  213. package/dist/http/routes/onboarding.d.ts +34 -0
  214. package/dist/http/routes/onboarding.js +101 -0
  215. package/dist/http/routes/realtime-orchestrator.d.ts +10 -0
  216. package/dist/http/routes/realtime-orchestrator.js +74 -0
  217. package/dist/http/routes/run-control.d.ts +27 -0
  218. package/dist/http/routes/run-control.js +96 -0
  219. package/dist/http/routes/runtime-hooks.d.ts +69 -0
  220. package/dist/http/routes/runtime-hooks.js +437 -0
  221. package/dist/http/routes/sentinels-catalog.d.ts +7 -0
  222. package/dist/http/routes/sentinels-catalog.js +24 -0
  223. package/dist/http/routes/settings-byok.d.ts +23 -0
  224. package/dist/http/routes/settings-byok.js +163 -0
  225. package/dist/http/routes/summary.d.ts +18 -0
  226. package/dist/http/routes/summary.js +49 -0
  227. package/dist/http/routes/usage.d.ts +24 -0
  228. package/dist/http/routes/usage.js +362 -0
  229. package/dist/http/routes/work-artifacts.d.ts +9 -0
  230. package/dist/http/routes/work-artifacts.js +55 -0
  231. package/dist/http/shared-state.d.ts +16 -0
  232. package/dist/http/shared-state.js +1 -0
  233. package/dist/http-handler.d.ts +1 -88
  234. package/dist/http-handler.js +1 -10605
  235. package/dist/index.js +287 -2284
  236. package/dist/json-utils.d.ts +1 -0
  237. package/dist/json-utils.js +8 -0
  238. package/dist/local-openclaw.js +29 -6
  239. package/dist/mcp-client-setup.js +3 -3
  240. package/dist/mcp-http-handler.js +33 -59
  241. package/dist/next-up-queue-store.d.ts +16 -1
  242. package/dist/next-up-queue-store.js +93 -25
  243. package/dist/outbox.d.ts +5 -0
  244. package/dist/outbox.js +113 -9
  245. package/dist/paths.js +24 -5
  246. package/dist/reporting/rollups.d.ts +53 -0
  247. package/dist/reporting/rollups.js +148 -0
  248. package/dist/retro/domain-templates.d.ts +45 -0
  249. package/dist/retro/domain-templates.js +297 -0
  250. package/dist/retro/quality-rubric.d.ts +33 -0
  251. package/dist/retro/quality-rubric.js +213 -0
  252. package/dist/runtime-cleanup.d.ts +18 -0
  253. package/dist/runtime-cleanup.js +87 -0
  254. package/dist/runtime-instance-store.js +5 -31
  255. package/dist/services/background.d.ts +34 -0
  256. package/dist/services/background.js +45 -0
  257. package/dist/services/experiment-randomization.d.ts +21 -0
  258. package/dist/services/experiment-randomization.js +63 -0
  259. package/dist/services/instrumentation.d.ts +29 -0
  260. package/dist/services/instrumentation.js +136 -0
  261. package/dist/skill-pack-state.d.ts +36 -5
  262. package/dist/skill-pack-state.js +273 -29
  263. package/dist/snapshot-store.js +5 -25
  264. package/dist/stores/json-store.d.ts +11 -0
  265. package/dist/stores/json-store.js +42 -0
  266. package/dist/sync/local-agent-telemetry.d.ts +13 -0
  267. package/dist/sync/local-agent-telemetry.js +128 -0
  268. package/dist/sync/outbox-replay.d.ts +55 -0
  269. package/dist/sync/outbox-replay.js +621 -0
  270. package/dist/team-context-store.d.ts +23 -0
  271. package/dist/team-context-store.js +116 -0
  272. package/dist/telemetry/posthog.js +4 -2
  273. package/dist/tools/core-tools.d.ts +72 -0
  274. package/dist/tools/core-tools.js +2270 -0
  275. package/dist/types.d.ts +2 -0
  276. package/dist/types.js +2 -0
  277. package/dist/worker-supervisor.js +23 -0
  278. package/package.json +14 -4
  279. package/dashboard/dist/assets/B3ziCA02.js +0 -8
  280. package/dashboard/dist/assets/BNeJ0kpF.js +0 -1
  281. package/dashboard/dist/assets/BzkiMPmM.js +0 -215
  282. package/dashboard/dist/assets/CUV9IHHi.js +0 -1
  283. package/dashboard/dist/assets/Ie7d9Iq2.css +0 -1
  284. package/dashboard/dist/assets/sAhvFnpk.js +0 -4
@@ -0,0 +1,357 @@
1
+ /**
2
+ * Domain artifact metadata schemas for the OrgX Proof Ladder.
3
+ *
4
+ * Each domain has one or more canonical "atomic unit types" with required
5
+ * metadata fields. Validation is warn-only in phase 1 — artifacts that fail
6
+ * schema checks are still registered but tagged with `schema_validated: false`.
7
+ */
8
+ // ---------------------------------------------------------------------------
9
+ // Canonical atomic unit types per domain
10
+ // ---------------------------------------------------------------------------
11
+ export const ATOMIC_UNIT_TYPES = [
12
+ // Engineering
13
+ "engineering.commit",
14
+ "engineering.pr",
15
+ // Product
16
+ "product.spec",
17
+ "product.decision",
18
+ // Design
19
+ "design.component",
20
+ "design.a11y",
21
+ // Marketing
22
+ "marketing.asset",
23
+ "marketing.experiment",
24
+ // Sales
25
+ "sales.qualification",
26
+ "sales.proposal",
27
+ // Operations
28
+ "operations.runbook",
29
+ "operations.incident",
30
+ // Orchestration
31
+ "orchestration.routing",
32
+ "orchestration.decomp",
33
+ ];
34
+ const ENGINEERING_COMMIT_FIELDS = {
35
+ commit_sha: { label: "Commit SHA", required: true },
36
+ branch: { label: "Branch name", required: true },
37
+ diff_summary: { label: "Diff summary", required: false },
38
+ "verification.tests_passed": { label: "Tests passed", required: false },
39
+ "verification.lint_passed": { label: "Lint passed", required: false },
40
+ "verification.build_passed": { label: "Build passed", required: false },
41
+ };
42
+ const ENGINEERING_PR_FIELDS = {
43
+ pr_url: { label: "PR URL", required: true },
44
+ branch: { label: "Branch name", required: true },
45
+ commit_count: { label: "Commit count", required: false },
46
+ ci_status: { label: "CI status", required: false },
47
+ };
48
+ const PRODUCT_SPEC_FIELDS = {
49
+ acceptance_criteria: { label: "Acceptance criteria", required: true },
50
+ constraints: { label: "Constraints", required: false },
51
+ success_metric: { label: "Success metric", required: true },
52
+ };
53
+ const PRODUCT_DECISION_FIELDS = {
54
+ decision_context: { label: "Decision context", required: true },
55
+ options: { label: "Options considered", required: false },
56
+ recommendation: { label: "Recommendation", required: true },
57
+ };
58
+ const DESIGN_COMPONENT_FIELDS = {
59
+ evidence_url: { label: "Evidence URL", required: true },
60
+ tokens_referenced: { label: "Tokens referenced", required: false },
61
+ viewport_evidence: { label: "Viewport evidence", required: false },
62
+ };
63
+ const DESIGN_A11Y_FIELDS = {
64
+ audit_results: { label: "Audit results", required: true },
65
+ wcag_level: { label: "WCAG level", required: false },
66
+ remediation_notes: { label: "Remediation notes", required: false },
67
+ };
68
+ const MARKETING_ASSET_FIELDS = {
69
+ audience: { label: "Target audience", required: true },
70
+ channel: { label: "Channel", required: true },
71
+ promise: { label: "Promise/value prop", required: false },
72
+ cta: { label: "Call to action", required: false },
73
+ measurement_hook: { label: "Measurement hook", required: true },
74
+ };
75
+ const MARKETING_EXPERIMENT_FIELDS = {
76
+ variant_id: { label: "Variant ID", required: true },
77
+ hypothesis: { label: "Hypothesis", required: true },
78
+ metric_target: { label: "Metric target", required: false },
79
+ };
80
+ const SALES_QUALIFICATION_FIELDS = {
81
+ buyer_stage: { label: "Buyer stage", required: true },
82
+ meddic_fields: { label: "MEDDIC fields", required: false },
83
+ next_action: { label: "Next action", required: true },
84
+ };
85
+ const SALES_PROPOSAL_FIELDS = {
86
+ recipient: { label: "Recipient", required: true },
87
+ value_prop: { label: "Value proposition", required: false },
88
+ pricing_summary: { label: "Pricing summary", required: false },
89
+ };
90
+ const OPERATIONS_RUNBOOK_FIELDS = {
91
+ change_description: { label: "Change description", required: true },
92
+ rollback_path: { label: "Rollback path", required: true },
93
+ affected_systems: { label: "Affected systems", required: true },
94
+ };
95
+ const OPERATIONS_INCIDENT_FIELDS = {
96
+ incident_id: { label: "Incident ID", required: true },
97
+ severity: { label: "Severity", required: true },
98
+ resolution_steps: { label: "Resolution steps", required: false },
99
+ detection_method: { label: "Detection method", required: false },
100
+ };
101
+ const ORCHESTRATION_ROUTING_FIELDS = {
102
+ action_type: { label: "Action type", required: true },
103
+ target_entity_ids: { label: "Target entity IDs", required: true },
104
+ rationale: { label: "Rationale", required: true },
105
+ unblocked_work: { label: "Unblocked work", required: false },
106
+ };
107
+ const ORCHESTRATION_DECOMP_FIELDS = {
108
+ parent_entity_id: { label: "Parent entity ID", required: true },
109
+ child_tasks: { label: "Child tasks", required: true },
110
+ sequencing: { label: "Sequencing info", required: false },
111
+ };
112
+ export const DOMAIN_ARTIFACT_SCHEMAS = {
113
+ "engineering.commit": {
114
+ atomicUnitType: "engineering.commit",
115
+ domain: "engineering",
116
+ receiptName: "commit_or_pr_receipt",
117
+ fields: ENGINEERING_COMMIT_FIELDS,
118
+ },
119
+ "engineering.pr": {
120
+ atomicUnitType: "engineering.pr",
121
+ domain: "engineering",
122
+ receiptName: "commit_or_pr_receipt",
123
+ fields: ENGINEERING_PR_FIELDS,
124
+ },
125
+ "product.spec": {
126
+ atomicUnitType: "product.spec",
127
+ domain: "product",
128
+ receiptName: "decision_spec_receipt",
129
+ fields: PRODUCT_SPEC_FIELDS,
130
+ },
131
+ "product.decision": {
132
+ atomicUnitType: "product.decision",
133
+ domain: "product",
134
+ receiptName: "decision_spec_receipt",
135
+ fields: PRODUCT_DECISION_FIELDS,
136
+ },
137
+ "design.component": {
138
+ atomicUnitType: "design.component",
139
+ domain: "design",
140
+ receiptName: "design_spec_or_a11y_receipt",
141
+ fields: DESIGN_COMPONENT_FIELDS,
142
+ },
143
+ "design.a11y": {
144
+ atomicUnitType: "design.a11y",
145
+ domain: "design",
146
+ receiptName: "design_spec_or_a11y_receipt",
147
+ fields: DESIGN_A11Y_FIELDS,
148
+ },
149
+ "marketing.asset": {
150
+ atomicUnitType: "marketing.asset",
151
+ domain: "marketing",
152
+ receiptName: "experiment_asset_receipt",
153
+ fields: MARKETING_ASSET_FIELDS,
154
+ },
155
+ "marketing.experiment": {
156
+ atomicUnitType: "marketing.experiment",
157
+ domain: "marketing",
158
+ receiptName: "experiment_asset_receipt",
159
+ fields: MARKETING_EXPERIMENT_FIELDS,
160
+ },
161
+ "sales.qualification": {
162
+ atomicUnitType: "sales.qualification",
163
+ domain: "sales",
164
+ receiptName: "stage_advance_artifact_receipt",
165
+ fields: SALES_QUALIFICATION_FIELDS,
166
+ },
167
+ "sales.proposal": {
168
+ atomicUnitType: "sales.proposal",
169
+ domain: "sales",
170
+ receiptName: "stage_advance_artifact_receipt",
171
+ fields: SALES_PROPOSAL_FIELDS,
172
+ },
173
+ "operations.runbook": {
174
+ atomicUnitType: "operations.runbook",
175
+ domain: "operations",
176
+ receiptName: "runbook_or_incident_receipt",
177
+ fields: OPERATIONS_RUNBOOK_FIELDS,
178
+ },
179
+ "operations.incident": {
180
+ atomicUnitType: "operations.incident",
181
+ domain: "operations",
182
+ receiptName: "runbook_or_incident_receipt",
183
+ fields: OPERATIONS_INCIDENT_FIELDS,
184
+ },
185
+ "orchestration.routing": {
186
+ atomicUnitType: "orchestration.routing",
187
+ domain: "orchestration",
188
+ receiptName: "delegation_closure_receipt",
189
+ fields: ORCHESTRATION_ROUTING_FIELDS,
190
+ },
191
+ "orchestration.decomp": {
192
+ atomicUnitType: "orchestration.decomp",
193
+ domain: "orchestration",
194
+ receiptName: "delegation_closure_receipt",
195
+ fields: ORCHESTRATION_DECOMP_FIELDS,
196
+ },
197
+ };
198
+ // ---------------------------------------------------------------------------
199
+ // Domain → atomic unit type mapping
200
+ // ---------------------------------------------------------------------------
201
+ export const DOMAIN_DEFAULT_ATOMIC_TYPES = {
202
+ engineering: ["engineering.commit", "engineering.pr"],
203
+ product: ["product.spec", "product.decision"],
204
+ design: ["design.component", "design.a11y"],
205
+ marketing: ["marketing.asset", "marketing.experiment"],
206
+ sales: ["sales.qualification", "sales.proposal"],
207
+ operations: ["operations.runbook", "operations.incident"],
208
+ orchestration: ["orchestration.routing", "orchestration.decomp"],
209
+ };
210
+ // ---------------------------------------------------------------------------
211
+ // Quality thresholds per domain
212
+ // ---------------------------------------------------------------------------
213
+ export const DOMAIN_QUALITY_THRESHOLDS = {
214
+ engineering: 4,
215
+ product: 4,
216
+ design: 4,
217
+ operations: 4,
218
+ marketing: 3,
219
+ sales: 3,
220
+ orchestration: 3,
221
+ };
222
+ /**
223
+ * Resolve a nested dotted path (e.g. "verification.tests_passed") from
224
+ * a flat or nested metadata object.
225
+ */
226
+ function resolveField(metadata, path) {
227
+ // Try flat key first (some callers store "verification.tests_passed" as-is)
228
+ if (path in metadata)
229
+ return metadata[path];
230
+ // Try nested
231
+ const parts = path.split(".");
232
+ let current = metadata;
233
+ for (const part of parts) {
234
+ if (current == null || typeof current !== "object")
235
+ return undefined;
236
+ current = current[part];
237
+ }
238
+ return current;
239
+ }
240
+ function isPresent(value) {
241
+ if (value == null)
242
+ return false;
243
+ if (typeof value === "string")
244
+ return value.trim().length > 0;
245
+ if (Array.isArray(value))
246
+ return value.length > 0;
247
+ return true;
248
+ }
249
+ /**
250
+ * Validate artifact metadata against its domain schema.
251
+ *
252
+ * Returns validation result with missing fields listed. In phase 1 this is
253
+ * advisory (warn-only); callers should not block artifact registration.
254
+ */
255
+ export function validateArtifactMetadata(atomicUnitType, metadata) {
256
+ const schema = DOMAIN_ARTIFACT_SCHEMAS[atomicUnitType];
257
+ if (!schema) {
258
+ return {
259
+ valid: true, // unknown types pass through for backward compat
260
+ atomicUnitType,
261
+ missingRequired: [],
262
+ missingOptional: [],
263
+ warnings: [`Unknown atomic_unit_type "${atomicUnitType}"; skipping schema validation.`],
264
+ };
265
+ }
266
+ const missingRequired = [];
267
+ const missingOptional = [];
268
+ const warnings = [];
269
+ for (const [fieldPath, spec] of Object.entries(schema.fields)) {
270
+ const value = resolveField(metadata, fieldPath);
271
+ if (!isPresent(value)) {
272
+ if (spec.required) {
273
+ missingRequired.push(fieldPath);
274
+ }
275
+ else {
276
+ missingOptional.push(fieldPath);
277
+ }
278
+ }
279
+ }
280
+ if (missingRequired.length > 0) {
281
+ warnings.push(`Missing required field(s) for ${atomicUnitType}: ${missingRequired.join(", ")}`);
282
+ }
283
+ return {
284
+ valid: missingRequired.length === 0,
285
+ atomicUnitType,
286
+ missingRequired,
287
+ missingOptional,
288
+ warnings,
289
+ };
290
+ }
291
+ /**
292
+ * Infer the canonical atomic unit type from a freeform artifact_type string.
293
+ *
294
+ * Maps existing artifact_type conventions (e.g. "eng.diff_pack",
295
+ * "shared.project_handbook") into one of the 14 canonical types.
296
+ * Returns null if no mapping is found — the artifact still registers
297
+ * but won't be schema-validated.
298
+ */
299
+ export function normalizeArtifactType(artifactType) {
300
+ const normalized = artifactType.trim().toLowerCase();
301
+ // Direct canonical match
302
+ if (ATOMIC_UNIT_TYPES.includes(normalized)) {
303
+ return normalized;
304
+ }
305
+ // Engineering aliases
306
+ if (normalized.startsWith("eng.") ||
307
+ normalized.includes("diff_pack") ||
308
+ normalized.includes("commit")) {
309
+ return "engineering.commit";
310
+ }
311
+ if (normalized.includes("pull_request") || normalized.includes("pr")) {
312
+ return "engineering.pr";
313
+ }
314
+ // Product aliases
315
+ if (normalized.includes("spec") || normalized.includes("prd")) {
316
+ return "product.spec";
317
+ }
318
+ if (normalized.includes("decision")) {
319
+ return "product.decision";
320
+ }
321
+ // Design aliases
322
+ if (normalized.includes("component") || normalized.includes("design_spec")) {
323
+ return "design.component";
324
+ }
325
+ if (normalized.includes("a11y") || normalized.includes("accessibility")) {
326
+ return "design.a11y";
327
+ }
328
+ // Marketing aliases
329
+ if (normalized.includes("campaign") || normalized.includes("channel_asset")) {
330
+ return "marketing.asset";
331
+ }
332
+ if (normalized.includes("experiment") || normalized.includes("variant")) {
333
+ return "marketing.experiment";
334
+ }
335
+ // Sales aliases
336
+ if (normalized.includes("qualification") || normalized.includes("meddic")) {
337
+ return "sales.qualification";
338
+ }
339
+ if (normalized.includes("proposal")) {
340
+ return "sales.proposal";
341
+ }
342
+ // Operations aliases
343
+ if (normalized.includes("runbook") || normalized.includes("process_change")) {
344
+ return "operations.runbook";
345
+ }
346
+ if (normalized.includes("incident")) {
347
+ return "operations.incident";
348
+ }
349
+ // Orchestration aliases
350
+ if (normalized.includes("routing") || normalized.includes("delegation")) {
351
+ return "orchestration.routing";
352
+ }
353
+ if (normalized.includes("decomp") || normalized.includes("breakdown")) {
354
+ return "orchestration.decomp";
355
+ }
356
+ return null;
357
+ }
@@ -1,5 +1,5 @@
1
1
  import type { OrgXClient } from "../contracts/client.js";
2
- export type ArtifactEntityType = "initiative" | "milestone" | "task" | "decision" | "project";
2
+ export type ArtifactEntityType = "initiative" | "workstream" | "milestone" | "task" | "decision" | "project";
3
3
  export interface RegisterArtifactInput {
4
4
  /** Optional deterministic artifact id (UUID). Enables idempotent retries/outbox replay. */
5
5
  artifact_id?: string | null;
@@ -7,6 +7,7 @@ export interface RegisterArtifactInput {
7
7
  entity_id: string;
8
8
  name: string;
9
9
  artifact_type: string;
10
+ confidence_score?: number | null;
10
11
  /**
11
12
  * Required by OrgX work_artifacts schema.
12
13
  * If omitted, defaults to "human" (safe default for user-scoped oxk_ keys).
@@ -24,8 +25,8 @@ export interface RegisterArtifactInput {
24
25
  metadata?: Record<string, unknown> | null;
25
26
  /**
26
27
  * When true, do a read-after-write check against:
27
- * - GET /api/artifacts/:id
28
- * - GET /api/work-artifacts/by-entity
28
+ * - GET /api/client/artifacts/:id
29
+ * - GET /api/client/artifacts/by-entity
29
30
  */
30
31
  validate_persistence?: boolean;
31
32
  }