@triflux/remote 10.50.1 → 10.51.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.
- package/cto/brief.mjs +0 -12
- package/cto/collect.mjs +16 -247
- package/cto/current.schema.json +4 -20
- package/cto/events.mjs +13 -294
- package/cto/hygiene.mjs +26 -346
- package/cto/lake-root.mjs +114 -16
- package/cto/status.mjs +33 -128
- package/hub/index.mjs +0 -8
- package/hub/store-adapter.mjs +1 -1
- package/hub/team/agent-map.json +0 -1
- package/hub/team/ansi.mjs +1 -35
- package/hub/team/backend.mjs +9 -145
- package/hub/team/cli/commands/attach.mjs +1 -17
- package/hub/team/cli/commands/control.mjs +12 -38
- package/hub/team/cli/commands/debug.mjs +1 -37
- package/hub/team/cli/commands/focus.mjs +5 -31
- package/hub/team/cli/commands/interrupt.mjs +6 -25
- package/hub/team/cli/commands/kill.mjs +1 -30
- package/hub/team/cli/commands/list.mjs +0 -16
- package/hub/team/cli/commands/send.mjs +6 -26
- package/hub/team/cli/commands/start/index.mjs +41 -133
- package/hub/team/cli/commands/start/parse-args.mjs +15 -40
- package/hub/team/cli/commands/start/start-headless.mjs +138 -105
- package/hub/team/cli/commands/start/start-mux.mjs +0 -3
- package/hub/team/cli/commands/status.mjs +2 -57
- package/hub/team/cli/commands/stop.mjs +14 -19
- package/hub/team/cli/help.mjs +4 -5
- package/hub/team/cli/manifest.mjs +5 -1
- package/hub/team/cli/render.mjs +0 -12
- package/hub/team/cli/services/hub-client.mjs +2 -88
- package/hub/team/cli/services/runtime-mode.mjs +27 -98
- package/hub/team/handoff.mjs +3 -34
- package/hub/team/headless.mjs +14 -755
- package/hub/team/orchestrator.mjs +4 -30
- package/hub/team/pane.mjs +6 -28
- package/hub/team/psmux.mjs +16 -403
- package/hub/team/remote-session.mjs +1 -2
- package/hub/team/session.mjs +8 -119
- package/hub/team/swarm-intent.mjs +0 -198
- package/hub/team/terminal-opener.mjs +11 -35
- package/hub/team/tui-core.mjs +1 -1
- package/hub/team/tui-viewer.mjs +2 -2
- package/hub/team/tui.mjs +8 -269
- package/hub/team/wt-manager.mjs +2 -2
- package/hub/workers/factory.mjs +4 -37
- package/hub/workers/lib/jsonrpc-ws-uds.mjs +0 -2
- package/package.json +1 -1
- package/scripts/lib/agent-route-policy.mjs +162 -14
- package/scripts/lib/claudemd-scanner.mjs +2 -199
- package/scripts/lib/cli-claude.mjs +0 -2
- package/scripts/lib/context.mjs +3 -19
- package/scripts/lib/env-probe.mjs +5 -64
- package/scripts/lib/gemini-profiles.mjs +2 -69
- package/scripts/lib/legacy-mcp-cleanup.mjs +14 -3
- package/scripts/lib/machine-profile.mjs +3 -17
- package/scripts/lib/mcp-filter.mjs +109 -53
- package/scripts/lib/mcp-health.mjs +2 -2
- package/scripts/lib/mcp-server-catalog.mjs +2 -2
- package/scripts/lib/psmux-info.mjs +25 -104
- package/scripts/lib/skill-template.mjs +0 -271
- package/cto/hygiene-actions.mjs +0 -355
- package/cto/hygiene-notify.mjs +0 -170
- package/hub/team/build-worker-prompt.mjs +0 -92
- package/hub/team/check-mcp-hub.mjs +0 -49
- package/hub/team/claude-native-bridge.mjs +0 -987
- package/hub/team/cli/commands/start/start-in-process.mjs +0 -50
- package/hub/team/cli/commands/start/start-wt.mjs +0 -86
- package/hub/team/cli/services/native-control.mjs +0 -145
- package/hub/team/codex-review.mjs +0 -520
- package/hub/team/conductor-mesh-bridge.mjs +0 -122
- package/hub/team/conductor.mjs +0 -1529
- package/hub/team/consensus-meta.mjs +0 -176
- package/hub/team/cto-pull.mjs +0 -31
- package/hub/team/daemon-pty-tmux-bridge.mjs +0 -146
- package/hub/team/dashboard.mjs +0 -322
- package/hub/team/event-log.mjs +0 -84
- package/hub/team/execution-mode.mjs +0 -324
- package/hub/team/extract-completion-payload.mjs +0 -110
- package/hub/team/headless-bridge-session.mjs +0 -17
- package/hub/team/health-probe.mjs +0 -435
- package/hub/team/interactive-native-launcher.mjs +0 -119
- package/hub/team/interactive-native-worker.mjs +0 -80
- package/hub/team/interactive-tui-transport.mjs +0 -479
- package/hub/team/launcher-template.mjs +0 -144
- package/hub/team/mcp-selector.mjs +0 -145
- package/hub/team/native-supervisor.mjs +0 -460
- package/hub/team/native.mjs +0 -727
- package/hub/team/recovery-store.mjs +0 -149
- package/hub/team/remote-probe.mjs +0 -292
- package/hub/team/remote-watcher.mjs +0 -506
- package/hub/team/runtime-strategy.mjs +0 -200
- package/hub/team/schemas/worker-completion.json +0 -39
- package/hub/team/sentinel-capture.mjs +0 -127
- package/hub/team/swarm-cli.mjs +0 -390
- package/hub/team/swarm-hypervisor.mjs +0 -2206
- package/hub/team/swarm-locks.mjs +0 -335
- package/hub/team/swarm-planner.mjs +0 -371
- package/hub/team/swarm-preflight.mjs +0 -366
- package/hub/team/swarm-reconciler.mjs +0 -242
- package/hub/team/tui-remote-adapter.mjs +0 -377
- package/hub/team/worker-completion-validator.mjs +0 -79
- package/hub/team/worktree-lifecycle.mjs +0 -639
- package/hub/team/wt-templates.json +0 -43
- package/hub/workers/antigravity-route-worker.mjs +0 -179
- package/hub/workers/gemini-worker.mjs +0 -217
- package/scripts/lib/agent-json.mjs +0 -27
- package/scripts/lib/async.mjs +0 -174
- package/scripts/lib/cli-agy.mjs +0 -85
- package/scripts/lib/cli-codex.mjs +0 -62
- package/scripts/lib/cli-gemini.mjs +0 -37
- package/scripts/lib/dynamic-route-cli.mjs +0 -107
- package/scripts/lib/env.mjs +0 -14
- package/scripts/lib/hub.mjs +0 -48
- package/scripts/lib/pid.mjs +0 -63
- package/scripts/lib/quota.mjs +0 -47
- package/scripts/lib/skill-state.mjs +0 -220
- package/scripts/lib/team.mjs +0 -75
- package/scripts/lib/timeout.mjs +0 -66
- package/scripts/lib/tmp.mjs +0 -26
- package/scripts/lib/toml.mjs +0 -132
package/cto/events.mjs
CHANGED
|
@@ -6,12 +6,13 @@ import {
|
|
|
6
6
|
unlinkSync,
|
|
7
7
|
} from "node:fs";
|
|
8
8
|
import { basename, join } from "node:path";
|
|
9
|
-
import {
|
|
9
|
+
import { pathLabel, shortHash, toIsoTime } from "./lake-root.mjs";
|
|
10
10
|
|
|
11
11
|
export const CTO_EVENT_SCHEMA_VERSION = "cto-event.v1";
|
|
12
12
|
export const DEFAULT_CTO_EVENT_SOURCE = "tfx_cto_event";
|
|
13
13
|
|
|
14
14
|
export const CTO_EVENT_TYPES = Object.freeze([
|
|
15
|
+
"collect",
|
|
15
16
|
"session_started",
|
|
16
17
|
"session_heartbeat",
|
|
17
18
|
"session_stale",
|
|
@@ -42,98 +43,6 @@ export const CTO_HYGIENE_STATUSES = Object.freeze([
|
|
|
42
43
|
const EVENT_TYPE_SET = new Set(CTO_EVENT_TYPES);
|
|
43
44
|
const STATUS_SET = new Set(CTO_HYGIENE_STATUSES);
|
|
44
45
|
|
|
45
|
-
const EVENT_PRESETS = Object.freeze({
|
|
46
|
-
"context-save": {
|
|
47
|
-
event: "checkpoint_saved",
|
|
48
|
-
source: "gstack_context_save",
|
|
49
|
-
actor: { cli: "gstack context-save" },
|
|
50
|
-
ownerSurface: "gstack context-save -> tfx cto event context-save",
|
|
51
|
-
},
|
|
52
|
-
"checkpoint-saved": {
|
|
53
|
-
event: "checkpoint_saved",
|
|
54
|
-
ownerSurface: "checkpoint wrapper -> tfx cto event checkpoint-saved",
|
|
55
|
-
},
|
|
56
|
-
"context-restore": {
|
|
57
|
-
event: "checkpoint_restored",
|
|
58
|
-
source: "gstack_context_restore",
|
|
59
|
-
actor: { cli: "gstack context-restore" },
|
|
60
|
-
ownerSurface: "gstack context-restore -> tfx cto event context-restore",
|
|
61
|
-
},
|
|
62
|
-
"checkpoint-restored": {
|
|
63
|
-
event: "checkpoint_restored",
|
|
64
|
-
ownerSurface: "checkpoint wrapper -> tfx cto event checkpoint-restored",
|
|
65
|
-
},
|
|
66
|
-
"pr-created": {
|
|
67
|
-
event: "pr_created",
|
|
68
|
-
source: "tfx_pr_lifecycle",
|
|
69
|
-
actor: { cli: "gh pr create" },
|
|
70
|
-
ownerSurface: "gh pr create/merge/close -> tfx cto event pr-created",
|
|
71
|
-
},
|
|
72
|
-
"pr-merged": {
|
|
73
|
-
event: "pr_merged_or_closed",
|
|
74
|
-
source: "tfx_pr_lifecycle",
|
|
75
|
-
status: "completed",
|
|
76
|
-
actor: { cli: "gh pr merge" },
|
|
77
|
-
ownerSurface:
|
|
78
|
-
"gh pr create/merge/close -> tfx cto event pr-merged-or-closed",
|
|
79
|
-
},
|
|
80
|
-
"pr-closed": {
|
|
81
|
-
event: "pr_merged_or_closed",
|
|
82
|
-
source: "tfx_pr_lifecycle",
|
|
83
|
-
status: "completed",
|
|
84
|
-
actor: { cli: "gh pr close" },
|
|
85
|
-
ownerSurface:
|
|
86
|
-
"gh pr create/merge/close -> tfx cto event pr-merged-or-closed",
|
|
87
|
-
},
|
|
88
|
-
"pr-merged-or-closed": {
|
|
89
|
-
event: "pr_merged_or_closed",
|
|
90
|
-
source: "tfx_pr_lifecycle",
|
|
91
|
-
actor: { cli: "gh pr merge/close" },
|
|
92
|
-
ownerSurface:
|
|
93
|
-
"gh pr create/merge/close -> tfx cto event pr-merged-or-closed",
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
const OPTION_KEYS = Object.freeze({
|
|
98
|
-
event: "event",
|
|
99
|
-
"event-type": "event",
|
|
100
|
-
source: "source",
|
|
101
|
-
summary: "summary",
|
|
102
|
-
now: "now",
|
|
103
|
-
ts: "ts",
|
|
104
|
-
status: "status",
|
|
105
|
-
"session-id": "session_id",
|
|
106
|
-
"parent-session-id": "parent_session_id",
|
|
107
|
-
"restored-from-session-id": "restored_from_session_id",
|
|
108
|
-
"checkpoint-id": "checkpoint_id",
|
|
109
|
-
"artifact-path": "artifact_path",
|
|
110
|
-
artifact: "artifact_path",
|
|
111
|
-
"task-id": "task_id",
|
|
112
|
-
branch: "branch",
|
|
113
|
-
"last-seen-at": "last_seen_at",
|
|
114
|
-
"stale-reason": "stale_reason",
|
|
115
|
-
"hygiene-key": "hygiene_key",
|
|
116
|
-
"hygiene-kind": "hygiene_kind",
|
|
117
|
-
"hygiene-id": "hygiene_id",
|
|
118
|
-
"hygiene-action": "hygiene_action",
|
|
119
|
-
"project-root": "project_root",
|
|
120
|
-
"worktree-path": "worktree_path",
|
|
121
|
-
worktree: "worktree_path",
|
|
122
|
-
issue: "issue_refs",
|
|
123
|
-
"issue-ref": "issue_refs",
|
|
124
|
-
"issue-refs": "issue_refs",
|
|
125
|
-
pr: "pr_refs",
|
|
126
|
-
"pr-ref": "pr_refs",
|
|
127
|
-
"pr-refs": "pr_refs",
|
|
128
|
-
"actor-cli": "actor.cli",
|
|
129
|
-
"actor-session-id": "actor.session_id",
|
|
130
|
-
"actor-agent-id": "actor.agent_id",
|
|
131
|
-
"actor-host": "actor.host",
|
|
132
|
-
"owner-surface": "owner_surface",
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
const COLLECTION_KEYS = new Set(["issue_refs", "pr_refs"]);
|
|
136
|
-
|
|
137
46
|
function sleep(ms) {
|
|
138
47
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
139
48
|
}
|
|
@@ -144,31 +53,6 @@ function maybeString(value) {
|
|
|
144
53
|
return trimmed || null;
|
|
145
54
|
}
|
|
146
55
|
|
|
147
|
-
function toIsoTime(value) {
|
|
148
|
-
if (typeof value === "string" && value.trim()) return value;
|
|
149
|
-
if (value instanceof Date) return value.toISOString();
|
|
150
|
-
if (typeof value === "number" && Number.isFinite(value)) {
|
|
151
|
-
return new Date(value).toISOString();
|
|
152
|
-
}
|
|
153
|
-
return new Date().toISOString();
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function shortHash(value) {
|
|
157
|
-
const str = String(value ?? "");
|
|
158
|
-
let h = 5381;
|
|
159
|
-
for (let i = 0; i < str.length; i += 1) {
|
|
160
|
-
h = (h * 33) ^ str.charCodeAt(i);
|
|
161
|
-
}
|
|
162
|
-
return (h >>> 0).toString(36);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function pathLabel(value) {
|
|
166
|
-
const str = String(value ?? "").replace(/[/\\]+$/u, "");
|
|
167
|
-
if (!str) return null;
|
|
168
|
-
const segments = str.split(/[/\\]+/u);
|
|
169
|
-
return segments[segments.length - 1] || null;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
56
|
function normalizeNumericRefs(values) {
|
|
173
57
|
const rawValues = Array.isArray(values)
|
|
174
58
|
? values
|
|
@@ -200,124 +84,6 @@ function normalizeActor(actor) {
|
|
|
200
84
|
return Object.keys(normalized).length > 0 ? normalized : null;
|
|
201
85
|
}
|
|
202
86
|
|
|
203
|
-
function optionName(raw) {
|
|
204
|
-
return String(raw || "")
|
|
205
|
-
.replace(/^--?/u, "")
|
|
206
|
-
.trim();
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function appendCollection(target, key, value) {
|
|
210
|
-
const values = String(value ?? "")
|
|
211
|
-
.split(",")
|
|
212
|
-
.map((item) => item.trim())
|
|
213
|
-
.filter(Boolean);
|
|
214
|
-
if (values.length === 0) return;
|
|
215
|
-
if (!Array.isArray(target[key])) target[key] = [];
|
|
216
|
-
target[key].push(...values);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function putPathValue(target, keyPath, value) {
|
|
220
|
-
if (keyPath.startsWith("actor.")) {
|
|
221
|
-
const key = keyPath.slice("actor.".length);
|
|
222
|
-
target.actor ||= {};
|
|
223
|
-
target.actor[key] = value;
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
if (COLLECTION_KEYS.has(keyPath)) {
|
|
227
|
-
appendCollection(target, keyPath, value);
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
target[keyPath] = value;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
function parseEventArgs(args = []) {
|
|
234
|
-
const fields = {};
|
|
235
|
-
const positional = [];
|
|
236
|
-
let json = false;
|
|
237
|
-
|
|
238
|
-
for (let i = 0; i < args.length; i += 1) {
|
|
239
|
-
const arg = args[i];
|
|
240
|
-
if (arg === "--json") {
|
|
241
|
-
json = true;
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
if (!arg?.startsWith?.("--")) {
|
|
245
|
-
positional.push(arg);
|
|
246
|
-
continue;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
const eqIndex = arg.indexOf("=");
|
|
250
|
-
const rawName = eqIndex >= 0 ? arg.slice(0, eqIndex) : arg;
|
|
251
|
-
const name = optionName(rawName);
|
|
252
|
-
const mapped = OPTION_KEYS[name];
|
|
253
|
-
if (!mapped) {
|
|
254
|
-
throw new Error(`unknown tfx cto event option: --${name}`);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
let value = eqIndex >= 0 ? arg.slice(eqIndex + 1) : null;
|
|
258
|
-
if (value === null) {
|
|
259
|
-
const next = args[i + 1];
|
|
260
|
-
if (typeof next === "string" && !next.startsWith("--")) {
|
|
261
|
-
value = next;
|
|
262
|
-
i += 1;
|
|
263
|
-
} else {
|
|
264
|
-
value = "true";
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
putPathValue(fields, mapped, value);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
return {
|
|
271
|
-
presetName: positional[0] || null,
|
|
272
|
-
extraPositionals: positional.slice(1),
|
|
273
|
-
fields,
|
|
274
|
-
json,
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
function mergeActor(defaultActor, overrideActor) {
|
|
279
|
-
const actor = { ...(defaultActor || {}), ...(overrideActor || {}) };
|
|
280
|
-
return Object.keys(actor).length > 0 ? actor : undefined;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function defaultEventSummary(input) {
|
|
284
|
-
if (input.event === "checkpoint_saved") {
|
|
285
|
-
return `context-save checkpoint ${input.checkpoint_id}`;
|
|
286
|
-
}
|
|
287
|
-
if (input.event === "checkpoint_restored") {
|
|
288
|
-
return `context-restore checkpoint ${input.checkpoint_id}`;
|
|
289
|
-
}
|
|
290
|
-
if (input.event === "pr_created") {
|
|
291
|
-
const [pr] = normalizeNumericRefs(input.pr_refs);
|
|
292
|
-
return pr ? `PR #${pr} created` : "PR created";
|
|
293
|
-
}
|
|
294
|
-
if (input.event === "pr_merged_or_closed") {
|
|
295
|
-
const [pr] = normalizeNumericRefs(input.pr_refs);
|
|
296
|
-
return pr ? `PR #${pr} merged or closed` : "PR merged or closed";
|
|
297
|
-
}
|
|
298
|
-
return undefined;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
function validateRunEventInput(input) {
|
|
302
|
-
if (!input.event) {
|
|
303
|
-
throw new Error("tfx cto event requires a preset or --event <event_type>");
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
if (
|
|
307
|
-
["checkpoint_saved", "checkpoint_restored"].includes(input.event) &&
|
|
308
|
-
!maybeString(input.checkpoint_id)
|
|
309
|
-
) {
|
|
310
|
-
throw new Error(`tfx cto event ${input.event} requires --checkpoint-id`);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
if (
|
|
314
|
-
["pr_created", "pr_merged_or_closed"].includes(input.event) &&
|
|
315
|
-
normalizeNumericRefs(input.pr_refs).length === 0
|
|
316
|
-
) {
|
|
317
|
-
throw new Error(`tfx cto event ${input.event} requires --pr`);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
87
|
function putString(target, key, value) {
|
|
322
88
|
const normalized = maybeString(value);
|
|
323
89
|
if (normalized) target[key] = normalized;
|
|
@@ -341,7 +107,16 @@ export function normalizeCtoEvent(input = {}) {
|
|
|
341
107
|
throw new Error(`invalid CTO status: ${status}`);
|
|
342
108
|
}
|
|
343
109
|
|
|
344
|
-
const ts = toIsoTime(input.now ?? input.ts);
|
|
110
|
+
const ts = toIsoTime(input.now ?? input.ts) || new Date().toISOString();
|
|
111
|
+
if (eventType === "collect") {
|
|
112
|
+
return {
|
|
113
|
+
ts,
|
|
114
|
+
event: eventType,
|
|
115
|
+
source: maybeString(input.source) || "tfx_cto_collect",
|
|
116
|
+
summary: maybeString(input.summary) || eventType,
|
|
117
|
+
ref: input.ref ?? null,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
345
120
|
const ref = {
|
|
346
121
|
schema_version: CTO_EVENT_SCHEMA_VERSION,
|
|
347
122
|
event_type: eventType,
|
|
@@ -416,7 +191,7 @@ export async function appendCtoEvent(lakeRoot, input, opts = {}) {
|
|
|
416
191
|
|
|
417
192
|
if (fd === null) {
|
|
418
193
|
stderr.write(
|
|
419
|
-
"[tfx cto
|
|
194
|
+
"[tfx cto] warning: ledger lock timeout; skipped ledger append\n",
|
|
420
195
|
);
|
|
421
196
|
return { appended: false, event };
|
|
422
197
|
}
|
|
@@ -431,59 +206,3 @@ export async function appendCtoEvent(lakeRoot, input, opts = {}) {
|
|
|
431
206
|
} catch {}
|
|
432
207
|
}
|
|
433
208
|
}
|
|
434
|
-
|
|
435
|
-
export async function runEvent(args = [], opts = {}) {
|
|
436
|
-
const parsed = parseEventArgs(args);
|
|
437
|
-
if (parsed.extraPositionals.length > 0) {
|
|
438
|
-
throw new Error(
|
|
439
|
-
`unexpected tfx cto event argument: ${parsed.extraPositionals[0]}`,
|
|
440
|
-
);
|
|
441
|
-
}
|
|
442
|
-
const preset = parsed.presetName ? EVENT_PRESETS[parsed.presetName] : null;
|
|
443
|
-
if (parsed.presetName && !preset && !parsed.fields.event) {
|
|
444
|
-
throw new Error(`unknown tfx cto event preset: ${parsed.presetName}`);
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
const rootDir = opts.rootDir || resolveLakeRootDir(process.cwd());
|
|
448
|
-
const lakeRoot = opts.lakeRoot || join(rootDir, ".triflux", "lake");
|
|
449
|
-
const stdout = opts.stdout || process.stdout;
|
|
450
|
-
const jsonOut = opts.json === true || parsed.json;
|
|
451
|
-
const ownerSurface =
|
|
452
|
-
parsed.fields.owner_surface ||
|
|
453
|
-
preset?.ownerSurface ||
|
|
454
|
-
"external wrapper -> tfx cto event --event";
|
|
455
|
-
|
|
456
|
-
const input = {
|
|
457
|
-
...(preset || {}),
|
|
458
|
-
...parsed.fields,
|
|
459
|
-
actor: mergeActor(preset?.actor, parsed.fields.actor),
|
|
460
|
-
};
|
|
461
|
-
delete input.ownerSurface;
|
|
462
|
-
delete input.owner_surface;
|
|
463
|
-
if (!input.project_root) input.project_root = rootDir;
|
|
464
|
-
if (!input.summary) input.summary = defaultEventSummary(input);
|
|
465
|
-
|
|
466
|
-
validateRunEventInput(input);
|
|
467
|
-
|
|
468
|
-
const result = await appendCtoEvent(lakeRoot, input, {
|
|
469
|
-
stderr: opts.stderr,
|
|
470
|
-
lockRetries: opts.ledgerLockRetries,
|
|
471
|
-
lockRetryDelayMs: opts.ledgerLockRetryDelayMs,
|
|
472
|
-
});
|
|
473
|
-
const payload = {
|
|
474
|
-
appended: result.appended,
|
|
475
|
-
owner_surface: ownerSurface,
|
|
476
|
-
event: result.event,
|
|
477
|
-
};
|
|
478
|
-
|
|
479
|
-
if (jsonOut) {
|
|
480
|
-
stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
|
|
481
|
-
} else {
|
|
482
|
-
const status = result.appended ? "appended" : "skipped";
|
|
483
|
-
stdout.write(
|
|
484
|
-
`[tfx cto event] ${status} ${result.event.event} via ${ownerSurface}\n`,
|
|
485
|
-
);
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
return payload;
|
|
489
|
-
}
|