@yaag/cli 0.9.0 → 0.10.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/assets/types/runtime/agent/spawn-parent.d.ts +11 -0
- package/assets/types/runtime/agent/spawn-request.d.ts +2 -0
- package/assets/types/runtime/cassette/cassette-schema.d.ts +1 -0
- package/assets/types/runtime/cassette/cassette.d.ts +5 -0
- package/assets/types/runtime/events.d.ts +9 -0
- package/assets/types/runtime/index.d.ts +1 -1
- package/assets/types/runtime/summary/index.d.ts +1 -1
- package/assets/types/runtime/summary/summary-agent.d.ts +8 -2
- package/assets/types/runtime/summary/summary.d.ts +1 -1
- package/assets/types/runtime/transport/transport.d.ts +5 -0
- package/assets/types/runtime/types.d.ts +12 -1
- package/package.json +3 -3
- package/src/terminal/render.ts +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Agent } from "./agent.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves a Parent Link to the parent Agent's name.
|
|
4
|
+
*
|
|
5
|
+
* Only a Handle this Run already spawned is accepted, which is what makes a
|
|
6
|
+
* lineage cycle impossible by construction: a Handle exists only after its own
|
|
7
|
+
* spawn resolved. Liveness is deliberately not checked — a cleanly exited Agent
|
|
8
|
+
* remains a valid parent, because the link states tree position, not a
|
|
9
|
+
* dependency on a live process.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveParent(parent: unknown, agents: readonly Agent[]): string | undefined;
|
|
@@ -8,6 +8,8 @@ export interface OpenRequestOptions {
|
|
|
8
8
|
readonly spawnOptions: SpawnOptions;
|
|
9
9
|
readonly resolvedExtensionPaths?: readonly string[];
|
|
10
10
|
readonly declaredExtensions?: readonly string[];
|
|
11
|
+
/** Resolved parent Agent name (Parent Link); spawn identity only, never argv. */
|
|
12
|
+
readonly parent?: string;
|
|
11
13
|
readonly sessionDir: string | undefined;
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
@@ -31,6 +31,7 @@ export declare const CassetteSchema: Type.TObject<{
|
|
|
31
31
|
cwd: Type.TString;
|
|
32
32
|
worktree: Type.TOptional<Type.TLiteral<true>>;
|
|
33
33
|
declaredExtensions: Type.TOptional<Type.TArray<Type.TString>>;
|
|
34
|
+
parent: Type.TOptional<Type.TString>;
|
|
34
35
|
}>;
|
|
35
36
|
model: Type.TString;
|
|
36
37
|
sessionFile: Type.TOptional<Type.TString>;
|
|
@@ -72,6 +72,11 @@ export interface CassetteSpawn {
|
|
|
72
72
|
* across machines (ADR-0040). Absent when the Agent ran no extension.
|
|
73
73
|
*/
|
|
74
74
|
readonly declaredExtensions?: readonly string[];
|
|
75
|
+
/**
|
|
76
|
+
* Resolved name of the Agent named as this Agent's parent (Parent Link).
|
|
77
|
+
* Part of spawn identity; absent for a root Agent and for older Cassettes.
|
|
78
|
+
*/
|
|
79
|
+
readonly parent?: string;
|
|
75
80
|
}
|
|
76
81
|
/** The frames attributed to one Ask marker. */
|
|
77
82
|
export interface CassetteAsk {
|
|
@@ -17,6 +17,11 @@ export type { ModelErrorReason } from "./model/index.ts";
|
|
|
17
17
|
* settled Run never writes it (ADR-0031).
|
|
18
18
|
*/
|
|
19
19
|
export type RunOutcome = "completed" | "failed" | "stopped" | "paused" | "interrupted";
|
|
20
|
+
/**
|
|
21
|
+
* How an Agent came to be. An absent value on an event means "spawn"; "fork"
|
|
22
|
+
* arrives with the forking spec.
|
|
23
|
+
*/
|
|
24
|
+
export type SpawnOrigin = "spawn" | "fork";
|
|
20
25
|
/** The current, Ask-scoped observer projection derived from Agent frames. */
|
|
21
26
|
export type AgentActivity = {
|
|
22
27
|
readonly type: "thinking";
|
|
@@ -65,6 +70,10 @@ export type LifecycleEventBody = {
|
|
|
65
70
|
* Cassette-playback Agents and events from older CLIs.
|
|
66
71
|
*/
|
|
67
72
|
readonly sessionFile?: string;
|
|
73
|
+
/** Resolved name of the Agent named as this Agent's parent (Parent Link). */
|
|
74
|
+
readonly parent?: string;
|
|
75
|
+
/** How the Agent came to be; absent means "spawn". */
|
|
76
|
+
readonly origin?: SpawnOrigin;
|
|
68
77
|
} | {
|
|
69
78
|
readonly type: "ask_start";
|
|
70
79
|
readonly agent: string;
|
|
@@ -6,7 +6,7 @@ export type { ConfigEnvironment, ConfigExtension, ConfigLayerName, EffectiveConf
|
|
|
6
6
|
export { EMPTY_EFFECTIVE_CONFIG, loadEffectiveConfig, PROJECT_CONFIG_DIR, } from "./config/index.ts";
|
|
7
7
|
export type { AskInvalidOutputOutcome, AskLimitKind, AskLimitOutcome, AskStalledOutcome, ModelResolutionOutcome, YaagErrorCode, } from "./errors.ts";
|
|
8
8
|
export { isYaagError, YaagError } from "./errors.ts";
|
|
9
|
-
export type { AgentActivity, AskOutputChannel, EventSink, LifecycleEvent, LifecycleEventBody, NodeState, NodeUsage, StampedEventSink, } from "./events.ts";
|
|
9
|
+
export type { AgentActivity, AskOutputChannel, EventSink, LifecycleEvent, LifecycleEventBody, NodeState, NodeUsage, SpawnOrigin, StampedEventSink, } from "./events.ts";
|
|
10
10
|
export type { ModelError, ModelErrorReason, ModelResolver, ModelSelection, ModelSpec, ThinkingResolver, ThinkingSpec, } from "./model/index.ts";
|
|
11
11
|
export type { DecodedNode, NodeDecoder, NodePath, NodeSnapshot } from "./node/index.ts";
|
|
12
12
|
export { agentAskPath, childPath, DEFAULT_NODE_DECODERS, NodeTracker, sanitizeNodeName, } from "./node/index.ts";
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Files inside this directory import each other directly.
|
|
4
4
|
*/
|
|
5
5
|
export { applyEvent, type EndedRunSummary, initialSummary, type RunningRunSummary, type RunOutcome, type RunState, type RunSummary, } from "./summary.ts";
|
|
6
|
-
export type { AgentInfo, AgentState, AskingAgentInfo, ExitedAgentInfo, IdleAgentInfo, ModelFallbackInfo, NodeInfo, } from "./summary-agent.ts";
|
|
6
|
+
export type { AgentInfo, AgentState, AskingAgentInfo, ExitedAgentInfo, IdleAgentInfo, ModelFallbackInfo, NodeInfo, SpawnOrigin, } from "./summary-agent.ts";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { AgentActivity } from "../events.ts";
|
|
1
|
+
import type { AgentActivity, SpawnOrigin } from "../events.ts";
|
|
2
2
|
import type { TokenBreakdown, WorktreeResolution } from "../transport/index.ts";
|
|
3
3
|
import type { ModelFallbackInfo } from "./summary-fallbacks.ts";
|
|
4
4
|
import type { NodeInfo } from "./summary-nodes.ts";
|
|
5
|
-
export type { AgentActivity } from "../events.ts";
|
|
5
|
+
export type { AgentActivity, SpawnOrigin } from "../events.ts";
|
|
6
6
|
export type { ModelFallbackInfo } from "./summary-fallbacks.ts";
|
|
7
7
|
export type { NodeInfo } from "./summary-nodes.ts";
|
|
8
8
|
/** The observer-facing lifecycle state of an Agent. */
|
|
@@ -19,6 +19,10 @@ interface AgentInfoBase {
|
|
|
19
19
|
readonly branch: string | null;
|
|
20
20
|
/** pi's session file for this Agent, when the spawn reported one; a Peek reads it. */
|
|
21
21
|
readonly sessionFile: string | null;
|
|
22
|
+
/** The Agent named as this one's parent (Parent Link), or null for a root Agent. */
|
|
23
|
+
readonly parent: string | null;
|
|
24
|
+
/** How the Agent came to be; "spawn" until forking ships. */
|
|
25
|
+
readonly origin: SpawnOrigin;
|
|
22
26
|
readonly activity: AgentActivity | null;
|
|
23
27
|
readonly tokens: TokenBreakdown | null;
|
|
24
28
|
readonly cost: number | null;
|
|
@@ -90,6 +94,8 @@ export declare function spawnAgent(current: AgentRecord | undefined, identity: {
|
|
|
90
94
|
readonly cwd: string;
|
|
91
95
|
readonly branch?: string;
|
|
92
96
|
readonly sessionFile?: string;
|
|
97
|
+
readonly parent?: string;
|
|
98
|
+
readonly origin?: SpawnOrigin;
|
|
93
99
|
}, at: number | null): AgentRecord;
|
|
94
100
|
/**
|
|
95
101
|
* Folds an Ask start into the asking arm when it is not older than the folded
|
|
@@ -2,7 +2,7 @@ import type { LifecycleEvent, LifecycleEventBody, RunOutcome } from "../events.t
|
|
|
2
2
|
import type { TokenBreakdown } from "../transport/index.ts";
|
|
3
3
|
import type { AgentInfo } from "./summary-agent.ts";
|
|
4
4
|
export type { NodeState, NodeUsage, RunOutcome } from "../events.ts";
|
|
5
|
-
export type { AgentActivity, AgentInfo, AgentState, AskingAgentInfo, ExitedAgentInfo, IdleAgentInfo, ModelFallbackInfo, NodeInfo, } from "./summary-agent.ts";
|
|
5
|
+
export type { AgentActivity, AgentInfo, AgentState, AskingAgentInfo, ExitedAgentInfo, IdleAgentInfo, ModelFallbackInfo, NodeInfo, SpawnOrigin, } from "./summary-agent.ts";
|
|
6
6
|
/** The observer-facing lifecycle state of a Run. */
|
|
7
7
|
export type RunState = "running" | "ended";
|
|
8
8
|
/** Accounting and identity facts shared by all Run observer states. */
|
|
@@ -162,6 +162,11 @@ export interface OpenOptions {
|
|
|
162
162
|
* Spawn identity only: it never becomes argv, and it is absent when empty.
|
|
163
163
|
*/
|
|
164
164
|
readonly declaredExtensions?: readonly string[];
|
|
165
|
+
/**
|
|
166
|
+
* Resolved name of the Agent named as this Agent's parent (Parent Link).
|
|
167
|
+
* Spawn identity only: it never becomes argv.
|
|
168
|
+
*/
|
|
169
|
+
readonly parent?: string;
|
|
165
170
|
/** Session storage directory. Used by the e2e suite to stay out of ~/.pi (ticket 06). */
|
|
166
171
|
readonly sessionDir?: string;
|
|
167
172
|
/** Resumes an existing pi session, translated to `--session <path>`. */
|
|
@@ -64,14 +64,23 @@ export interface SpawnOptions {
|
|
|
64
64
|
readonly name?: string;
|
|
65
65
|
/** Request a fresh Git worktree. The requested cwd remains the base until spawn resolves. */
|
|
66
66
|
readonly worktree?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Names this Agent's parent in the Run tree (Parent Link). Data only: it is
|
|
69
|
+
* no conversation channel and no lifetime rule.
|
|
70
|
+
*/
|
|
71
|
+
readonly parent?: Handle;
|
|
67
72
|
}
|
|
68
73
|
/**
|
|
69
74
|
* Spawn options after Model Resolution has settled one model and thinking level.
|
|
70
75
|
*
|
|
71
76
|
* This is the settled shape, and it is what the Cassette identity hashes
|
|
72
77
|
* (ADR-0039).
|
|
78
|
+
*
|
|
79
|
+
* `parent` is omitted on purpose: a Handle must never reach this shape, because
|
|
80
|
+
* an Ask records these options into the Cassette. Spawn resolves the Parent
|
|
81
|
+
* Link to a name, which travels in `OpenOptions` and stays out of Ask identity.
|
|
73
82
|
*/
|
|
74
|
-
export interface ResolvedSpawnOptions extends Omit<SpawnOptions, "model" | "thinking"> {
|
|
83
|
+
export interface ResolvedSpawnOptions extends Omit<SpawnOptions, "model" | "thinking" | "parent"> {
|
|
75
84
|
readonly model?: string;
|
|
76
85
|
readonly thinking?: ThinkingLevel;
|
|
77
86
|
}
|
|
@@ -83,6 +92,8 @@ export interface SpawnOverrides {
|
|
|
83
92
|
readonly cwd?: string;
|
|
84
93
|
/** Request a fresh Git worktree. */
|
|
85
94
|
readonly worktree?: boolean;
|
|
95
|
+
/** Names this Agent's parent in the Run tree (Parent Link). Data only. */
|
|
96
|
+
readonly parent?: Handle;
|
|
86
97
|
}
|
|
87
98
|
/**
|
|
88
99
|
* Options for one Ask (ADR-0003).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yaag/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@earendil-works/pi-tui": "^0.84.0",
|
|
24
|
-
"@yaag/runtime": "0.
|
|
25
|
-
"@yaag/tui": "0.
|
|
24
|
+
"@yaag/runtime": "0.10.0",
|
|
25
|
+
"@yaag/tui": "0.10.0",
|
|
26
26
|
"typebox": "1.3.7"
|
|
27
27
|
}
|
|
28
28
|
}
|
package/src/terminal/render.ts
CHANGED
|
@@ -24,7 +24,7 @@ function renderPlainEvent(event: LifecycleEventBody, mode: PlainRenderMode): str
|
|
|
24
24
|
case "run_start":
|
|
25
25
|
return `[yaag] run ${event.program}`;
|
|
26
26
|
case "agent_spawn":
|
|
27
|
-
return `[${event.agent}] spawned ${event.model} in ${event.cwd}`;
|
|
27
|
+
return `[${event.agent}] spawned ${event.model} in ${event.cwd}${event.parent === undefined ? "" : ` under ${event.parent}`}`;
|
|
28
28
|
case "ask_start":
|
|
29
29
|
return `[${event.agent}] ask #${event.index + 1}${event.replayed === true ? " (replayed)" : ""}${event.promptGist === "" ? "" : ` — ${event.promptGist}`}`;
|
|
30
30
|
case "ask_activity":
|