agent-afk 5.303.0 → 5.303.2
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/dist/agent/daemon/scheduler.d.ts +2 -0
- package/dist/agent/daemon/scheduler.execute-agent-task.d.ts +9 -0
- package/dist/agent/daemon.d.ts +1 -0
- package/dist/agent/dag-subagent.d.ts +3 -0
- package/dist/agent/dag-subagent.dispatch.d.ts +3 -0
- package/dist/agent/dag-subagent.recovery.d.ts +4 -0
- package/dist/agent/model-limits.d.ts +2 -2
- package/dist/agent/providers/openai-compatible/catalog-awareness.d.ts +14 -0
- package/dist/agent/providers/openai-compatible/models-catalog.d.ts +11 -0
- package/dist/agent/providers/openai-compatible/query/context-overflow.d.ts +1 -1
- package/dist/agent/providers/openai-compatible/query/context-pressure.d.ts +4 -0
- package/dist/agent/providers/openai-compatible/query/turn-iteration.d.ts +2 -1
- package/dist/agent/providers/shared/context-pressure.d.ts +7 -0
- package/dist/agent/providers/shared/sleep-with-abort.d.ts +3 -1
- package/dist/agent/session/ledger-lifecycle.d.ts +1 -1
- package/dist/agent/session-ledger-project.d.ts +1 -0
- package/dist/agent/session-ledger.d.ts +1 -1
- package/dist/agent/tools/compose-agent-resolve.d.ts +1 -0
- package/dist/agent/tools/compose-node-results.d.ts +14 -0
- package/dist/agent/tools/subagent-executor.notices.d.ts +4 -0
- package/dist/agent/trace/emit.d.ts +2 -1
- package/dist/agent/trace/events.d.ts +6 -0
- package/dist/agent/trace/events.session-phase.d.ts +6 -0
- package/dist/agent/trace/index.d.ts +3 -6
- package/dist/agent/trace/types.session-phase.d.ts +1 -1
- package/dist/cli/commands/daemon-session-persist.d.ts +5 -0
- package/dist/cli/session-autosave.d.ts +26 -0
- package/dist/cli/slash/types.d.ts +1 -1
- package/dist/cli.mjs +420 -415
- package/dist/config/env.d.ts +16 -0
- package/dist/config/env.model.d.ts +16 -0
- package/dist/index.mjs +156 -155
- package/dist/telegram.mjs +188 -185
- package/dist/web-server/session-name-head.d.ts +2 -0
- package/dist/web-server/session-owner.autosave.d.ts +5 -0
- package/dist/web-server/session-owner.d.ts +1 -0
- package/dist/web-ui-assets/assets/{index-CcN04Dl-.js → index-Bs_yATUj.js} +3 -3
- package/dist/web-ui-assets/assets/{index-HrybHVLc.js → index-DoLWZ4qo.js} +1 -1
- package/dist/web-ui-assets/index.html +1 -1
- package/package.json +3 -3
|
@@ -5,6 +5,7 @@ import type { Telegraf } from 'telegraf';
|
|
|
5
5
|
import { ScheduledTask } from './triggers.js';
|
|
6
6
|
export { resolveWorktreePruneRoot } from './worktree-prune-task.js';
|
|
7
7
|
export { daemonTraceLabel } from './session-spawn.js';
|
|
8
|
+
import { type TaskTurnCompleteArgs } from './scheduler.execute-agent-task.js';
|
|
8
9
|
import { type SessionStartSkipReason } from './gates.js';
|
|
9
10
|
export interface SchedulerOptions {
|
|
10
11
|
sessionConfig?: Partial<AgentConfig>;
|
|
@@ -19,6 +20,7 @@ export interface SchedulerOptions {
|
|
|
19
20
|
responseText: string;
|
|
20
21
|
successfulToolNames: readonly string[];
|
|
21
22
|
}) => boolean;
|
|
23
|
+
onTaskTurnComplete?: (args: TaskTurnCompleteArgs) => void;
|
|
22
24
|
bot?: Telegraf;
|
|
23
25
|
primaryChatId?: number;
|
|
24
26
|
primaryThreadId?: number;
|
|
@@ -6,6 +6,7 @@ import type { StateStore } from '../state/state-store.js';
|
|
|
6
6
|
import type { ScheduledTask } from './triggers.js';
|
|
7
7
|
import type { TelemetryRecord, TelemetryTrigger, TaskCompletionDetails } from './scheduler.js';
|
|
8
8
|
import type { Telegraf } from 'telegraf';
|
|
9
|
+
import type { Message } from '../types/message-types.js';
|
|
9
10
|
interface AgentTaskOptions {
|
|
10
11
|
bot?: Telegraf;
|
|
11
12
|
primaryChatId?: number;
|
|
@@ -14,6 +15,14 @@ interface AgentTaskOptions {
|
|
|
14
15
|
responseText: string;
|
|
15
16
|
successfulToolNames: readonly string[];
|
|
16
17
|
}) => boolean;
|
|
18
|
+
onTaskTurnComplete?: (args: TaskTurnCompleteArgs) => void;
|
|
19
|
+
}
|
|
20
|
+
export interface TaskTurnCompleteArgs {
|
|
21
|
+
task: ScheduledTask;
|
|
22
|
+
sessionId: string | undefined;
|
|
23
|
+
cwd: string | undefined;
|
|
24
|
+
userInput: string;
|
|
25
|
+
response: Message;
|
|
17
26
|
}
|
|
18
27
|
export interface AgentTaskContext {
|
|
19
28
|
options: AgentTaskOptions;
|
package/dist/agent/daemon.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface DaemonOptions {
|
|
|
13
13
|
now?: () => number;
|
|
14
14
|
onTaskComplete?: SchedulerOptions['onTaskComplete'];
|
|
15
15
|
doneUnverifiedProbe?: SchedulerOptions['doneUnverifiedProbe'];
|
|
16
|
+
onTaskTurnComplete?: SchedulerOptions['onTaskTurnComplete'];
|
|
16
17
|
pullPollIntervalMs?: number;
|
|
17
18
|
queueDir?: string;
|
|
18
19
|
writePortFile?: boolean;
|
|
@@ -7,7 +7,9 @@ import type { JournalParent } from './subagent/fork-types.js';
|
|
|
7
7
|
import { type DAGEdge, type DAGRunResult } from './dag.js';
|
|
8
8
|
import type { DelegationBudget } from './tools/delegation-budget.js';
|
|
9
9
|
import type { ImageBlockAttachment } from './content/image-blocks.js';
|
|
10
|
+
import type { TraceSink } from './trace/index.js';
|
|
10
11
|
export interface SubagentDAGNode {
|
|
12
|
+
replaySafe?: boolean;
|
|
11
13
|
id: string;
|
|
12
14
|
systemPrompt: string;
|
|
13
15
|
promptBuilder: (inputs: Record<string, unknown>) => string;
|
|
@@ -32,6 +34,7 @@ export interface SubagentDAGNode {
|
|
|
32
34
|
resolvedAttachments?: ImageBlockAttachment[];
|
|
33
35
|
}
|
|
34
36
|
export interface SubagentDAGOptions {
|
|
37
|
+
traceWriter?: TraceSink;
|
|
35
38
|
manager: SubagentManager;
|
|
36
39
|
parentSession: Pick<IAgentSession, 'sessionId' | 'abortSignal'> & JournalParent;
|
|
37
40
|
nodes: SubagentDAGNode[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { SubagentDAGNode, SubagentDAGOptions } from './dag-subagent.js';
|
|
2
|
+
import type { SubagentResult } from './subagent/result.js';
|
|
3
|
+
export declare function dispatchDagNode(originalSpec: SubagentDAGNode, inputs: Record<string, unknown>, nodeSignal: AbortSignal, options: SubagentDAGOptions, softDeadlineForNode: number, isolationCounter: number): Promise<SubagentResult>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SubagentResult } from './subagent/result.js';
|
|
2
|
+
import type { TraceSink } from './trace/index.js';
|
|
3
|
+
export declare function isComposeReplaySafe(tools: readonly string[] | undefined): boolean;
|
|
4
|
+
export declare function recoverDagNode(id: string, dispatch: () => Promise<SubagentResult>, signal: AbortSignal, sideEffectFree: boolean, traceWriter?: TraceSink): Promise<SubagentResult>;
|
|
@@ -3,5 +3,5 @@ export declare const MODEL_MAX_OUTPUT_TOKENS: Record<string, number>;
|
|
|
3
3
|
export declare function maxOutputTokensForKnown(model: ClaudeModel | string): number | undefined;
|
|
4
4
|
export declare function maxOutputTokensFor(model: ClaudeModel | string): number;
|
|
5
5
|
export declare const MODEL_CONTEXT_LIMITS: Record<string, number>;
|
|
6
|
-
export declare function contextLimitFor(model: ClaudeModel | string): number;
|
|
7
|
-
export declare function autoCompactLimitFor(model: ClaudeModel | string): number;
|
|
6
|
+
export declare function contextLimitFor(model: ClaudeModel | string, subscriptionPath?: boolean): number;
|
|
7
|
+
export declare function autoCompactLimitFor(model: ClaudeModel | string, subscriptionPath?: boolean): number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type CatalogReaderDeps } from './models-catalog.js';
|
|
2
|
+
import type { TraceSink } from '../../trace/index.js';
|
|
3
|
+
export declare function availableCatalogModels(deps?: CatalogReaderDeps): {
|
|
4
|
+
slug: string;
|
|
5
|
+
priority: number | undefined;
|
|
6
|
+
contextWindow: number | undefined;
|
|
7
|
+
maxContextWindow: number | undefined;
|
|
8
|
+
effectiveInputLimit: number | undefined;
|
|
9
|
+
upgrade: {
|
|
10
|
+
model: string;
|
|
11
|
+
migration_markdown?: string;
|
|
12
|
+
} | undefined;
|
|
13
|
+
}[];
|
|
14
|
+
export declare function catalogUpgradeNotice(model: string | undefined, trace?: TraceSink, deps?: CatalogReaderDeps): string | undefined;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
export interface CatalogModel {
|
|
2
2
|
slug: string;
|
|
3
|
+
context_window?: number;
|
|
4
|
+
effective_context_window_percent?: number;
|
|
5
|
+
max_context_window?: number;
|
|
6
|
+
visibility?: string;
|
|
7
|
+
supported_in_api?: boolean;
|
|
8
|
+
priority?: number;
|
|
9
|
+
upgrade?: {
|
|
10
|
+
model: string;
|
|
11
|
+
migration_markdown?: string;
|
|
12
|
+
};
|
|
3
13
|
service_tiers?: Array<{
|
|
4
14
|
id: string;
|
|
5
15
|
name?: string;
|
|
@@ -10,6 +20,7 @@ export interface CatalogModel {
|
|
|
10
20
|
export interface CatalogReaderDeps {
|
|
11
21
|
homedir?: () => string;
|
|
12
22
|
readFile?: (path: string) => string | null;
|
|
23
|
+
revision?: (path: string) => string | undefined;
|
|
13
24
|
}
|
|
14
25
|
export declare function resetCatalogCache(): void;
|
|
15
26
|
export declare function loadModelsCatalog(deps?: CatalogReaderDeps): Map<string, CatalogModel>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ProviderUsage } from '../../../provider.js';
|
|
2
|
-
export declare function checkContextOverflow(lastUsage: Partial<ProviderUsage> | null, currentModel: string, maxOutputTokens: number | undefined, configuredModel: string): Error | null;
|
|
2
|
+
export declare function checkContextOverflow(lastUsage: Partial<ProviderUsage> | null, currentModel: string, maxOutputTokens: number | undefined, configuredModel: string, subscriptionPath?: boolean): Error | null;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TurnDriverContext } from './turn-driver.js';
|
|
2
|
+
export declare const WIND_DOWN_MAX_OUTPUT_TOKENS = 4096;
|
|
3
|
+
export declare function windDownForContextPressure(ctx: TurnDriverContext, appendedAt: number): boolean;
|
|
4
|
+
export declare function canSynthesizeUnderPressure(ctx: TurnDriverContext, appendedAt: number): boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
+
import { CONTEXT_PRESSURE_WIND_DOWN } from '../../shared/context-pressure.js';
|
|
2
3
|
import type { AgentConfig } from '../../../types/config-types.js';
|
|
3
4
|
import type { ProviderEvent, ProviderUsage } from '../../../provider.js';
|
|
4
5
|
import { type OpenAIMessage } from '../messages.js';
|
|
@@ -37,4 +38,4 @@ export interface FinishTurnContext {
|
|
|
37
38
|
}
|
|
38
39
|
export declare function finishTurn(ctx: FinishTurnContext, accumulatedUsage: ProviderUsage, turnStartTime: number): Generator<ProviderEvent>;
|
|
39
40
|
export declare function pushUserTurn(ctx: IterationContext, content: import('../../../provider.js').ProviderUserTurn['content']): void;
|
|
40
|
-
export declare function runIteration(ctx: IterationContext, controller: AbortController, vision: boolean, windDown: typeof TOOL_USE_LOOP_CAPPED | typeof SOFT_DEADLINE_WIND_DOWN | null): AsyncGenerator<ProviderEvent, IterationResult | null>;
|
|
41
|
+
export declare function runIteration(ctx: IterationContext, controller: AbortController, vision: boolean, windDown: typeof TOOL_USE_LOOP_CAPPED | typeof SOFT_DEADLINE_WIND_DOWN | typeof CONTEXT_PRESSURE_WIND_DOWN | null): AsyncGenerator<ProviderEvent, IterationResult | null>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TraceSink } from '../../trace/index.js';
|
|
2
|
+
export declare const CONTEXT_PRESSURE_WIND_DOWN = "context_pressure_wind_down";
|
|
3
|
+
export declare const CONTEXT_PRESSURE_NOTE = "Context capacity is nearly exhausted. Do not request tools. Return partial findings, saved work, and remaining steps now.";
|
|
4
|
+
export declare function projectedContextTokens(lastRoundTokens: number, appendedBytes: number): number;
|
|
5
|
+
export declare function contextGuardFraction(route: 'codex-subscription' | 'anthropic' | 'openai-api'): number | null;
|
|
6
|
+
export declare function contextPressure(lastRoundTokens: number, appendedBytes: number, limit: number, fraction?: number): boolean;
|
|
7
|
+
export declare function traceContextPressure(trace: TraceSink | undefined, projected: number, limit: number, fraction?: number): void;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare function sleep(ms: number, opts?: {
|
|
2
2
|
unref?: boolean;
|
|
3
3
|
}): Promise<void>;
|
|
4
|
-
export declare function sleepWithAbort(ms: number, signal: AbortSignal
|
|
4
|
+
export declare function sleepWithAbort(ms: number, signal: AbortSignal, opts?: {
|
|
5
|
+
unref?: boolean;
|
|
6
|
+
}): Promise<void>;
|
|
@@ -15,7 +15,7 @@ export declare class LedgerLifecycle {
|
|
|
15
15
|
private writer;
|
|
16
16
|
private initAttempted;
|
|
17
17
|
ensure(ctx: LedgerEnsureContext): void;
|
|
18
|
-
recordUser(text: string): void;
|
|
18
|
+
recordUser(text: string, input?: string): void;
|
|
19
19
|
recordEvent(event: OutputEvent): void;
|
|
20
20
|
recordElicitation(reqId: string, request: ElicitationRequest): void;
|
|
21
21
|
seal(reason: string): Promise<void>;
|
|
@@ -16,7 +16,7 @@ export declare class SessionLedgerWriter {
|
|
|
16
16
|
get active(): boolean;
|
|
17
17
|
record(payload: import('./session-ledger-project.js').LedgerPayload): void;
|
|
18
18
|
recordEvent(event: OutputEvent): void;
|
|
19
|
-
recordUser(text: string): void;
|
|
19
|
+
recordUser(text: string, input?: string): void;
|
|
20
20
|
private _openStream;
|
|
21
21
|
private _writeLine;
|
|
22
22
|
close(reason?: string): Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SubagentDAGNode } from '../dag-subagent.js';
|
|
2
|
+
type BuildResult = SubagentDAGNode | {
|
|
3
|
+
attachmentError: true;
|
|
4
|
+
nodeId: string;
|
|
5
|
+
error: Error;
|
|
6
|
+
};
|
|
7
|
+
export declare function splitComposeNodeResults(results: BuildResult[]): {
|
|
8
|
+
dagNodes: SubagentDAGNode[];
|
|
9
|
+
attachmentErrors: Array<{
|
|
10
|
+
id: string;
|
|
11
|
+
error: Error;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ToolResult } from '../providers/anthropic-direct/types.js';
|
|
2
|
+
import type { TraceSink } from '../trace/index.js';
|
|
3
|
+
export declare function withCatalogNotice(result: Promise<ToolResult>, model: string, trace: TraceSink | undefined): Promise<ToolResult>;
|
|
4
|
+
export declare function addForegroundNotices(result: ToolResult, model: string, attachments: boolean, name: string | undefined, prompt: string, writable: boolean, usage: string | undefined, trace: TraceSink | undefined): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { AbortPayload, BackgroundAgentPayload, BrowserEventPayload, BudgetPayload, ClaimPayload, ClosurePayload, CompactionPayloadInput, HookDecisionPayload, PeerMessagePayload, QueuedUserMessagePayload, SessionPhasePayload, SubagentLifecyclePayload, ToolCallPayload
|
|
1
|
+
import type { AbortPayload, BackgroundAgentPayload, BrowserEventPayload, BudgetPayload, ClaimPayload, ClosurePayload, CompactionPayloadInput, HookDecisionPayload, PeerMessagePayload, QueuedUserMessagePayload, SessionPhasePayload, SubagentLifecyclePayload, ToolCallPayload } from './types.js';
|
|
2
|
+
import type { TraceSink } from './writer.js';
|
|
2
3
|
export declare const emitToolCall: (w: TraceSink | undefined, p: ToolCallPayload) => Promise<void>;
|
|
3
4
|
export declare const emitHookDecision: (w: TraceSink | undefined, p: HookDecisionPayload) => Promise<void>;
|
|
4
5
|
export declare const emitSubagentLifecycle: (w: TraceSink | undefined, p: SubagentLifecyclePayload) => Promise<void>;
|
|
@@ -613,6 +613,8 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
613
613
|
loop_start: "loop_start";
|
|
614
614
|
loop_end: "loop_end";
|
|
615
615
|
model_ttfb: "model_ttfb";
|
|
616
|
+
context_pressure_wind_down: "context_pressure_wind_down";
|
|
617
|
+
catalog_model_upgrade: "catalog_model_upgrade";
|
|
616
618
|
interrupt_halt: "interrupt_halt";
|
|
617
619
|
rate_limit: "rate_limit";
|
|
618
620
|
ttfb_timeout: "ttfb_timeout";
|
|
@@ -645,6 +647,7 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
645
647
|
orphan_repair: "orphan_repair";
|
|
646
648
|
background_process_started: "background_process_started";
|
|
647
649
|
background_process_settled: "background_process_settled";
|
|
650
|
+
compose_recovery_decision: "compose_recovery_decision";
|
|
648
651
|
}>;
|
|
649
652
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
650
653
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1029,6 +1032,8 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1029
1032
|
loop_start: "loop_start";
|
|
1030
1033
|
loop_end: "loop_end";
|
|
1031
1034
|
model_ttfb: "model_ttfb";
|
|
1035
|
+
context_pressure_wind_down: "context_pressure_wind_down";
|
|
1036
|
+
catalog_model_upgrade: "catalog_model_upgrade";
|
|
1032
1037
|
interrupt_halt: "interrupt_halt";
|
|
1033
1038
|
rate_limit: "rate_limit";
|
|
1034
1039
|
ttfb_timeout: "ttfb_timeout";
|
|
@@ -1061,6 +1066,7 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1061
1066
|
orphan_repair: "orphan_repair";
|
|
1062
1067
|
background_process_started: "background_process_started";
|
|
1063
1068
|
background_process_settled: "background_process_settled";
|
|
1069
|
+
compose_recovery_decision: "compose_recovery_decision";
|
|
1064
1070
|
}>;
|
|
1065
1071
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
1066
1072
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -11,6 +11,8 @@ export declare const SessionPhaseNameSchema: z.ZodEnum<{
|
|
|
11
11
|
loop_start: "loop_start";
|
|
12
12
|
loop_end: "loop_end";
|
|
13
13
|
model_ttfb: "model_ttfb";
|
|
14
|
+
context_pressure_wind_down: "context_pressure_wind_down";
|
|
15
|
+
catalog_model_upgrade: "catalog_model_upgrade";
|
|
14
16
|
interrupt_halt: "interrupt_halt";
|
|
15
17
|
rate_limit: "rate_limit";
|
|
16
18
|
ttfb_timeout: "ttfb_timeout";
|
|
@@ -43,6 +45,7 @@ export declare const SessionPhaseNameSchema: z.ZodEnum<{
|
|
|
43
45
|
orphan_repair: "orphan_repair";
|
|
44
46
|
background_process_started: "background_process_started";
|
|
45
47
|
background_process_settled: "background_process_settled";
|
|
48
|
+
compose_recovery_decision: "compose_recovery_decision";
|
|
46
49
|
}>;
|
|
47
50
|
export declare const SessionPhasePayloadSchema: z.ZodObject<{
|
|
48
51
|
phase: z.ZodEnum<{
|
|
@@ -57,6 +60,8 @@ export declare const SessionPhasePayloadSchema: z.ZodObject<{
|
|
|
57
60
|
loop_start: "loop_start";
|
|
58
61
|
loop_end: "loop_end";
|
|
59
62
|
model_ttfb: "model_ttfb";
|
|
63
|
+
context_pressure_wind_down: "context_pressure_wind_down";
|
|
64
|
+
catalog_model_upgrade: "catalog_model_upgrade";
|
|
60
65
|
interrupt_halt: "interrupt_halt";
|
|
61
66
|
rate_limit: "rate_limit";
|
|
62
67
|
ttfb_timeout: "ttfb_timeout";
|
|
@@ -89,6 +94,7 @@ export declare const SessionPhasePayloadSchema: z.ZodObject<{
|
|
|
89
94
|
orphan_repair: "orphan_repair";
|
|
90
95
|
background_process_started: "background_process_started";
|
|
91
96
|
background_process_settled: "background_process_settled";
|
|
97
|
+
compose_recovery_decision: "compose_recovery_decision";
|
|
92
98
|
}>;
|
|
93
99
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
94
100
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export type { NdjsonTraceWriterOptions, TraceSink, TraceWriter } from './writer.js';
|
|
5
|
-
export { emitSessionIdAssigned } from '../session/session-id-trace.js';
|
|
6
|
-
export { emitPeerMessage } from './emit.js';
|
|
1
|
+
export type { AbortOrigin, BackgroundAgentPayload, ClosureReason, HookEventName, SessionPhasePayload, SubagentLifecyclePayload, TraceEvent, TraceEventInput, } from './types.js';
|
|
2
|
+
export { InMemoryTraceWriter, } from './writer.js';
|
|
3
|
+
export type { TraceSink, TraceWriter } from './writer.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type SessionPhaseName = 'bootstrap_start' | 'bootstrap_done' | 'session_init_start' | 'session_init_done' | 'mcp_connect_start' | 'mcp_connect_done' | 'mcp_server_start' | 'mcp_server_done' | 'loop_start' | 'loop_end' | 'model_ttfb' | 'interrupt_halt' | 'rate_limit' | 'ttfb_timeout' | 'usage_limit_pause' | 'usage_limit_resume' | 'overload_pause' | 'overload_resume' | 'idle_watchdog_fired' | 'pause_extension_granted' | 'suspected_loop' | 'compaction_disabled' | 'boot_warning' | 'workspace_subscribed' | 'workspace_delivery' | 'gate_shape' | 'session_id_assigned' | 'many_image_degraded' | 'stream_accepted_after_drop' | 'connection_retry' | 'connection_retry_exhausted' | 'connection_failure' | 'connection_recovered' | 'connection_budget_exhausted' | 'usage_notice' | 'tool_degraded' | 'strategy_nudge_fired' | 'stop_inject_dropped' | 'stop_hook_continuation' | 'stop_hook_cap_reached' | 'orphan_repair' | 'background_process_started' | 'background_process_settled';
|
|
1
|
+
export type SessionPhaseName = 'bootstrap_start' | 'bootstrap_done' | 'session_init_start' | 'session_init_done' | 'mcp_connect_start' | 'mcp_connect_done' | 'mcp_server_start' | 'mcp_server_done' | 'loop_start' | 'loop_end' | 'model_ttfb' | 'context_pressure_wind_down' | 'catalog_model_upgrade' | 'interrupt_halt' | 'rate_limit' | 'ttfb_timeout' | 'usage_limit_pause' | 'usage_limit_resume' | 'overload_pause' | 'overload_resume' | 'idle_watchdog_fired' | 'pause_extension_granted' | 'suspected_loop' | 'compaction_disabled' | 'boot_warning' | 'workspace_subscribed' | 'workspace_delivery' | 'gate_shape' | 'session_id_assigned' | 'many_image_degraded' | 'stream_accepted_after_drop' | 'connection_retry' | 'connection_retry_exhausted' | 'connection_failure' | 'connection_recovered' | 'connection_budget_exhausted' | 'usage_notice' | 'tool_degraded' | 'strategy_nudge_fired' | 'stop_inject_dropped' | 'stop_hook_continuation' | 'stop_hook_cap_reached' | 'orphan_repair' | 'background_process_started' | 'background_process_settled' | 'compose_recovery_decision';
|
|
2
2
|
export interface SessionPhasePayload {
|
|
3
3
|
phase: SessionPhaseName;
|
|
4
4
|
durationMs?: number;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AgentModelInput } from '../../agent/types.js';
|
|
2
|
+
import type { TaskTurnCompleteArgs } from '../../agent/daemon/scheduler.execute-agent-task.js';
|
|
3
|
+
import type { SchedulerOptions } from '../../agent/daemon/scheduler.js';
|
|
4
|
+
export declare function makeDaemonTurnPersister(model: AgentModelInput): (args: TaskTurnCompleteArgs) => void;
|
|
5
|
+
export declare function daemonTurnHooks(model: AgentModelInput, doneUnverifiedProbe: NonNullable<SchedulerOptions['doneUnverifiedProbe']>): Pick<SchedulerOptions, 'doneUnverifiedProbe' | 'onTaskTurnComplete'>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ResponseMetadata } from '../agent/types/message-types.js';
|
|
2
|
+
import type { AgentModelInput, OutputEvent } from '../agent/types.js';
|
|
3
|
+
import type { SessionStats, ToolEvent } from './slash/types.js';
|
|
4
|
+
export interface SessionAutosaverOptions {
|
|
5
|
+
model: AgentModelInput;
|
|
6
|
+
source: NonNullable<SessionStats['source']>;
|
|
7
|
+
cwd?: string;
|
|
8
|
+
sessionId?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
onError?: (err: unknown) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface SessionAutosaver {
|
|
13
|
+
readonly stats: SessionStats;
|
|
14
|
+
saveTurn(userInput: string, assistantText: string, metadata: ResponseMetadata | undefined, toolEvents?: ToolEvent[]): void;
|
|
15
|
+
}
|
|
16
|
+
export declare function createSessionAutosaver(opts: SessionAutosaverOptions): SessionAutosaver;
|
|
17
|
+
export interface CollectedTurn {
|
|
18
|
+
completed: boolean;
|
|
19
|
+
assistantText: string;
|
|
20
|
+
metadata: ResponseMetadata | undefined;
|
|
21
|
+
toolEvents: ToolEvent[];
|
|
22
|
+
}
|
|
23
|
+
export declare function createTurnCollector(): {
|
|
24
|
+
observe(event: OutputEvent): void;
|
|
25
|
+
result(): CollectedTurn;
|
|
26
|
+
};
|