@sema-agent/core 7.6.3 → 7.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -10
- package/dist/agents/agent-transcript-tool.js +2 -2
- package/dist/agents/list-agents-tool.js +2 -3
- package/dist/agents/observer.js +2 -2
- package/dist/agents/peer-admission.d.ts +1 -1
- package/dist/agents/send-message-tool.js +2 -1
- package/dist/agents/subagent-steps.js +5 -4
- package/dist/agents/subagent.js +2 -3
- package/dist/brain/anthropic.js +8 -2
- package/dist/brain/open-responses.js +5 -3
- package/dist/brain/openai.js +31 -8
- package/dist/brain/reasoning.d.ts +32 -0
- package/dist/brain/reasoning.js +18 -0
- package/dist/core/ask-question.js +2 -2
- package/dist/core/auto-mode-defaults.d.ts +16 -0
- package/dist/core/auto-mode-defaults.js +1 -0
- package/dist/core/auto-mode.d.ts +19 -0
- package/dist/core/auto-mode.js +74 -56
- package/dist/core/checkpoint-execution-record.d.ts +110 -0
- package/dist/core/checkpoint-execution-record.js +49 -0
- package/dist/core/checkpoint-store.d.ts +114 -2
- package/dist/core/checkpoint-store.js +35 -2
- package/dist/core/context-edit.d.ts +0 -22
- package/dist/core/context-edit.js +2 -11
- package/dist/core/engine-notice.d.ts +17 -0
- package/dist/core/fs-write-gate-policy.d.ts +7 -1
- package/dist/core/fs-write-gate-policy.js +7 -7
- package/dist/core/gate-fold.js +2 -2
- package/dist/core/gate-lanes.js +4 -3
- package/dist/core/governance-codes.d.ts +1 -1
- package/dist/core/governance-codes.js +8 -0
- package/dist/core/hooks.d.ts +8 -2
- package/dist/core/hooks.js +1 -1
- package/dist/core/lsp.js +2 -2
- package/dist/core/mcp-server-spec.d.ts +17 -0
- package/dist/core/mcp.js +3 -1
- package/dist/core/memory-engine/tools.js +4 -12
- package/dist/core/permission-rules.d.ts +32 -2
- package/dist/core/permission-rules.js +43 -37
- package/dist/core/present-plan-tool.js +3 -4
- package/dist/core/runner/active-skill-scope.js +7 -4
- package/dist/core/runner/clock-and-limits.d.ts +117 -0
- package/dist/core/runner/clock-and-limits.js +118 -0
- package/dist/core/runner/compaction-call-options.d.ts +1 -1
- package/dist/core/runner/contracts.d.ts +37 -3
- package/dist/core/runner/decide-continuation.d.ts +98 -0
- package/dist/core/runner/decide-continuation.js +133 -0
- package/dist/core/runner/execution-record.d.ts +26 -0
- package/dist/core/runner/execution-record.js +19 -0
- package/dist/core/runner/git-leg-delivery.d.ts +28 -0
- package/dist/core/runner/git-leg-delivery.js +94 -0
- package/dist/core/runner/initial-run-state.d.ts +14 -0
- package/dist/core/runner/initial-run-state.js +11 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -4
- package/dist/core/runner/prepare-caps-and-workflow.js +33 -11
- package/dist/core/runner/prepare-defer-classify.d.ts +5 -26
- package/dist/core/runner/prepare-defer-classify.js +10 -10
- package/dist/core/runner/prepare-delegation-surface.d.ts +5 -4
- package/dist/core/runner/prepare-delegation-surface.js +15 -17
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -1
- package/dist/core/runner/prepare-gate-stations.js +3 -1
- package/dist/core/runner/prepare-hands-readface.d.ts +3 -2
- package/dist/core/runner/prepare-hands-readface.js +3 -2
- package/dist/core/runner/prepare-inherited-gate.d.ts +1 -1
- package/dist/core/runner/prepare-inherited-gate.js +1 -0
- package/dist/core/runner/prepare-lsp.d.ts +4 -3
- package/dist/core/runner/prepare-lsp.js +3 -2
- package/dist/core/runner/prepare-memory-engine-session.d.ts +4 -4
- package/dist/core/runner/prepare-memory-engine-session.js +4 -2
- package/dist/core/runner/prepare-offload-wrappers.js +7 -5
- package/dist/core/runner/prepare-park-ask.d.ts +4 -0
- package/dist/core/runner/prepare-park-ask.js +4 -1
- package/dist/core/runner/prepare-project-context.d.ts +5 -23
- package/dist/core/runner/prepare-project-context.js +7 -5
- package/dist/core/runner/prepare-prompt-assembly.d.ts +1 -1
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -1
- package/dist/core/runner/prepare-protocol-tools.js +38 -21
- package/dist/core/runner/prepare-question-face.d.ts +4 -3
- package/dist/core/runner/prepare-question-face.js +5 -3
- package/dist/core/runner/prepare-safety-scan.js +42 -2
- package/dist/core/runner/prepare-task.js +37 -19
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +5 -2
- package/dist/core/runner/prepare-tool-disclosure-mount.js +3 -1
- package/dist/core/runner/prepare-wiring-manifest.d.ts +4 -0
- package/dist/core/runner/prepare-wiring-manifest.js +3 -8
- package/dist/core/runner/run-harness-handlers.d.ts +46 -0
- package/dist/core/runner/run-harness-handlers.js +345 -0
- package/dist/core/runner/run-turn-boundary.d.ts +69 -0
- package/dist/core/runner/run-turn-boundary.js +694 -0
- package/dist/core/runner/runtask.d.ts +0 -68
- package/dist/core/runner/runtask.js +66 -1486
- package/dist/core/runner/session-rule-policy.js +9 -4
- package/dist/core/runner/steer-admission.d.ts +17 -0
- package/dist/core/runner/steer-admission.js +17 -0
- package/dist/core/runner/synthetic-tools.js +5 -8
- package/dist/core/runner/tool-disclosure.d.ts +4 -0
- package/dist/core/runner/tool-disclosure.js +9 -5
- package/dist/core/runner/tool-end-body.d.ts +71 -0
- package/dist/core/runner/tool-end-body.js +75 -0
- package/dist/core/runner/tool-face-overlay.d.ts +40 -0
- package/dist/core/runner/tool-face-overlay.js +125 -0
- package/dist/core/runner/tool-output-projection.d.ts +10 -0
- package/dist/core/runner/tool-output-projection.js +33 -10
- package/dist/core/sensitive-path-policy.d.ts +3 -0
- package/dist/core/sensitive-path-policy.js +6 -5
- package/dist/core/shared-memory/tools.js +3 -6
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +4 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +108 -0
- package/dist/core/task-event.d.ts +10 -0
- package/dist/core/task-registry.js +4 -5
- package/dist/core/task-spec.d.ts +8 -0
- package/dist/core/tool-catalog-entries.d.ts +48 -0
- package/dist/core/tool-catalog-entries.js +174 -0
- package/dist/core/tool-conformance.d.ts +22 -0
- package/dist/core/tool-conformance.js +37 -0
- package/dist/core/tool-face.d.ts +171 -0
- package/dist/core/tool-face.js +25 -0
- package/dist/core/tool-policy.d.ts +24 -0
- package/dist/core/tool-policy.js +4 -2
- package/dist/core/tool-registry.d.ts +114 -0
- package/dist/core/tool-registry.js +114 -0
- package/dist/core/tool-result-budget.d.ts +0 -3
- package/dist/core/tool-result-budget.js +4 -3
- package/dist/core/tool-result-store.d.ts +0 -18
- package/dist/core/tool-result-store.js +2 -18
- package/dist/core/tool-roster.d.ts +450 -0
- package/dist/core/tool-roster.js +497 -0
- package/dist/core/tool-spec.d.ts +54 -3
- package/dist/core/tools.js +7 -0
- package/dist/core/trace.d.ts +24 -0
- package/dist/core/wiring-manifest.d.ts +13 -0
- package/dist/core/wiring-manifest.js +2 -1
- package/dist/core/write-protect.d.ts +2 -1
- package/dist/core/write-protect.js +5 -4
- package/dist/engine/compaction/utils.d.ts +6 -0
- package/dist/engine/compaction/utils.js +19 -19
- package/dist/engine/loop/types.d.ts +6 -0
- package/dist/index.d.ts +20 -8
- package/dist/index.js +19 -7
- package/dist/orchestration/goal.js +2 -1
- package/dist/orchestration/run-spec.js +3 -5
- package/dist/orchestration/run-workflow-tool.js +2 -2
- package/dist/prompt-assembly/event-registry.js +3 -3
- package/dist/prompt-assembly/tool-catalog.d.ts +2 -2
- package/dist/stores/file/checkpoint-store.d.ts +7 -0
- package/dist/stores/file/checkpoint-store.js +20 -1
- package/dist/tools/fs/fs-bash.d.ts +1 -1
- package/dist/tools/fs/fs-bash.js +7 -11
- package/dist/tools/fs/fs-read.js +2 -2
- package/dist/tools/fs/fs-search-tools.d.ts +0 -7
- package/dist/tools/fs/fs-search-tools.js +3 -16
- package/dist/tools/fs/fs-write.js +4 -6
- package/dist/tools/fs/repo-map.js +2 -2
- package/dist/tools/fs/safety.d.ts +2 -1
- package/dist/tools/fs/safety.js +6 -5
- package/dist/tools/monitor.js +2 -2
- package/dist/tools/scheduler-tools.js +5 -8
- package/dist/tools/task-list.js +5 -8
- package/dist/tools/todo.js +2 -2
- package/dist/tools/web.js +3 -6
- package/dist/tools/worktree.js +3 -4
- package/package.json +4 -1
- package/test/export-surface.snapshot.json +183 -7
|
@@ -3,77 +3,9 @@ import { type CheckpointToken, type ResumeOutcome } from "../checkpoint-store.js
|
|
|
3
3
|
import { type TaskOutcome } from "../task-outcome.js";
|
|
4
4
|
import { type SideQuerySpec, type SideQueryResult } from "../side-query.js";
|
|
5
5
|
import type { SessionStore } from "../session.js";
|
|
6
|
-
import { type RecoveredOrphan } from "../session-reconcile.js";
|
|
7
|
-
import type { GateOutcome } from "../gate-outcome.js";
|
|
8
|
-
import { type McpDelivered } from "../mcp-failure.js";
|
|
9
6
|
import type { AgentDefinition, ModelRef, RunnerDeps, TaskEvent, TaskResult, TaskSpec, TaskStream } from "../types.js";
|
|
10
7
|
import type { ResumeRun, ResumeTaskConfig, RunInternals, RunnerSelfSeat } from "./contracts.js";
|
|
11
8
|
export type { ResumeTaskConfig } from "./contracts.js";
|
|
12
|
-
/** The `tool_end` body fields projected from a harness tool result — output/truncated/totalChars via
|
|
13
|
-
* {@link toolOutputFrom} and the CC card via {@link structuredFrom}. Single construction point for BOTH
|
|
14
|
-
* the live loop's frames and the resumed batch's frames (`resolvePendingCall` + the deferred-sibling
|
|
15
|
-
* close): the resumed frames used to carry only `isError`, so a client rendering tool output from frames
|
|
16
|
-
* showed an empty body for every durable-approved call. Same projection = same source as the transcript.
|
|
17
|
-
* Also the one place the gate outcome reaches a frame — see the parameter. */
|
|
18
|
-
declare function toolEndBodyFrom(result: unknown, isError: boolean,
|
|
19
|
-
/** The gate's record of the pass that admitted or refused this call, supplied by the CALLER of this
|
|
20
|
-
* projection — the live loop reads it off the gate's per-call sideband, the resumed leg off the decide's
|
|
21
|
-
* minted record. Deliberately a parameter and never derived from `result`: a tool's own `details`
|
|
22
|
-
* (which post-tool hooks may also replace) is writable by layers that adjudicate nothing, so reading
|
|
23
|
-
* provenance out of it would let a failing tool claim a person approved it. Omitted ⇒ the call never
|
|
24
|
-
* went through the gate (see the `tool_end.gate` doc, the one home). */
|
|
25
|
-
gate?: GateOutcome,
|
|
26
|
-
/** WHICH call this run's committed durable park is holding ({@link gatedCallIdOf}), for the frames the
|
|
27
|
-
* abort short-circuits. Same never-derived-from-`result` posture as the outcome above, and for the
|
|
28
|
-
* sharpest version of that reason: this one is an assertion about a DIFFERENT call, so a tool able to
|
|
29
|
-
* author it could point an approval UI at a call nobody is waiting on. Omitted ⇒ no park is holding a
|
|
30
|
-
* call (nothing parked, or the park that did holds none), and the frame then carries no id at all. */
|
|
31
|
-
gatedCallIdOfRun?: string): {
|
|
32
|
-
output?: unknown;
|
|
33
|
-
truncated?: boolean;
|
|
34
|
-
totalChars?: number;
|
|
35
|
-
structured?: unknown;
|
|
36
|
-
errorCode?: string;
|
|
37
|
-
delivered?: McpDelivered;
|
|
38
|
-
gatedCallId?: string;
|
|
39
|
-
gate?: GateOutcome;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* scan-1/A1 — the BODY of the synthetic `tool_end` that closes a reconcile-recovered orphan. ONE
|
|
43
|
-
* construction point for BOTH minting legs (the live-abort loop at the end of a run, and the wake/crash
|
|
44
|
-
* leg's replay at run open), so the two can never disagree about the shape of the same event.
|
|
45
|
-
*
|
|
46
|
-
* Both frames used to carry `isError:true` and NOTHING else: a consumer rendering tool output from the
|
|
47
|
-
* event stream showed an EMPTY body for every interrupted call, even though the persisted transcript
|
|
48
|
-
* (which the model reads) carried the full `[INTERRUPTED]` explanation — the two faces of one call
|
|
49
|
-
* disagreed. The projection goes through the same {@link toolEndBodyFrom} every live tool result uses, so
|
|
50
|
-
* `output` = the persisted model-facing text and `errorCode` = the persisted `details.errorKind`
|
|
51
|
-
* (`interrupted_never_started` / `interrupted_outcome_unknown`) — a consumer discriminates on the code
|
|
52
|
-
* instead of prose-matching. No `structured`: the reconcile mints no CC card (no `details.type`), which
|
|
53
|
-
* `structuredFrom`'s allowlist already enforces.
|
|
54
|
-
*/
|
|
55
|
-
export declare function reconciledToolEndBody(orphan: Pick<RecoveredOrphan, "text" | "errorKind">): ReturnType<typeof toolEndBodyFrom>;
|
|
56
|
-
export declare const GOVERNANCE_READ_STALLED: unique symbol;
|
|
57
|
-
/** Await a ledger charge, firing `onSlow` ONCE if it has not settled after
|
|
58
|
-
* {@link CHARGE_SETTLE_DISCLOSE_MS}. The charge itself is always awaited to completion. */
|
|
59
|
-
export declare function awaitChargeWithSlowDisclosure<T>(charge: Promise<T>, onSlow: () => void, discloseAfterMs?: number): Promise<T>;
|
|
60
|
-
/**
|
|
61
|
-
* Await `p` until the absolute epoch `deadline`, then give up with {@link GOVERNANCE_READ_STALLED}.
|
|
62
|
-
*
|
|
63
|
-
* Chunked, and deliberately so: the deadline is derived from a caller-declared environment lifetime, so
|
|
64
|
-
* the distance to it can exceed {@link MAX_TIMER_DELAY_MS} — a single timer armed for that distance
|
|
65
|
-
* would fire at once and abandon a perfectly healthy read. Each chunk re-reads the wall clock, so the
|
|
66
|
-
* decision is always made against the deadline itself rather than against an allowance computed once.
|
|
67
|
-
*
|
|
68
|
-
* Exported for its own unit pin (the same posture as the brain-call guardrail primitive): the
|
|
69
|
-
* behaviors below are clock behaviors, and only a virtual clock can assert them without spending the
|
|
70
|
-
* wall-clock time they describe. Not re-exported from the package index.
|
|
71
|
-
*
|
|
72
|
-
* An already-overdue deadline still gets ONE zero-delay pass: a promise that is settled (or settles in a
|
|
73
|
-
* microtask, which is every in-process store) must be allowed to win, because giving up on an answer we
|
|
74
|
-
* already hold would be a fabricated stall. The second pass is what makes the loop terminate.
|
|
75
|
-
*/
|
|
76
|
-
export declare function raceUntilDeadline<T>(p: Promise<T>, deadline: number): Promise<T | typeof GOVERNANCE_READ_STALLED>;
|
|
77
9
|
/**
|
|
78
10
|
* A stateless task runner. Holds shared deps (the external brain, model catalog) and an
|
|
79
11
|
* in-memory session store so that passing a `sessionId` continues a prior conversation.
|