@useorgx/openclaw-plugin 0.4.9 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/README.md +77 -11
  2. package/dashboard/dist/assets/6mILZQ2a.js +1 -0
  3. package/dashboard/dist/assets/6mILZQ2a.js.br +0 -0
  4. package/dashboard/dist/assets/6mILZQ2a.js.gz +0 -0
  5. package/dashboard/dist/assets/8dksYiq4.js +2 -0
  6. package/dashboard/dist/assets/8dksYiq4.js.br +0 -0
  7. package/dashboard/dist/assets/8dksYiq4.js.gz +0 -0
  8. package/dashboard/dist/assets/B5zYRHc3.js +1 -0
  9. package/dashboard/dist/assets/B5zYRHc3.js.br +0 -0
  10. package/dashboard/dist/assets/B5zYRHc3.js.gz +0 -0
  11. package/dashboard/dist/assets/B6wPWJ35.js +1 -0
  12. package/dashboard/dist/assets/B6wPWJ35.js.br +0 -0
  13. package/dashboard/dist/assets/B6wPWJ35.js.gz +0 -0
  14. package/dashboard/dist/assets/BJgZIVUQ.js +53 -0
  15. package/dashboard/dist/assets/BJgZIVUQ.js.br +0 -0
  16. package/dashboard/dist/assets/BJgZIVUQ.js.gz +0 -0
  17. package/dashboard/dist/assets/BWEwjt1W.js +1 -0
  18. package/dashboard/dist/assets/BWEwjt1W.js.br +0 -0
  19. package/dashboard/dist/assets/BWEwjt1W.js.gz +0 -0
  20. package/dashboard/dist/assets/BgOYB78t.js +4 -0
  21. package/dashboard/dist/assets/BgOYB78t.js.br +0 -0
  22. package/dashboard/dist/assets/BgOYB78t.js.gz +0 -0
  23. package/dashboard/dist/assets/BzRbDCAD.css +1 -0
  24. package/dashboard/dist/assets/BzRbDCAD.css.br +0 -0
  25. package/dashboard/dist/assets/BzRbDCAD.css.gz +0 -0
  26. package/dashboard/dist/assets/C-KIc3Wc.js.br +0 -0
  27. package/dashboard/dist/assets/C-KIc3Wc.js.gz +0 -0
  28. package/dashboard/dist/assets/C8uM3AX8.js +1 -0
  29. package/dashboard/dist/assets/C8uM3AX8.js.br +0 -0
  30. package/dashboard/dist/assets/C8uM3AX8.js.gz +0 -0
  31. package/dashboard/dist/assets/C9jy61eu.js +212 -0
  32. package/dashboard/dist/assets/C9jy61eu.js.br +0 -0
  33. package/dashboard/dist/assets/C9jy61eu.js.gz +0 -0
  34. package/dashboard/dist/assets/CC63EwFD.js +1 -0
  35. package/dashboard/dist/assets/CC63EwFD.js.br +0 -0
  36. package/dashboard/dist/assets/CC63EwFD.js.gz +0 -0
  37. package/dashboard/dist/assets/CL_wXqR7.js +1 -0
  38. package/dashboard/dist/assets/CL_wXqR7.js.br +0 -0
  39. package/dashboard/dist/assets/CL_wXqR7.js.gz +0 -0
  40. package/dashboard/dist/assets/CZaT3ob_.js +1 -0
  41. package/dashboard/dist/assets/CZaT3ob_.js.br +0 -0
  42. package/dashboard/dist/assets/CZaT3ob_.js.gz +0 -0
  43. package/dashboard/dist/assets/CgaottFX.js +1 -0
  44. package/dashboard/dist/assets/CgaottFX.js.br +0 -0
  45. package/dashboard/dist/assets/CgaottFX.js.gz +0 -0
  46. package/dashboard/dist/assets/{CpJsfbXo.js → CxQ08qFN.js} +2 -2
  47. package/dashboard/dist/assets/CxQ08qFN.js.br +0 -0
  48. package/dashboard/dist/assets/CxQ08qFN.js.gz +0 -0
  49. package/dashboard/dist/assets/CzCxAZlW.js +1 -0
  50. package/dashboard/dist/assets/CzCxAZlW.js.br +0 -0
  51. package/dashboard/dist/assets/CzCxAZlW.js.gz +0 -0
  52. package/dashboard/dist/assets/D3iMTYEj.js +1 -0
  53. package/dashboard/dist/assets/D3iMTYEj.js.br +0 -0
  54. package/dashboard/dist/assets/D3iMTYEj.js.gz +0 -0
  55. package/dashboard/dist/assets/D8JNX8kq.js +2 -0
  56. package/dashboard/dist/assets/D8JNX8kq.js.br +0 -0
  57. package/dashboard/dist/assets/D8JNX8kq.js.gz +0 -0
  58. package/dashboard/dist/assets/DnA8dpj6.js +1 -0
  59. package/dashboard/dist/assets/DnA8dpj6.js.br +0 -0
  60. package/dashboard/dist/assets/DnA8dpj6.js.gz +0 -0
  61. package/dashboard/dist/assets/IUexzymk.js +1 -0
  62. package/dashboard/dist/assets/IUexzymk.js.br +0 -0
  63. package/dashboard/dist/assets/IUexzymk.js.gz +0 -0
  64. package/dashboard/dist/assets/cNrhgGc1.js +8 -0
  65. package/dashboard/dist/assets/cNrhgGc1.js.br +0 -0
  66. package/dashboard/dist/assets/cNrhgGc1.js.gz +0 -0
  67. package/dashboard/dist/assets/ic2FaMnh.js +1 -0
  68. package/dashboard/dist/assets/ic2FaMnh.js.br +0 -0
  69. package/dashboard/dist/assets/ic2FaMnh.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/rttbDbEx.js +1 -0
  74. package/dashboard/dist/assets/rttbDbEx.js.br +0 -0
  75. package/dashboard/dist/assets/rttbDbEx.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 +34 -8
  88. package/dist/agent-context-store.js +79 -17
  89. package/dist/agent-run-store.js +44 -3
  90. package/dist/agent-suite.d.ts +9 -0
  91. package/dist/agent-suite.js +149 -9
  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/chat-store.d.ts +157 -0
  97. package/dist/chat-store.js +586 -0
  98. package/dist/cli/orgx.js +11 -0
  99. package/dist/contracts/client.d.ts +43 -3
  100. package/dist/contracts/client.js +159 -30
  101. package/dist/contracts/practice-exercise-schema.d.ts +216 -0
  102. package/dist/contracts/practice-exercise-schema.js +314 -0
  103. package/dist/contracts/retro-schema.d.ts +81 -0
  104. package/dist/contracts/retro-schema.js +80 -0
  105. package/dist/contracts/shared-types.d.ts +159 -0
  106. package/dist/contracts/shared-types.js +199 -1
  107. package/dist/contracts/skill-pack-schema.d.ts +192 -0
  108. package/dist/contracts/skill-pack-schema.js +180 -0
  109. package/dist/contracts/types.d.ts +247 -2
  110. package/dist/entities/auto-assignment.js +43 -17
  111. package/dist/event-sanitization.d.ts +11 -0
  112. package/dist/event-sanitization.js +113 -0
  113. package/dist/gateway-watchdog.d.ts +5 -0
  114. package/dist/gateway-watchdog.js +50 -0
  115. package/dist/hooks/post-reporting-event.mjs +1 -5
  116. package/dist/http/helpers/activity-headline.js +13 -132
  117. package/dist/http/helpers/auto-continue-engine.d.ts +198 -10
  118. package/dist/http/helpers/auto-continue-engine.js +3145 -186
  119. package/dist/http/helpers/autopilot-operations.d.ts +19 -0
  120. package/dist/http/helpers/autopilot-operations.js +182 -31
  121. package/dist/http/helpers/autopilot-runtime.d.ts +1 -0
  122. package/dist/http/helpers/autopilot-runtime.js +328 -25
  123. package/dist/http/helpers/autopilot-slice-utils.d.ts +18 -0
  124. package/dist/http/helpers/autopilot-slice-utils.js +514 -93
  125. package/dist/http/helpers/decision-mapper.d.ts +40 -0
  126. package/dist/http/helpers/decision-mapper.js +223 -7
  127. package/dist/http/helpers/dispatch-lifecycle.d.ts +19 -2
  128. package/dist/http/helpers/dispatch-lifecycle.js +242 -37
  129. package/dist/http/helpers/kickoff-context.js +104 -0
  130. package/dist/http/helpers/llm-client.d.ts +47 -0
  131. package/dist/http/helpers/llm-client.js +256 -0
  132. package/dist/http/helpers/mission-control.d.ts +102 -3
  133. package/dist/http/helpers/mission-control.js +498 -9
  134. package/dist/http/helpers/sentinel-catalog.d.ts +23 -0
  135. package/dist/http/helpers/sentinel-catalog.js +193 -0
  136. package/dist/http/helpers/session-classification.d.ts +9 -0
  137. package/dist/http/helpers/session-classification.js +564 -0
  138. package/dist/http/helpers/slice-experience-v2.d.ts +137 -0
  139. package/dist/http/helpers/slice-experience-v2.js +677 -0
  140. package/dist/http/helpers/slice-run-projections.d.ts +72 -0
  141. package/dist/http/helpers/slice-run-projections.js +877 -0
  142. package/dist/http/helpers/triage-mapper.d.ts +43 -0
  143. package/dist/http/helpers/triage-mapper.js +549 -0
  144. package/dist/http/helpers/value-utils.js +7 -2
  145. package/dist/http/helpers/workspace-scope.d.ts +15 -0
  146. package/dist/http/helpers/workspace-scope.js +170 -0
  147. package/dist/http/index.js +1420 -105
  148. package/dist/http/routes/agent-suite.d.ts +9 -0
  149. package/dist/http/routes/agent-suite.js +294 -8
  150. package/dist/http/routes/agents-catalog.js +64 -19
  151. package/dist/http/routes/chat.d.ts +19 -0
  152. package/dist/http/routes/chat.js +522 -0
  153. package/dist/http/routes/decision-actions.d.ts +8 -1
  154. package/dist/http/routes/decision-actions.js +42 -5
  155. package/dist/http/routes/dispatch-gateway-envelope.d.ts +25 -0
  156. package/dist/http/routes/dispatch-gateway-envelope.js +26 -0
  157. package/dist/http/routes/entities.d.ts +16 -0
  158. package/dist/http/routes/entities.js +232 -6
  159. package/dist/http/routes/live-legacy.d.ts +5 -0
  160. package/dist/http/routes/live-legacy.js +23 -509
  161. package/dist/http/routes/live-misc.d.ts +12 -0
  162. package/dist/http/routes/live-misc.js +251 -31
  163. package/dist/http/routes/live-snapshot.d.ts +49 -2
  164. package/dist/http/routes/live-snapshot.js +653 -23
  165. package/dist/http/routes/live-terminal.d.ts +11 -0
  166. package/dist/http/routes/live-terminal.js +154 -0
  167. package/dist/http/routes/live-triage.d.ts +61 -0
  168. package/dist/http/routes/live-triage.js +192 -0
  169. package/dist/http/routes/mission-control-actions.d.ts +49 -1
  170. package/dist/http/routes/mission-control-actions.js +1246 -84
  171. package/dist/http/routes/mission-control-read.d.ts +48 -3
  172. package/dist/http/routes/mission-control-read.js +1658 -20
  173. package/dist/http/routes/realtime-orchestrator.d.ts +10 -0
  174. package/dist/http/routes/realtime-orchestrator.js +74 -0
  175. package/dist/http/routes/run-control.d.ts +5 -2
  176. package/dist/http/routes/run-control.js +10 -0
  177. package/dist/http/routes/sentinels-catalog.d.ts +7 -0
  178. package/dist/http/routes/sentinels-catalog.js +24 -0
  179. package/dist/http/routes/summary.js +10 -3
  180. package/dist/http/routes/usage.d.ts +24 -0
  181. package/dist/http/routes/usage.js +362 -0
  182. package/dist/http/routes/work-artifacts.js +28 -9
  183. package/dist/index.js +165 -27
  184. package/dist/local-openclaw.js +29 -6
  185. package/dist/mcp-client-setup.js +3 -3
  186. package/dist/mcp-http-handler.d.ts +3 -0
  187. package/dist/mcp-http-handler.js +34 -60
  188. package/dist/next-up-queue-store.d.ts +16 -1
  189. package/dist/next-up-queue-store.js +89 -7
  190. package/dist/outbox.d.ts +5 -0
  191. package/dist/outbox.js +113 -9
  192. package/dist/paths.js +36 -5
  193. package/dist/reporting/rollups.d.ts +41 -0
  194. package/dist/reporting/rollups.js +113 -0
  195. package/dist/retro/domain-templates.d.ts +45 -0
  196. package/dist/retro/domain-templates.js +297 -0
  197. package/dist/retro/quality-rubric.d.ts +33 -0
  198. package/dist/retro/quality-rubric.js +213 -0
  199. package/dist/runtime-cleanup.d.ts +18 -0
  200. package/dist/runtime-cleanup.js +87 -0
  201. package/dist/services/background.d.ts +11 -0
  202. package/dist/services/background.js +22 -0
  203. package/dist/services/experiment-randomization.d.ts +21 -0
  204. package/dist/services/experiment-randomization.js +63 -0
  205. package/dist/skill-pack-state.d.ts +36 -5
  206. package/dist/skill-pack-state.js +273 -29
  207. package/dist/sync/local-agent-telemetry.d.ts +13 -0
  208. package/dist/sync/local-agent-telemetry.js +128 -0
  209. package/dist/sync/outbox-replay.js +131 -24
  210. package/dist/team-context-store.d.ts +23 -0
  211. package/dist/team-context-store.js +116 -0
  212. package/dist/telemetry/posthog.js +4 -2
  213. package/dist/tools/core-tools.d.ts +10 -14
  214. package/dist/tools/core-tools.js +1289 -24
  215. package/dist/types.d.ts +2 -0
  216. package/dist/types.js +2 -0
  217. package/dist/worker-supervisor.js +23 -0
  218. package/package.json +20 -6
  219. package/dashboard/dist/assets/B3ziCA02.js +0 -8
  220. package/dashboard/dist/assets/B5NEElEI.css +0 -1
  221. package/dashboard/dist/assets/BhapSNAs.js +0 -215
  222. package/dashboard/dist/assets/iFdvE7lx.js +0 -1
  223. package/dashboard/dist/assets/jRJsmpYM.js +0 -1
  224. package/dashboard/dist/assets/sAhvFnpk.js +0 -4
