@useorgx/openclaw-plugin 0.4.6 → 0.4.9

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 (137) hide show
  1. package/README.md +310 -24
  2. package/dashboard/dist/assets/B5NEElEI.css +1 -0
  3. package/dashboard/dist/assets/BhapSNAs.js +215 -0
  4. package/dashboard/dist/assets/iFdvE7lx.js +1 -0
  5. package/dashboard/dist/assets/jRJsmpYM.js +1 -0
  6. package/dashboard/dist/index.html +2 -2
  7. package/dist/activity-actor-fields.d.ts +3 -0
  8. package/dist/activity-actor-fields.js +128 -0
  9. package/dist/activity-store.js +12 -19
  10. package/dist/agent-context-store.js +5 -25
  11. package/dist/agent-run-store.js +5 -25
  12. package/dist/agent-suite.js +1 -8
  13. package/dist/artifacts/register-artifact.d.ts +47 -0
  14. package/dist/artifacts/register-artifact.js +271 -0
  15. package/dist/auth/flows.d.ts +47 -0
  16. package/dist/auth/flows.js +169 -0
  17. package/dist/auth-store.js +14 -39
  18. package/dist/byok-store.js +5 -19
  19. package/dist/cli/orgx.d.ts +66 -0
  20. package/dist/cli/orgx.js +91 -0
  21. package/dist/config/refresh.d.ts +32 -0
  22. package/dist/config/refresh.js +55 -0
  23. package/dist/config/resolution.d.ts +37 -0
  24. package/dist/config/resolution.js +178 -0
  25. package/dist/contracts/client.d.ts +1 -0
  26. package/dist/contracts/client.js +7 -5
  27. package/dist/contracts/shared-types.d.ts +147 -0
  28. package/dist/contracts/shared-types.js +3 -0
  29. package/dist/contracts/types.d.ts +1 -130
  30. package/dist/contracts/types.js +5 -0
  31. package/dist/entities/auto-assignment.d.ts +36 -0
  32. package/dist/entities/auto-assignment.js +115 -0
  33. package/dist/entity-comment-store.js +5 -25
  34. package/dist/hash-utils.d.ts +2 -0
  35. package/dist/hash-utils.js +12 -0
  36. package/dist/http/helpers/activity-headline.d.ts +10 -0
  37. package/dist/http/helpers/activity-headline.js +192 -0
  38. package/dist/http/helpers/artifact-fallback.d.ts +13 -0
  39. package/dist/http/helpers/artifact-fallback.js +148 -0
  40. package/dist/http/helpers/auto-continue-engine.d.ts +298 -0
  41. package/dist/http/helpers/auto-continue-engine.js +1218 -0
  42. package/dist/http/helpers/autopilot-operations.d.ts +157 -0
  43. package/dist/http/helpers/autopilot-operations.js +403 -0
  44. package/dist/http/helpers/autopilot-runtime.d.ts +42 -0
  45. package/dist/http/helpers/autopilot-runtime.js +319 -0
  46. package/dist/http/helpers/autopilot-slice-utils.d.ts +38 -0
  47. package/dist/http/helpers/autopilot-slice-utils.js +476 -0
  48. package/dist/http/helpers/decision-mapper.d.ts +12 -0
  49. package/dist/http/helpers/decision-mapper.js +44 -0
  50. package/dist/http/helpers/dispatch-lifecycle.d.ts +102 -0
  51. package/dist/http/helpers/dispatch-lifecycle.js +604 -0
  52. package/dist/http/helpers/hash-utils.d.ts +1 -0
  53. package/dist/http/helpers/hash-utils.js +1 -0
  54. package/dist/http/helpers/kickoff-context.d.ts +12 -0
  55. package/dist/http/helpers/kickoff-context.js +154 -0
  56. package/dist/http/helpers/mission-control.d.ts +94 -0
  57. package/dist/http/helpers/mission-control.js +894 -0
  58. package/dist/http/helpers/openclaw-cli.d.ts +37 -0
  59. package/dist/http/helpers/openclaw-cli.js +283 -0
  60. package/dist/http/helpers/runtime-sse.d.ts +20 -0
  61. package/dist/http/helpers/runtime-sse.js +110 -0
  62. package/dist/http/helpers/value-utils.d.ts +6 -0
  63. package/dist/http/helpers/value-utils.js +67 -0
  64. package/dist/http/index.d.ts +88 -0
  65. package/dist/http/index.js +2353 -0
  66. package/dist/http/router.d.ts +23 -0
  67. package/dist/http/router.js +23 -0
  68. package/dist/http/routes/agent-control.d.ts +79 -0
  69. package/dist/http/routes/agent-control.js +684 -0
  70. package/dist/http/routes/agent-suite.d.ts +29 -0
  71. package/dist/http/routes/agent-suite.js +198 -0
  72. package/dist/http/routes/agents-catalog.d.ts +40 -0
  73. package/dist/http/routes/agents-catalog.js +83 -0
  74. package/dist/http/routes/billing.d.ts +23 -0
  75. package/dist/http/routes/billing.js +55 -0
  76. package/dist/http/routes/debug.d.ts +14 -0
  77. package/dist/http/routes/debug.js +21 -0
  78. package/dist/http/routes/decision-actions.d.ts +13 -0
  79. package/dist/http/routes/decision-actions.js +66 -0
  80. package/dist/http/routes/delegation.d.ts +19 -0
  81. package/dist/http/routes/delegation.js +32 -0
  82. package/dist/http/routes/entities.d.ts +47 -0
  83. package/dist/http/routes/entities.js +152 -0
  84. package/dist/http/routes/entity-dynamic.d.ts +25 -0
  85. package/dist/http/routes/entity-dynamic.js +191 -0
  86. package/dist/http/routes/health.d.ts +22 -0
  87. package/dist/http/routes/health.js +49 -0
  88. package/dist/http/routes/live-legacy.d.ts +110 -0
  89. package/dist/http/routes/live-legacy.js +598 -0
  90. package/dist/http/routes/live-misc.d.ts +69 -0
  91. package/dist/http/routes/live-misc.js +206 -0
  92. package/dist/http/routes/live-snapshot.d.ts +90 -0
  93. package/dist/http/routes/live-snapshot.js +297 -0
  94. package/dist/http/routes/mission-control-actions.d.ts +83 -0
  95. package/dist/http/routes/mission-control-actions.js +541 -0
  96. package/dist/http/routes/mission-control-read.d.ts +28 -0
  97. package/dist/http/routes/mission-control-read.js +67 -0
  98. package/dist/http/routes/onboarding.d.ts +34 -0
  99. package/dist/http/routes/onboarding.js +101 -0
  100. package/dist/http/routes/run-control.d.ts +24 -0
  101. package/dist/http/routes/run-control.js +86 -0
  102. package/dist/http/routes/runtime-hooks.d.ts +69 -0
  103. package/dist/http/routes/runtime-hooks.js +437 -0
  104. package/dist/http/routes/settings-byok.d.ts +23 -0
  105. package/dist/http/routes/settings-byok.js +163 -0
  106. package/dist/http/routes/summary.d.ts +18 -0
  107. package/dist/http/routes/summary.js +42 -0
  108. package/dist/http/routes/work-artifacts.d.ts +9 -0
  109. package/dist/http/routes/work-artifacts.js +36 -0
  110. package/dist/http/shared-state.d.ts +16 -0
  111. package/dist/http/shared-state.js +1 -0
  112. package/dist/http-handler.d.ts +1 -88
  113. package/dist/http-handler.js +1 -9664
  114. package/dist/index.js +122 -2121
  115. package/dist/json-utils.d.ts +1 -0
  116. package/dist/json-utils.js +8 -0
  117. package/dist/local-openclaw.js +8 -0
  118. package/dist/mcp-client-setup.js +75 -90
  119. package/dist/next-up-queue-store.js +4 -18
  120. package/dist/runtime-instance-store.js +8 -34
  121. package/dist/services/background.d.ts +23 -0
  122. package/dist/services/background.js +23 -0
  123. package/dist/services/instrumentation.d.ts +29 -0
  124. package/dist/services/instrumentation.js +136 -0
  125. package/dist/snapshot-store.js +5 -25
  126. package/dist/stores/json-store.d.ts +11 -0
  127. package/dist/stores/json-store.js +42 -0
  128. package/dist/sync/outbox-replay.d.ts +55 -0
  129. package/dist/sync/outbox-replay.js +514 -0
  130. package/dist/tools/core-tools.d.ts +76 -0
  131. package/dist/tools/core-tools.js +1005 -0
  132. package/dist/worker-supervisor.js +15 -0
  133. package/package.json +6 -1
  134. package/dashboard/dist/assets/0tOC3wSN.js +0 -214
  135. package/dashboard/dist/assets/Bm8QnMJ_.js +0 -1
  136. package/dashboard/dist/assets/CyxZio4Y.js +0 -1
  137. package/dashboard/dist/assets/DaAIOik3.css +0 -1
