@monoes/monomindcli 2.16.13 → 2.16.14
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/README.md +1 -1
- package/dist/src/commands/org-control.d.ts +117 -0
- package/dist/src/commands/org-control.d.ts.map +1 -0
- package/dist/src/commands/org-control.js +274 -0
- package/dist/src/commands/org-control.js.map +1 -0
- package/dist/src/commands/org-lifecycle.d.ts +7 -0
- package/dist/src/commands/org-lifecycle.d.ts.map +1 -0
- package/dist/src/commands/org-lifecycle.js +298 -0
- package/dist/src/commands/org-lifecycle.js.map +1 -0
- package/dist/src/commands/org-manage.d.ts +7 -0
- package/dist/src/commands/org-manage.d.ts.map +1 -0
- package/dist/src/commands/org-manage.js +357 -0
- package/dist/src/commands/org-manage.js.map +1 -0
- package/dist/src/commands/org-memory-command.d.ts +3 -0
- package/dist/src/commands/org-memory-command.d.ts.map +1 -0
- package/dist/src/commands/org-memory-command.js +178 -0
- package/dist/src/commands/org-memory-command.js.map +1 -0
- package/dist/src/commands/org-observe-approvals.d.ts +8 -0
- package/dist/src/commands/org-observe-approvals.d.ts.map +1 -0
- package/dist/src/commands/org-observe-approvals.js +211 -0
- package/dist/src/commands/org-observe-approvals.js.map +1 -0
- package/dist/src/commands/org-observe-checkpoint.d.ts +26 -0
- package/dist/src/commands/org-observe-checkpoint.d.ts.map +1 -0
- package/dist/src/commands/org-observe-checkpoint.js +180 -0
- package/dist/src/commands/org-observe-checkpoint.js.map +1 -0
- package/dist/src/commands/org-observe-config.d.ts +8 -0
- package/dist/src/commands/org-observe-config.d.ts.map +1 -0
- package/dist/src/commands/org-observe-config.js +160 -0
- package/dist/src/commands/org-observe-config.js.map +1 -0
- package/dist/src/commands/org-observe-gates.d.ts +4 -0
- package/dist/src/commands/org-observe-gates.d.ts.map +1 -0
- package/dist/src/commands/org-observe-gates.js +182 -0
- package/dist/src/commands/org-observe-gates.js.map +1 -0
- package/dist/src/commands/org-observe-inbox.d.ts +18 -0
- package/dist/src/commands/org-observe-inbox.d.ts.map +1 -0
- package/dist/src/commands/org-observe-inbox.js +154 -0
- package/dist/src/commands/org-observe-inbox.js.map +1 -0
- package/dist/src/commands/org-observe-logs.d.ts +31 -0
- package/dist/src/commands/org-observe-logs.d.ts.map +1 -0
- package/dist/src/commands/org-observe-logs.js +272 -0
- package/dist/src/commands/org-observe-logs.js.map +1 -0
- package/dist/src/commands/org-observe-questions.d.ts +8 -0
- package/dist/src/commands/org-observe-questions.d.ts.map +1 -0
- package/dist/src/commands/org-observe-questions.js +201 -0
- package/dist/src/commands/org-observe-questions.js.map +1 -0
- package/dist/src/commands/org-observe-report.d.ts +8 -0
- package/dist/src/commands/org-observe-report.d.ts.map +1 -0
- package/dist/src/commands/org-observe-report.js +366 -0
- package/dist/src/commands/org-observe-report.js.map +1 -0
- package/dist/src/commands/org-observe-shared.d.ts +20 -0
- package/dist/src/commands/org-observe-shared.d.ts.map +1 -0
- package/dist/src/commands/org-observe-shared.js +55 -0
- package/dist/src/commands/org-observe-shared.js.map +1 -0
- package/dist/src/commands/org-observe.d.ts +9 -101
- package/dist/src/commands/org-observe.d.ts.map +1 -1
- package/dist/src/commands/org-observe.js +12 -1675
- package/dist/src/commands/org-observe.js.map +1 -1
- package/dist/src/commands/org-poll.d.ts +57 -0
- package/dist/src/commands/org-poll.d.ts.map +1 -0
- package/dist/src/commands/org-poll.js +194 -0
- package/dist/src/commands/org-poll.js.map +1 -0
- package/dist/src/commands/org-run.d.ts +3 -0
- package/dist/src/commands/org-run.d.ts.map +1 -0
- package/dist/src/commands/org-run.js +449 -0
- package/dist/src/commands/org-run.js.map +1 -0
- package/dist/src/commands/org-serve.d.ts +19 -0
- package/dist/src/commands/org-serve.d.ts.map +1 -0
- package/dist/src/commands/org-serve.js +395 -0
- package/dist/src/commands/org-serve.js.map +1 -0
- package/dist/src/commands/org-subcommands-config.d.ts +8 -0
- package/dist/src/commands/org-subcommands-config.d.ts.map +1 -0
- package/dist/src/commands/org-subcommands-config.js +93 -0
- package/dist/src/commands/org-subcommands-config.js.map +1 -0
- package/dist/src/commands/org-subcommands-hil.d.ts +11 -0
- package/dist/src/commands/org-subcommands-hil.d.ts.map +1 -0
- package/dist/src/commands/org-subcommands-hil.js +216 -0
- package/dist/src/commands/org-subcommands-hil.js.map +1 -0
- package/dist/src/commands/org-subcommands-observe.d.ts +12 -0
- package/dist/src/commands/org-subcommands-observe.d.ts.map +1 -0
- package/dist/src/commands/org-subcommands-observe.js +249 -0
- package/dist/src/commands/org-subcommands-observe.js.map +1 -0
- package/dist/src/commands/org-subcommands-runtime.d.ts +12 -0
- package/dist/src/commands/org-subcommands-runtime.d.ts.map +1 -0
- package/dist/src/commands/org-subcommands-runtime.js +163 -0
- package/dist/src/commands/org-subcommands-runtime.js.map +1 -0
- package/dist/src/commands/org.d.ts +3 -151
- package/dist/src/commands/org.d.ts.map +1 -1
- package/dist/src/commands/org.js +43 -2735
- package/dist/src/commands/org.js.map +1 -1
- package/dist/src/orgrt/daemon-types.d.ts +196 -0
- package/dist/src/orgrt/daemon-types.d.ts.map +1 -0
- package/dist/src/orgrt/daemon-types.js +38 -0
- package/dist/src/orgrt/daemon-types.js.map +1 -0
- package/dist/src/orgrt/daemon.d.ts +70 -300
- package/dist/src/orgrt/daemon.d.ts.map +1 -1
- package/dist/src/orgrt/daemon.js +41 -2536
- package/dist/src/orgrt/daemon.js.map +1 -1
- package/dist/src/orgrt/idle-watchdog.d.ts +39 -0
- package/dist/src/orgrt/idle-watchdog.d.ts.map +1 -0
- package/dist/src/orgrt/idle-watchdog.js +289 -0
- package/dist/src/orgrt/idle-watchdog.js.map +1 -0
- package/dist/src/orgrt/org-reload.d.ts +7 -0
- package/dist/src/orgrt/org-reload.d.ts.map +1 -0
- package/dist/src/orgrt/org-reload.js +111 -0
- package/dist/src/orgrt/org-reload.js.map +1 -0
- package/dist/src/orgrt/org-start-steps.d.ts +21 -0
- package/dist/src/orgrt/org-start-steps.d.ts.map +1 -0
- package/dist/src/orgrt/org-start-steps.js +305 -0
- package/dist/src/orgrt/org-start-steps.js.map +1 -0
- package/dist/src/orgrt/org-start.d.ts +7 -0
- package/dist/src/orgrt/org-start.d.ts.map +1 -0
- package/dist/src/orgrt/org-start.js +435 -0
- package/dist/src/orgrt/org-start.js.map +1 -0
- package/dist/src/orgrt/org-state-file.d.ts +8 -0
- package/dist/src/orgrt/org-state-file.d.ts.map +1 -0
- package/dist/src/orgrt/org-state-file.js +116 -0
- package/dist/src/orgrt/org-state-file.js.map +1 -0
- package/dist/src/orgrt/org-stop.d.ts +6 -0
- package/dist/src/orgrt/org-stop.d.ts.map +1 -0
- package/dist/src/orgrt/org-stop.js +332 -0
- package/dist/src/orgrt/org-stop.js.map +1 -0
- package/dist/src/orgrt/org-tools.d.ts +11 -0
- package/dist/src/orgrt/org-tools.d.ts.map +1 -0
- package/dist/src/orgrt/org-tools.js +305 -0
- package/dist/src/orgrt/org-tools.js.map +1 -0
- package/dist/src/orgrt/role-incarnation.d.ts +18 -0
- package/dist/src/orgrt/role-incarnation.d.ts.map +1 -0
- package/dist/src/orgrt/role-incarnation.js +374 -0
- package/dist/src/orgrt/role-incarnation.js.map +1 -0
- package/dist/src/orgrt/role-respawn.d.ts +7 -0
- package/dist/src/orgrt/role-respawn.d.ts.map +1 -0
- package/dist/src/orgrt/role-respawn.js +318 -0
- package/dist/src/orgrt/role-respawn.js.map +1 -0
- package/dist/src/orgrt/role-session-opts.d.ts +389 -0
- package/dist/src/orgrt/role-session-opts.d.ts.map +1 -0
- package/dist/src/orgrt/role-session-opts.js +289 -0
- package/dist/src/orgrt/role-session-opts.js.map +1 -0
- package/dist/src/orgrt/runner-resolve.d.ts +43 -0
- package/dist/src/orgrt/runner-resolve.d.ts.map +1 -0
- package/dist/src/orgrt/runner-resolve.js +77 -0
- package/dist/src/orgrt/runner-resolve.js.map +1 -0
- package/dist/src/orgrt/session-gate.d.ts +34 -0
- package/dist/src/orgrt/session-gate.d.ts.map +1 -0
- package/dist/src/orgrt/session-gate.js +74 -0
- package/dist/src/orgrt/session-gate.js.map +1 -0
- package/dist/src/orgrt/session-prompt.d.ts +31 -0
- package/dist/src/orgrt/session-prompt.d.ts.map +1 -0
- package/dist/src/orgrt/session-prompt.js +115 -0
- package/dist/src/orgrt/session-prompt.js.map +1 -0
- package/dist/src/orgrt/session-run.d.ts +18 -0
- package/dist/src/orgrt/session-run.d.ts.map +1 -0
- package/dist/src/orgrt/session-run.js +429 -0
- package/dist/src/orgrt/session-run.js.map +1 -0
- package/dist/src/orgrt/session-stream.d.ts +21 -0
- package/dist/src/orgrt/session-stream.d.ts.map +1 -0
- package/dist/src/orgrt/session-stream.js +173 -0
- package/dist/src/orgrt/session-stream.js.map +1 -0
- package/dist/src/orgrt/session-types.d.ts +219 -0
- package/dist/src/orgrt/session-types.d.ts.map +1 -0
- package/dist/src/orgrt/session-types.js +2 -0
- package/dist/src/orgrt/session-types.js.map +1 -0
- package/dist/src/orgrt/session-usage.d.ts +29 -0
- package/dist/src/orgrt/session-usage.d.ts.map +1 -0
- package/dist/src/orgrt/session-usage.js +64 -0
- package/dist/src/orgrt/session-usage.js.map +1 -0
- package/dist/src/orgrt/session.d.ts +5 -281
- package/dist/src/orgrt/session.d.ts.map +1 -1
- package/dist/src/orgrt/session.js +8 -1117
- package/dist/src/orgrt/session.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
// packages/@monomind/cli/src/commands/org-observe-report.ts
|
|
2
|
+
//
|
|
3
|
+
// `monomind org report | costs | flow` — run summaries, per-role cost
|
|
4
|
+
// tables and the Mermaid flow export.
|
|
5
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { roleTokensNote } from '../orgrt/report-budget.js';
|
|
8
|
+
import { readHistory, readRunEvents, summarizeRun } from '../orgrt/reporting.js';
|
|
9
|
+
import { ORG_DIR, OrgDefSchema } from '../orgrt/types.js';
|
|
10
|
+
import { output } from '../output.js';
|
|
11
|
+
import { endpointRoleIds, orgJson, printOrgJson, resolveRun } from './org-observe-shared.js';
|
|
12
|
+
const log = (text) => {
|
|
13
|
+
console.log(text);
|
|
14
|
+
};
|
|
15
|
+
/** `org report <name> [--run id] [--all] [--by-role] [--format mermaid]` — summarize a run (or list run history). */
|
|
16
|
+
export const reportAction = async (ctx, name) => {
|
|
17
|
+
if (ctx.flags.all === true) {
|
|
18
|
+
const history = readHistory(ctx.cwd, name);
|
|
19
|
+
if (!history.length)
|
|
20
|
+
return { success: false, message: `no run history for org ${name}` };
|
|
21
|
+
if (orgJson(ctx))
|
|
22
|
+
return printOrgJson({ v: 1, org: name, items: history });
|
|
23
|
+
log(output.info(`org ${name} — ${history.length} recorded run(s):`));
|
|
24
|
+
for (const h of history) {
|
|
25
|
+
const dur = h.durationMs != null ? `${Math.round(h.durationMs / 1000)}s` : '?';
|
|
26
|
+
// #302: an honest "why", not a bare "no outcome recorded", when the
|
|
27
|
+
// truth gate actually knows the real cause (idle-stop, failed-start, a
|
|
28
|
+
// boss-restart giving up) and whether work was left outstanding.
|
|
29
|
+
const outcome = h.outcome
|
|
30
|
+
? `${h.outcome.status}: ${h.outcome.summary.slice(0, 60)}`
|
|
31
|
+
: h.closedBy && h.closedBy !== 'org-complete'
|
|
32
|
+
? `no outcome recorded — ended via ${h.closedBy}${h.runnableTasksAtStop > 0 ? `, ${h.runnableTasksAtStop} task(s) left` : ''}`
|
|
33
|
+
: 'no outcome recorded';
|
|
34
|
+
log(output.info(` • ${h.run} ${dur} ${h.totalTokens} tokens ${h.messages} msgs — ${outcome}`));
|
|
35
|
+
}
|
|
36
|
+
return { success: true };
|
|
37
|
+
}
|
|
38
|
+
const run = resolveRun(ctx.cwd, name, ctx.flags.run);
|
|
39
|
+
if (!run)
|
|
40
|
+
return { success: false, message: `no runs found for org ${name}` };
|
|
41
|
+
const events = readRunEvents(ctx.cwd, name, run);
|
|
42
|
+
if (!events.length)
|
|
43
|
+
return { success: false, message: `run ${run} has no recorded events` };
|
|
44
|
+
const s = summarizeRun(events);
|
|
45
|
+
// M2: endpoint roles are automations — they have no row in the role tables.
|
|
46
|
+
const endpointIds = endpointRoleIds(ctx.cwd, name);
|
|
47
|
+
for (const id of endpointIds)
|
|
48
|
+
delete s.roles[id];
|
|
49
|
+
// Protocol JSON mode (§7.2): the run summary as a bare object. Emitted
|
|
50
|
+
// before the human-only flag modes (mermaid/audit/by-role) — those render
|
|
51
|
+
// views of the same summary and have no JSON shape defined by the spec.
|
|
52
|
+
if (orgJson(ctx)) {
|
|
53
|
+
return printOrgJson({
|
|
54
|
+
v: 1,
|
|
55
|
+
org: name,
|
|
56
|
+
run,
|
|
57
|
+
duration_ms: s.durationMs,
|
|
58
|
+
events: s.events,
|
|
59
|
+
messages: s.messages,
|
|
60
|
+
xorg_messages: s.xorgMessages,
|
|
61
|
+
total_tokens: s.totalTokens,
|
|
62
|
+
total_cost_usd: s.totalCostUsd,
|
|
63
|
+
outcome: s.outcome,
|
|
64
|
+
blocker: s.blocker,
|
|
65
|
+
blocker_detail: s.blockerDetail,
|
|
66
|
+
closed_by: s.closedBy,
|
|
67
|
+
runnable_tasks_at_stop: s.runnableTasksAtStop,
|
|
68
|
+
cut_short: s.cutShort,
|
|
69
|
+
crashes: s.crashes,
|
|
70
|
+
roles: s.roles,
|
|
71
|
+
assets: s.assets,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
// Mermaid flowchart (--format mermaid flag)
|
|
75
|
+
if (ctx.flags.format === 'mermaid') {
|
|
76
|
+
// Extract message flow from events
|
|
77
|
+
const messageEvents = events.filter((e) => e.type === 'message' || e.type === 'xorg');
|
|
78
|
+
const roleSet = new Set();
|
|
79
|
+
const edges = new Set();
|
|
80
|
+
for (const e of messageEvents) {
|
|
81
|
+
if (e.from) {
|
|
82
|
+
const fromRole = e.from.includes(':') ? e.from.split(':')[1] : e.from;
|
|
83
|
+
roleSet.add(fromRole);
|
|
84
|
+
if (e.to) {
|
|
85
|
+
const toRole = e.to.includes(':') ? e.to.split(':')[1] : e.to;
|
|
86
|
+
roleSet.add(toRole);
|
|
87
|
+
const edge = `${fromRole} -->|${e.subject || 'msg'}| ${toRole}`;
|
|
88
|
+
edges.add(edge);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const roles = Array.from(roleSet).sort();
|
|
93
|
+
log(output.info(`flowchart TD`));
|
|
94
|
+
log(output.info(` %% Org flow for ${name} / ${run}`));
|
|
95
|
+
log(output.info(` %% ${messageEvents.length} messages exchanged`));
|
|
96
|
+
log(output.info(` `));
|
|
97
|
+
// Define role nodes with styling
|
|
98
|
+
for (const role of roles) {
|
|
99
|
+
log(output.info(` ${role}[${role}]`));
|
|
100
|
+
}
|
|
101
|
+
log(output.info(` `));
|
|
102
|
+
// Add edges for messages
|
|
103
|
+
for (const edge of edges) {
|
|
104
|
+
log(output.info(` ${edge}`));
|
|
105
|
+
}
|
|
106
|
+
log(output.info(` `));
|
|
107
|
+
log(output.info(`classDef bossNode fill:#f9f,stroke:#333,stroke-width:2px`));
|
|
108
|
+
log(output.info(`classDef workerNode fill:#bbf,stroke:#333,stroke-width:1px`));
|
|
109
|
+
return { success: true, message: `Mermaid flowchart exported for ${name} / ${run}` };
|
|
110
|
+
}
|
|
111
|
+
// Tool audit filter (--audit flag) - show only tool decision events
|
|
112
|
+
if (ctx.flags.audit === true) {
|
|
113
|
+
let toolEvents = events.filter((e) => e.type === 'tool');
|
|
114
|
+
// Optional --tool flag filters to a specific tool name
|
|
115
|
+
if (typeof ctx.flags.tool === 'string' && ctx.flags.tool) {
|
|
116
|
+
const toolName = ctx.flags.tool;
|
|
117
|
+
toolEvents = toolEvents.filter((e) => e.tool === toolName);
|
|
118
|
+
}
|
|
119
|
+
if (!toolEvents.length) {
|
|
120
|
+
const toolFilter = typeof ctx.flags.tool === 'string' ? ` for tool "${ctx.flags.tool}"` : '';
|
|
121
|
+
log(output.info(`No tool events found${toolFilter} in ${run}`));
|
|
122
|
+
return { success: true };
|
|
123
|
+
}
|
|
124
|
+
log(output.info(`Tool audit trail for ${name} / ${run} (${toolEvents.length} events):`));
|
|
125
|
+
log(output.info('┌──────────────────┬─────────────────────────┬──────────┬──────────────────────────────────────┐'));
|
|
126
|
+
log(output.info('│ Role │ Tool │ Decision │ Reason │'));
|
|
127
|
+
log(output.info('├──────────────────┼─────────────────────────┼──────────┼──────────────────────────────────────┤'));
|
|
128
|
+
for (const e of toolEvents) {
|
|
129
|
+
const role = e.from ?? 'system';
|
|
130
|
+
const tool = e.tool ?? 'unknown';
|
|
131
|
+
const decision = e.decision === 'deny' ? 'DENY' : 'ALLOW';
|
|
132
|
+
const reason = e.reason || '-';
|
|
133
|
+
log(output.info(`│ ${role.padEnd(16)} │ ${tool.padEnd(23)} │ ${decision.padEnd(8)} │ ${reason.padEnd(38)} │`));
|
|
134
|
+
}
|
|
135
|
+
log(output.info('└──────────────────┴─────────────────────────┴──────────┴──────────────────────────────────────┘'));
|
|
136
|
+
return { success: true };
|
|
137
|
+
}
|
|
138
|
+
// Per-role cost breakdown (--by-role flag)
|
|
139
|
+
if (ctx.flags['by-role'] === true) {
|
|
140
|
+
const byRole = new Map();
|
|
141
|
+
for (const [roleId, roleStats] of Object.entries(s.roles)) {
|
|
142
|
+
const acc = byRole.get(roleId) ?? { cost: 0, tokens: 0, messages: 0 };
|
|
143
|
+
acc.cost += roleStats.costUsd ?? 0;
|
|
144
|
+
acc.tokens += roleStats.tokens;
|
|
145
|
+
acc.messages += roleStats.messagesSent;
|
|
146
|
+
byRole.set(roleId, acc);
|
|
147
|
+
}
|
|
148
|
+
log(output.info(`Per-role cost breakdown for ${name} / ${run}:`));
|
|
149
|
+
log(output.info('┌──────────────────┬───────────┬────────────┬───────────┐'));
|
|
150
|
+
log(output.info('│ Role │ Cost ($) │ Tokens │ Messages │'));
|
|
151
|
+
log(output.info('├──────────────────┼───────────┼────────────┼───────────┤'));
|
|
152
|
+
for (const [roleId, data] of byRole) {
|
|
153
|
+
log(output.info(`│ ${roleId.padEnd(16)} │ ${(data.cost.toFixed(4)).padStart(9)} │ ${String(data.tokens).padStart(10)} │ ${String(data.messages).padStart(9)} │`));
|
|
154
|
+
}
|
|
155
|
+
log(output.info('└──────────────────┴───────────┴────────────┴───────────┘'));
|
|
156
|
+
return { success: true };
|
|
157
|
+
}
|
|
158
|
+
// Per-role budget ceiling: same split the daemon applies (budget ÷ role count),
|
|
159
|
+
// with any explicit policy.maxTokens override. Missing/unreadable config → no ceilings.
|
|
160
|
+
let perRoleBudget = null;
|
|
161
|
+
let basis = 'uncached';
|
|
162
|
+
const roleCeiling = new Map();
|
|
163
|
+
try {
|
|
164
|
+
const def = OrgDefSchema.parse(JSON.parse(readFileSync(join(ctx.cwd, ORG_DIR, `${name}.json`), 'utf8')));
|
|
165
|
+
const sessionRoles = def.roles.filter((r) => r.kind !== 'endpoint');
|
|
166
|
+
perRoleBudget = Math.floor((def.run_config.budget_tokens ?? 1_000_000) / Math.max(1, sessionRoles.length));
|
|
167
|
+
basis = def.run_config.budget_tokens_basis ?? 'uncached';
|
|
168
|
+
for (const r of sessionRoles) {
|
|
169
|
+
const max = r.policy?.maxTokens;
|
|
170
|
+
roleCeiling.set(r.id, max ?? r.budget_tokens ?? perRoleBudget);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
/* config gone or invalid — report without budget context */
|
|
175
|
+
}
|
|
176
|
+
log(output.info(`ORG REPORT — ${name} / ${run}`));
|
|
177
|
+
log(output.info(` Duration: ${s.durationMs != null ? `${Math.round(s.durationMs / 1000)}s` : '?'} Events: ${s.events} Messages: ${s.messages}${s.xorgMessages ? ` (+${s.xorgMessages} cross-org)` : ''}`));
|
|
178
|
+
log(output.info(` Tokens: ${s.totalTokens}${perRoleBudget ? ` (budget: ${perRoleBudget}/role ${basis === 'billable' ? 'billable' : 'in+out'})` : ''}${s.totalCostUsd ? ` Cost: $${s.totalCostUsd.toFixed(4)}` : ''}`));
|
|
179
|
+
if (s.outcome) {
|
|
180
|
+
// #302: blocker/blockerDetail are top-level on RunSummary (a sibling of
|
|
181
|
+
// outcome, not nested in it — see reporting.ts), rendered here alongside
|
|
182
|
+
// the outcome they were attached to.
|
|
183
|
+
const blockerSuffix = s.blocker
|
|
184
|
+
? ` [blocker: ${s.blocker}${s.blockerDetail ? ` — ${s.blockerDetail}` : ''}]`
|
|
185
|
+
: '';
|
|
186
|
+
log(output.success(` Outcome: ${s.outcome.status} (by ${s.outcome.by}) — ${s.outcome.summary}${blockerSuffix}`));
|
|
187
|
+
}
|
|
188
|
+
else if (s.closedBy && s.closedBy !== 'org-complete') {
|
|
189
|
+
// #302 truth gate: a run that never called org_complete still has a real,
|
|
190
|
+
// recorded cause — never leave an operator reading "not recorded" when
|
|
191
|
+
// we actually know the run was idle-stopped, failed to start, or gave up
|
|
192
|
+
// after a boss-restart, and how much runnable work was left behind.
|
|
193
|
+
const pending = s.runnableTasksAtStop > 0 ? `, ${s.runnableTasksAtStop} task(s) left` : '';
|
|
194
|
+
log(output.warning(` Outcome: not recorded — ended via ${s.closedBy}${pending}`));
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
log(output.warning(' Outcome: not recorded (coordinator never called org_complete)'));
|
|
198
|
+
}
|
|
199
|
+
log(output.info(' Roles:'));
|
|
200
|
+
for (const [id, r] of Object.entries(s.roles)) {
|
|
201
|
+
const wasCutShort = s.cutShort.includes(id);
|
|
202
|
+
const icon = r.crashed ? '✗' : wasCutShort ? '⊘' : '•';
|
|
203
|
+
const suffix = r.crashed ? ' — CRASHED' : wasCutShort ? ' — cut short by stop' : '';
|
|
204
|
+
log(output.info(` ${icon} ${id}: ${r.messagesSent} msgs, ${r.toolsAllowed} tools${r.toolsDenied ? ` (${r.toolsDenied} denied)` : ''}, ${roleTokensNote(r, roleCeiling.get(id), basis)}${suffix}`));
|
|
205
|
+
}
|
|
206
|
+
if (s.assets.length) {
|
|
207
|
+
log(output.info(` Assets (${s.assets.length}):`));
|
|
208
|
+
for (const a of s.assets.slice(0, 20))
|
|
209
|
+
log(output.info(` 📄 ${a}`));
|
|
210
|
+
if (s.assets.length > 20)
|
|
211
|
+
log(output.info(` … and ${s.assets.length - 20} more`));
|
|
212
|
+
}
|
|
213
|
+
return { success: true };
|
|
214
|
+
};
|
|
215
|
+
/** `org costs <name> [--run id]` — show per-role cost tracking from runtime.json */
|
|
216
|
+
export const costsAction = async (ctx, name) => {
|
|
217
|
+
const run = resolveRun(ctx.cwd, name, ctx.flags.run);
|
|
218
|
+
if (!run)
|
|
219
|
+
return {
|
|
220
|
+
success: false,
|
|
221
|
+
message: `no runs found for org ${name} — start one with: monomind org run ${name}`,
|
|
222
|
+
};
|
|
223
|
+
// Read runtime.json for the per-role metrics
|
|
224
|
+
const rtPath = join(ctx.cwd, ORG_DIR, name, 'runtime.json');
|
|
225
|
+
if (!existsSync(rtPath)) {
|
|
226
|
+
return { success: false, message: `no runtime state found for org ${name}` };
|
|
227
|
+
}
|
|
228
|
+
let rt;
|
|
229
|
+
try {
|
|
230
|
+
rt = JSON.parse(readFileSync(rtPath, 'utf8'));
|
|
231
|
+
}
|
|
232
|
+
catch (err) {
|
|
233
|
+
log(output.error(`Cannot read runtime.json: ${err instanceof Error ? err.message : String(err)}`));
|
|
234
|
+
return { success: false, message: 'runtime.json unreadable' };
|
|
235
|
+
}
|
|
236
|
+
if (rt?.run !== run && !orgJson(ctx)) {
|
|
237
|
+
log(output.warning(`Note: runtime.json shows run ${rt?.run ?? 'unknown'} — showing metrics for requested run ${run} from history`));
|
|
238
|
+
}
|
|
239
|
+
// Also check the run summary for cost data
|
|
240
|
+
const events = readRunEvents(ctx.cwd, name, run);
|
|
241
|
+
const summary = events.length ? summarizeRun(events) : null;
|
|
242
|
+
if (!orgJson(ctx))
|
|
243
|
+
log(output.info(`Per-role cost breakdown for ${name} / ${run}:`));
|
|
244
|
+
// Combine data from runtime.json (live metrics) and summary (historical)
|
|
245
|
+
const roleData = new Map();
|
|
246
|
+
// M2: endpoint roles are automations — no row in the cost table.
|
|
247
|
+
const endpointIds = endpointRoleIds(ctx.cwd, name);
|
|
248
|
+
// Add live metrics from runtime.json
|
|
249
|
+
if (rt?.roleMetrics) {
|
|
250
|
+
for (const [roleId, metrics] of Object.entries(rt.roleMetrics)) {
|
|
251
|
+
if (endpointIds.has(roleId))
|
|
252
|
+
continue;
|
|
253
|
+
roleData.set(roleId, {
|
|
254
|
+
tokens: metrics.tokens,
|
|
255
|
+
costUsd: metrics.costUsd,
|
|
256
|
+
messages: 0,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
// Add historical data from summary if available
|
|
261
|
+
if (summary?.roles) {
|
|
262
|
+
for (const [roleId, roleStats] of Object.entries(summary.roles)) {
|
|
263
|
+
if (endpointIds.has(roleId))
|
|
264
|
+
continue;
|
|
265
|
+
const existing = roleData.get(roleId) ?? { tokens: 0, costUsd: 0, messages: 0 };
|
|
266
|
+
roleData.set(roleId, {
|
|
267
|
+
tokens: existing.tokens || roleStats.tokens,
|
|
268
|
+
costUsd: existing.costUsd || roleStats.costUsd,
|
|
269
|
+
messages: roleStats.messagesSent,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (orgJson(ctx)) {
|
|
274
|
+
const items = [];
|
|
275
|
+
for (const [roleId, data] of roleData) {
|
|
276
|
+
items.push({
|
|
277
|
+
role: roleId,
|
|
278
|
+
tokens: data.tokens,
|
|
279
|
+
cost_usd: data.costUsd,
|
|
280
|
+
messages: data.messages,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
const totals = items.reduce((acc, i) => ({
|
|
284
|
+
tokens: acc.tokens + i.tokens,
|
|
285
|
+
cost_usd: acc.cost_usd + i.cost_usd,
|
|
286
|
+
messages: acc.messages + i.messages,
|
|
287
|
+
}), { tokens: 0, cost_usd: 0, messages: 0 });
|
|
288
|
+
return printOrgJson({ v: 1, org: name, run, items, totals });
|
|
289
|
+
}
|
|
290
|
+
if (roleData.size === 0) {
|
|
291
|
+
log(output.info(`No role metrics available yet — metrics populate as agents use tokens.`));
|
|
292
|
+
return { success: true };
|
|
293
|
+
}
|
|
294
|
+
log(output.info('┌──────────────────┬───────────┬────────────┬───────────┐'));
|
|
295
|
+
log(output.info('│ Role │ Cost ($) │ Tokens │ Messages │'));
|
|
296
|
+
log(output.info('├──────────────────┼───────────┼────────────┼───────────┤'));
|
|
297
|
+
let totalCost = 0;
|
|
298
|
+
let totalTokens = 0;
|
|
299
|
+
let totalMessages = 0;
|
|
300
|
+
for (const [roleId, data] of roleData) {
|
|
301
|
+
log(output.info(`│ ${roleId.padEnd(16)} │ ${(data.costUsd.toFixed(4)).padStart(9)} │ ${String(data.tokens).padStart(10)} │ ${String(data.messages).padStart(9)} │`));
|
|
302
|
+
totalCost += data.costUsd;
|
|
303
|
+
totalTokens += data.tokens;
|
|
304
|
+
totalMessages += data.messages;
|
|
305
|
+
}
|
|
306
|
+
log(output.info('├──────────────────┼───────────┼────────────┼───────────┤'));
|
|
307
|
+
log(output.info(`│ ${('TOTAL').padEnd(16)} │ ${(totalCost.toFixed(4)).padStart(9)} │ ${String(totalTokens).padStart(10)} │ ${String(totalMessages).padStart(9)} │`));
|
|
308
|
+
log(output.info('└──────────────────┴───────────┴────────────┴───────────┘'));
|
|
309
|
+
return { success: true };
|
|
310
|
+
};
|
|
311
|
+
/** `org flow <name> [--run id]` — export org flow as Mermaid diagram */
|
|
312
|
+
export const flowAction = async (ctx, name) => {
|
|
313
|
+
const run = resolveRun(ctx.cwd, name, ctx.flags.run);
|
|
314
|
+
if (!run)
|
|
315
|
+
return {
|
|
316
|
+
success: false,
|
|
317
|
+
message: `no runs found for org ${name} — start one with: monomind org run ${name}`,
|
|
318
|
+
};
|
|
319
|
+
const events = readRunEvents(ctx.cwd, name, run);
|
|
320
|
+
if (!events.length)
|
|
321
|
+
return { success: false, message: `run ${run} has no recorded events` };
|
|
322
|
+
// Extract message flow from events
|
|
323
|
+
const messageEvents = events.filter((e) => e.type === 'message' || e.type === 'xorg');
|
|
324
|
+
const roleSet = new Set();
|
|
325
|
+
const edges = new Set();
|
|
326
|
+
const edgeObjects = [];
|
|
327
|
+
for (const e of messageEvents) {
|
|
328
|
+
if (e.from) {
|
|
329
|
+
const fromRole = e.from.includes(':') ? e.from.split(':')[1] : e.from;
|
|
330
|
+
roleSet.add(fromRole);
|
|
331
|
+
if (e.to) {
|
|
332
|
+
const toRole = e.to.includes(':') ? e.to.split(':')[1] : e.to;
|
|
333
|
+
roleSet.add(toRole);
|
|
334
|
+
const edge = `${fromRole} -->|${e.subject || 'msg'}| ${toRole}`;
|
|
335
|
+
edges.add(edge);
|
|
336
|
+
edgeObjects.push({ from: fromRole, to: toRole, subject: e.subject || 'msg' });
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
// M2: endpoint roles are automations — not listed as role nodes.
|
|
341
|
+
const endpointIds = endpointRoleIds(ctx.cwd, name);
|
|
342
|
+
const roles = Array.from(roleSet)
|
|
343
|
+
.filter((r) => !endpointIds.has(r))
|
|
344
|
+
.sort();
|
|
345
|
+
// Protocol JSON mode (§7.2): structured roles + edges instead of Mermaid.
|
|
346
|
+
if (orgJson(ctx))
|
|
347
|
+
return printOrgJson({ v: 1, org: name, run, roles, edges: edgeObjects });
|
|
348
|
+
log(output.info(`flowchart TD`));
|
|
349
|
+
log(output.info(` %% Org flow for ${name} / ${run}`));
|
|
350
|
+
log(output.info(` %% ${messageEvents.length} messages exchanged`));
|
|
351
|
+
log(output.info(` `));
|
|
352
|
+
// Define role nodes with styling
|
|
353
|
+
for (const role of roles) {
|
|
354
|
+
log(output.info(` ${role}[${role}]`));
|
|
355
|
+
}
|
|
356
|
+
log(output.info(` `));
|
|
357
|
+
// Add edges for messages
|
|
358
|
+
for (const edge of edges) {
|
|
359
|
+
log(output.info(` ${edge}`));
|
|
360
|
+
}
|
|
361
|
+
log(output.info(` `));
|
|
362
|
+
log(output.info(`classDef bossNode fill:#f9f,stroke:#333,stroke-width:2px`));
|
|
363
|
+
log(output.info(`classDef workerNode fill:#bbf,stroke:#333,stroke-width:1px`));
|
|
364
|
+
return { success: true, message: `Mermaid flowchart exported for ${name} / ${run}` };
|
|
365
|
+
};
|
|
366
|
+
//# sourceMappingURL=org-observe-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-observe-report.js","sourceRoot":"","sources":["../../../src/commands/org-observe-report.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAmB,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE7F,MAAM,GAAG,GAAG,CAAC,IAAY,EAAQ,EAAE;IACjC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC,CAAC;AAEF,qHAAqH;AACrH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,GAAmB,EAAE,IAAY,EAA0B,EAAE;IAC9F,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,OAAO,CAAC,M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AAM,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;IAChC,CAAC;IAED,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACvB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC,CAAC;IAC7E,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC,CAAC;IAE/E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,kCAAkC,IAAI,MAAM,GAAG,EAAE,EAAE,CAAC;AACvF,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CommandContext, CommandResult } from '../types.js';
|
|
2
|
+
/** True when this invocation asked for protocol JSON output. */
|
|
3
|
+
export declare const orgJson: (ctx: CommandContext) => boolean;
|
|
4
|
+
/** Print one protocol JSON payload on stdout (compact — one line, NDJSON-safe
|
|
5
|
+
* for line-oriented callers) and return a success result. */
|
|
6
|
+
export declare const printOrgJson: (payload: Record<string, unknown>) => CommandResult;
|
|
7
|
+
/** M5: `--by <resolver>` — who resolved a decision (default `human`). Returns
|
|
8
|
+
* an error string for an invalid value. */
|
|
9
|
+
export declare const resolverFlag: (ctx: CommandContext) => Promise<{
|
|
10
|
+
ok: true;
|
|
11
|
+
by: string;
|
|
12
|
+
} | {
|
|
13
|
+
ok: false;
|
|
14
|
+
message: string;
|
|
15
|
+
}>;
|
|
16
|
+
/** M2: ids of the org's endpoint roles (automations, not agents) — excluded
|
|
17
|
+
* from the costs/report/flow role tables. Unreadable config → none. */
|
|
18
|
+
export declare const endpointRoleIds: (cwd: string, name: string) => Set<string>;
|
|
19
|
+
export declare const resolveRun: (cwd: string, name: string, runFlag: unknown) => string | null;
|
|
20
|
+
//# sourceMappingURL=org-observe-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-observe-shared.d.ts","sourceRoot":"","sources":["../../../src/commands/org-observe-shared.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAOjE,gEAAgE;AAChE,eAAO,MAAM,OAAO,QAAS,cAAc,KAAG,OAAsC,CAAC;AAErF;8DAC8D;AAC9D,eAAO,MAAM,YAAY,YAAa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,aAG/D,CAAC;AAEF;4CAC4C;AAC5C,eAAO,MAAM,YAAY,QAClB,cAAc,KAClB,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAOnE,CAAC;AAEF;wEACwE;AACxE,eAAO,MAAM,eAAe,QAAS,MAAM,QAAQ,MAAM,KAAG,GAAG,CAAC,MAAM,CAarE,CAAC;AAMF,eAAO,MAAM,UAAU,QAAS,MAAM,QAAQ,MAAM,WAAW,OAAO,KAAG,MAAM,GAAG,IAGjF,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// packages/@monomind/cli/src/commands/org-observe-shared.ts
|
|
2
|
+
//
|
|
3
|
+
// Helpers shared by the org observe subcommand modules: protocol JSON output,
|
|
4
|
+
// the --by resolver flag, endpoint-role ids and --run resolution.
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { listRunDirs } from '../orgrt/reporting.js';
|
|
8
|
+
import { ORG_DIR } from '../orgrt/types.js';
|
|
9
|
+
// ─── Agent Exec Protocol JSON output (doc/agent-exec-protocol.md §7) ────────
|
|
10
|
+
// Org observe commands emit machine JSON under the global `--format json`
|
|
11
|
+
// flag: one JSON object on stdout, diagnostics on stderr only. Envelope for
|
|
12
|
+
// lists {v, org, items}; singletons are bare objects carrying v.
|
|
13
|
+
/** True when this invocation asked for protocol JSON output. */
|
|
14
|
+
export const orgJson = (ctx) => ctx.flags.format === 'json';
|
|
15
|
+
/** Print one protocol JSON payload on stdout (compact — one line, NDJSON-safe
|
|
16
|
+
* for line-oriented callers) and return a success result. */
|
|
17
|
+
export const printOrgJson = (payload) => {
|
|
18
|
+
process.stdout.write(`${JSON.stringify(payload)}\n`);
|
|
19
|
+
return { success: true, data: payload };
|
|
20
|
+
};
|
|
21
|
+
/** M5: `--by <resolver>` — who resolved a decision (default `human`). Returns
|
|
22
|
+
* an error string for an invalid value. */
|
|
23
|
+
export const resolverFlag = async (ctx) => {
|
|
24
|
+
const raw = ctx.flags.by;
|
|
25
|
+
if (raw === undefined || raw === false)
|
|
26
|
+
return { ok: true, by: 'human' };
|
|
27
|
+
const { normalizeResolver } = await import('../orgrt/approvals.js');
|
|
28
|
+
const by = normalizeResolver(raw);
|
|
29
|
+
if (!by)
|
|
30
|
+
return { ok: false, message: '--by must be 1-128 printable characters' };
|
|
31
|
+
return { ok: true, by };
|
|
32
|
+
};
|
|
33
|
+
/** M2: ids of the org's endpoint roles (automations, not agents) — excluded
|
|
34
|
+
* from the costs/report/flow role tables. Unreadable config → none. */
|
|
35
|
+
export const endpointRoleIds = (cwd, name) => {
|
|
36
|
+
try {
|
|
37
|
+
const raw = JSON.parse(readFileSync(join(cwd, ORG_DIR, `${name}.json`), 'utf8'));
|
|
38
|
+
return new Set((Array.isArray(raw.roles) ? raw.roles : [])
|
|
39
|
+
.filter((r) => r?.kind === 'endpoint' && typeof r.id === 'string')
|
|
40
|
+
.map((r) => r.id));
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return new Set();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
// Run ids are joined into filesystem paths — enforce the daemon's own id shape
|
|
47
|
+
// so a crafted --run can't traverse out of the org directory (same reason the
|
|
48
|
+
// org-name guard exists).
|
|
49
|
+
const RUN_ID_RE = /^run-[A-Za-z0-9-]+$/;
|
|
50
|
+
export const resolveRun = (cwd, name, runFlag) => {
|
|
51
|
+
if (typeof runFlag === 'string' && runFlag)
|
|
52
|
+
return RUN_ID_RE.test(runFlag) ? runFlag : null;
|
|
53
|
+
return listRunDirs(cwd, name)[0] ?? null;
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=org-observe-shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-observe-shared.js","sourceRoot":"","sources":["../../../src/commands/org-observe-shared.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,EAAE;AACF,8EAA8E;AAC9E,kEAAkE;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,+EAA+E;AAC/E,0EAA0E;AAC1E,4EAA4E;AAC5E,iEAAiE;AAEjE,gEAAgE;AAChE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAmB,EAAW,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC;AAErF;8DAC8D;AAC9D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAgC,EAAiB,EAAE;IAC9E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC1C,CAAC,CAAC;AAEF;4CAC4C;AAC5C,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAC/B,GAAmB,EACiD,EAAE;IACtE,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;IACzB,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,KAAK;QAAE,OAAO,E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OAAgB,EAAiB,EAAE;IACvF,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO;QAAE,OAAO,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5F,OAAO,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC3C,CAAC,CAAC"}
|
|
@@ -1,102 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare const validateAction: (ctx: CommandContext) => Promise<CommandResult>;
|
|
11
|
-
/** `org logs <name> [--run id] [--role r] [--filter-tool t] [--filter-role r] [--tools-only] [--audit-filter allow|deny] [--follow]` — formatted bus.jsonl tail. */
|
|
12
|
-
export declare const logsAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
13
|
-
/**
|
|
14
|
-
* `org watch <name> <role> [--verbose] [--stats]` — live-tail one role's
|
|
15
|
-
* assistant chat text.
|
|
16
|
-
*
|
|
17
|
-
* Every runner (Claude included — this isn't specific to the subprocess CLI
|
|
18
|
-
* runners) funnels through session.ts's shared message loop, which emits
|
|
19
|
-
* each assistant-text chunk onto the bus as a `chat` event. This command is
|
|
20
|
-
* just `logsAction` pre-filtered to that event type + role and formatted as
|
|
21
|
-
* a plain transcript instead of the full annotated event line — a friendlier
|
|
22
|
-
* front door onto infrastructure that already exists and already covers
|
|
23
|
-
* every runtime uniformly. For the fuller event stream (tool calls, audit
|
|
24
|
-
* decisions) use `org logs <name> --role <role> --follow` directly.
|
|
25
|
-
*
|
|
26
|
-
* --verbose additionally interleaves that role's `status` events (session
|
|
27
|
-
* start/end, restart/crash/backoff, state changes) into the transcript, so
|
|
28
|
-
* a human watching sees WHY a role went quiet instead of just silence.
|
|
29
|
-
* --stats prints a running token/cost line off that role's `usage` events
|
|
30
|
-
* (emitted per turn by session.ts, same as --verbose: already-existing bus
|
|
31
|
-
* data, no new instrumentation).
|
|
32
|
-
*/
|
|
33
|
-
export declare const watchAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
34
|
-
/** `org report <name> [--run id] [--all] [--by-role] [--format mermaid]` — summarize a run (or list run history). */
|
|
35
|
-
export declare const reportAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
36
|
-
/** `org questions <name> [--all]` — list pending (or all) ask_human questions. */
|
|
37
|
-
export declare const questionsAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
38
|
-
/** `org approvals <name> [--all]` — list pending (or all) tool/action approval requests. */
|
|
39
|
-
export declare const approvalsAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
40
|
-
/** `org answer <name> <question-id> <answer...>` — answer a pending ask_human question.
|
|
41
|
-
* Delivers live via the hosting daemon's /api/answer-question when the org is running
|
|
42
|
-
* (broker lookup); otherwise records the answer and queues it for the next run. */
|
|
43
|
-
export declare const answerAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
44
|
-
/** `org inbox <name> --json '{"from":"orgA:role","subject":"...","body":"..."}' [--to role]`
|
|
45
|
-
* (or `--from/--subject/--body`) `[--format json]`.
|
|
46
|
-
* Inbound entrypoint for cross-org/remote delivery — orgrt/remote.ts's deliverRemote()
|
|
47
|
-
* shells out to exactly this command over SSH, and mono-agent replies through it.
|
|
48
|
-
*
|
|
49
|
-
* Live path (M3): POST to the hosting daemon's /api/xdeliver with the OPERATOR
|
|
50
|
-
* credential (readOperatorCredential), which lets the daemon trust `from` as
|
|
51
|
-
* given — the sender org need not be registered (`workflow`, an automation
|
|
52
|
-
* role). Without an operator credential it presents the sender org's own
|
|
53
|
-
* broker credential, if that org is registered. Offline path: spool into
|
|
54
|
-
* inbox.jsonl, drained into the role's mailbox on the org's next start.
|
|
55
|
-
*
|
|
56
|
-
* `--format json` prints `{"v":1,"org","to","from","delivery":"live"|"queued",
|
|
57
|
-
* "receipt","messageId"}`. Exit 0 for live and queued; non-zero only for
|
|
58
|
-
* invalid input or an unknown org. */
|
|
59
|
-
export declare const inboxAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
60
|
-
/** `org create <name> --template <t> [--goal g] [--schedule s]` — scaffold a config from a template. */
|
|
61
|
-
export declare const createAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
62
|
-
/** `org costs <name> [--run id]` — show per-role cost tracking from runtime.json */
|
|
63
|
-
export declare const costsAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
64
|
-
/** `org flow <name> [--run id]` — export org flow as Mermaid diagram */
|
|
65
|
-
export declare const flowAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
66
|
-
/** `org approve <org> <role> <action> [--request <id>] [--by <resolver>]` — approve a pending tool/action approval */
|
|
67
|
-
export declare const approveAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
68
|
-
/** `org deny <org> <role> <action> [--request <id>] [--by <resolver>]` — deny a pending tool/action approval */
|
|
69
|
-
export declare const denyAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
70
|
-
/** `org replay <org> <run-id>` — time-travel debugging: re-emit a past run's bus
|
|
71
|
-
* events into a fresh replay run for inspection. This is event-log replay only —
|
|
72
|
-
* it does not restart agent execution or restore live sessions. To actually
|
|
73
|
-
* resume an org's execution from where it left off, use `org run --resume`. */
|
|
74
|
-
export declare const replayAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
75
|
-
/** `org resume-from <org>` — resume live execution from the org's persisted
|
|
76
|
-
* checkpoint (runtime.json): restores mailbox queues, policy/token counters,
|
|
77
|
-
* and session state, subject to checkpoint TTL and checksum validation. Unlike
|
|
78
|
-
* `replay`, this restarts real agent execution via `startOrg(..., { resume: true })`. */
|
|
79
|
-
export declare const resumeFromAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
80
|
-
/** `org branch <org> <run-id> <label> [--format json]` — snapshot a run's event
|
|
81
|
-
* log for replay. This is NOT an executable what-if scenario: it copies
|
|
82
|
-
* bus.jsonl into a new run directory tagged with a `.branch-source` marker so
|
|
83
|
-
* it can be inspected or replayed later; it does not fork or re-run agent
|
|
84
|
-
* execution. Delegates to the shared, atomic (tmp+rename) implementation in
|
|
85
|
-
* checkpoint-ops.ts.
|
|
86
|
-
*
|
|
87
|
-
* `<label>` is a note recorded in `.branch-source`, not the new run's name —
|
|
88
|
-
* the run id is generated. `--format json` reports that generated id as a
|
|
89
|
-
* field so a scripted caller can feed it to `org replay` without scraping the
|
|
90
|
-
* human-readable line (#292). */
|
|
91
|
-
export declare const branchAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
92
|
-
/** `org decisions <org> [--run id]` — show Rifft-style decision traces */
|
|
93
|
-
export declare const decisionsAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
94
|
-
export declare const gatesAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
95
|
-
export declare const gateResolveAction: (ctx: CommandContext, name: string, approved: boolean) => Promise<CommandResult>;
|
|
96
|
-
/** `org events <name> [--run id] [--follow] [--since <eventId|iso>] [--ndjson]`
|
|
97
|
-
* — live tail of a run's bus.jsonl as NDJSON, one BusEvent per line
|
|
98
|
-
* (protocol §7.3). This is the machine streaming surface; `org logs` stays
|
|
99
|
-
* the human one. NDJSON is the only output mode (--ndjson accepted for
|
|
100
|
-
* spec symmetry). */
|
|
101
|
-
export declare const eventsAction: (ctx: CommandContext, name: string) => Promise<CommandResult>;
|
|
1
|
+
export { approvalsAction, approveAction, denyAction, } from './org-observe-approvals.js';
|
|
2
|
+
export { branchAction, decisionsAction, replayAction, resumeFromAction, } from './org-observe-checkpoint.js';
|
|
3
|
+
export { createAction, validateAction, } from './org-observe-config.js';
|
|
4
|
+
export { gateResolveAction, gatesAction, } from './org-observe-gates.js';
|
|
5
|
+
export { inboxAction } from './org-observe-inbox.js';
|
|
6
|
+
export { eventsAction, logsAction, watchAction, } from './org-observe-logs.js';
|
|
7
|
+
export { answerAction, questionsAction, } from './org-observe-questions.js';
|
|
8
|
+
export { costsAction, flowAction, reportAction, } from './org-observe-report.js';
|
|
9
|
+
export { orgJson, printOrgJson, } from './org-observe-shared.js';
|
|
102
10
|
//# sourceMappingURL=org-observe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"org-observe.d.ts","sourceRoot":"","sources":["../../../src/commands/org-observe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"org-observe.d.ts","sourceRoot":"","sources":["../../../src/commands/org-observe.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,eAAe,EACf,aAAa,EACb,UAAU,GACX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,YAAY,EACZ,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,iBAAiB,EACjB,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EACL,YAAY,EACZ,UAAU,EACV,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,YAAY,EACZ,eAAe,GAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,WAAW,EACX,UAAU,EACV,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,OAAO,EACP,YAAY,GACb,MAAM,yBAAyB,CAAC"}
|