@@ -4,7 +4,9 @@
4
4
  * Types for the plugin's API client and tool interfaces.
5
5
  * Mirrors the server-side types in orgx/lib/client-integration/types.ts
6
6
  */
7
- export type { HandoffEvent, HandoffSummary, LiveActivityItem, LiveActivityType, LiveDecision, OnboardingKeySource, OnboardingNextAction, OnboardingState, OnboardingStatus, RunPhase, RuntimeInstance, RuntimeInstanceState, RuntimeProviderLogo, RuntimeSourceClient, SessionTreeEdge, SessionTreeGroup, SessionTreeNode, SessionTreeResponse, } from './shared-types.js';
7
+ import type { DecisionActionType } from './shared-types.js';
8
+ import type { RetroArtifactSchemaVersion } from './retro-schema.js';
9
+ export type { ActivityEventName, HandoffEvent, HandoffSummary, LiveActivityItem, LiveActivityType, LiveDecision, OnboardingKeySource, OnboardingNextAction, OnboardingState, OnboardingStatus, RunPhase, RuntimeInstance, RuntimeInstanceState, RuntimeProviderLogo, RuntimeSourceClient, SessionBlockerContext, SessionBlockerDiagnostics, SessionTreeEdge, SessionTreeGroup, SessionTreeNode, SessionTreeResponse, } from './shared-types.js';
8
10
  export interface OrgXConfig {
9
11
  /** OrgX API key */
10
12
  apiKey: string;
@@ -81,6 +83,42 @@ export interface KickoffContext {
81
83
  collaboration_style?: string | null;
82
84
  defaults?: string[] | null;
83
85
  } | null;
86
+ runtime_settings?: {
87
+ decision_v2_enabled?: boolean;
88
+ decision_dedupe_enabled?: boolean;
89
+ decision_evidence_required_for_blocking?: boolean;
90
+ decision_auto_resolve_guarded_enabled?: boolean;
91
+ question_auto_answer_enabled?: boolean;
92
+ question_auto_answer_timeout_sec?: number;
93
+ question_auto_answer_policy?: "contextual" | "approve_non_blocking" | "defer_non_blocking";
94
+ question_blocking_behavior?: "require_human" | "guarded_auto_resolve_then_human";
95
+ question_policy_version?: number;
96
+ question_auto_answer_delay_seconds?: number;
97
+ question_auto_answer_action?: "approve" | "reject";
98
+ workspace_question_defaults?: {
99
+ question_auto_answer_enabled?: boolean;
100
+ question_auto_answer_timeout_sec?: number;
101
+ question_auto_answer_policy?: "contextual" | "approve_non_blocking" | "defer_non_blocking";
102
+ question_blocking_behavior?: "require_human" | "guarded_auto_resolve_then_human";
103
+ } | null;
104
+ custom_run_instructions?: string | null;
105
+ } | null;
106
+ /** Recent team activity for cross-agent awareness. */
107
+ team_context?: {
108
+ recent_completions?: Array<{
109
+ domain: string;
110
+ task_title: string;
111
+ summary: string;
112
+ key_outputs?: string[];
113
+ completed_at: string;
114
+ }>;
115
+ recent_decisions?: Array<{
116
+ title: string;
117
+ resolution: string;
118
+ affected_domains?: string[];
119
+ resolved_at: string;
120
+ }>;
121
+ } | null;
84
122
  }