@@ -0,0 +1,178 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ const DEFAULT_BASE_URL = "https://www.useorgx.com";
6
+ const DEFAULT_DOCS_URL = "https://orgx.mintlify.site/guides/openclaw-plugin-setup";
7
+ export function isUserScopedApiKey(apiKey) {
8
+ return apiKey.trim().toLowerCase().startsWith("oxk_");
9
+ }
10
+ export function resolveRuntimeUserId(apiKey, candidates) {
11
+ if (isUserScopedApiKey(apiKey)) {
12
+ // For oxk_ keys, the OrgX API ignores X-Orgx-User-Id, but we still keep a UUID
13
+ // around for created_by_id on certain entity writes (e.g., work_artifacts).
14
+ for (const candidate of candidates) {
15
+ if (typeof candidate !== "string")
16
+ continue;
17
+ const trimmed = candidate.trim();
18
+ if (/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(trimmed)) {
19
+ return trimmed;
20
+ }
21
+ }
22
+ return "";
23
+ }
24
+ for (const candidate of candidates) {
25
+ if (typeof candidate === "string") {
26
+ const trimmed = candidate.trim();
27
+ if (trimmed.length > 0)
28
+ return trimmed;
29
+ }
30
+ }
31
+ return "";
32
+ }
33
+ function normalizeHost(value) {
34
+ return value.trim().toLowerCase().replace(/^\[|\]$/g, "");
35
+ }
36
+ function isLoopbackHostname(hostname) {
37
+ const normalized = normalizeHost(hostname);
38
+ return normalized === "localhost" || normalized === "127.0.0.1" || normalized === "::1";
39
+ }
40
+ export function normalizeBaseUrl(raw) {
41
+ const candidate = raw?.trim() ?? "";
42
+ if (!candidate) {
43
+ return DEFAULT_BASE_URL;
44
+ }
45
+ try {
46
+ const parsed = new URL(candidate);
47
+ if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
48
+ return DEFAULT_BASE_URL;
49
+ }
50
+ // Do not allow credential-bearing URLs.
51
+ if (parsed.username || parsed.password) {
52
+ return DEFAULT_BASE_URL;
53
+ }
54
+ // Plain HTTP is only allowed for local loopback development.
55
+ if (parsed.protocol === "http:" && !isLoopbackHostname(parsed.hostname)) {
56
+ return DEFAULT_BASE_URL;
57
+ }
58
+ parsed.search = "";
59
+ parsed.hash = "";
60
+ const normalizedPath = parsed.pathname.replace(/\/+$/, "");
61
+ parsed.pathname = normalizedPath;
62
+ const normalized = parsed.toString().replace(/\/+$/, "");
63
+ return normalized.length > 0 ? normalized : DEFAULT_BASE_URL;
64
+ }
65
+ catch {
66
+ return DEFAULT_BASE_URL;
67
+ }
68
+ }
69
+ export function readLegacyEnvValue(keyPattern) {
70
+ try {
71
+ const envPath = join(homedir(), "Code", "orgx", "orgx", ".env.local");
72
+ const envContent = readFileSync(envPath, "utf-8");
73
+ const match = envContent.match(keyPattern);
74
+ return match?.[1]?.trim() ?? "";
75
+ }
76
+ catch {
77
+ return "";
78
+ }
79
+ }
80
+ export function readOpenClawOrgxConfig() {
81
+ try {
82
+ const configPath = join(homedir(), ".openclaw", "openclaw.json");
83
+ const raw = readFileSync(configPath, "utf8");
84
+ const parsed = JSON.parse(raw);
85
+ const plugins = parsed.plugins && typeof parsed.plugins === "object"
86
+ ? parsed.plugins
87
+ : {};
88
+ const entries = plugins.entries && typeof plugins.entries === "object"
89
+ ? plugins.entries
90
+ : {};
91
+ const orgx = entries.orgx && typeof entries.orgx === "object"
92
+ ? entries.orgx
93
+ : {};
94
+ const config = orgx.config && typeof orgx.config === "object"
95
+ ? orgx.config
96
+ : {};
97
+ const apiKey = typeof config.apiKey === "string" ? config.apiKey.trim() : "";
98
+ const userId = typeof config.userId === "string" ? config.userId.trim() : "";
99
+ const baseUrl = typeof config.baseUrl === "string" ? config.baseUrl.trim() : "";
100
+ return { apiKey, userId, baseUrl };
101
+ }
102
+ catch {
103
+ return { apiKey: "", userId: "", baseUrl: "" };
104
+ }
105
+ }
106
+ function resolveApiKey(pluginConf, persistedApiKey) {
107
+ if (pluginConf.apiKey && pluginConf.apiKey.trim().length > 0) {
108
+ return { value: pluginConf.apiKey.trim(), source: "config" };
109
+ }
110
+ if (process.env.ORGX_API_KEY && process.env.ORGX_API_KEY.trim().length > 0) {
111
+ return { value: process.env.ORGX_API_KEY.trim(), source: "environment" };
112
+ }
113
+ if (persistedApiKey && persistedApiKey.trim().length > 0) {
114
+ return { value: persistedApiKey.trim(), source: "persisted" };
115
+ }
116
+ const openclaw = readOpenClawOrgxConfig();
117
+ if (openclaw.apiKey) {
118
+ return { value: openclaw.apiKey, source: "openclaw-config-file" };
119
+ }
120
+ // For local dev convenience we read `ORGX_API_KEY` from `~/Code/orgx/orgx/.env.local`.
121
+ // Do not auto-consume `ORGX_SERVICE_KEY` because service keys often require `X-Orgx-User-Id`,
122
+ // and the dashboard/client flows are intended to run on user-scoped keys (`oxk_...`).
123
+ const legacy = readLegacyEnvValue(/^ORGX_API_KEY=["']?([^"'\n]+)["']?$/m);
124
+ if (legacy) {
125
+ return { value: legacy, source: "legacy-dev" };
126
+ }
127
+ return { value: "", source: "none" };
128
+ }
129
+ export function resolvePluginVersion() {
130
+ try {
131
+ const packagePath = fileURLToPath(new URL("../../package.json", import.meta.url));
132
+ const parsed = JSON.parse(readFileSync(packagePath, "utf8"));
133
+ return parsed.version && parsed.version.trim().length > 0 ? parsed.version : "dev";
134
+ }
135
+ catch {
136
+ return "dev";
137
+ }
138
+ }
139
+ export function resolveDocsUrl(baseUrl) {
140
+ const normalized = baseUrl.replace(/\/+$/, "");
141
+ try {
142
+ const parsed = new URL(normalized);
143
+ if (isLoopbackHostname(parsed.hostname)) {
144
+ return `${normalized}/docs/mintlify/guides/openclaw-plugin-setup`;
145
+ }
146
+ }
147
+ catch {
148
+ return DEFAULT_DOCS_URL;
149
+ }
150
+ return DEFAULT_DOCS_URL;
151
+ }
152
+ export function resolveConfig(api, input) {
153
+ const pluginConf = api.config?.plugins?.entries?.orgx?.config ?? {};
154
+ const openclaw = readOpenClawOrgxConfig();
155
+ const apiKeyResolution = resolveApiKey(pluginConf, input.persistedApiKey);
156
+ const apiKey = apiKeyResolution.value;
157
+ const userId = resolveRuntimeUserId(apiKey, [
158
+ pluginConf.userId,
159
+ process.env.ORGX_USER_ID,
160
+ input.persistedUserId,
161
+ openclaw.userId,
162
+ readLegacyEnvValue(/^ORGX_USER_ID=["']?([^"'\n]+)["']?$/m),
163
+ ]);
164
+ const baseUrl = normalizeBaseUrl(pluginConf.baseUrl || process.env.ORGX_BASE_URL || openclaw.baseUrl || DEFAULT_BASE_URL);
165
+ return {
166
+ apiKey,
167
+ userId,
168
+ baseUrl,
169
+ syncIntervalMs: pluginConf.syncIntervalMs ?? 300_000,
170
+ enabled: pluginConf.enabled ?? true,
171
+ autoInstallAgentSuiteOnConnect: pluginConf.autoInstallAgentSuiteOnConnect ?? true,
172
+ dashboardEnabled: pluginConf.dashboardEnabled ?? true,
173
+ installationId: input.installationId,
174
+ pluginVersion: resolvePluginVersion(),
175
+ docsUrl: resolveDocsUrl(baseUrl),
176
+ apiKeySource: apiKeyResolution.source,
177
+ };
178
+ }
@@ -26,6 +26,7 @@ export declare class OrgXClient {
26
26
  baseUrl?: string;
27
27
  }): void;
