@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
|
@@ -1,276 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type { RoleFence } from './fence.js';
|
|
6
|
-
import type { LoadoutSummary, ResolvedLoadout } from './loadouts.js';
|
|
7
|
-
import { Mailbox } from './mailbox.js';
|
|
8
|
-
import type { Decision, PolicyEngine } from './policy.js';
|
|
9
|
-
import { type TaskProcesses } from './task-cancel.js';
|
|
10
|
-
import type { RolePick, TaskPick } from './task-match.js';
|
|
11
|
-
import { type DecisionKind, type OrgDef, type OrgRole } from './types.js';
|
|
12
|
-
import { SessionLedger } from './session-ledger.js';
|
|
13
|
-
/**
|
|
14
|
-
* Resolves the extra system-prompt block for a role: its pinned library
|
|
15
|
-
* skills and on-demand skill catalog (skill-library.ts) plus the role's own
|
|
16
|
-
* `instructions_file`, if any — all optional and independent. A missing or
|
|
17
|
-
* unreadable `instructions_file` is skipped (not an error): a role shouldn't
|
|
18
|
-
* fail to start a session over a stale/typo'd custom-file path.
|
|
19
|
-
*/
|
|
20
|
-
export declare function resolveRoleExtraGuidance(role: OrgRole, projectRoot?: string): string | undefined;
|
|
21
|
-
/** Resolve the model string for a role: explicit adapter_config.model wins;
|
|
22
|
-
* otherwise fall back to the vendor/runtime default.
|
|
23
|
-
*
|
|
24
|
-
* Vendor defaults are read straight off VERCEL_PROVIDERS, which already
|
|
25
|
-
* carries a defaultModel per vendor. A second hand-kept table lived here and
|
|
26
|
-
* restated all sixteen of them — two lists of per-vendor defaults that would
|
|
27
|
-
* eventually disagree, which is precisely the drift #252 was. An empty
|
|
28
|
-
* registry default (openai-compatible, which serves arbitrary endpoints) is
|
|
29
|
-
* falsy and so falls through to the runtime switch, as it always did. */
|
|
30
|
-
export declare function resolveModel(role: OrgRole, runtime?: string, vendor?: string): string;
|
|
31
|
-
export type DeliverFn = (from: string, to: string, subject: string, body: string) => Promise<string>;
|
|
32
|
-
/** The SDK's `canUseTool` gate, composed from two independent layers: PolicyEngine's
|
|
33
|
-
* static config checks (deny/allow lists, path scoping, git level, web allowlist,
|
|
34
|
-
* budget), then — only for calls policy would allow — the human-approval guardrail
|
|
35
|
-
* (`beforeTool`, i.e. daemon.checkApproval) for whatever action names it treats as
|
|
36
|
-
* sensitive (Bash/WebFetch/WebSearch/org_complete). Exported standalone so this
|
|
37
|
-
* composition is unit-testable without spinning up a real SDK session: previously
|
|
38
|
-
* `beforeTool` was wired into SessionOpts but never actually called from here, so
|
|
39
|
-
* none of those sensitive actions ever paused for a human. */
|
|
40
|
-
export declare function gatedCanUseTool(policy: PolicyEngine, beforeTool: SessionOpts['beforeTool'], roleId: string, fence?: RoleFence,
|
|
41
|
-
/** Optional hook invoked whenever this gate denies a tool call — wired to
|
|
42
|
-
* daemon.recordDecision() so denials show up in `org decisions` traces.
|
|
43
|
-
* #290: `kind` names WHICH of this function's four deny paths fired, so a
|
|
44
|
-
* consumer never has to tell a fence block from a routine pending approval
|
|
45
|
-
* by matching the English in the message. */
|
|
46
|
-
onDeny?: (toolName: string, input: Record<string, unknown>, decision: Extract<Decision, {
|
|
47
|
-
behavior: 'deny';
|
|
48
|
-
}>, kind: DecisionKind) => void,
|
|
49
|
-
/** ORG-9: reports whether this role has a pending (unresolved) decision gate.
|
|
50
|
-
* org_gate is documented as creating a "hard-blocking" checkpoint, but until
|
|
51
|
-
* this was wired in nothing actually stopped tool use while a gate sat
|
|
52
|
-
* pending — only approvals did that. When set and true, ALL tool calls are
|
|
53
|
-
* denied (not just the sensitive subset approvals gate) until the gate is
|
|
54
|
-
* resolved, matching the "hard-blocking" description. */
|
|
55
|
-
hasPendingGate?: () => boolean): (toolName: string, input: Record<string, unknown>,
|
|
56
|
-
/** #289: the harness's id for this call, forwarded to policy.decide so the
|
|
57
|
-
* invocation event can be joined to the later tool_result event. */
|
|
58
|
-
meta?: {
|
|
59
|
-
toolUseId?: string;
|
|
60
|
-
}) => Promise<Decision>;
|
|
61
|
-
export interface SessionOpts {
|
|
62
|
-
org: string;
|
|
63
|
-
role: OrgRole;
|
|
64
|
-
bus: OrgBus;
|
|
65
|
-
policy: PolicyEngine;
|
|
66
|
-
mailbox: Mailbox;
|
|
67
|
-
cwd: string;
|
|
68
|
-
/** Org state directory (`.monomind/orgs/<name>`). Used to pass
|
|
69
|
-
* MONOMIND_ORG_DIR to runners that persist per-role state (VercelAgentRunner
|
|
70
|
-
* stores session history under `<orgDir>/sessions/`). */
|
|
71
|
-
orgDir?: string;
|
|
72
|
-
/** Project root for resolving `adapter_config.provider` named providers
|
|
73
|
-
* (config search must start at the project root even when the role's
|
|
74
|
-
* workspace cwd is an isolated scratch dir). Defaults to opts.cwd. */
|
|
75
|
-
orgRoot?: string;
|
|
76
|
-
/** Run id of the org run this session belongs to (MONOMIND_ORG_RUN). */
|
|
77
|
-
run?: string;
|
|
78
|
-
/** M1: build this session's tool-provider tools (role `tool_providers`).
|
|
79
|
-
* Called once per session start; the returned set is closed (provider
|
|
80
|
-
* processes killed) when the session ends. */
|
|
81
|
-
buildProviderTools?: () => Promise<{
|
|
82
|
-
tools: OrgToolDef[];
|
|
83
|
-
close(): void;
|
|
84
|
-
} | undefined>;
|
|
85
|
-
deliver: DeliverFn;
|
|
86
|
-
askHuman?: (role: string, question: string, blocking?: boolean) => Promise<string>;
|
|
87
|
-
/** Coordinator-only: records the run's outcome (daemon persists it to run
|
|
88
|
-
* history) — #302: the daemon gathers the facts, calls the completion
|
|
89
|
-
* gate, and returns a refusal string instead of recording anything when
|
|
90
|
-
* the call is unsatisfiable; `null`/`undefined` means allowed. */
|
|
91
|
-
onComplete?: (role: string, outcome: 'achieved' | 'partial' | 'failed', summary: string, blocker?: 'budget' | 'human' | 'external' | 'time', blockerDetail?: string) => string | null | undefined;
|
|
92
|
-
/** Present only for the selected coordinator (same gating pattern as
|
|
93
|
-
* onComplete) — mid-run role replacement. Returns the JSON-shaped
|
|
94
|
-
* RespawnReceipt (see role-slot.ts). */
|
|
95
|
-
onRespawnRole?: (callerId: string, args: {
|
|
96
|
-
roleId: string;
|
|
97
|
-
runtime?: string;
|
|
98
|
-
model?: string;
|
|
99
|
-
providerName?: string;
|
|
100
|
-
budgetTokens?: number;
|
|
101
|
-
reason: string;
|
|
102
|
-
briefing: string;
|
|
103
|
-
}) => Promise<unknown>;
|
|
104
|
-
/** Present only for the selected coordinator. Returns the JSON-shaped
|
|
105
|
-
* runtime/named-provider listing (see runtime-options.ts). */
|
|
106
|
-
onListRuntimeOptions?: () => Promise<unknown>;
|
|
107
|
-
/** Search the org's accumulated cross-run memory (memory_namespace). */
|
|
108
|
-
recall?: (role: string, query: string) => Promise<string>;
|
|
109
|
-
/** Write a memory deliberately: scope 'org' (shared, default) or 'agent' (private to this role). */
|
|
110
|
-
remember?: (role: string, content: string, scope: 'org' | 'agent') => Promise<string>;
|
|
111
|
-
/** Persist extracted entities/relations/rules into the org's knowledge graph. */
|
|
112
|
-
learn?: (role: string, payload: {
|
|
113
|
-
nodes?: {
|
|
114
|
-
name: string;
|
|
115
|
-
type?: string;
|
|
116
|
-
description?: string;
|
|
117
|
-
}[];
|
|
118
|
-
edges?: {
|
|
119
|
-
source: string;
|
|
120
|
-
target: string;
|
|
121
|
-
relation: string;
|
|
122
|
-
description?: string;
|
|
123
|
-
}[];
|
|
124
|
-
rules?: {
|
|
125
|
-
rule: string;
|
|
126
|
-
context?: string;
|
|
127
|
-
}[];
|
|
128
|
-
}) => Promise<string>;
|
|
129
|
-
/** Top existing KG entity names - injected into the coordinator prompt so
|
|
130
|
-
* extraction reuses canonical names instead of minting near-duplicates. */
|
|
131
|
-
glossary?: string[];
|
|
132
|
-
/** Search the user's Second Brain (project documents + personal global brain). */
|
|
133
|
-
searchKnowledge?: (role: string, query: string) => Promise<string>;
|
|
134
|
-
/** Guardrail beforeTool hook: checks if a tool call requires approval before execution.
|
|
135
|
-
* `input` is the tool's actual call arguments — required so the approval cache can
|
|
136
|
-
* key on what's actually being called (e.g. the Bash command, the WebFetch url),
|
|
137
|
-
* not just the tool name; see approvals.ts's checkApproval for why. */
|
|
138
|
-
beforeTool?: (role: string, toolName: string, input: Record<string, unknown>) => Promise<boolean | null>;
|
|
139
|
-
/** Called whenever gatedCanUseTool denies a tool call — wired to daemon.recordDecision()
|
|
140
|
-
* so those denials show up in `org decisions` traces. `kind` (#290) says which
|
|
141
|
-
* deny path fired, so the trace is machine-readable rather than prose-only. */
|
|
142
|
-
onDecision?: (role: string, toolName: string, message: string, kind: DecisionKind) => void;
|
|
143
|
-
/** ORG-9: reports whether this role currently has a pending decision gate —
|
|
144
|
-
* wired to daemon.listGates(org, 'pending'). When true, gatedCanUseTool
|
|
145
|
-
* denies every tool call until the gate is resolved. */
|
|
146
|
-
hasPendingGate?: () => boolean;
|
|
147
|
-
def?: OrgDef;
|
|
148
|
-
maxTurns?: number;
|
|
149
|
-
queryFn?: typeof query;
|
|
150
|
-
/** Provider-agnostic runner. Takes precedence over queryFn. When unset,
|
|
151
|
-
* session.ts builds a ClaudeAgentRunner from queryFn (or the default),
|
|
152
|
-
* preserving the previous Claude-only behaviour exactly. */
|
|
153
|
-
runner?: AgentRunner;
|
|
154
|
-
/** Caller-owned cancellation handle for THIS incarnation. Every session
|
|
155
|
-
* attempt runs on its own AbortController linked to this one: aborting it
|
|
156
|
-
* aborts the in-flight attempt, which lets the daemon force-stop a specific
|
|
157
|
-
* incarnation (org stop, mid-run role replacement's forced-stop step)
|
|
158
|
-
* without reaching into runAgentSession's internals. An attempt's own abort
|
|
159
|
-
* (the silent-stream kill) never propagates back to it (#256). */
|
|
160
|
-
externalAbort?: AbortController;
|
|
161
|
-
/** Lets org_task_cancel end this role's task-scoped process for the
|
|
162
|
-
* cancelled task (task-cancel.ts). */
|
|
163
|
-
taskProcesses?: TaskProcesses;
|
|
164
|
-
/** Override how long a session's first stream pull may stay silent before
|
|
165
|
-
* the attempt is aborted and retried (tests only; default 4 minutes). */
|
|
166
|
-
silentSessionMs?: number;
|
|
167
|
-
/** ID of the last message received by this agent (for threading responses). Function to ensure live reading. */
|
|
168
|
-
lastMessageId?: () => string | undefined;
|
|
169
|
-
/** Callback for each output line — feeds ScrollbackBuffer. */
|
|
170
|
-
onOutput?: (line: string) => void;
|
|
171
|
-
/** Callback when the SDK assigns a session ID — enables checkpoint resume (P2-13). */
|
|
172
|
-
onSessionId?: (id: string) => void;
|
|
173
|
-
/** Called once per finished turn (the runner's `result` message), so the
|
|
174
|
-
* daemon can check what the role left open before its session parks. */
|
|
175
|
-
onTurnEnd?: () => void;
|
|
176
|
-
/** SDK session ID persisted in a checkpoint from a prior run — when set, the
|
|
177
|
-
* first query() call resumes it instead of starting a fresh conversation
|
|
178
|
-
* (P2-13: this is what actually makes checkpoint resume resume). */
|
|
179
|
-
resumeSessionId?: string;
|
|
180
|
-
/** ADR-O001 D3: the run's task-keyed session records. Every session run is
|
|
181
|
-
* recorded here (sessionIdBefore/After) in every scope; only
|
|
182
|
-
* `session_scope: 'task'` resumes from it. Omitted = in-memory. */
|
|
183
|
-
sessionLedger?: SessionLedger;
|
|
184
|
-
/** Circuit breaker config for this role. */
|
|
185
|
-
circuitBreaker?: {
|
|
186
|
-
threshold: number;
|
|
187
|
-
state: {
|
|
188
|
-
failures: number;
|
|
189
|
-
tripped: boolean;
|
|
190
|
-
};
|
|
191
|
-
};
|
|
192
|
-
/** Called when the coordinator's context window is exhausted. */
|
|
193
|
-
onContextLimit?: () => void;
|
|
194
|
-
/** MonoFence guardrail instance for this role. */
|
|
195
|
-
fence?: RoleFence;
|
|
196
|
-
/** Decision gate: creates a hard-blocking human-approval checkpoint. */
|
|
197
|
-
onGate?: (role: string, name: string, description: string) => Promise<string>;
|
|
198
|
-
/** Task DAG: create a task with dependencies. `loadout` (ADR-O001 D7) is
|
|
199
|
-
* the catalog entry the caller selected; only offered when the org has a
|
|
200
|
-
* catalog (`loadoutCatalog`). */
|
|
201
|
-
createTask?: (role: string, title: string, assignee: string, deps: string[], loadout?: string, brief?: string, pick?: TaskPick) => string;
|
|
202
|
-
/** Resolves `assignee: "auto"` on org_task from the title and brief: the
|
|
203
|
-
* decision model (or, without one, a keyword match over role titles and
|
|
204
|
-
* responsibilities) picks among the agent roles other than `caller`.
|
|
205
|
-
* `role: null` = no role fits (or the best ones tie); the caller must name
|
|
206
|
-
* one. The pick is recorded on the task (OrgTask.pick). */
|
|
207
|
-
pickAssignee?: (title: string, brief: string | undefined, caller: string) => Promise<RolePick>;
|
|
208
|
-
/** Called after org_skill_load served one of the role's skills, so the
|
|
209
|
-
* daemon can record it against a task that suggested it. */
|
|
210
|
-
onSkillLoad?: (role: string, name: string) => void;
|
|
211
|
-
/** ADR-O001 D7: the org's loadout catalog. Set only when the org declares
|
|
212
|
-
* one; it adds the optional `loadout` argument to org_task/org_plan_graph.
|
|
213
|
-
* Unset, those tools are byte-identical to before (same gating idea as
|
|
214
|
-
* `requireTaskEvidence`). Identical for every role and every loadout, so
|
|
215
|
-
* the tool list — prefix position 0 — never varies with the loadout. */
|
|
216
|
-
loadoutCatalog?: LoadoutSummary[];
|
|
217
|
-
/** ADR-O001 D7: the loadout THIS session's system prompt is built with.
|
|
218
|
-
* Plain data resolved by the caller before the session starts, so it is
|
|
219
|
-
* fixed for the session's whole life — every maxTurns/crash restart
|
|
220
|
-
* rebuilds the identical prompt, and nothing can edit it mid-session.
|
|
221
|
-
* D3 hook: a task-keyed session for (role, taskKey) passes
|
|
222
|
-
* `resolveLoadout(def, task.loadout, root)` here. */
|
|
223
|
-
loadout?: ResolvedLoadout;
|
|
224
|
-
/** ADR-O001 D3 x D7: in task scope each task's session is built with that
|
|
225
|
-
* task's recorded loadout (undefined = none selected) instead of the
|
|
226
|
-
* incarnation's `loadout`, which then only serves untagged mail. */
|
|
227
|
-
loadoutFor?: (taskId: string) => ResolvedLoadout | undefined;
|
|
228
|
-
/** Task DAG: mark a task as completed. `evidence` is ADR-O001 D5's
|
|
229
|
-
* machine-checkable proof — acceptance commands with their real exit
|
|
230
|
-
* codes, pinned to a commit sha. Only demanded when the org sets
|
|
231
|
-
* run_config.completion_evidence (see `requireTaskEvidence`). */
|
|
232
|
-
completeTask?: (role: string, taskId: string, result?: string, evidence?: TaskEvidence) => string;
|
|
233
|
-
/** run_config.completion_evidence: when true, org_task_done advertises the
|
|
234
|
-
* evidence argument as required. Off by default, so a role in an org that
|
|
235
|
-
* has not opted in sees a byte-identical tool description (D7: the tool
|
|
236
|
-
* list is prefix position 0 — changing it for every org would invalidate
|
|
237
|
-
* every cached prompt). */
|
|
238
|
-
requireTaskEvidence?: boolean;
|
|
239
|
-
/** ADR-O001 D6: request an artifact-only review. Set only when the org has
|
|
240
|
-
* a role with review_input: 'artifact-only'; otherwise org_review is not
|
|
241
|
-
* registered and the tool list is unchanged. */
|
|
242
|
-
requestReview?: (role: string, taskId: string, reviewer: string, base?: string) => string;
|
|
243
|
-
/** Task DAG: list all tasks, or just `taskId`. */
|
|
244
|
-
listTasks?: (taskId?: string) => string;
|
|
245
|
-
splitTask?: (role: string, parentId: string, children: {
|
|
246
|
-
title: string;
|
|
247
|
-
assignee: string;
|
|
248
|
-
}[]) => string;
|
|
249
|
-
mergeTask?: (role: string, sourceId: string, targetId: string) => string;
|
|
250
|
-
cancelTask?: (role: string, taskId: string, reason?: string) => string;
|
|
251
|
-
/** Task DAG: mark a 'running' task as waiting on a real-world time (not a
|
|
252
|
-
* dependency) — e.g. a scheduled soak test, a CI run, a human-set
|
|
253
|
-
* deadline. The idle watchdog skips nudging while any task is actively
|
|
254
|
-
* blocked, auto-resumes (re-dispatches) it once the time passes, and
|
|
255
|
-
* wakes its assignee to re-check it every recheckAfterMinutes (#329). */
|
|
256
|
-
blockTask?: (role: string, taskId: string, untilIso: string, reason?: string, recheckAfterMinutes?: number) => string;
|
|
257
|
-
planGraph?: (role: string, specs: {
|
|
258
|
-
name: string;
|
|
259
|
-
title: string;
|
|
260
|
-
assignee: string;
|
|
261
|
-
after?: string[];
|
|
262
|
-
loadout?: string;
|
|
263
|
-
brief?: string;
|
|
264
|
-
}[]) => string;
|
|
265
|
-
}
|
|
266
|
-
/** Role briefing given to each agent session (SDK systemPrompt option).
|
|
267
|
-
* `extraGuidance` carries pre-resolved text the caller already loaded from
|
|
268
|
-
* disk — the role's library skills and/or its own `instructions_file`,
|
|
269
|
-
* if either resolved to something. Kept as a plain string param (not read here)
|
|
270
|
-
* so this function stays synchronous/pure and trivially testable. */
|
|
271
|
-
export declare function buildRolePrompt(role: OrgRole, def: Pick<OrgDef, 'name' | 'goal'>, roster: string[], glossary?: string[], extraGuidance?: string,
|
|
272
|
-
/** M2: one line per endpoint role (endpointBriefingLines) — boss only. */
|
|
273
|
-
endpointBriefing?: string[]): string;
|
|
1
|
+
import type { SessionOpts } from './session-types.js';
|
|
2
|
+
export { gatedCanUseTool } from './session-gate.js';
|
|
3
|
+
export { buildRolePrompt, resolveModel, resolveRoleExtraGuidance, } from './session-prompt.js';
|
|
4
|
+
export type { DeliverFn, SessionOpts } from './session-types.js';
|
|
274
5
|
/**
|
|
275
6
|
* Runs a role for the life of the org, transparently restarting the
|
|
276
7
|
* underlying SDK session whenever it ends on its own (`maxTurns` reached)
|
|
@@ -282,13 +13,6 @@ endpointBriefing?: string[]): string;
|
|
|
282
13
|
* deliver() kept queuing new messages into a mailbox nobody was reading.
|
|
283
14
|
*/
|
|
284
15
|
export declare function runAgentSession(opts: SessionOpts): Promise<void>;
|
|
285
|
-
|
|
286
|
-
* close over sessionOpts callbacks (deliver, recall, remember, …) — same
|
|
287
|
-
* wiring as the previous inline createSdkMcpServer block, just decoupled from
|
|
288
|
-
* the Claude SDK's tool() shape so any AgentRunner can host them.
|
|
289
|
-
*
|
|
290
|
-
* Behaviour is identical to the old inline definitions: conditional tools are
|
|
291
|
-
* gated on their callback being present, org_send/ask_human are always added. */
|
|
16
|
+
export { buildOrgTools } from './org-tools.js';
|
|
292
17
|
export { AUTO_ASSIGNEE } from './task-tools.js';
|
|
293
|
-
export declare function buildOrgTools(opts: SessionOpts): OrgToolDef[];
|
|
294
18
|
//# sourceMappingURL=session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/orgrt/session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/orgrt/session.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,eAAe,EACf,YAAY,EACZ,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAWtE;AAuWD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|