85
123
  export type KickoffContextRequest = KickoffContextScope & {
86
124
  agent_id?: string | null;
@@ -124,6 +162,49 @@ export type OrgxAgentPack = {
124
162
  agents: OrgxAgentProfile[];
125
163
  managed_files: string[];
126
164
  };
165
+ export interface AgentRuntimeSettingsPayload {
166
+ decision_v2_enabled?: boolean;
167
+ decision_dedupe_enabled?: boolean;
168
+ decision_evidence_required_for_blocking?: boolean;
169
+ decision_auto_resolve_guarded_enabled?: boolean;
170
+ question_auto_answer_enabled?: boolean;
171
+ question_auto_answer_timeout_sec?: number;
172
+ question_auto_answer_policy?: "contextual" | "approve_non_blocking" | "defer_non_blocking";
173
+ question_blocking_behavior?: "require_human" | "guarded_auto_resolve_then_human";
174
+ question_policy_version?: number;
175
+ question_auto_answer_delay_seconds?: number;
176
+ question_auto_answer_action?: "approve" | "reject";
177
+ custom_run_instructions?: string | null;
178
+ }
179
+ export interface ClientRuntimeSettingsAgent {
180
+ id: string;
181
+ name: string;
182
+ type: string;
183
+ status: string;
184
+ model: string | null;
185
+ runtime_settings: AgentRuntimeSettingsPayload;
186
+ }
187
+ export type ClientRuntimeSettingsResponse = {
188
+ ok: true;
189
+ workspace_id?: string | null;
190
+ /** Legacy alias retained for backward compatibility */
191
+ project_id?: string | null;
192
+ agents?: ClientRuntimeSettingsAgent[];
193
+ agent?: ClientRuntimeSettingsAgent;
194
+ } | {
195
+ ok: false;
196
+ error: string;
197
+ };
198
+ export interface ClientRuntimeSettingsUpdateRequest {
199
+ /** Canonical workspace scope */
200
+ workspace_id?: string;
201
+ /** Legacy alias retained for backward compatibility */
202
+ command_center_id?: string;
203
+ /** Legacy alias retained for backward compatibility */
204
+ project_id?: string;
205
+ agent_id: string;
206
+ runtime_settings: AgentRuntimeSettingsPayload;
207
+ }
127
208
  export type SkillPack = {
128
209
  name: string;
129
210
  version: string;
@@ -184,6 +265,8 @@ export interface SyncPayload {
184
265
  memory?: string;
185
266
  /** Today's session log */
186
267
  dailyLog?: string;
268
+ /** Local OpenClaw agent states to mirror into OrgX */
269
+ agents?: AgentState[];
187
270
  /** Workspace state for local↔cloud handoff continuity */
188
271
  workspaceState?: HandoffWorkspaceState;
189
272
  /** Decisions made this session */
@@ -205,6 +288,8 @@ export interface SyncResponse {
205
288
  title: string;
206
289
  status: string;
207
290
  }>;
291
+ /** Agent states (optional for backward compatibility with older servers) */
292
+ agents?: AgentState[];
208
293
  /** In-progress tasks */
209
294
  activeTasks: Array<{
210
295
  id: string;
@@ -249,6 +334,80 @@ export interface BillingUrlResult {
249
334
  url: string | null;
250
335
  checkout_url?: string | null;
251
336
  }
337
+ export type UsageRiskLevel = "safe" | "watch" | "at_risk" | "over_limit";
338
+ export type UsageBreakdownBucket = {
339
+ key: string;
340
+ label: string;
341
+ runs: number;
342
+ tokens: number;
343
+ minutes: number;
344
+ costCents: number;
345
+ };
346
+ export type UsagePrediction = {
347
+ agentRuns: number;
348
+ agentMinutes: number;
349
+ tokens: number;
350
+ costCents: number;
351
+ confidence: number;
352
+ method: string;
353
+ remainingAgentRuns: number;
354
+ remainingAgentMinutes: number;
355
+ remainingTokens: number;
356
+ remainingCostCents: number;
357
+ };
358
+ export type UsageControlPlaneSummary = {
359
+ generatedAt: string;
360
+ period: {
361
+ start: string;
362
+ end: string;
363
+ daysTotal: number;
364
+ daysElapsed: number;
365
+ daysRemaining: number;
366
+ };
367
+ plan: {
368
+ id: string;
369
+ name: string;
370
+ allowsOverage: boolean;
371
+ includedBudgetCents: number;
372
+ overageBudgetCents: number;
373
+ agentRunsLimit: number;
374
+ agentMinutesLimit: number;
375
+ scaffoldsLimit: number;
376
+ };
377
+ actual: {
378
+ agentRuns: number;
379
+ agentMinutes: number;
380
+ tokens: number;
381
+ costCents: number;
382
+ scaffoldsUsed: number;
383
+ scaffoldsRemaining: number;
384
+ };
385
+ predicted: UsagePrediction;
386
+ utilization: {
387
+ runsPct: number | null;
388
+ minutesPct: number | null;
389
+ budgetPct: number | null;
390
+ };
391
+ headroom: {
392
+ agentRunsRemaining: number;
393
+ agentMinutesRemaining: number;
394
+ budgetRemainingCents: number;
395
+ };
396
+ risk: UsageRiskLevel;
397
+ breakdown: {
398
+ provider: UsageBreakdownBucket[];
399
+ executionTarget: UsageBreakdownBucket[];
400
+ sourceClient: UsageBreakdownBucket[];
401
+ model: UsageBreakdownBucket[];
402
+ };
403
+ velocity: {
404
+ windowDays: number;
405
+ dailyAvgRuns: number;
406
+ dailyAvgMinutes: number;
407
+ dailyAvgTokens: number;
408
+ dailyAvgCostCents: number;
409
+ };
410
+ };
252
411
  export interface HandoffWorkspaceState {
253
412
  git?: {
254
413
  branch?: string | null;
@@ -377,14 +536,61 @@ export interface EntityUpdatePayload {
377
536
  export interface EntityListFilters {
378
537
  status?: string;
379
538
  limit?: number;
539
+ offset?: number;
540
+ search?: string;
541
+ id?: string;
542
+ ids?: string[] | string;
543
+ initiative_id?: string;
544
+ project_id?: string;
545
+ /** Canonical workspace scope */
546
+ workspace_id?: string;
547
+ /** Legacy alias for workspace_id */
548
+ command_center_id?: string;
380
549
  [key: string]: unknown;
381
550
  }
551
+ export interface WorkstreamReassignmentStatus {
552
+ scheduled: boolean;
553
+ requestId?: string | null;
554
+ dueAt?: string | null;
555
+ reason?: string;
556
+ }
557
+ export interface InitiativeReassignmentStatus {
558
+ triggered: boolean;
559
+ requested: number;
560
+ scheduled: number;
561
+ skipped: number;
562
+ failures: string[];
563
+ }
564
+ export interface EntityUpdateResult {
565
+ entity: Entity;
566
+ reassignment?: WorkstreamReassignmentStatus | null;
567
+ initiative_reassignment?: InitiativeReassignmentStatus | null;
568
+ }
382
569
  export type ReportingSourceClient = 'openclaw' | 'codex' | 'claude-code' | 'api';
383
570
  export type ReportingPhase = 'intent' | 'execution' | 'blocked' | 'review' | 'handoff' | 'completed';
384
571
  export type ReportingLevel = 'info' | 'warn' | 'error';
385
572
  export type TaskStatus = 'todo' | 'in_progress' | 'done' | 'blocked';
386
573
  export type MilestoneStatus = 'planned' | 'in_progress' | 'completed' | 'at_risk' | 'cancelled';
387
574
  export type DecisionUrgency = 'low' | 'medium' | 'high' | 'urgent';
575
+ export type DecisionOptionImpliedStatus = 'approved' | 'declined' | 'cancelled' | 'rejected';
576
+ export interface DecisionCreateOption {
577
+ id?: string;
578
+ label: string;
579
+ description?: string;
580
+ implied_status?: DecisionOptionImpliedStatus;
581
+ action_type?: DecisionActionType;
582
+ requires_note?: boolean;
583
+ }
584
+ export interface DecisionEvidenceRef {
585
+ evidence_type?: string;
586
+ title?: string;
587
+ summary?: string;
588
+ source_url?: string;
589
+ source_pointer?: string;
590
+ freshness?: string;
591
+ confidence?: number;
592
+ payload?: Record<string, unknown>;
593
+ }
388
594
  export interface EmitActivityRequest {
389
595
  initiative_id: string;
390
596
  message: string;
@@ -431,8 +637,22 @@ export type ChangesetOperation = {
431
637
  title: string;
432
638
  summary?: string;
433
639
  urgency?: DecisionUrgency;
434
- options?: string[];
640
+ options?: Array<string | DecisionCreateOption>;
435
641
  blocking?: boolean;
642
+ decision_type?: string;
643
+ workstream_id?: string;
644
+ agent_id?: string;
645
+ due_at?: string;
646
+ source_system?: string;
647
+ conflict_source?: string;
648
+ dedupe_key?: string;
649
+ recommended_action?: string;
650
+ source_run_id?: string;
651
+ source_session_id?: string;
652
+ source_stream_id?: string;
653
+ source_ref?: Record<string, unknown>;
654
+ evidence_refs?: DecisionEvidenceRef[];
655
+ metadata?: Record<string, unknown>;
436
656
  };
437
657
  export interface ApplyChangesetRequest {
438
658
  initiative_id: string;
@@ -486,6 +706,7 @@ export interface RecordRunOutcomeResponse {
486
706
  }
487
707
  export type RetroFollowUpPriority = 'p0' | 'p1' | 'p2';
488
708
  export interface RetroJson {
709
+ schema_version: RetroArtifactSchemaVersion;
489
710
  summary: string;
490
711
  what_went_well?: string[];
491
712
  what_went_wrong?: string[];
@@ -520,3 +741,27 @@ export interface RecordRunRetroResponse {
520
741
  event_id: string | null;
521
742
  auth_mode?: 'service' | 'api_key';
522
743
  }
744
+ export type ProofLevel = "L1_traceability" | "L2_correctness" | "L3_completion" | "L4_adoption" | "L5_impact" | "L6_economics" | "L7_repeatability";
745
+ export type ProofEnforcement = "hard_block" | "soft_warn" | "reporting_only";
746
+ export interface ProofLevelStatus {
747
+ level: ProofLevel;
748
+ label: string;
749
+ passed: boolean;
750
+ enforcement: ProofEnforcement;
751
+ missingFields: string[];
752
+ details?: string;
753
+ }
754
+ export interface ProofChainStatus {
755
+ task_id?: string;
756
+ run_id?: string;
757
+ domain?: OrgxAgentDomain;
758
+ levels: ProofLevelStatus[];
759
+ overall_passed: boolean;
760
+ missing_count: number;
761
+ /** Codes like "no_artifact", "no_quality_gate", "no_outcome" etc. */
762
+ reason_codes: string[];
763
+ }
764
+ export interface ProofStatusRequest {
765
+ task_id?: string;
766
+ run_id?: string;
767
+ }
@@ -1,3 +1,24 @@
1
+ import { callLlmJson } from "../http/helpers/llm-client.js";
2
+ const VALID_DOMAINS = new Set([
3
+ "engineering",
4
+ "product",
5
+ "design",
6
+ "marketing",
7
+ "sales",
8
+ "operations",
9
+ ]);
10
+ function heuristicDomainGuess(title, summary) {
11
+ const haystack = `${title} ${summary ?? ""}`.toLowerCase();
12
+ if (/market|campaign|thread|article|tweet|copy/.test(haystack))
13
+ return ["marketing"];
14
+ if (/design|ux|ui|a11y/.test(haystack))
15
+ return ["design"];
16
+ if (/ops|runbook|incident|reliability/.test(haystack))
17
+ return ["operations"];
18
+ if (/sales|deal|pipeline/.test(haystack))
19
+ return ["sales"];
20
+ return ["engineering", "product"];
21
+ }
1
22
  export async function autoAssignEntityForCreate(input) {
2
23
  const warnings = [];
3
24
  const byKey = new Map();
@@ -67,23 +88,28 @@ export async function autoAssignEntityForCreate(input) {
67
88
  warnings.push(`delegation preflight failed (${input.toErrorMessage(err)})`);
68
89
  }
69
90
  if (byKey.size === 0) {
70
- const haystack = `${input.title} ${input.summary ?? ""}`.toLowerCase();
71
- const domainHints = [];
72
- if (/market|campaign|thread|article|tweet|copy/.test(haystack)) {
73
- domainHints.push("marketing");
74
- }
75
- else if (/design|ux|ui|a11y/.test(haystack)) {
76
- domainHints.push("design");
77
- }
78
- else if (/ops|runbook|incident|reliability/.test(haystack)) {
79
- domainHints.push("operations");
80
- }
81
- else if (/sales|deal|pipeline/.test(haystack)) {
82
- domainHints.push("sales");
83
- }
84
- else {
85
- domainHints.push("engineering", "product");
86
- }
91
+ const domainResult = await callLlmJson({
92
+ taskId: "domain_assignment",
93
+ systemPrompt: 'Classify which agent domain(s) should handle this task. Return JSON: {"domains": [...]} with 1-2 values from: engineering, product, design, marketing, sales, operations. Be precise based on the task content.',
94
+ userPrompt: `Task: ${input.title}\n${input.summary ? `Details: ${input.summary}` : ""}`,
95
+ maxTokens: 64,
96
+ temperature: 0.1,
97
+ cacheTtlMs: 60 * 60_000, // 1 hour
98
+ }, (raw) => {
99
+ try {
100
+ const parsed = JSON.parse(raw);
101
+ if (Array.isArray(parsed.domains) &&
102
+ parsed.domains.length > 0 &&
103
+ parsed.domains.every((d) => typeof d === "string" && VALID_DOMAINS.has(d))) {
104
+ return { domains: parsed.domains };
105
+ }
106
+ }
107
+ catch {
108
+ // fall through
109
+ }
110
+ return null;
111
+ }, () => ({ domains: heuristicDomainGuess(input.title, input.summary ?? null) }));
112
+ const domainHints = domainResult.result.domains;
87
113
  for (const domain of domainHints) {
88
114
  const match = liveAgents.find((agent) => (agent.domain ?? "").toLowerCase().includes(domain));
89
115
  if (match)
@@ -0,0 +1,11 @@
1
+ import type { LiveActivityItem } from "./contracts/shared-types.js";
2
+ export declare function isUuid(value: string | null | undefined): boolean;
3
+ export declare function isSyntheticIdentifier(value: string | null | undefined): boolean;
4
+ type OutboxEventLike = {
5
+ type?: unknown;
6
+ payload?: unknown;
7
+ activityItem?: unknown;
8
+ };
9
+ export declare function classifyOutboxReplaySkip(event: OutboxEventLike): string | null;
10
+ export declare function shouldHideActivityItem(item: LiveActivityItem): boolean;
11
+ export {};
@@ -0,0 +1,113 @@
1
+ function toRecord(value) {
2
+ if (!value || typeof value !== "object" || Array.isArray(value))
3
+ return null;
4
+ return value;
5
+ }
6
+ function pickString(input, ...keys) {
7
+ if (!input)
8
+ return null;
9
+ for (const key of keys) {
10
+ const value = input[key];
11
+ if (typeof value !== "string")
12
+ continue;
13
+ const trimmed = value.trim();
14
+ if (trimmed.length > 0)
15
+ return trimmed;
16
+ }
17
+ return null;
18
+ }
19
+ function pickBool(input, ...keys) {
20
+ if (!input)
21
+ return false;
22
+ for (const key of keys) {
23
+ if (input[key] === true)
24
+ return true;
25
+ }
26
+ return false;
27
+ }
28
+ function containsMockMarker(value) {
29
+ if (!value)
30
+ return false;
31
+ const normalized = value.trim().toLowerCase();
32
+ if (!normalized)
33
+ return false;
34
+ // Match whole marker tokens and avoid substring false positives (e.g. "latest").
35
+ return /(^|[^a-z0-9])(mock|fixture|synthetic|test)([^a-z0-9]|$)/i.test(normalized);
36
+ }
37
+ export function isUuid(value) {
38
+ if (!value)
39
+ return false;
40
+ const trimmed = value.trim();
41
+ if (!trimmed)
42
+ return false;
43
+ return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(trimmed);
44
+ }
45
+ export function isSyntheticIdentifier(value) {
46
+ if (!value)
47
+ return false;
48
+ const trimmed = value.trim();
49
+ if (!trimmed)
50
+ return false;
51
+ if (isUuid(trimmed))
52
+ return false;
53
+ return /^(init|initiative|task|workstream|ws|milestone|ms|decision|artifact|demo|mock|test|sample|queue|tmp|local)-/i.test(trimmed);
54
+ }
55
+ function isMockTaggedMetadata(metadata) {
56
+ if (!metadata)
57
+ return false;
58
+ if (pickBool(metadata, "mock", "is_mock", "isMock"))
59
+ return true;
60
+ if (containsMockMarker(pickString(metadata, "source")) ||
61
+ containsMockMarker(pickString(metadata, "worker_kind", "workerKind")) ||
62
+ containsMockMarker(pickString(metadata, "environment"))) {
63
+ return true;
64
+ }
65
+ return false;
66
+ }
67
+ export function classifyOutboxReplaySkip(event) {
68
+ const eventType = typeof event.type === "string" ? event.type.trim().toLowerCase() : "";
69
+ const payload = toRecord(event.payload);
70
+ const activity = toRecord(event.activityItem);
71
+ const payloadMetadata = toRecord(payload?.metadata);
72
+ const activityMetadata = toRecord(activity?.metadata);
73
+ const normalizedSourceClient = pickString(payload, "source_client", "sourceClient")
74
+ ?.trim()
75
+ .toLowerCase();
76
+ const normalizedPayloadEvent = pickString(payloadMetadata, "event")?.trim().toLowerCase();
77
+ const normalizedActivityEvent = pickString(activityMetadata, "event")?.trim().toLowerCase();
78
+ const skipMockOutboxReplay = String(process.env.ORGX_SKIP_MOCK_OUTBOX_REPLAY ?? "false")
79
+ .trim()
80
+ .toLowerCase() === "true";
81
+ if (skipMockOutboxReplay &&
82
+ (isMockTaggedMetadata(payloadMetadata) ||
83
+ isMockTaggedMetadata(activityMetadata) ||
84
+ pickBool(payload, "mock", "is_mock", "isMock"))) {
85
+ return "mock_event";
86
+ }
87
+ if (eventType === "artifact") {
88
+ const initiativeId = pickString(payload, "initiative_id", "initiativeId");
89
+ const entityId = pickString(payload, "entity_id", "entityId");
90
+ const allowSyntheticArtifact = normalizedSourceClient === "openclaw" ||
91
+ normalizedPayloadEvent === "autopilot_slice_artifact_buffered" ||
92
+ normalizedActivityEvent === "autopilot_slice_artifact_buffered";
93
+ if (!allowSyntheticArtifact && isSyntheticIdentifier(initiativeId)) {
94
+ return "synthetic_initiative_id";
95
+ }
96
+ if (!allowSyntheticArtifact && !entityId) {
97
+ return "missing_artifact_entity_id";
98
+ }
99
+ if (!allowSyntheticArtifact && isSyntheticIdentifier(entityId)) {
100
+ return "synthetic_artifact_entity_id";
101
+ }
102
+ }
103
+ return null;
104
+ }
105
+ export function shouldHideActivityItem(item) {
106
+ const metadata = toRecord(item.metadata);
107
+ const hideMockActivity = String(process.env.ORGX_HIDE_MOCK_ACTIVITY ?? "false")
108
+ .trim()
109
+ .toLowerCase() === "true";
110
+ if (hideMockActivity && isMockTaggedMetadata(metadata))
111
+ return true;
112
+ return false;
113
+ }
@@ -8,4 +8,9 @@ export declare function ensureGatewayWatchdog(logger: Logger): {
8
8
  started: boolean;
9
9
  pid: number | null;
10
10
  };
11
+ export declare function stopGatewayWatchdog(logger?: Logger, timeoutMs?: number): Promise<{
12
+ pid: number | null;
13
+ wasRunning: boolean;
14
+ stopped: boolean;
15
+ }>;
11
16
  export {};
@@ -8,6 +8,31 @@ const DEFAULT_MONITOR_INTERVAL_MS = 30_000;
8
8
  const DEFAULT_FAILURES_BEFORE_RESTART = 2;
9
9
  const DEFAULT_PROBE_TIMEOUT_MS = 2_500;
10
10
  const WATCHDOG_PID_FILE = join(getOpenClawDir(), "orgx-gateway-watchdog.pid");
11
+ function sendSignal(pid, signal) {
12
+ try {
13
+ // Detached child uses its own process group on Unix.
14
+ process.kill(-pid, signal);
15
+ return;
16
+ }
17
+ catch {
18
+ // Fall through to direct pid kill.
19
+ }
20
+ try {
21
+ process.kill(pid, signal);
22
+ }
23
+ catch {
24
+ // best effort
25
+ }
26
+ }
27
+ async function waitForExit(pid, timeoutMs) {
28
+ const deadline = Date.now() + Math.max(100, timeoutMs);
29
+ while (Date.now() < deadline) {
30
+ if (!isPidAlive(pid))
31
+ return true;
32
+ await new Promise((resolve) => setTimeout(resolve, 100));
33
+ }
34
+ return !isPidAlive(pid);
35
+ }
11
36
  function readEnvNumber(name, fallback, min) {
12
37
  const raw = (process.env[name] ?? "").trim();
13
38
  if (!raw)
@@ -219,3 +244,28 @@ export function ensureGatewayWatchdog(logger) {
219
244
  child.unref();
220
245
  return { started: true, pid: child.pid ?? null };
221
246
  }
247
+ export async function stopGatewayWatchdog(logger = console, timeoutMs = 1_500) {
248
+ const pid = readWatchdogPid();
249
+ if (!pid) {
250
+ clearWatchdogPid();
251
+ return { pid: null, wasRunning: false, stopped: true };
252
+ }
253
+ if (!isPidAlive(pid)) {
254
+ clearWatchdogPid();
255
+ return { pid, wasRunning: false, stopped: true };
256
+ }
257
+ sendSignal(pid, "SIGTERM");
258
+ let stopped = await waitForExit(pid, timeoutMs);
259
+ if (!stopped) {
260
+ sendSignal(pid, "SIGKILL");
261
+ stopped = await waitForExit(pid, 500);
262
+ }
263
+ if (stopped) {
264
+ clearWatchdogPid();
265
+ logger.info?.("[orgx] Gateway watchdog stopped", { pid });
266
+ }
267
+ else {
268
+ logger.warn?.("[orgx] Gateway watchdog did not exit after stop attempt", { pid });
269
+ }
270
+ return { pid, wasRunning: true, stopped };
271
+ }
@@ -168,11 +168,7 @@ export async function main({
168
168
  const runId = pickString(args.run_id, env.ORGX_RUN_ID);
169
169
  const correlationId = runId
170
170
  ? undefined
171
- : pickString(
172
- args.correlation_id,
173
- env.ORGX_CORRELATION_ID,
174
- `hook-${now()}`
175
- );
171
+ : pickString(args.correlation_id, env.ORGX_CORRELATION_ID);
176
172
 
177
173
  const event = pickString(args.event, "hook_event");
178
174
  const phase = pickString(args.phase, "execution");