28
28
  getBaseUrl(): string;
29
+ getUserId(): string;
29
30
  /**
30
31
  * Low-level authenticated request helper.
31
32
  *
@@ -80,17 +80,16 @@ export class OrgXClient {
80
80
  constructor(apiKey, baseUrl, userId) {
81
81
  this.apiKey = apiKey;
82
82
  this.baseUrl = normalizeClientBaseUrl(baseUrl, DEFAULT_CLIENT_BASE_URL);
83
- this.userId = isUserScopedApiKey(apiKey) ? "" : userId || "";
83
+ // Keep userId available even for oxk_ keys (it can be used as created_by_id for certain writes),
84
+ // but only send it as a header for non-user-scoped keys.
85
+ this.userId = userId || "";
84
86
  }
85
87
  setCredentials(input) {
86
88
  if (typeof input.apiKey === "string") {
87
89
  this.apiKey = input.apiKey;
88
- if (isUserScopedApiKey(this.apiKey)) {
89
- this.userId = "";
90
- }
91
90
  }
92
91
  if (typeof input.userId === "string") {
93
- this.userId = isUserScopedApiKey(this.apiKey) ? "" : input.userId;
92
+ this.userId = input.userId;
94
93
  }
95
94
  if (typeof input.baseUrl === "string" && input.baseUrl.trim().length > 0) {
96
95
  this.baseUrl = normalizeClientBaseUrl(input.baseUrl, this.baseUrl);
@@ -99,6 +98,9 @@ export class OrgXClient {
99
98
  getBaseUrl() {
100
99
  return this.baseUrl;
101
100
  }
101
+ getUserId() {
102
+ return this.userId;
103
+ }
102
104
  // ===========================================================================
103
105
  // HTTP helpers
104
106
  // ===========================================================================
@@ -0,0 +1,147 @@
1
+ export type OnboardingStatus = 'idle' | 'starting' | 'awaiting_browser_auth' | 'pairing' | 'connected' | 'error' | 'manual_key';
2
+ export type OnboardingNextAction = 'connect' | 'wait_for_browser' | 'open_dashboard' | 'retry' | 'start_pairing' | 'open_browser' | 'poll' | 'enter_manual_key' | 'reconnect' | 'none';
3
+ export type OnboardingKeySource = 'config' | 'environment' | 'persisted' | 'openclaw-config-file' | 'legacy-dev' | 'none';
4
+ export interface OnboardingState {
5
+ status: OnboardingStatus;
6
+ hasApiKey: boolean;
7
+ connectionVerified: boolean;
8
+ workspaceName: string | null;
9
+ lastError: string | null;
10
+ nextAction: OnboardingNextAction;
11
+ docsUrl: string;
12
+ keySource?: OnboardingKeySource;
13
+ installationId?: string | null;
14
+ connectUrl: string | null;
15
+ pairingId?: string | null;
16
+ expiresAt: string | null;
17
+ pollIntervalMs: number | null;
18
+ }
19
+ export type RunPhase = 'intent' | 'execution' | 'blocked' | 'review' | 'handoff' | 'completed';
20
+ export type RuntimeSourceClient = 'openclaw' | 'codex' | 'claude-code' | 'api' | 'unknown';
21
+ export type RuntimeProviderLogo = 'codex' | 'openai' | 'anthropic' | 'openclaw' | 'orgx' | 'unknown';
22
+ export type RuntimeInstanceState = 'active' | 'stale' | 'stopped' | 'error';
23
+ export interface RuntimeInstance {
24
+ id: string;
25
+ sourceClient: RuntimeSourceClient;
26
+ displayName: string;
27
+ providerLogo: RuntimeProviderLogo;
28
+ state: RuntimeInstanceState;
29
+ runId: string | null;
30
+ correlationId: string | null;
31
+ initiativeId: string | null;
32
+ workstreamId: string | null;
33
+ taskId: string | null;
34
+ agentId: string | null;
35
+ agentName: string | null;
36
+ phase: string | null;
37
+ progressPct: number | null;
38
+ currentTask: string | null;
39
+ lastHeartbeatAt: string | null;
40
+ lastEventAt: string;
41
+ lastMessage: string | null;
42
+ metadata: Record<string, unknown> | null;
43
+ }
44
+ export type LiveActivityType = 'run_started' | 'run_completed' | 'run_failed' | 'artifact_created' | 'decision_requested' | 'decision_resolved' | 'handoff_requested' | 'handoff_claimed' | 'handoff_fulfilled' | 'blocker_created' | 'milestone_completed' | 'delegation';
45
+ export interface LiveActivityItem {
46
+ id: string;
47
+ type: LiveActivityType;
48
+ title: string;
49
+ description: string | null;
50
+ agentId: string | null;
51
+ agentName: string | null;
52
+ requesterAgentId: string | null;
53
+ requesterAgentName: string | null;
54
+ executorAgentId: string | null;
55
+ executorAgentName: string | null;
56
+ runId: string | null;
57
+ initiativeId: string | null;
58
+ timestamp: string;
59
+ phase?: RunPhase | null;
60
+ state?: string | null;
61
+ kind?: string | null;
62
+ summary?: string | null;
63
+ decisionRequired?: boolean;
64
+ costDelta?: number | null;
65
+ runtimeClient?: RuntimeSourceClient | null;
66
+ runtimeLabel?: string | null;
67
+ runtimeProvider?: RuntimeProviderLogo | null;
68
+ instanceId?: string | null;
69
+ lastHeartbeatAt?: string | null;
70
+ metadata?: Record<string, unknown>;
71
+ }
72
+ export interface LiveDecision {
73
+ id: string;
74
+ title: string;
75
+ context: string | null;
76
+ status: string;
77
+ agentName: string | null;
78
+ requestedAt: string | null;
79
+ updatedAt: string | null;
80
+ waitingMinutes: number;
81
+ metadata?: Record<string, unknown>;
82
+ }
83
+ export interface SessionTreeNode {
84
+ id: string;
85
+ parentId: string | null;
86
+ runId: string;
87
+ title: string;
88
+ agentId: string | null;
89
+ agentName: string | null;
90
+ status: string;
91
+ progress: number | null;
92
+ initiativeId: string | null;
93
+ workstreamId: string | null;
94
+ groupId: string;
95
+ groupLabel: string;
96
+ startedAt: string | null;
97
+ updatedAt: string | null;
98
+ lastEventAt: string | null;
99
+ lastEventSummary: string | null;
100
+ blockers: string[];
101
+ phase?: RunPhase | null;
102
+ state?: string | null;
103
+ eta?: string | null;
104
+ cost?: number | null;
105
+ checkpointCount?: number | null;
106
+ blockerReason?: string | null;
107
+ runtimeClient?: RuntimeSourceClient | null;
108
+ runtimeLabel?: string | null;
109
+ runtimeProvider?: RuntimeProviderLogo | null;
110
+ instanceId?: string | null;
111
+ lastHeartbeatAt?: string | null;
112
+ }
113
+ export interface SessionTreeEdge {
114
+ parentId: string;
115
+ childId: string;
116
+ }
117
+ export interface SessionTreeGroup {
118
+ id: string;
119
+ label: string;
120
+ status: string | null;
121
+ }
122
+ export interface SessionTreeResponse {
123
+ nodes: SessionTreeNode[];
124
+ edges: SessionTreeEdge[];
125
+ groups: SessionTreeGroup[];
126
+ }
127
+ export interface HandoffEvent {
128
+ id: string;
129
+ handoffId: string;
130
+ eventType: string;
131
+ actorType: string | null;
132
+ actorId: string | null;
133
+ payload: Record<string, unknown> | null;
134
+ createdAt: string;
135
+ }
136
+ export interface HandoffSummary {
137
+ id: string;
138
+ title: string;
139
+ status: string;
140
+ priority: string | null;
141
+ summary: string | null;
142
+ currentActorType: string | null;
143
+ currentActorId: string | null;
144
+ createdAt: string;
145
+ updatedAt: string;
146
+ events: HandoffEvent[];
147
+ }
@@ -0,0 +1,3 @@
1
+ // Canonical shared types consumed by both core plugin code and dashboard code.
2
+ // Keep this file dependency-free so it can be imported across build boundaries.
3
+ export {};
@@ -4,6 +4,7 @@
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
8
  export interface OrgXConfig {
8
9
  /** OrgX API key */
