@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,305 @@
|
|
|
1
|
+
// packages/@monomind/cli/src/orgrt/org-tools.ts
|
|
2
|
+
// Extracted from session.ts — the org tool surface every role session gets.
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { resolveSessionScope } from './session-ledger.js';
|
|
5
|
+
import { skillTools } from './skill-tools.js';
|
|
6
|
+
import { MAX_TASK_BRIEF } from './task-dag.js';
|
|
7
|
+
import { orgTaskTool } from './task-tools.js';
|
|
8
|
+
import { strictArgs } from './tool-fence.js';
|
|
9
|
+
import { MAX_BLOCK_RECHECK_MINUTES } from './types.js';
|
|
10
|
+
/** Build the org tool surface as platform-agnostic OrgToolDef[]. The handlers
|
|
11
|
+
* close over sessionOpts callbacks (deliver, recall, remember, …) — same
|
|
12
|
+
* wiring as the previous inline createSdkMcpServer block, just decoupled from
|
|
13
|
+
* the Claude SDK's tool() shape so any AgentRunner can host them.
|
|
14
|
+
*
|
|
15
|
+
* Behaviour is identical to the old inline definitions: conditional tools are
|
|
16
|
+
* gated on their callback being present, org_send/ask_human are always added. */
|
|
17
|
+
export function buildOrgTools(opts) {
|
|
18
|
+
const { role, deliver } = opts;
|
|
19
|
+
const tools = [];
|
|
20
|
+
const text = (t) => ({ text: t });
|
|
21
|
+
const searchKnowledge = opts.searchKnowledge;
|
|
22
|
+
if (searchKnowledge) {
|
|
23
|
+
tools.push({
|
|
24
|
+
name: 'knowledge_search',
|
|
25
|
+
description: "Semantic search over the user's Second Brain: this project's indexed documents plus their personal cross-project global brain. Use to ground work in the user's actual notes, handbooks, and documents.",
|
|
26
|
+
schema: { query: z.string() },
|
|
27
|
+
handler: async (args) => text(await searchKnowledge(role.id, args.query)),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
tools.push(...skillTools(role, opts.orgRoot ?? opts.cwd, opts.onSkillLoad));
|
|
31
|
+
const recall = opts.recall;
|
|
32
|
+
if (recall) {
|
|
33
|
+
tools.push({
|
|
34
|
+
name: 'org_recall',
|
|
35
|
+
description: "Search this org's accumulated memory from previous runs (outcomes, decisions, learnings). Use before starting work that may already have been done.",
|
|
36
|
+
schema: { query: z.string() },
|
|
37
|
+
handler: async (args) => text(await recall(role.id, args.query)),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const remember = opts.remember;
|
|
41
|
+
if (remember) {
|
|
42
|
+
tools.push({
|
|
43
|
+
name: 'org_remember',
|
|
44
|
+
description: 'Save a memory for future runs. scope "org" (default) shares it with the whole org; scope "agent" keeps it private to your role. Use for decisions, findings, and state worth recalling later - org_recall searches both.',
|
|
45
|
+
schema: { content: z.string(), scope: z.enum(['org', 'agent']).optional() },
|
|
46
|
+
handler: async (args) => text(await remember(role.id, args.content, args.scope ?? 'org')),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const learn = opts.learn;
|
|
50
|
+
if (learn) {
|
|
51
|
+
tools.push({
|
|
52
|
+
name: 'org_learn',
|
|
53
|
+
description: "Persist durable knowledge from this run into the org's knowledge graph: entities ({name, type?, description?}), relationships ({source, target, relation, description?}) and reusable rules ({rule, context?}). Entities merge by name across runs - reuse the exact names listed in your briefing. Call once, before org_complete.",
|
|
54
|
+
schema: {
|
|
55
|
+
nodes: z
|
|
56
|
+
.array(strictArgs({
|
|
57
|
+
name: z.string(),
|
|
58
|
+
type: z.string().optional(),
|
|
59
|
+
description: z.string().optional(),
|
|
60
|
+
}))
|
|
61
|
+
.optional(),
|
|
62
|
+
edges: z
|
|
63
|
+
.array(strictArgs({
|
|
64
|
+
source: z.string(),
|
|
65
|
+
target: z.string(),
|
|
66
|
+
relation: z.string(),
|
|
67
|
+
description: z.string().optional(),
|
|
68
|
+
}))
|
|
69
|
+
.optional(),
|
|
70
|
+
rules: z.array(strictArgs({ rule: z.string(), context: z.string().optional() })).optional(),
|
|
71
|
+
},
|
|
72
|
+
handler: async (args) => text(await learn(role.id, args)),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
// Gate purely on onComplete: the daemon passes it only to the role its
|
|
76
|
+
// boss-selection rule picked, so tool availability always matches the
|
|
77
|
+
// kickoff instruction (reports_to may be non-null for a fallback boss).
|
|
78
|
+
if (opts.onComplete) {
|
|
79
|
+
tools.push({
|
|
80
|
+
name: 'org_complete',
|
|
81
|
+
description: '⚠️ Ends the run — every agent session shuts down after this. Call exactly once, and only against the org\'s actual, full stated goal (see your briefing), never against just the current batch of dispatched tasks. "achieved" means the WHOLE goal is done, not "everyone assigned so far finished their piece" — a multi-phase or open-ended goal is very rarely achieved in a single run. If the current task batch is clearly done but the goal has more scope left: do NOT call this — use org_task/createTask to dispatch the next phase\'s work instead, so the org keeps making progress instead of stopping short. "achieved" only when the full goal is met; "failed" only when it clearly cannot be — neither requires a blocker (though if this org\'s run_config.completion is set to \'dag\', "achieved" is ALSO refused while org_tasks still has runnable work that is not blocked on a real-world time — check org_tasks first if that setting applies to you). Use outcome "partial" only when you are ending the run with real scope still remaining, and you MUST name why with `blocker`: \'budget\' (a role is genuinely near its token/USD ceiling), \'human\' (an ask_human question or decision gate is actually pending), \'time\' (if the only thing blocking further work is a scheduled process or deadline you know the time of, call org_task_block instead of ending the run so a future run can pick back up automatically — this blocker is refused unless a task is actually blocked that way), or \'external\' (anything else — `blockerDetail` must be a real, substantive explanation; placeholders like "none"/"n/a" and anything under 10 characters are refused, because this is the one blocker nothing else can check, and it is recorded verbatim in the run history under your name). A refusal names which of these to use instead. Before calling, check org_tasks — siblings with in-progress work only get a short drain window to finish before being cut off, so do not call this while others are still mid-build or mid-edit unless the run genuinely cannot continue. The outcome and summary are persisted to the org run history and briefed to the next run. If the run produced a concrete deliverable (a post, document, message, piece of content, code, etc.), summary MUST include that deliverable\'s full text verbatim — not a meta-description of what happened. Someone reading only summary should be able to see the actual result, not just that "a result was produced".',
|
|
82
|
+
schema: {
|
|
83
|
+
outcome: z.enum(['achieved', 'partial', 'failed']),
|
|
84
|
+
summary: z.string(),
|
|
85
|
+
blocker: z.enum(['budget', 'human', 'external', 'time']).optional(),
|
|
86
|
+
blockerDetail: z.string().optional(),
|
|
87
|
+
},
|
|
88
|
+
handler: async (args) => {
|
|
89
|
+
const refusal = opts.onComplete?.(role.id, args.outcome, args.summary, args.blocker, args.blockerDetail);
|
|
90
|
+
// #302: a refusal must not claim the outcome was recorded — nothing
|
|
91
|
+
// was, and the daemon never emitted the event that would stop the run.
|
|
92
|
+
if (refusal)
|
|
93
|
+
return text(refusal);
|
|
94
|
+
return text(`outcome "${args.outcome}" recorded`);
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
const onRespawnRole = opts.onRespawnRole;
|
|
99
|
+
if (onRespawnRole) {
|
|
100
|
+
tools.push({
|
|
101
|
+
name: 'org_respawn_role',
|
|
102
|
+
description: "Replace one crashed, exhausted, or unsuitable WORKER role with a fresh session — keeping its role id, workspace, task ownership, and queued messages. Cannot target the coordinator (yourself) or an unknown/removed/not-yet-started role. Omit runtime/model/providerName to keep their current values. Omitted budgetTokens uses the normal per-role allocation for this run; it cannot raise the org-wide token budget. reason is a short operational reason for the audit log; briefing is what the replacement should know to continue the work — it starts a FRESH model session with no memory of the old one's conversation, so include everything it needs.",
|
|
103
|
+
schema: {
|
|
104
|
+
roleId: z.string(),
|
|
105
|
+
runtime: z.string().optional(),
|
|
106
|
+
model: z.string().optional(),
|
|
107
|
+
providerName: z.string().optional(),
|
|
108
|
+
budgetTokens: z.number().optional(),
|
|
109
|
+
reason: z.string(),
|
|
110
|
+
briefing: z.string(),
|
|
111
|
+
},
|
|
112
|
+
handler: async (args) => {
|
|
113
|
+
const receipt = await onRespawnRole(role.id, args);
|
|
114
|
+
return text(JSON.stringify(receipt));
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
const onListRuntimeOptions = opts.onListRuntimeOptions;
|
|
119
|
+
if (onListRuntimeOptions) {
|
|
120
|
+
tools.push({
|
|
121
|
+
name: 'org_list_runtime_options',
|
|
122
|
+
description: 'List every runtime this daemon knows how to run a role on (availability, detected binary/version, install hint) and every named provider configured for this project (name and default model only — never keys, tokens, or endpoints). Use before org_respawn_role to pick a real runtime/providerName. "available" means locally resolvable/detected, not that login, quota, or a remote model is valid.',
|
|
123
|
+
schema: {},
|
|
124
|
+
handler: async () => text(JSON.stringify(await onListRuntimeOptions())),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
const onGate = opts.onGate;
|
|
128
|
+
if (onGate) {
|
|
129
|
+
tools.push({
|
|
130
|
+
name: 'org_gate',
|
|
131
|
+
description: 'Create a decision gate — a hard-blocking human-approval checkpoint. Use before irreversible actions (deployments, deletions, external comms). The gate pauses your work until a human approves or rejects it. End your turn after calling this; you will receive the resolution as a new message.',
|
|
132
|
+
schema: { name: z.string(), description: z.string() },
|
|
133
|
+
handler: async (args) => text(await onGate(role.id, args.name, args.description)),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
// ADR-O001 D7: the `loadout` argument exists only for an org with a
|
|
137
|
+
// catalog, so every other org's tool list stays byte-identical.
|
|
138
|
+
const catalog = opts.loadoutCatalog?.length ? opts.loadoutCatalog : undefined;
|
|
139
|
+
const loadoutArg = catalog
|
|
140
|
+
? { loadout: z.enum(catalog.map((l) => l.name)).optional() }
|
|
141
|
+
: {};
|
|
142
|
+
// Sent with the dispatch itself (task-provenance.ts dispatchLine), so the
|
|
143
|
+
// instructions arrive with the task instead of in a follow-up message.
|
|
144
|
+
const briefArg = z.string().max(MAX_TASK_BRIEF).optional();
|
|
145
|
+
const orgTask = orgTaskTool(opts, loadoutArg, briefArg);
|
|
146
|
+
if (orgTask)
|
|
147
|
+
tools.push(orgTask);
|
|
148
|
+
const completeTask = opts.completeTask;
|
|
149
|
+
if (completeTask) {
|
|
150
|
+
tools.push({
|
|
151
|
+
name: 'org_task_done',
|
|
152
|
+
description: opts.requireTaskEvidence
|
|
153
|
+
? 'Mark a task as completed. This org requires EVIDENCE (run_config.completion_evidence): pass `evidence` with the current commit sha of the work (the HEAD of any worktree of this repository, or any local branch tip), `worktree` naming the worktree you ran in when it is not the org workspace, and one entry per acceptance criterion — the command you actually ran, its real exit code, and its output. A check passes when its exit code equals `expectExit` (default 0): when the criterion is met by a non-zero exit (a lookup that must find nothing → 1, a timeout that must fire → 124), set `expectExit` instead of appending `|| true`, which erases the exit code, and always say why in a one-line `expectReason` ("404 = branch not protected") — `expectExit` without it is refused. `expectExit` is only for a SINGLE-PURPOSE command: on a test suite or any other aggregate runner (vitest, jest, `pnpm test`, `pnpm -r`, a verify script) it is refused outright, because a suite exit code means "at least one of many things failed" and declaring it expected accepts every other failure too — run the one failing test file on its own and declare `expectExit` on that, or exclude the known failure and record the exclusion in `result`. A task whose job is to REPORT (QA, an audit) closes on commands that prove the report exists and is complete (e.g. `test -s <report file>`); the failures it found are findings — put them in `result` and send them to the coordinator, not in `checks`. If you tested something outside a git worktree (a scratch dir, an installed tarball), pin `headSha`/`worktree` to the worktree the artifact was built from. Evidence pinned to a commit that is no longer the head of that work is stale and will be refused, and a refused completion puts the task back in your queue with the reason — but only up to run_config.max_evidence_attempts refused proofs (default 3; a call with no `evidence` at all is refused without counting), after which the task is recorded as failed and escalated to the boss instead of returned to you. Any downstream tasks whose deps are now all done become ready and are dispatched.'
|
|
154
|
+
: 'Mark a task as completed and optionally provide a result summary. Any downstream tasks whose deps are now all done will become ready and be dispatched.',
|
|
155
|
+
schema: {
|
|
156
|
+
taskId: z.string(),
|
|
157
|
+
result: z.string().optional(),
|
|
158
|
+
evidence: strictArgs({
|
|
159
|
+
headSha: z.string(),
|
|
160
|
+
worktree: z.string().optional(),
|
|
161
|
+
checks: z
|
|
162
|
+
.array(strictArgs({
|
|
163
|
+
command: z.string(),
|
|
164
|
+
exitCode: z.number().int(),
|
|
165
|
+
expectExit: z.number().int().optional(),
|
|
166
|
+
expectReason: z.string().optional(),
|
|
167
|
+
output: z.string().optional(),
|
|
168
|
+
}))
|
|
169
|
+
.default([]),
|
|
170
|
+
}).optional(),
|
|
171
|
+
},
|
|
172
|
+
handler: async (args) => text(completeTask(role.id, args.taskId, args.result, args.evidence)),
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
const requestReview = opts.requestReview;
|
|
176
|
+
if (requestReview) {
|
|
177
|
+
tools.push({
|
|
178
|
+
name: 'org_review',
|
|
179
|
+
description: "Ask an artifact-only reviewer for a verdict on a task. You pass ids only: the runtime builds the review from the task's text, its assignee's latest org_task_done evidence (commands, exit codes, output) and its own git diff of base...headSha — nothing you write is added, so there is no summary to give. The reviewer starts cold every time and replies to you with org_send. Refused if the task has no evidence yet.",
|
|
180
|
+
schema: {
|
|
181
|
+
taskId: z.string(),
|
|
182
|
+
reviewer: z.string(),
|
|
183
|
+
base: z.string().optional().describe("git ref to diff against (default 'main')"),
|
|
184
|
+
},
|
|
185
|
+
handler: async (args) => text(requestReview(role.id, args.taskId, args.reviewer, args.base)),
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
const listTasks = opts.listTasks;
|
|
189
|
+
if (listTasks) {
|
|
190
|
+
tools.push({
|
|
191
|
+
name: 'org_tasks',
|
|
192
|
+
description: 'List all tasks in the DAG with their current status and dependencies. Pass `taskId` to get just that task, including its result and latest evidence.',
|
|
193
|
+
schema: { taskId: z.string().optional() },
|
|
194
|
+
handler: async (args) => text(listTasks(args.taskId)),
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
const splitTask = opts.splitTask;
|
|
198
|
+
if (splitTask) {
|
|
199
|
+
tools.push({
|
|
200
|
+
name: 'org_task_split',
|
|
201
|
+
description: 'Split a task into parallel children when scope expands. The parent becomes "split"; children inherit its deps; downstream tasks are rewired to depend on all children.',
|
|
202
|
+
schema: {
|
|
203
|
+
parentId: z.string(),
|
|
204
|
+
children: z.array(strictArgs({ title: z.string(), assignee: z.string() })).min(1),
|
|
205
|
+
},
|
|
206
|
+
handler: async (args) => text(splitTask(role.id, args.parentId, args.children ?? [])),
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
const mergeTask = opts.mergeTask;
|
|
210
|
+
if (mergeTask) {
|
|
211
|
+
tools.push({
|
|
212
|
+
name: 'org_task_merge',
|
|
213
|
+
description: 'Merge one task into another when parallel branches converge early. The source becomes "merged"; downstream deps are rewired to the target.',
|
|
214
|
+
schema: { sourceId: z.string(), targetId: z.string() },
|
|
215
|
+
handler: async (args) => text(mergeTask(role.id, args.sourceId, args.targetId)),
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
const cancelTask = opts.cancelTask;
|
|
219
|
+
if (cancelTask) {
|
|
220
|
+
tools.push({
|
|
221
|
+
name: 'org_task_cancel',
|
|
222
|
+
description: 'Cancel a task as moot. The task becomes "cancelled" and unblocks downstream work. Its assignee is told to stop and not to commit or report further work for it; a role that runs one session per task has that session\'s process ended at once.',
|
|
223
|
+
schema: { taskId: z.string(), reason: z.string().optional() },
|
|
224
|
+
handler: async (args) => text(cancelTask(role.id, args.taskId, args.reason)),
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
const blockTask = opts.blockTask;
|
|
228
|
+
if (blockTask) {
|
|
229
|
+
tools.push({
|
|
230
|
+
name: 'org_task_block',
|
|
231
|
+
description: `Mark a task you are actively working (status "running") as blocked on a real-world time, not on other tasks — e.g. a scheduled soak test, a CI run that takes hours, a human-set deadline. Use this INSTEAD of leaving the task "running" with nothing actually happening, and instead of calling org_complete just because there is genuinely nothing to do right now: the idle watchdog will stop nudging you about this task until the time you give arrives, then automatically re-dispatch it to you. Give untilIso as an ISO 8601 date/time (e.g. "2026-08-19T09:00:00Z"). Nothing external wakes a blocked task — not a background command finishing, not a Monitor event, not npm propagation — so never block on a command you started: run waits in the foreground instead, with a command timeout long enough for them. Until the deadline you are woken periodically (every run_config.block_recheck_minutes, default 5; recheckAfterMinutes sets it for this block, 1-${MAX_BLOCK_RECHECK_MINUTES}) to re-check: close the task, re-block it, or report.`,
|
|
232
|
+
schema: {
|
|
233
|
+
taskId: z.string(),
|
|
234
|
+
untilIso: z.string(),
|
|
235
|
+
reason: z.string().optional(),
|
|
236
|
+
recheckAfterMinutes: z.number().positive().max(MAX_BLOCK_RECHECK_MINUTES).optional(),
|
|
237
|
+
},
|
|
238
|
+
handler: async (args) => text(blockTask(role.id, args.taskId, args.untilIso, args.reason, args.recheckAfterMinutes)),
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
const planGraph = opts.planGraph;
|
|
242
|
+
if (planGraph) {
|
|
243
|
+
tools.push({
|
|
244
|
+
name: 'org_plan_graph',
|
|
245
|
+
description: 'Propose a full work graph in one call. Each task spec uses a local "name" and references other specs by name in "after", and may carry a "brief" with its instructions exactly as org_task does.' +
|
|
246
|
+
(catalog ? ' Each spec may select a "loadout" exactly as org_task does.' : ''),
|
|
247
|
+
schema: {
|
|
248
|
+
tasks: z
|
|
249
|
+
.array(strictArgs({
|
|
250
|
+
name: z.string(),
|
|
251
|
+
title: z.string(),
|
|
252
|
+
assignee: z.string(),
|
|
253
|
+
after: z.array(z.string()).default([]),
|
|
254
|
+
brief: briefArg,
|
|
255
|
+
...loadoutArg,
|
|
256
|
+
}, { deps: 'use `after` with node names' }))
|
|
257
|
+
.min(1),
|
|
258
|
+
},
|
|
259
|
+
handler: async (args) => text(planGraph(role.id, args.tasks ?? [])),
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
tools.push({
|
|
263
|
+
name: 'org_send',
|
|
264
|
+
description: 'Send a message to another agent (role id) or another org ("org:role"). This is the only inter-agent channel.' +
|
|
265
|
+
// D3: only orgs with a task-scoped role see this, so every other org's
|
|
266
|
+
// tool list (prefix position 0) is unchanged.
|
|
267
|
+
(opts.def?.roles.some((r) => resolveSessionScope(r, opts.def) === 'task')
|
|
268
|
+
? " When a message is about a task, start its subject with [task:<id>] so a task-scoped recipient reads it in that task's session."
|
|
269
|
+
: ''),
|
|
270
|
+
schema: { to: z.string(), subject: z.string(), message: z.string() },
|
|
271
|
+
handler: async (args) => {
|
|
272
|
+
if (opts.beforeTool) {
|
|
273
|
+
const approved = await opts.beforeTool(role.id, 'org_send', args);
|
|
274
|
+
if (approved === false)
|
|
275
|
+
return text('Tool "org_send" was denied by guardrail approval');
|
|
276
|
+
if (approved === null)
|
|
277
|
+
return text('Tool "org_send" is pending human approval - you will receive the result when it is approved or denied.');
|
|
278
|
+
}
|
|
279
|
+
const receipt = await deliver(role.id, args.to, args.subject, args.message);
|
|
280
|
+
return text(receipt);
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
tools.push({
|
|
284
|
+
name: 'ask_human',
|
|
285
|
+
description: 'Ask a human a free-form question. Use only when you genuinely need human judgment. ' +
|
|
286
|
+
'Set blocking: true ONLY if you cannot continue until it is answered — a blocking question pauses the ' +
|
|
287
|
+
"org's idle watchdog (for up to an hour; after that the run resumes its normal idle checks either way). " +
|
|
288
|
+
'If you can keep working while you wait — an FYI, a preference, anything you would describe as "not blocking on this" — ' +
|
|
289
|
+
'pass blocking: false and carry on; the question is still recorded and answered, it just does not freeze the run. ' +
|
|
290
|
+
'Defaults to blocking.',
|
|
291
|
+
schema: { question: z.string(), blocking: z.boolean().optional() },
|
|
292
|
+
handler: async (args) => {
|
|
293
|
+
if (!opts.askHuman)
|
|
294
|
+
return text('ask_human is not available in this session');
|
|
295
|
+
const receipt = await opts.askHuman(role.id, args.question, args.blocking);
|
|
296
|
+
return text(receipt);
|
|
297
|
+
},
|
|
298
|
+
});
|
|
299
|
+
// Built-in org tools reject undeclared keys instead of stripping them: a
|
|
300
|
+
// stripped `deps` on an org_plan_graph node silently dropped every edge.
|
|
301
|
+
for (const t of tools)
|
|
302
|
+
t.strict ??= {};
|
|
303
|
+
return tools;
|
|
304
|
+
}
|
|
305
|
+
//# sourceMappingURL=org-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-tools.js","sourceRoot":"","sources":["../../../src/orgrt/org-tools.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,4EAA4E;AAC5E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;;;kFAMkF;AAClF,MAAM,UAAU,aAAa,C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yHAAyH;YACzH,mHAAmH;YACnH,uBAAuB;QACzB,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE;QAClE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,IAAI,CAAC,IAAI,CAAC,QAAQ;gBAAE,OAAO,IAAI,CAAC,4CAA4C,CAAC,CAAC;YAC9E,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,CACjC,IAAI,CAAC,EAAE,EACP,IAAI,CAAC,QAAkB,EACvB,IAAI,CAAC,QAA+B,CACrC,CAAC;YACF,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC,CAAC;IACH,yEAAyE;IACzE,yEAAyE;IACzE,KAAK,MAAM,CAAC,IAAI,KAAK;QAAE,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC;IACvC,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type RoleCheckpoint } from './checkpoint.js';
|
|
2
|
+
import { OrgDaemon } from './daemon.js';
|
|
3
|
+
import type { AgentRuntime, RunningOrg } from './daemon-types.js';
|
|
4
|
+
import { type OrgRole } from './types.js';
|
|
5
|
+
/** Build one role incarnation: mailbox, policy, AgentRuntime, sessionOpts,
|
|
6
|
+
* and the supervised crash-retry loop. Used by BOTH the startup lazy-spawn
|
|
7
|
+
* path (generation 0, via the `spawnRole` closure inside startOrgInner)
|
|
8
|
+
* and respawnRole() (generation N+1). Does not touch running.agents or
|
|
9
|
+
* running.roleSlots — callers publish the result themselves. */
|
|
10
|
+
export declare function spawnRoleIncarnation(daemon: OrgDaemon, name: string, running: RunningOrg, role: OrgRole, generation: number, opts?: {
|
|
11
|
+
roleCheckpoint?: RoleCheckpoint;
|
|
12
|
+
abort?: AbortController;
|
|
13
|
+
budgetTokensOverride?: number;
|
|
14
|
+
}): {
|
|
15
|
+
runtime: AgentRuntime;
|
|
16
|
+
abort: AbortController;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=role-incarnation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-incarnation.d.ts","sourceRoot":"","sources":["../../../src/orgrt/role-incarnation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,cAAc,EAA2C,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAYlE,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;iEAIiE;AACjE,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,MAAM,EAClB,IAAI,GAAE;IACJ,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC1B,GACL;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE,CA+WnD"}
|