@yaag/runtime 0.6.0 → 0.6.1
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/package.json +1 -1
- package/src/{agent-usage.ts → agent/agent-usage.ts} +1 -1
- package/src/{agent.ts → agent/agent.ts} +8 -8
- package/src/{define-agent.ts → agent/define-agent.ts} +3 -3
- package/src/agent/index.ts +13 -0
- package/src/{spawn.ts → agent/spawn.ts} +10 -10
- package/src/{ask-activity.ts → ask/ask-activity.ts} +3 -3
- package/src/{ask-exchange-events.ts → ask/ask-exchange-events.ts} +4 -4
- package/src/{ask-exchange-options.ts → ask/ask-exchange-options.ts} +4 -5
- package/src/{ask-exchange.ts → ask/ask-exchange.ts} +21 -17
- package/src/{ask-hash.ts → ask/ask-hash.ts} +4 -4
- package/src/{ask-output-steering.ts → ask/ask-output-steering.ts} +1 -1
- package/src/{ask-output-tail.ts → ask/ask-output-tail.ts} +3 -3
- package/src/{ask-settlement.ts → ask/ask-settlement.ts} +1 -1
- package/src/{ask-turn.ts → ask/ask-turn.ts} +1 -1
- package/src/{idle-watch.ts → ask/idle-watch.ts} +2 -2
- package/src/ask/index.ts +7 -0
- package/src/{stall-watchdog.ts → ask/stall-watchdog.ts} +3 -4
- package/src/{ask-limit.ts → ask-contract/ask-limit.ts} +3 -3
- package/src/{ask-output.ts → ask-contract/ask-output.ts} +4 -4
- package/src/ask-contract/index.ts +36 -0
- package/src/{report-result-output.ts → ask-contract/report-result-output.ts} +2 -2
- package/src/{report-result.ts → ask-contract/report-result.ts} +1 -1
- package/src/{cassette-loader.ts → cassette/cassette-loader.ts} +2 -5
- package/src/{cassette-replay.ts → cassette/cassette-replay.ts} +4 -4
- package/src/{cassette-schema.ts → cassette/cassette-schema.ts} +2 -2
- package/src/{cassette.ts → cassette/cassette.ts} +5 -5
- package/src/{checkpoint-dir.ts → cassette/checkpoint-dir.ts} +9 -1
- package/src/cassette/index.ts +37 -0
- package/src/{recording-transport.ts → cassette/recording-transport.ts} +3 -3
- package/src/{replay-divergence.ts → cassette/replay-divergence.ts} +2 -2
- package/src/{replay-transport.ts → cassette/replay-transport.ts} +4 -4
- package/src/{resume-preconditions.ts → cassette/resume-preconditions.ts} +1 -1
- package/src/{resume-transport.ts → cassette/resume-transport.ts} +6 -6
- package/src/{run-checkpoint.ts → cassette/run-checkpoint.ts} +1 -1
- package/src/errors.ts +2 -2
- package/src/events.ts +3 -3
- package/src/extension/index.ts +5 -0
- package/src/index.ts +36 -30
- package/src/model/index.ts +15 -0
- package/src/node/index.ts +8 -0
- package/src/{node-decoder-subagent.ts → node/node-decoder-subagent.ts} +1 -1
- package/src/{node-decoder-workflow.ts → node/node-decoder-workflow.ts} +1 -1
- package/src/{node-decoder.ts → node/node-decoder.ts} +1 -1
- package/src/{node-details.ts → node/node-details.ts} +3 -3
- package/src/{node-tracker.ts → node/node-tracker.ts} +2 -2
- package/src/prompt/index.ts +7 -0
- package/src/{prompt-gist.ts → prompt/prompt-gist.ts} +1 -1
- package/src/{args-validation.ts → run/args-validation.ts} +2 -2
- package/src/run/index.ts +13 -0
- package/src/{run-context.ts → run/run-context.ts} +2 -2
- package/src/{run.ts → run/run.ts} +29 -23
- package/src/summary/index.ts +22 -0
- package/src/{summary-agent.ts → summary/summary-agent.ts} +3 -3
- package/src/{summary-nodes.ts → summary/summary-nodes.ts} +3 -3
- package/src/{summary.ts → summary/summary.ts} +3 -3
- package/src/{connection.ts → transport/connection.ts} +1 -1
- package/src/{fake-transport.ts → transport/fake-transport.ts} +6 -3
- package/src/transport/index.ts +41 -0
- package/src/{live-transport.ts → transport/live-transport.ts} +1 -1
- package/src/{pi-state.ts → transport/pi-state.ts} +1 -1
- package/src/{tool-probe.ts → transport/tool-probe.ts} +1 -2
- package/src/{transport.ts → transport/transport.ts} +3 -4
- package/src/{worktree-transport.ts → transport/worktree-transport.ts} +1 -1
- package/src/types.ts +2 -3
- /package/src/{agent-names.ts → agent/agent-names.ts} +0 -0
- /package/src/{ask-contract-identity.ts → ask-contract/ask-contract-identity.ts} +0 -0
- /package/src/{report-result-extension.ts → ask-contract/report-result-extension.ts} +0 -0
- /package/src/{report-result-steering.ts → ask-contract/report-result-steering.ts} +0 -0
- /package/src/{cassette-publish.ts → cassette/cassette-publish.ts} +0 -0
- /package/src/{checkpoint-flush.ts → cassette/checkpoint-flush.ts} +0 -0
- /package/src/{git-facts.ts → cassette/git-facts.ts} +0 -0
- /package/src/{program-hash.ts → cassette/program-hash.ts} +0 -0
- /package/src/{resume-identity.ts → cassette/resume-identity.ts} +0 -0
- /package/src/{extension-package.ts → extension/extension-package.ts} +0 -0
- /package/src/{extension-paths.ts → extension/extension-paths.ts} +0 -0
- /package/src/{extension-source.ts → extension/extension-source.ts} +0 -0
- /package/src/{model-resolution.ts → model/model-resolution.ts} +0 -0
- /package/src/{model-suffix.ts → model/model-suffix.ts} +0 -0
- /package/src/{thinking-level.ts → model/thinking-level.ts} +0 -0
- /package/src/{node-decoders.ts → node/node-decoders.ts} +0 -0
- /package/src/{node-path.ts → node/node-path.ts} +0 -0
- /package/src/{prompt.ts → prompt/prompt.ts} +0 -0
- /package/src/{define-run.ts → run/define-run.ts} +0 -0
- /package/src/{frame-gap.ts → transport/frame-gap.ts} +0 -0
- /package/src/{frame-queue.ts → transport/frame-queue.ts} +0 -0
- /package/src/{jsonl.ts → transport/jsonl.ts} +0 -0
- /package/src/{reap.ts → transport/reap.ts} +0 -0
- /package/src/{skill-probe.ts → transport/skill-probe.ts} +0 -0
- /package/src/{skill-restriction-transport.ts → transport/skill-restriction-transport.ts} +0 -0
- /package/src/{system-prompt-recorder-extension.ts → transport/system-prompt-recorder-extension.ts} +0 -0
- /package/src/{system-prompt-recorder.ts → transport/system-prompt-recorder.ts} +0 -0
- /package/src/{tool-probe-extension.ts → transport/tool-probe-extension.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Static, TSchema } from "typebox";
|
|
2
|
+
import type { EffectiveAskOptions } from "../ask/index.ts";
|
|
3
|
+
import { exchangeAsk } from "../ask/index.ts";
|
|
4
|
+
import { ReportResultTool } from "../ask-contract/index.ts";
|
|
5
|
+
import { agentError } from "../errors.ts";
|
|
6
|
+
import type { EventSink } from "../events.ts";
|
|
7
|
+
import type { AgentStats, AgentTransport } from "../transport/index.ts";
|
|
8
|
+
import { Connection } from "../transport/index.ts";
|
|
9
|
+
import type { AskOptions, Handle, ResolvedSpawnOptions, StructuredAskOptions } from "../types.ts";
|
|
2
10
|
import { AgentUsage } from "./agent-usage.ts";
|
|
3
|
-
import { exchangeAsk } from "./ask-exchange.ts";
|
|
4
|
-
import type { EffectiveAskOptions } from "./ask-hash.ts";
|
|
5
|
-
import { Connection } from "./connection.ts";
|
|
6
|
-
import { agentError } from "./errors.ts";
|
|
7
|
-
import type { EventSink } from "./events.ts";
|
|
8
|
-
import { ReportResultTool } from "./report-result.ts";
|
|
9
|
-
import type { AgentStats, AgentTransport } from "./transport.ts";
|
|
10
|
-
import type { AskOptions, Handle, ResolvedSpawnOptions, StructuredAskOptions } from "./types.ts";
|
|
11
11
|
|
|
12
12
|
export interface AgentOptions {
|
|
13
13
|
readonly name: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ModelSpec, ThinkingSpec } from "
|
|
2
|
-
import type { AskOptions } from "
|
|
1
|
+
import type { ModelSpec, ThinkingSpec } from "../model/index.ts";
|
|
2
|
+
import type { AskOptions } from "../types.ts";
|
|
3
3
|
|
|
4
|
-
export type { ThinkingLevel } from "
|
|
4
|
+
export type { ThinkingLevel } from "../types.ts";
|
|
5
5
|
|
|
6
6
|
/** What `defineAgent` is given: the policy of one Agent, never its topology. */
|
|
7
7
|
export interface AgentConfig {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public surface of the `agent/` module: the Agent handle and spawn.
|
|
3
|
+
* Files inside this directory import each other directly.
|
|
4
|
+
*/
|
|
5
|
+
export { Agent } from "./agent.ts";
|
|
6
|
+
export {
|
|
7
|
+
type AgentConfig,
|
|
8
|
+
type AgentDefinition,
|
|
9
|
+
agentDefinitionConfig,
|
|
10
|
+
defineAgent,
|
|
11
|
+
isAgentDefinition,
|
|
12
|
+
} from "./define-agent.ts";
|
|
13
|
+
export { makeSpawn } from "./spawn.ts";
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
7
|
-
import {
|
|
8
|
-
import { normalizeModelResolution } from "./model-resolution.ts";
|
|
9
|
-
import type { RunContext } from "./run-context.ts";
|
|
10
|
-
import type { AgentTransport, TransportFactory, TransportStartup } from "./transport.ts";
|
|
2
|
+
import { YaagError } from "../errors.ts";
|
|
3
|
+
import type { EventSink } from "../events.ts";
|
|
4
|
+
import { resolveExtensionPaths } from "../extension/index.ts";
|
|
5
|
+
import { normalizeModelResolution } from "../model/index.ts";
|
|
6
|
+
import type { RunContext } from "../run/index.ts";
|
|
7
|
+
import type { AgentTransport, TransportFactory, TransportStartup } from "../transport/index.ts";
|
|
11
8
|
import type {
|
|
12
9
|
AskOptions,
|
|
13
10
|
Handle,
|
|
14
11
|
ResolvedSpawnOptions,
|
|
15
12
|
SpawnOptions,
|
|
16
13
|
SpawnOverrides,
|
|
17
|
-
} from "
|
|
14
|
+
} from "../types.ts";
|
|
15
|
+
import { Agent } from "./agent.ts";
|
|
16
|
+
import { uniqueAgentName } from "./agent-names.ts";
|
|
17
|
+
import { type AgentDefinition, agentDefinitionConfig, isAgentDefinition } from "./define-agent.ts";
|
|
18
18
|
|
|
19
19
|
/** Dependencies for one Run's Agent-spawn gate. */
|
|
20
20
|
export interface SpawnDependencies {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AgentActivity } from "
|
|
2
|
-
import type { Frame } from "
|
|
3
|
-
import { TOOL_ARGS_GIST_MAX_CHARS } from "
|
|
1
|
+
import type { AgentActivity } from "../events.ts";
|
|
2
|
+
import type { Frame } from "../transport/index.ts";
|
|
3
|
+
import { TOOL_ARGS_GIST_MAX_CHARS } from "../wire-constants.ts";
|
|
4
4
|
|
|
5
5
|
/** Reports complete Ask activity transitions derived from already-observed frames. */
|
|
6
6
|
export class AskActivityTracker {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AgentActivity, AskOutputChannel, EventSink } from "
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { promptGist } from "
|
|
1
|
+
import type { AgentActivity, AskOutputChannel, EventSink } from "../events.ts";
|
|
2
|
+
import type { NodeSnapshot } from "../node/index.ts";
|
|
3
|
+
import { agentAskPath, childPath } from "../node/index.ts";
|
|
4
|
+
import { promptGist } from "../prompt/index.ts";
|
|
5
5
|
import type { SettlementCause } from "./stall-watchdog.ts";
|
|
6
6
|
|
|
7
7
|
/** What one finished Ask reports in its `ask_end` Lifecycle Event. */
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import type { ReportResultTool } from "../ask-contract/index.ts";
|
|
2
|
+
import type { EventSink } from "../events.ts";
|
|
3
|
+
import type { AgentTransport, Connection, Frame } from "../transport/index.ts";
|
|
4
|
+
import type { ResolvedSpawnOptions } from "../types.ts";
|
|
1
5
|
import type { EffectiveAskOptions } from "./ask-hash.ts";
|
|
2
|
-
import type { Connection } from "./connection.ts";
|
|
3
|
-
import type { EventSink } from "./events.ts";
|
|
4
|
-
import type { ReportResultTool } from "./report-result.ts";
|
|
5
|
-
import type { AgentTransport, Frame } from "./transport.ts";
|
|
6
|
-
import type { ResolvedSpawnOptions } from "./types.ts";
|
|
7
6
|
|
|
8
7
|
/** A frame consumer whose lifetime exceeds one Ask; the Agent's AgentUsage satisfies it. */
|
|
9
8
|
export interface FrameObserver {
|
|
@@ -1,36 +1,40 @@
|
|
|
1
1
|
import type { TSchema } from "typebox";
|
|
2
|
+
import type { AskOutputContract } from "../ask-contract/index.ts";
|
|
3
|
+
import {
|
|
4
|
+
AskLimit,
|
|
5
|
+
LEGACY_ASK_OUTPUT_EXTRACTION_POLICY,
|
|
6
|
+
REPORT_RESULT_WRAP_UP,
|
|
7
|
+
ReportResultCall,
|
|
8
|
+
ReportResultSteering,
|
|
9
|
+
resolvePlaybackAskOutput,
|
|
10
|
+
resolvePlaybackReportedResult,
|
|
11
|
+
} from "../ask-contract/index.ts";
|
|
12
|
+
import {
|
|
13
|
+
type AskLimitOutcome,
|
|
14
|
+
type AskStalledOutcome,
|
|
15
|
+
agentError,
|
|
16
|
+
askLimitError,
|
|
17
|
+
askStalledError,
|
|
18
|
+
isYaagError,
|
|
19
|
+
} from "../errors.ts";
|
|
20
|
+
import { NodeTracker } from "../node/index.ts";
|
|
21
|
+
import type { AskPlayback } from "../transport/index.ts";
|
|
22
|
+
import { FrameGapTracker } from "../transport/index.ts";
|
|
2
23
|
import { AskActivityTracker } from "./ask-activity.ts";
|
|
3
|
-
import type { AskOutputContract } from "./ask-contract-identity.ts";
|
|
4
24
|
import { type AskEndOutcome, AskEvents } from "./ask-exchange-events.ts";
|
|
5
25
|
import type { AskExchangeOptions } from "./ask-exchange-options.ts";
|
|
6
26
|
import { askHash, askMarkerContext, structuredOutputContract } from "./ask-hash.ts";
|
|
7
|
-
import { AskLimit } from "./ask-limit.ts";
|
|
8
|
-
import { LEGACY_ASK_OUTPUT_EXTRACTION_POLICY, resolvePlaybackAskOutput } from "./ask-output.ts";
|
|
9
27
|
import { AskOutputSteering } from "./ask-output-steering.ts";
|
|
10
28
|
import { AskOutputTail } from "./ask-output-tail.ts";
|
|
11
29
|
import { awaitAskSettlement } from "./ask-settlement.ts";
|
|
12
30
|
import { AskTurn } from "./ask-turn.ts";
|
|
13
|
-
import {
|
|
14
|
-
type AskLimitOutcome,
|
|
15
|
-
type AskStalledOutcome,
|
|
16
|
-
agentError,
|
|
17
|
-
askLimitError,
|
|
18
|
-
askStalledError,
|
|
19
|
-
isYaagError,
|
|
20
|
-
} from "./errors.ts";
|
|
21
|
-
import { FrameGapTracker } from "./frame-gap.ts";
|
|
22
31
|
import { IdleKillSignal, IdleWatch } from "./idle-watch.ts";
|
|
23
|
-
import { NodeTracker } from "./node-tracker.ts";
|
|
24
|
-
import { ReportResultCall } from "./report-result.ts";
|
|
25
|
-
import { REPORT_RESULT_WRAP_UP, resolvePlaybackReportedResult } from "./report-result-output.ts";
|
|
26
|
-
import { ReportResultSteering } from "./report-result-steering.ts";
|
|
27
32
|
import {
|
|
28
33
|
type SettlementCause,
|
|
29
34
|
StallSignal,
|
|
30
35
|
StallWatchdog,
|
|
31
36
|
stallBudgetMs,
|
|
32
37
|
} from "./stall-watchdog.ts";
|
|
33
|
-
import type { AskPlayback } from "./transport.ts";
|
|
34
38
|
|
|
35
39
|
export type { AskExchangeOptions } from "./ask-exchange-options.ts";
|
|
36
40
|
/** Runs one Ask's transport exchange, including controls and structured-output correction. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { TSchema } from "typebox";
|
|
2
|
-
import
|
|
3
|
-
import type
|
|
4
|
-
import type { AskMarkerContext } from "
|
|
5
|
-
import type { AskOptions, ResolvedSpawnOptions, StructuredAskOptions } from "
|
|
2
|
+
import type { AskOutputExtractionPolicy } from "../ask-contract/index.ts";
|
|
3
|
+
import { type AskOutputContract, createAskOutputContract } from "../ask-contract/index.ts";
|
|
4
|
+
import type { AskMarkerContext } from "../transport/index.ts";
|
|
5
|
+
import type { AskOptions, ResolvedSpawnOptions, StructuredAskOptions } from "../types.ts";
|
|
6
6
|
|
|
7
7
|
/** The combined option shape used internally after Definition defaults merge. */
|
|
8
8
|
export type EffectiveAskOptions = AskOptions | StructuredAskOptions<TSchema>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { AskOutputChannel } from "
|
|
2
|
-
import type { Frame } from "
|
|
1
|
+
import type { AskOutputChannel } from "../events.ts";
|
|
2
|
+
import type { Frame } from "../transport/index.ts";
|
|
3
3
|
import {
|
|
4
4
|
ASK_OUTPUT_FLUSH_INTERVAL_MS,
|
|
5
5
|
ASK_OUTPUT_MAX_BYTES,
|
|
6
6
|
ASK_OUTPUT_TRUNCATION_MARKER,
|
|
7
|
-
} from "
|
|
7
|
+
} from "../wire-constants.ts";
|
|
8
8
|
|
|
9
9
|
/** The timer boundary used to test output batching without changing its wire rate. */
|
|
10
10
|
export interface AskOutputTailScheduler<Handle = unknown> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AskStalledOutcome } from "
|
|
2
|
-
import type { Frame } from "
|
|
1
|
+
import type { AskStalledOutcome } from "../errors.ts";
|
|
2
|
+
import type { Frame } from "../transport/index.ts";
|
|
3
3
|
|
|
4
4
|
/** Fixed time allowed for `agent_settled` to arrive after the idle abort. */
|
|
5
5
|
export const IDLE_ABORT_SETTLE_MS = 5_000;
|
package/src/ask/index.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public surface of the `ask/` module: the live Ask exchange.
|
|
3
|
+
* Files inside this directory import each other directly.
|
|
4
|
+
*/
|
|
5
|
+
export { exchangeAsk } from "./ask-exchange.ts";
|
|
6
|
+
export { askHash, askMarkerContext, type EffectiveAskOptions } from "./ask-hash.ts";
|
|
7
|
+
export type { SettlementCause } from "./stall-watchdog.ts";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import { readAgentProgress } from "
|
|
4
|
-
import type { Frame } from "./transport.ts";
|
|
1
|
+
import type { AskStalledOutcome } from "../errors.ts";
|
|
2
|
+
import type { CommandResponse, Frame } from "../transport/index.ts";
|
|
3
|
+
import { readAgentProgress } from "../transport/index.ts";
|
|
5
4
|
|
|
6
5
|
/** Silence allowed on a live Ask before the Stall Watchdog probes the Agent. */
|
|
7
6
|
export const DEFAULT_STALL_MS = 600_000;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AskLimitKind, AskLimitOutcome } from "
|
|
1
|
+
import type { AskLimitKind, AskLimitOutcome } from "../errors.ts";
|
|
2
|
+
import type { Frame } from "../transport/index.ts";
|
|
3
|
+
import type { AskOptions } from "../types.ts";
|
|
2
4
|
import { REPORT_RESULT_TOOL_NAME } from "./report-result.ts";
|
|
3
|
-
import type { Frame } from "./transport.ts";
|
|
4
|
-
import type { AskOptions } from "./types.ts";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* True for a call to yaag's private result tool.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { TSchema } from "typebox";
|
|
2
2
|
import { Value } from "typebox/value";
|
|
3
|
-
import type { AskInvalidOutputOutcome } from "
|
|
4
|
-
import { YaagError } from "
|
|
5
|
-
import type { AskInvalidOutputPlayback } from "
|
|
6
|
-
import { formatValidationErrors } from "
|
|
3
|
+
import type { AskInvalidOutputOutcome } from "../errors.ts";
|
|
4
|
+
import { YaagError } from "../errors.ts";
|
|
5
|
+
import type { AskInvalidOutputPlayback } from "../transport/index.ts";
|
|
6
|
+
import { formatValidationErrors } from "../validation-errors.ts";
|
|
7
7
|
|
|
8
8
|
/** Versioned extraction behavior, and part of Ask identity in a Cassette. */
|
|
9
9
|
export const ASK_OUTPUT_EXTRACTION_POLICY = "report-result-tool/v1";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public surface of the `ask-contract/` module: what an Ask declares and how it settles.
|
|
3
|
+
* Files inside this directory import each other directly.
|
|
4
|
+
*/
|
|
5
|
+
export {
|
|
6
|
+
type AskOutputContract,
|
|
7
|
+
type CanonicalJsonObject,
|
|
8
|
+
createAskOutputContract,
|
|
9
|
+
validateCanonicalOutputSchema,
|
|
10
|
+
validateExtractionPolicy,
|
|
11
|
+
} from "./ask-contract-identity.ts";
|
|
12
|
+
export { AskLimit, DEFAULT_WRAP_UP_PROMPT } from "./ask-limit.ts";
|
|
13
|
+
export {
|
|
14
|
+
type AskOutputExtractionPolicy,
|
|
15
|
+
DEFAULT_MAX_STEERS,
|
|
16
|
+
formatAskOutputCorrection,
|
|
17
|
+
invalidAskOutputError,
|
|
18
|
+
LEGACY_ASK_OUTPUT_EXTRACTION_POLICY,
|
|
19
|
+
resolvePlaybackAskOutput,
|
|
20
|
+
validateAskOutput,
|
|
21
|
+
} from "./ask-output.ts";
|
|
22
|
+
export {
|
|
23
|
+
isReportResultCommandFrame,
|
|
24
|
+
REPORT_RESULT_EXTENSION_PATH,
|
|
25
|
+
REPORT_RESULT_TOOL_NAME,
|
|
26
|
+
type ReportedResult,
|
|
27
|
+
ReportResultCall,
|
|
28
|
+
ReportResultTool,
|
|
29
|
+
reportResultCommandMessage,
|
|
30
|
+
} from "./report-result.ts";
|
|
31
|
+
export {
|
|
32
|
+
REPORT_RESULT_CORRECTION,
|
|
33
|
+
REPORT_RESULT_WRAP_UP,
|
|
34
|
+
resolvePlaybackReportedResult,
|
|
35
|
+
} from "./report-result-output.ts";
|
|
36
|
+
export { ReportResultSteering } from "./report-result-steering.ts";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { TSchema } from "typebox";
|
|
2
2
|
import { Value } from "typebox/value";
|
|
3
|
+
import type { AskInvalidOutputPlayback } from "../transport/index.ts";
|
|
4
|
+
import { formatValidationErrors } from "../validation-errors.ts";
|
|
3
5
|
import type { AskOutputResult } from "./ask-output.ts";
|
|
4
6
|
import { invalidAskOutputError } from "./ask-output.ts";
|
|
5
7
|
import type { ReportedResult } from "./report-result.ts";
|
|
6
|
-
import type { AskInvalidOutputPlayback } from "./transport.ts";
|
|
7
|
-
import { formatValidationErrors } from "./validation-errors.ts";
|
|
8
8
|
|
|
9
9
|
/** The one correction an Agent gets when it settles without reporting a result. */
|
|
10
10
|
export const REPORT_RESULT_CORRECTION =
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
|
+
import type { Frame } from "../transport/index.ts";
|
|
2
3
|
import type { CanonicalJsonObject } from "./ask-contract-identity.ts";
|
|
3
|
-
import type { Frame } from "./transport.ts";
|
|
4
4
|
|
|
5
5
|
/** The internal tool a schema-bearing Ask settles from (ADR-0032). */
|
|
6
6
|
export const REPORT_RESULT_TOOL_NAME = "report_result";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Value } from "typebox/value";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
validateExtractionPolicy,
|
|
5
|
-
} from "./ask-contract-identity.ts";
|
|
2
|
+
import { validateCanonicalOutputSchema, validateExtractionPolicy } from "../ask-contract/index.ts";
|
|
3
|
+
import { formatValidationErrors } from "../validation-errors.ts";
|
|
6
4
|
import {
|
|
7
5
|
CASSETTE_VERSION,
|
|
8
6
|
type Cassette,
|
|
@@ -10,7 +8,6 @@ import {
|
|
|
10
8
|
type CassetteAsk,
|
|
11
9
|
} from "./cassette.ts";
|
|
12
10
|
import { CassetteSchema } from "./cassette-schema.ts";
|
|
13
|
-
import { formatValidationErrors } from "./validation-errors.ts";
|
|
14
11
|
|
|
15
12
|
/**
|
|
16
13
|
* Reads and validates one Cassette artifact before replay begins.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { ReportedResult } from "../ask-contract/index.ts";
|
|
2
|
+
import { isReportResultCommandFrame, ReportResultCall } from "../ask-contract/index.ts";
|
|
3
|
+
import type { AgentStats, AskMarker, AskPlayback, Frame } from "../transport/index.ts";
|
|
4
|
+
import { FrameQueue } from "../transport/index.ts";
|
|
1
5
|
import type { CassetteAgent } from "./cassette.ts";
|
|
2
|
-
import { FrameQueue } from "./frame-queue.ts";
|
|
3
|
-
import type { ReportedResult } from "./report-result.ts";
|
|
4
|
-
import { isReportResultCommandFrame, ReportResultCall } from "./report-result.ts";
|
|
5
|
-
import type { AgentStats, AskMarker, AskPlayback, Frame } from "./transport.ts";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Replays one Cassette Agent's frame streams at the transport seam.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Static, Type } from "typebox";
|
|
2
|
-
import type { CanonicalJsonObject } from "
|
|
2
|
+
import type { CanonicalJsonObject } from "../ask-contract/index.ts";
|
|
3
|
+
import type { Frame } from "../transport/index.ts";
|
|
3
4
|
import type { CassetteArtifact } from "./cassette.ts";
|
|
4
|
-
import type { Frame } from "./transport.ts";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Structure-only mirror of the hand-written Cassette interfaces; `cassette.ts`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CanonicalJsonObject } from "
|
|
2
|
-
import type { AskLimitOutcome, AskStalledOutcome } from "
|
|
3
|
-
import type { RunOutcome } from "
|
|
1
|
+
import type { CanonicalJsonObject } from "../ask-contract/index.ts";
|
|
2
|
+
import type { AskLimitOutcome, AskStalledOutcome } from "../errors.ts";
|
|
3
|
+
import type { RunOutcome } from "../events.ts";
|
|
4
4
|
import type {
|
|
5
5
|
AgentStats,
|
|
6
6
|
AskCompletion,
|
|
@@ -10,8 +10,8 @@ import type {
|
|
|
10
10
|
Frame,
|
|
11
11
|
OpenOptions,
|
|
12
12
|
WorktreeResolution,
|
|
13
|
-
} from "
|
|
14
|
-
import type { ThinkingLevel } from "
|
|
13
|
+
} from "../transport/index.ts";
|
|
14
|
+
import type { ThinkingLevel } from "../types.ts";
|
|
15
15
|
|
|
16
16
|
/** The Cassette format this runtime writes; the loader also reads version 1. */
|
|
17
17
|
export const CASSETTE_VERSION = 2 as const;
|
|
@@ -9,12 +9,20 @@ export const CHECKPOINT_TEMP_MAX_AGE_MS = 24 * 60 * 60 * 1000;
|
|
|
9
9
|
|
|
10
10
|
const CHECKPOINT_SUFFIX = join("yaag", "checkpoints");
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* The part of the environment this module reads. It is structural on purpose:
|
|
14
|
+
* the vendored declaration tree compiles with no ambient Node globals.
|
|
15
|
+
*/
|
|
16
|
+
export interface CheckpointEnvironment {
|
|
17
|
+
readonly [name: string]: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
/**
|
|
13
21
|
* Resolves where a stopped Run publishes its checkpoint when `--record` set no
|
|
14
22
|
* path: `YAAG_CHECKPOINT_DIR`, then an absolute `XDG_STATE_HOME`, then
|
|
15
23
|
* `$HOME/.local/state`. A relative `XDG_STATE_HOME` is ignored (XDG spec).
|
|
16
24
|
*/
|
|
17
|
-
export function resolveCheckpointDirectory(env:
|
|
25
|
+
export function resolveCheckpointDirectory(env: CheckpointEnvironment = process.env): string {
|
|
18
26
|
const override = env["YAAG_CHECKPOINT_DIR"];
|
|
19
27
|
if (override !== undefined && override !== "") return override;
|
|
20
28
|
const xdg = env["XDG_STATE_HOME"];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public surface of the `cassette/` module: record, replay, checkpoint, and resume.
|
|
3
|
+
* Files inside this directory import each other directly.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
CASSETTE_VERSION,
|
|
8
|
+
type Cassette,
|
|
9
|
+
type CassetteAgent,
|
|
10
|
+
type CassetteArtifact,
|
|
11
|
+
type CassetteAsk,
|
|
12
|
+
CassetteCollector,
|
|
13
|
+
type CassetteGit,
|
|
14
|
+
type CassetteRun,
|
|
15
|
+
type CassetteSink,
|
|
16
|
+
type CassetteSpawn,
|
|
17
|
+
} from "./cassette.ts";
|
|
18
|
+
export { assertReplayable, interruptedResumeWarning, loadCassette } from "./cassette-loader.ts";
|
|
19
|
+
export { publishCassette } from "./cassette-publish.ts";
|
|
20
|
+
export {
|
|
21
|
+
checkpointFileName,
|
|
22
|
+
cleanStaleCheckpointTemp,
|
|
23
|
+
resolveCheckpointDirectory,
|
|
24
|
+
} from "./checkpoint-dir.ts";
|
|
25
|
+
export { createCheckpointFlusher, flushingSink } from "./checkpoint-flush.ts";
|
|
26
|
+
export { recordingTransport } from "./recording-transport.ts";
|
|
27
|
+
export { replayMismatch } from "./replay-divergence.ts";
|
|
28
|
+
export { replayTransport } from "./replay-transport.ts";
|
|
29
|
+
export { programIdentityWarning } from "./resume-identity.ts";
|
|
30
|
+
export { resumeTransport } from "./resume-transport.ts";
|
|
31
|
+
export {
|
|
32
|
+
type ProgramIdentity,
|
|
33
|
+
publishRunCheckpoint,
|
|
34
|
+
type RunCheckpointResult,
|
|
35
|
+
resolveRunIdentity,
|
|
36
|
+
writeRecordingDiagnostic,
|
|
37
|
+
} from "./run-checkpoint.ts";
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { CassetteSink } from "./cassette.ts";
|
|
2
|
-
import { readGitFacts } from "./git-facts.ts";
|
|
3
1
|
import type {
|
|
4
2
|
AgentStats,
|
|
5
3
|
AgentTransport,
|
|
@@ -11,7 +9,9 @@ import type {
|
|
|
11
9
|
TransportFactory,
|
|
12
10
|
TransportStartup,
|
|
13
11
|
TransportStartupObserver,
|
|
14
|
-
} from "
|
|
12
|
+
} from "../transport/index.ts";
|
|
13
|
+
import type { CassetteSink } from "./cassette.ts";
|
|
14
|
+
import { readGitFacts } from "./git-facts.ts";
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Wraps a transport factory and records frames at the public transport seam.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { YaagError } from "../errors.ts";
|
|
2
|
+
import type { AskMarker, AskMarkerContext, OpenOptions } from "../transport/index.ts";
|
|
1
3
|
import type { CassetteAgent, CassetteAsk, CassetteSpawn } from "./cassette.ts";
|
|
2
|
-
import { YaagError } from "./errors.ts";
|
|
3
|
-
import type { AskMarker, AskMarkerContext, OpenOptions } from "./transport.ts";
|
|
4
4
|
|
|
5
5
|
/** A pure description of the first strict replay identity mismatch. */
|
|
6
6
|
export interface ReplayMismatch {
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type { Cassette } from "./cassette.ts";
|
|
2
|
-
import { CassetteReplay } from "./cassette-replay.ts";
|
|
3
|
-
import { replayMismatch, strictReplay } from "./replay-divergence.ts";
|
|
4
1
|
import type {
|
|
5
2
|
AgentStats,
|
|
6
3
|
AgentTransport,
|
|
@@ -10,7 +7,10 @@ import type {
|
|
|
10
7
|
OpenOptions,
|
|
11
8
|
TransportFactory,
|
|
12
9
|
TransportStartupObserver,
|
|
13
|
-
} from "
|
|
10
|
+
} from "../transport/index.ts";
|
|
11
|
+
import type { Cassette } from "./cassette.ts";
|
|
12
|
+
import { CassetteReplay } from "./cassette-replay.ts";
|
|
13
|
+
import { replayMismatch, strictReplay } from "./replay-divergence.ts";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Creates a strict Cassette-backed transport factory without starting pi.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { stat } from "node:fs/promises";
|
|
2
|
+
import { YaagError } from "../errors.ts";
|
|
2
3
|
import type { CassetteAgent } from "./cassette.ts";
|
|
3
|
-
import { YaagError } from "./errors.ts";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Validates that a recorded Agent can safely continue from its persisted session.
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import type { Cassette, CassetteAgent } from "./cassette.ts";
|
|
2
|
-
import { CassetteReplay } from "./cassette-replay.ts";
|
|
3
|
-
import { FrameQueue } from "./frame-queue.ts";
|
|
4
|
-
import { replayMismatch } from "./replay-divergence.ts";
|
|
5
|
-
import { checkResumePreconditions } from "./resume-preconditions.ts";
|
|
6
1
|
import type {
|
|
7
2
|
AgentStats,
|
|
8
3
|
AgentTransport,
|
|
@@ -13,7 +8,12 @@ import type {
|
|
|
13
8
|
OpenOptions,
|
|
14
9
|
TransportFactory,
|
|
15
10
|
TransportStartupObserver,
|
|
16
|
-
} from "
|
|
11
|
+
} from "../transport/index.ts";
|
|
12
|
+
import { FrameQueue } from "../transport/index.ts";
|
|
13
|
+
import type { Cassette, CassetteAgent } from "./cassette.ts";
|
|
14
|
+
import { CassetteReplay } from "./cassette-replay.ts";
|
|
15
|
+
import { replayMismatch } from "./replay-divergence.ts";
|
|
16
|
+
import { checkResumePreconditions } from "./resume-preconditions.ts";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Creates a Cassette-prefix transport that continues with live pi at divergence.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { mkdir, unlink } from "node:fs/promises";
|
|
2
2
|
import { dirname } from "node:path";
|
|
3
|
+
import type { RunOutcome } from "../events.ts";
|
|
3
4
|
import type { CassetteCollector, CassetteRun } from "./cassette.ts";
|
|
4
5
|
import { publishCassette } from "./cassette-publish.ts";
|
|
5
|
-
import type { RunOutcome } from "./events.ts";
|
|
6
6
|
import { sha256Hex } from "./program-hash.ts";
|
|
7
7
|
|
|
8
8
|
/** What a resume is about to re-execute; resolved once, at Run start. */
|
package/src/errors.ts
CHANGED
|
@@ -7,9 +7,9 @@ export interface AskLimitOutcome {
|
|
|
7
7
|
readonly count: number;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
import type { AgentProgress } from "./
|
|
10
|
+
import type { AgentProgress } from "./transport/index.ts";
|
|
11
11
|
|
|
12
|
-
export type { AgentProgress } from "./
|
|
12
|
+
export type { AgentProgress } from "./transport/index.ts";
|
|
13
13
|
|
|
14
14
|
/** The recorded result when yaag rejects an Ask because no frame arrived within `idleMs`. */
|
|
15
15
|
export interface AskStalledOutcome {
|
package/src/events.ts
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* activity, output, and usage observations. v0 renders them as stderr lines; the
|
|
7
7
|
* dedicated fd arrives with the extension.
|
|
8
8
|
*/
|
|
9
|
-
import type { SettlementCause } from "./
|
|
10
|
-
import type { TokenBreakdown, WorktreeResolution } from "./transport.ts";
|
|
9
|
+
import type { SettlementCause } from "./ask/index.ts";
|
|
10
|
+
import type { TokenBreakdown, WorktreeResolution } from "./transport/index.ts";
|
|
11
11
|
|
|
12
|
-
export type { SettlementCause } from "./
|
|
12
|
+
export type { SettlementCause } from "./ask/index.ts";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* A Run's outcome (ADR-0022). `paused` arrives with the pause slice.
|