9
10
  apiKey: string;
@@ -24,23 +25,6 @@ export interface OrgXConfig {
24
25
  */
25
26
  autoInstallAgentSuiteOnConnect?: boolean;
26
27
  }
27
- export type OnboardingStatus = 'idle' | 'starting' | 'awaiting_browser_auth' | 'pairing' | 'connected' | 'error' | 'manual_key';
28
- export type OnboardingNextAction = 'connect' | 'wait_for_browser' | 'open_dashboard' | 'enter_manual_key' | 'retry' | 'reconnect';
29
- export interface OnboardingState {
30
- status: OnboardingStatus;
31
- hasApiKey: boolean;
32
- connectionVerified: boolean;
33
- workspaceName: string | null;
34
- lastError: string | null;
35
- nextAction: OnboardingNextAction;
36
- docsUrl: string;
37
- keySource: 'config' | 'environment' | 'persisted' | 'openclaw-config-file' | 'legacy-dev' | 'none';
38
- installationId: string | null;
39
- connectUrl: string | null;
40
- pairingId: string | null;
41
- expiresAt: string | null;
42
- pollIntervalMs: number | null;
43
- }
44
28
  export interface OrgSnapshot {
45
29
  /** Active initiatives */
46
30
  initiatives: Initiative[];
@@ -265,7 +249,6 @@ export interface BillingUrlResult {
265
249
  url: string | null;
266
250
  checkout_url?: string | null;
267
251
  }
268
- export type RunPhase = 'intent' | 'execution' | 'blocked' | 'review' | 'handoff' | 'completed';
269
252
  export interface HandoffWorkspaceState {
270
253
  git?: {
271
254
  branch?: string | null;
@@ -397,7 +380,6 @@ export interface EntityListFilters {
397
380
  [key: string]: unknown;
398
381
  }
399
382
  export type ReportingSourceClient = 'openclaw' | 'codex' | 'claude-code' | 'api';
400
- export type RuntimeSourceClient = ReportingSourceClient | 'unknown';
401
383
  export type ReportingPhase = 'intent' | 'execution' | 'blocked' | 'review' | 'handoff' | 'completed';
402
384
  export type ReportingLevel = 'info' | 'warn' | 'error';
403
385
  export type TaskStatus = 'todo' | 'in_progress' | 'done' | 'blocked';
@@ -538,114 +520,3 @@ export interface RecordRunRetroResponse {
538
520
  event_id: string | null;
539
521
  auth_mode?: 'service' | 'api_key';
540
522
  }
541
- export type LiveActivityType = 'run_started' | 'run_completed' | 'run_failed' | 'artifact_created' | 'decision_requested' | 'decision_resolved' | 'handoff_requested' | 'handoff_claimed' | 'handoff_fulfilled' | 'blocker_created' | 'milestone_completed' | 'delegation';
542
- export type RuntimeInstanceState = 'active' | 'stale' | 'stopped' | 'error';
543
- export interface RuntimeInstance {
544
- id: string;
545
- sourceClient: RuntimeSourceClient;
546
- displayName: string;
547
- providerLogo: 'codex' | 'openai' | 'anthropic' | 'openclaw' | 'orgx' | 'unknown';
548
- state: RuntimeInstanceState;
549
- runId: string | null;
550
- correlationId: string | null;
551
- initiativeId: string | null;
552
- workstreamId: string | null;
553
- taskId: string | null;
554
- agentId: string | null;
555
- agentName: string | null;
556
- phase: string | null;
557
- progressPct: number | null;
558
- currentTask: string | null;
559
- lastHeartbeatAt: string | null;
560
- lastEventAt: string;
561
- lastMessage: string | null;
562
- metadata: Record<string, unknown> | null;
563
- }
564
- export interface LiveActivityItem {
565
- id: string;
566
- type: LiveActivityType;
567
- title: string;
568
- description: string | null;
569
- agentId: string | null;
570
- agentName: string | null;
571
- runId: string | null;
572
- initiativeId: string | null;
573
- timestamp: string;
574
- phase?: RunPhase | null;
575
- state?: string | null;
576
- kind?: string | null;
577
- summary?: string | null;
578
- decisionRequired?: boolean;
579
- costDelta?: number | null;
580
- runtimeClient?: RuntimeSourceClient | null;
581
- runtimeLabel?: string | null;
582
- runtimeProvider?: RuntimeInstance['providerLogo'] | null;
583
- instanceId?: string | null;
584
- lastHeartbeatAt?: string | null;
585
- metadata?: Record<string, unknown>;
586
- }
587
- export interface SessionTreeNode {
588
- id: string;
589
- parentId: string | null;
590
- runId: string;
591
- title: string;
592
- agentId: string | null;
593
- agentName: string | null;
594
- status: string;
595
- progress: number | null;
596
- initiativeId: string | null;
597
- workstreamId: string | null;
598
- groupId: string;
599
- groupLabel: string;
600
- startedAt: string | null;
601
- updatedAt: string | null;
602
- lastEventAt: string | null;
603
- lastEventSummary: string | null;
604
- blockers: string[];
605
- phase?: RunPhase | null;
606
- state?: string | null;
607
- eta?: string | null;
608
- cost?: number | null;
609
- checkpointCount?: number | null;
610
- blockerReason?: string | null;
611
- runtimeClient?: RuntimeSourceClient | null;
612
- runtimeLabel?: string | null;
613
- runtimeProvider?: RuntimeInstance['providerLogo'] | null;
614
- instanceId?: string | null;
615
- lastHeartbeatAt?: string | null;
616
- }
617
- export interface SessionTreeEdge {
618
- parentId: string;
619
- childId: string;
620
- }
621
- export interface SessionTreeGroup {
622
- id: string;
623
- label: string;
624
- status: string | null;
625
- }
626
- export interface SessionTreeResponse {
627
- nodes: SessionTreeNode[];
628
- edges: SessionTreeEdge[];
629
- groups: SessionTreeGroup[];
630
- }
631
- export interface HandoffEvent {
632
- id: string;
633
- handoffId: string;
634
- eventType: string;
635
- actorType: string | null;
636
- actorId: string | null;
637
- payload: Record<string, unknown> | null;
638
- createdAt: string;
639
- }
640
- export interface HandoffSummary {
641
- id: string;
642
- title: string;
643
- status: string;
644
- priority: string | null;
645
- summary: string | null;
646
- currentActorType: string | null;
647
- currentActorId: string | null;
648
- createdAt: string;
649
- updatedAt: string;
650
- events: HandoffEvent[];
651
- }
@@ -5,3 +5,8 @@
5
5
  * Mirrors the server-side types in orgx/lib/client-integration/types.ts
6
6
  */
7
7
  export {};
8
+ // =============================================================================
9
+ // LIVE SESSION GRAPH + HANDOFFS
10
+ // =============================================================================
11
+ // Live/session/handoff activity shapes are imported and re-exported from
12
+ // ./shared-types.ts to keep dashboard and plugin contracts in lockstep.
@@ -0,0 +1,36 @@
1
+ export type AutoAssignedAgent = {
2
+ id: string;
3
+ name: string;
4
+ domain: string | null;
5
+ };
6
+ export declare function autoAssignEntityForCreate(input: {
7
+ client: {
8
+ getLiveAgents: (payload: {
9
+ initiative: string | null;
10
+ includeIdle: boolean;
11
+ }) => Promise<{
12
+ agents?: unknown[];
13
+ }>;
14
+ delegationPreflight: (payload: {
15
+ intent: string;
16
+ }) => Promise<{
17
+ data?: {
18
+ recommended_split?: Array<{
19
+ owner_domain?: string | null;
20
+ }>;
21
+ };
22
+ }>;
23
+ updateEntity: (entityType: string, entityId: string, payload: Record<string, unknown>) => Promise<unknown>;
24
+ };
25
+ toErrorMessage: (err: unknown) => string;
26
+ entityType: string;
27
+ entityId: string;
28
+ initiativeId: string | null;
29
+ title: string;
30
+ summary: string | null;
31
+ }): Promise<{
32
+ assignmentSource: "orchestrator" | "fallback" | "manual";
33
+ assignedAgents: AutoAssignedAgent[];
34
+ warnings: string[];
35
+ updatedEntity: Record<string, unknown> | null;
36
+ }>;