agent-afk 5.265.2 → 5.266.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/dist/agent/_lib/dir-newest-mtime.d.ts +5 -0
- package/dist/agent/dag-subagent.d.ts +2 -1
- package/dist/agent/journal/append-queue.d.ts +17 -0
- package/dist/agent/journal/blobs.d.ts +14 -0
- package/dist/agent/journal/fork.d.ts +1 -0
- package/dist/agent/journal/hydrate.d.ts +4 -0
- package/dist/agent/journal/index.d.ts +5 -0
- package/dist/agent/journal/journal-file.d.ts +37 -0
- package/dist/agent/journal/noop.d.ts +3 -0
- package/dist/agent/journal/reader.d.ts +24 -0
- package/dist/agent/journal/records.d.ts +13 -0
- package/dist/agent/journal/spill.d.ts +9 -0
- package/dist/agent/journal/sync.d.ts +18 -0
- package/dist/agent/journal/types.d.ts +121 -0
- package/dist/agent/journal/writer.d.ts +11 -0
- package/dist/agent/provider.d.ts +2 -0
- package/dist/agent/providers/anthropic-direct/journal-adapter.d.ts +3 -0
- package/dist/agent/providers/anthropic-direct/query/session-state.d.ts +4 -0
- package/dist/agent/providers/anthropic-direct/query/turn-request.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/query-options.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/query-runtime.d.ts +2 -0
- package/dist/agent/providers/anthropic-direct/request-types.d.ts +1 -0
- package/dist/agent/providers/openai-compatible/journal-adapter.d.ts +4 -0
- package/dist/agent/providers/openai-compatible/query/journal-wiring.d.ts +18 -0
- package/dist/agent/providers/openai-compatible/query.d.ts +3 -0
- package/dist/agent/providers/router/provider-router.d.ts +2 -0
- package/dist/agent/providers/shared/compaction.d.ts +2 -0
- package/dist/agent/providers/shared/resume-usage-seed.d.ts +8 -0
- package/dist/agent/session/agent-session.d.ts +3 -0
- package/dist/agent/session/journal-lifecycle.d.ts +22 -0
- package/dist/agent/session/session-config.d.ts +2 -0
- package/dist/agent/session/session-reset.d.ts +2 -0
- package/dist/agent/session/session-setup.d.ts +1 -0
- package/dist/agent/session-sidecar-sweep.d.ts +2 -0
- package/dist/agent/session-sidecar-sweep.dirs.d.ts +9 -0
- package/dist/agent/subagent/fork-types.d.ts +6 -1
- package/dist/agent/tools/compose-executor.d.ts +1 -1
- package/dist/agent/tools/nesting.d.ts +2 -1
- package/dist/agent/tools/skill-executor/fork-child-config.d.ts +5 -1
- package/dist/agent/tools/skill-executor/fork-dispatch.d.ts +2 -0
- package/dist/agent/tools/skill-executor/types.d.ts +3 -2
- package/dist/agent/tools/subagent/child-config.d.ts +4 -1
- package/dist/agent/tools/subagent-executor/types.d.ts +3 -2
- package/dist/agent/types/config-types.d.ts +3 -0
- package/dist/agent/types/session-types.d.ts +2 -0
- package/dist/cli/commands/interactive/turn-handler.completion.d.ts +0 -5
- package/dist/cli/commands/interactive/turn-handler.d.ts +0 -1
- package/dist/cli/commands/trace-format.d.ts +6 -0
- package/dist/cli/commands/trace-results.d.ts +13 -0
- package/dist/cli/commands/trace.d.ts +2 -0
- package/dist/cli/commit-mode.d.ts +0 -1
- package/dist/cli/slash/session-stats.d.ts +1 -2
- package/dist/cli/terminal-compositor.commit-geometry.d.ts +0 -1
- package/dist/cli/terminal-compositor.commit-phase1.d.ts +0 -1
- package/dist/cli/terminal-compositor.commit-route.d.ts +1 -0
- package/dist/cli/terminal-compositor.committed-band-commit.d.ts +2 -0
- package/dist/cli/terminal-compositor.d.ts +3 -0
- package/dist/cli/terminal-compositor.lifecycle.d.ts +5 -0
- package/dist/cli/terminal-compositor.lifecycle.suspend-observer.d.ts +8 -0
- package/dist/cli/terminal-compositor.lifecycle.suspend-observer.process.d.ts +20 -0
- package/dist/cli/terminal-compositor.lifecycle.teardown.d.ts +1 -0
- package/dist/cli/terminal-compositor.reset.d.ts +3 -0
- package/dist/cli.mjs +466 -441
- package/dist/config/env.d.ts +7 -0
- package/dist/config/env.session-storage.d.ts +15 -0
- package/dist/index.mjs +175 -160
- package/dist/paths.d.ts +1 -0
- package/dist/paths.journal.d.ts +4 -0
- package/dist/telegram.mjs +226 -211
- package/dist/web-server/routes.tool-results.d.ts +12 -0
- package/dist/web-server/shared/ledger-adapter.d.ts +4 -0
- package/dist/web-server/tool-result-text.d.ts +5 -0
- package/dist/web-ui-assets/assets/{index-yyhuSaHa.js → index-CpbGrtNj.js} +75 -75
- package/dist/web-ui-assets/assets/{index-DA-_KrIR.js → index-MIgeDul2.js} +1 -1
- package/dist/web-ui-assets/assets/index-PzcVW5-O.css +1 -0
- package/dist/web-ui-assets/index.html +2 -2
- package/package.json +1 -1
- package/dist/web-ui-assets/assets/index-BMUkERO1.css +0 -1
|
@@ -3,6 +3,7 @@ import type { ModelProvider } from '../provider.js';
|
|
|
3
3
|
import type { AgentModelInput } from '../types.js';
|
|
4
4
|
import type { Surface } from '../awareness/types.js';
|
|
5
5
|
import type { ReadScopeInputs } from '../subagent-read-scope.js';
|
|
6
|
+
import type { JournalParent } from '../subagent/fork-types.js';
|
|
6
7
|
import type { WorkspaceStore } from '../workspace/workspace-store.js';
|
|
7
8
|
import { SkillExecutor } from './skill-executor.js';
|
|
8
9
|
import type { SubagentExecutor } from './subagent-executor.js';
|
|
@@ -33,7 +34,7 @@ export interface CreateChildProviderFactoryOptions {
|
|
|
33
34
|
export declare function createChildProviderFactory(opts?: CreateChildProviderFactoryOptions): (args: ChildProviderFactoryArgs) => ModelProvider;
|
|
34
35
|
export declare function buildReadOnlyReconProvider(model: AgentModelInput | undefined, openaiBaseUrl?: string, allowedTools?: readonly string[]): ModelProvider;
|
|
35
36
|
export declare function buildComposeNodeProvider(model: AgentModelInput | undefined, workspaceStore: WorkspaceStore, openaiBaseUrl?: string, readOnlyBash?: boolean): ModelProvider;
|
|
36
|
-
export declare function createChildSkillExecutorFactory(defaultModel: AgentModelInput, apiKey: string | undefined, childProviderFactory: (args: ChildProviderFactoryArgs) => ModelProvider, baseUrl?: string, traceWriter?: TraceSink, backgroundRegistry?: BackgroundAgentRegistry, cwd?: string, resolveApiKeyForModel?: (model: string) => string | undefined, surface?: Surface, defaultSubagentModel?: AgentModelInput, agentRegistry?: AgentRegistry, openaiBaseUrl?: string, xaiBaseUrl?: string, workspaceStore?: WorkspaceStore, delegationBudget?: import('./delegation-budget.js').DelegationBudget): (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string) => SkillExecutor;
|
|
37
|
+
export declare function createChildSkillExecutorFactory(defaultModel: AgentModelInput, apiKey: string | undefined, childProviderFactory: (args: ChildProviderFactoryArgs) => ModelProvider, baseUrl?: string, traceWriter?: TraceSink, backgroundRegistry?: BackgroundAgentRegistry, cwd?: string, resolveApiKeyForModel?: (model: string) => string | undefined, surface?: Surface, defaultSubagentModel?: AgentModelInput, agentRegistry?: AgentRegistry, openaiBaseUrl?: string, xaiBaseUrl?: string, workspaceStore?: WorkspaceStore, delegationBudget?: import('./delegation-budget.js').DelegationBudget): (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string, journalParent?: JournalParent) => SkillExecutor;
|
|
37
38
|
export type PhaseRole = 'read-only' | 'read-write';
|
|
38
39
|
export declare function buildSkillRestrictedProvider(allowedTools: string[], model: AgentModelInput | undefined, readOnlyBash?: boolean, openaiBaseUrl?: string, workspaceStore?: WorkspaceStore): ModelProvider;
|
|
39
40
|
export declare function buildPhaseRestrictedProvider(_role: 'read-only', model: AgentModelInput | undefined): ModelProvider;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { SubagentManager } from '../../subagent.js';
|
|
2
2
|
import type { AgentConfig } from '../../types/config-types.js';
|
|
3
3
|
import type { SkillExecutorInternals } from './types.js';
|
|
4
|
-
|
|
4
|
+
import type { MessageJournal } from '../../journal/types.js';
|
|
5
|
+
export interface JournalParentHolder {
|
|
6
|
+
messageJournal?: MessageJournal;
|
|
7
|
+
}
|
|
8
|
+
export declare function buildForkedChildConfig(internals: SkillExecutorInternals, baseConfig: AgentConfig, signal: AbortSignal, readOnly?: boolean, allowedTools?: string[], journalView?: JournalParentHolder): {
|
|
5
9
|
childConfig: AgentConfig;
|
|
6
10
|
childManager: SubagentManager | undefined;
|
|
7
11
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SubagentManager } from '../../subagent.js';
|
|
2
2
|
import type { ToolCall, ToolResult } from '../types.js';
|
|
3
3
|
import type { AgentConfig } from '../../types/config-types.js';
|
|
4
|
+
import { type JournalParentHolder } from './fork-child-config.js';
|
|
4
5
|
import type { SkillExecutorInternals } from './types.js';
|
|
5
6
|
export declare function executeForkedRegistrySkill(internals: SkillExecutorInternals, skill: {
|
|
6
7
|
name: string;
|
|
@@ -13,6 +14,7 @@ export declare function runForkedSkillToResult(internals: SkillExecutorInternals
|
|
|
13
14
|
manager: SubagentManager;
|
|
14
15
|
childManager: SubagentManager | undefined;
|
|
15
16
|
childConfig: AgentConfig;
|
|
17
|
+
journalView?: JournalParentHolder;
|
|
16
18
|
label: string;
|
|
17
19
|
idPrefix: string;
|
|
18
20
|
parentId: string;
|
|
@@ -7,8 +7,9 @@ import type { ChildProviderFactoryArgs } from '../nesting.js';
|
|
|
7
7
|
import type { Surface } from '../../awareness/types.js';
|
|
8
8
|
import type { ReadScopeInputs } from '../../subagent-read-scope.js';
|
|
9
9
|
import type { SkillExecutor } from '../skill-executor.js';
|
|
10
|
+
import type { JournalParent } from '../../subagent/fork-types.js';
|
|
10
11
|
export interface SkillExecutorContext {
|
|
11
|
-
parentSession: Pick<IAgentSession, 'sessionId' | 'getInputStreamRef' | 'abortSignal'> & Partial<Pick<IAgentSession, 'hookRegistry'
|
|
12
|
+
parentSession: Pick<IAgentSession, 'sessionId' | 'getInputStreamRef' | 'abortSignal'> & Partial<Pick<IAgentSession, 'hookRegistry'>> & JournalParent;
|
|
12
13
|
defaultModel?: string;
|
|
13
14
|
surface?: Surface;
|
|
14
15
|
defaultSubagentModel: AgentModelInput;
|
|
@@ -21,7 +22,7 @@ export interface SkillExecutorContext {
|
|
|
21
22
|
depth?: number;
|
|
22
23
|
maxDepth?: number;
|
|
23
24
|
childProviderFactory?: (args: ChildProviderFactoryArgs) => ModelProvider;
|
|
24
|
-
childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string) => SkillExecutor;
|
|
25
|
+
childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string, journalParent?: JournalParent) => SkillExecutor;
|
|
25
26
|
traceWriter?: TraceSink;
|
|
26
27
|
backgroundRegistry?: BackgroundAgentRegistry;
|
|
27
28
|
cwd?: string;
|
|
@@ -3,6 +3,8 @@ import type { ReadScopeInputs } from '../../subagent-read-scope.js';
|
|
|
3
3
|
import type { ModelProvider } from '../../provider.js';
|
|
4
4
|
import type { AgentModelInput } from '../../types.js';
|
|
5
5
|
import type { AgentConfig } from '../../types/config-types.js';
|
|
6
|
+
import type { MessageJournal } from '../../journal/types.js';
|
|
7
|
+
import type { JournalParent } from '../../subagent/fork-types.js';
|
|
6
8
|
import { createStubParentSession, type ChildProviderFactoryArgs } from '../nesting.js';
|
|
7
9
|
import type { RegisteredAgent } from '../../agents/index.js';
|
|
8
10
|
import type { AgentRegistry } from '../../agents/index.js';
|
|
@@ -13,6 +15,7 @@ import type { SubagentExecutor, SubagentExecutorContext } from '../subagent-exec
|
|
|
13
15
|
import type { AgentInput } from './input-parse.js';
|
|
14
16
|
export type ChildParentSession = ReturnType<typeof createStubParentSession> & {
|
|
15
17
|
sessionId: string | undefined;
|
|
18
|
+
messageJournal?: MessageJournal;
|
|
16
19
|
};
|
|
17
20
|
export interface BuildChildConfigArgs {
|
|
18
21
|
parsed: AgentInput;
|
|
@@ -26,7 +29,7 @@ export interface BuildChildConfigArgs {
|
|
|
26
29
|
resolveApiKeyForModel?: (model: string) => string | undefined;
|
|
27
30
|
defaultSubagentModel: AgentModelInput;
|
|
28
31
|
childProviderFactory?: (args: ChildProviderFactoryArgs) => ModelProvider;
|
|
29
|
-
childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string) => SkillExecutor;
|
|
32
|
+
childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string, journalParent?: JournalParent) => SkillExecutor;
|
|
30
33
|
surface?: Surface;
|
|
31
34
|
allowedTools?: string[];
|
|
32
35
|
readOnlyBash?: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SubagentManager } from '../../subagent.js';
|
|
2
|
+
import type { JournalParent } from '../../subagent/fork-types.js';
|
|
2
3
|
import type { ReadScopeInputs } from '../../subagent-read-scope.js';
|
|
3
4
|
import type { BackgroundAgentRegistry } from '../../background-registry.js';
|
|
4
5
|
import type { ModelProvider } from '../../provider.js';
|
|
@@ -16,13 +17,13 @@ import type { PromotedSubagentInfo } from '../subagent/foreground-promotion.js';
|
|
|
16
17
|
export type { PromotedSubagentInfo, QueuedNoteClaim };
|
|
17
18
|
export interface SubagentExecutorContext {
|
|
18
19
|
subagentManager: SubagentManager;
|
|
19
|
-
parentSession: Pick<IAgentSession, 'sessionId' | 'getInputStreamRef' | 'abortSignal'> & Partial<Pick<IAgentSession, 'hookRegistry'
|
|
20
|
+
parentSession: Pick<IAgentSession, 'sessionId' | 'getInputStreamRef' | 'abortSignal'> & Partial<Pick<IAgentSession, 'hookRegistry'>> & JournalParent;
|
|
20
21
|
defaultConfig: Pick<AgentConfig, 'apiKey' | 'systemPrompt' | 'baseUrl' | 'openaiBaseUrl' | 'xaiBaseUrl' | 'skillDispatchName'>;
|
|
21
22
|
surface?: Surface;
|
|
22
23
|
resolveApiKeyForModel?: (model: string) => string | undefined;
|
|
23
24
|
defaultSubagentModel: AgentModelInput;
|
|
24
25
|
childProviderFactory?: (args: ChildProviderFactoryArgs) => ModelProvider;
|
|
25
|
-
childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string) => SkillExecutor;
|
|
26
|
+
childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string, journalParent?: JournalParent) => SkillExecutor;
|
|
26
27
|
depth: number;
|
|
27
28
|
maxDepth?: number;
|
|
28
29
|
backgroundRegistry?: BackgroundAgentRegistry;
|
|
@@ -2,6 +2,7 @@ import type { AgentDefinition, EffortLevel, HookCallbackMatcher, HookEvent, OnEl
|
|
|
2
2
|
import type { HookRegistry } from '../hooks.js';
|
|
3
3
|
import type { ModelProvider } from '../provider.js';
|
|
4
4
|
import type { TraceSink } from '../trace/index.js';
|
|
5
|
+
import type { JournalMessage, MessageJournal } from '../journal/types.js';
|
|
5
6
|
import type { AgentModelInput } from './model-types.js';
|
|
6
7
|
import type { ModelSlots } from '../session/model-slots.js';
|
|
7
8
|
import type { CanUseTool, PermissionBubbler } from './permission-types.js';
|
|
@@ -69,6 +70,8 @@ export interface AgentConfig {
|
|
|
69
70
|
continue?: boolean;
|
|
70
71
|
resume?: string;
|
|
71
72
|
resumeHistory?: ResumeHistoryTurn[];
|
|
73
|
+
resumeMessages?: JournalMessage[];
|
|
74
|
+
messageJournal?: MessageJournal;
|
|
72
75
|
sessionId?: string;
|
|
73
76
|
resumeSessionAt?: string;
|
|
74
77
|
forkSession?: boolean;
|
|
@@ -5,6 +5,7 @@ import type { InputStreamRef } from './permission-types.js';
|
|
|
5
5
|
import type { Message, MessageChunk, ResponseMetadata, SendMessageOptions, StructuredMessageOptions } from './message-types.js';
|
|
6
6
|
import type { ProviderCommandInfo, ProviderCompactResult, ProviderContextUsage, ProviderMcpServerStatus, ProviderQuery, ProviderRewindConversationResult, RewindTarget } from '../provider.js';
|
|
7
7
|
import type { HookRegistry } from '../hooks.js';
|
|
8
|
+
import type { MessageJournal } from '../journal/types.js';
|
|
8
9
|
import type { ZodType } from 'zod';
|
|
9
10
|
export type SessionState = 'idle' | 'processing' | 'streaming' | 'compacting' | 'closed';
|
|
10
11
|
export interface SessionIdentity {
|
|
@@ -138,6 +139,7 @@ export interface IAgentSession {
|
|
|
138
139
|
readonly sessionId?: string;
|
|
139
140
|
readonly cwd?: string;
|
|
140
141
|
readonly hookRegistry?: HookRegistry;
|
|
142
|
+
readonly messageJournal?: MessageJournal;
|
|
141
143
|
sendMessage(content: string, options?: SendMessageOptions): Promise<Message>;
|
|
142
144
|
sendMessageStream(content: string | ContentBlockParam[]): AsyncIterable<OutputEvent>;
|
|
143
145
|
sendMessageStructured?<T>(content: string, schema: ZodType<T>, options?: StructuredMessageOptions): Promise<T>;
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import type { SessionStats, ToolEvent } from '../../slash/types.js';
|
|
2
|
-
import type { ContentBlockParam } from '@anthropic-ai/sdk/resources';
|
|
3
2
|
import type { CompletionWriter, TurnHandles } from './shared.js';
|
|
4
3
|
import type { StreamEventState } from './turn-handler.stream-events.js';
|
|
5
4
|
import type { TerminalCompositor } from '../../terminal-compositor.js';
|
|
6
5
|
import type { StreamRenderer } from '../../_lib/stream-renderer.js';
|
|
7
|
-
export declare function buildAssistantContentBlocks(responseText: string, toolEvents: ToolEvent[]): ContentBlockParam[] | undefined;
|
|
8
|
-
export declare function buildUserContentBlocks(userText: string, toolEvents: ToolEvent[]): ContentBlockParam[] | undefined;
|
|
9
6
|
export interface TurnCompletionContext {
|
|
10
7
|
state: StreamEventState;
|
|
11
8
|
stats: SessionStats;
|
|
12
9
|
h: TurnHandles;
|
|
13
10
|
toolEvents: ToolEvent[];
|
|
14
11
|
historyText: string;
|
|
15
|
-
assistantBlocks: ContentBlockParam[] | undefined;
|
|
16
|
-
userBlocks: ContentBlockParam[] | undefined;
|
|
17
12
|
completionWriter: CompletionWriter | undefined;
|
|
18
13
|
borrowedCompositor: TerminalCompositor | null;
|
|
19
14
|
renderer: StreamRenderer;
|
|
@@ -4,7 +4,6 @@ import { type ImageAttachment } from '../../input/attachments.js';
|
|
|
4
4
|
import type { InputSurfaceRefs } from '../../input/input-surface.js';
|
|
5
5
|
import { type CompletionWriter, type ThinkingUiMode, type TurnHandles } from './shared.js';
|
|
6
6
|
export { formatToolLine, formatToolResultLine, ToolLane } from './tool-lane.js';
|
|
7
|
-
export { buildAssistantContentBlocks, buildUserContentBlocks } from './turn-handler.completion.js';
|
|
8
7
|
export type { InputSurfaceRefs } from '../../input/input-surface.js';
|
|
9
8
|
export declare function runTurn(input: {
|
|
10
9
|
text: string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function fmtDuration(ms: number): string;
|
|
2
|
+
export declare function fmtBytes(n: number): string;
|
|
3
|
+
export declare function fmtUsd(n: number): string;
|
|
4
|
+
export declare function fmtTime(ts: string): string;
|
|
5
|
+
export declare function truncate(s: string, n: number): string;
|
|
6
|
+
export declare function label(s: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TraceEvent } from '../../agent/trace/index.js';
|
|
2
|
+
export declare const DEFAULT_RESULT_LINES = 40;
|
|
3
|
+
export interface TraceResultsContext {
|
|
4
|
+
resultFor: (toolUseId: string) => string | null;
|
|
5
|
+
note: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function journalSessionCandidates(traceSessionId: string, events: readonly TraceEvent[]): string[];
|
|
8
|
+
export declare function renderResultBlock(text: string, maxLines: number, opts?: {
|
|
9
|
+
isError?: boolean;
|
|
10
|
+
subagentId?: string;
|
|
11
|
+
}): string;
|
|
12
|
+
export declare function buildTraceResults(traceSessionId: string, events: readonly TraceEvent[], maxLines?: number): TraceResultsContext;
|
|
13
|
+
export declare function withToolResult(line: string, event: TraceEvent, resultFor: ((toolUseId: string) => string | null) | undefined): string;
|
|
@@ -15,6 +15,8 @@ export declare function loadTrace(session: string): Promise<{
|
|
|
15
15
|
export interface FormatTraceOptions {
|
|
16
16
|
showAll?: boolean;
|
|
17
17
|
limit?: number;
|
|
18
|
+
resultFor?: (toolUseId: string) => string | null;
|
|
19
|
+
resultsNote?: string;
|
|
18
20
|
}
|
|
19
21
|
export declare function formatTrace(sessionId: string, tracePath: string, parsed: ParsedTrace, options?: FormatTraceOptions): string;
|
|
20
22
|
export declare function registerTraceCommand(program: Command): void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ResponseMetadata } from '../../agent/types/message-types.js';
|
|
2
2
|
import type { AgentModelInput } from '../../agent/types.js';
|
|
3
|
-
import type { ContentBlockParam } from '@anthropic-ai/sdk/resources';
|
|
4
3
|
import type { SessionStats, ToolEvent, TurnRecord } from './types.js';
|
|
5
4
|
export declare function createSessionStats(model: AgentModelInput): SessionStats;
|
|
6
5
|
export declare function resetStats(stats: SessionStats): void;
|
|
7
|
-
export declare function recordTurn(stats: SessionStats, userInput: string, assistantText: string, metadata: ResponseMetadata | undefined, toolEvents?: ToolEvent[]
|
|
6
|
+
export declare function recordTurn(stats: SessionStats, userInput: string, assistantText: string, metadata: ResponseMetadata | undefined, toolEvents?: ToolEvent[]): TurnRecord;
|
|
@@ -10,6 +10,5 @@ export interface CommitGeometry {
|
|
|
10
10
|
phase1EffectiveFrameTop: number;
|
|
11
11
|
hugSlack: number;
|
|
12
12
|
roomTop: number;
|
|
13
|
-
frameErased: boolean;
|
|
14
13
|
}
|
|
15
14
|
export declare function snapshotCommitGeometry(self: CommittedBandHost, contentLineCount: number, rows: number, cols: number): CommitGeometry;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { CommittedBandHost } from './terminal-compositor.committed-band-commit.js';
|
|
2
2
|
import type { CommitGeometry } from './terminal-compositor.commit-geometry.js';
|
|
3
3
|
import type { CommitRoute } from './terminal-compositor.commit-route.js';
|
|
4
|
-
export declare function erasedFramePriorBandErase(self: CommittedBandHost, geo: CommitGeometry): string;
|
|
5
4
|
export declare function commitPhase1Teardown(self: CommittedBandHost, geo: CommitGeometry, route: CommitRoute): number;
|
|
@@ -12,5 +12,6 @@ export interface CommitRoute {
|
|
|
12
12
|
archiveCount: number;
|
|
13
13
|
rawGenuineOverflow: number;
|
|
14
14
|
maxBandModel: number;
|
|
15
|
+
overflowPriorContiguous: boolean;
|
|
15
16
|
}
|
|
16
17
|
export declare function routeCommit(self: CommittedBandHost, t: CommitText, geo: CommitGeometry): CommitRoute;
|
|
@@ -26,10 +26,12 @@ export interface CommittedBandHost {
|
|
|
26
26
|
anchorRow: number | undefined;
|
|
27
27
|
armed: boolean;
|
|
28
28
|
readonly suspended: boolean;
|
|
29
|
+
suspendCommitQueue: string[];
|
|
29
30
|
logUpdate: LogUpdateFn | null;
|
|
30
31
|
readonly scrollRegion?: CompositorScrollRegionGuard;
|
|
31
32
|
readonly stdout: NodeJS.WriteStream;
|
|
32
33
|
}
|
|
33
34
|
export declare function commitAbove(self: CommittedBandHost, text: string): void;
|
|
34
35
|
export declare function clearCommittedBand(self: CommittedBandHost): void;
|
|
36
|
+
export declare function forgetCommittedBand(self: CommittedBandHost): void;
|
|
35
37
|
export declare function resetCommittedBand(self: CommittedBandHost): void;
|
|
@@ -45,6 +45,8 @@ export declare class TerminalCompositor {
|
|
|
45
45
|
pickerSavedMode: CompositorInputMode;
|
|
46
46
|
armed: boolean;
|
|
47
47
|
suspended: boolean;
|
|
48
|
+
suspendObserver: import('./terminal-compositor.lifecycle.suspend-observer.js').SuspendObserverHandle | null;
|
|
49
|
+
suspendCommitQueue: string[];
|
|
48
50
|
canceled: boolean;
|
|
49
51
|
backgrounded: boolean;
|
|
50
52
|
paused: boolean;
|
|
@@ -124,6 +126,7 @@ export declare class TerminalCompositor {
|
|
|
124
126
|
setActiveToolName(toolName: string | undefined): void;
|
|
125
127
|
commitAbove(text: string): void;
|
|
126
128
|
clearCommittedBand(): void;
|
|
129
|
+
forgetCommittedBand(): void;
|
|
127
130
|
flushResizeGhostErase(): void;
|
|
128
131
|
resetCommittedBand(): void;
|
|
129
132
|
repositionCommittedBand(desiredTopRow: number, preRenderFrameTop: number, targetBottomRow: number): void;
|
|
@@ -4,15 +4,18 @@ import type { CaretBlinkController } from './input/caret-blink.js';
|
|
|
4
4
|
import type { SuggestEngine } from './terminal-compositor.types.js';
|
|
5
5
|
import type { BandRowMeta, CompositorScrollRegionGuard, KeyInfo, LogUpdateFn } from './terminal-compositor.types.js';
|
|
6
6
|
import type { KeyDispatchHost } from './terminal-compositor.input-dispatch.js';
|
|
7
|
+
import { type SuspendObserverHandle } from './terminal-compositor.lifecycle.suspend-observer.js';
|
|
7
8
|
export { endTurnFlush } from './terminal-compositor.lifecycle.teardown.js';
|
|
8
9
|
export interface LifecycleHost {
|
|
9
10
|
repaint(): void;
|
|
10
11
|
resetState(): void;
|
|
12
|
+
commitAbove(text: string): void;
|
|
11
13
|
readonly repaintCount: number;
|
|
12
14
|
readonly stdout: NodeJS.WriteStream;
|
|
13
15
|
readonly stdin: NodeJS.ReadStream;
|
|
14
16
|
armed: boolean;
|
|
15
17
|
suspended: boolean;
|
|
18
|
+
suspendCommitQueue: string[];
|
|
16
19
|
wasRaw: boolean;
|
|
17
20
|
stdinClaim: StdinClaimHandle | null;
|
|
18
21
|
handleKeypress: ((char: string | undefined, key: KeyInfo) => void) | null;
|
|
@@ -42,6 +45,8 @@ export interface LifecycleHost {
|
|
|
42
45
|
lastMeasuredFrameBottom: number;
|
|
43
46
|
lifecycleStateDirty: boolean;
|
|
44
47
|
clearCommittedBand(): void;
|
|
48
|
+
forgetCommittedBand(): void;
|
|
49
|
+
suspendObserver: SuspendObserverHandle | null;
|
|
45
50
|
}
|
|
46
51
|
export declare function suspendInput(self: LifecycleHost): void;
|
|
47
52
|
export declare function resumeInput(self: LifecycleHost): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface SuspendObserverState {
|
|
2
|
+
readonly cursorRow: number;
|
|
3
|
+
readonly scrollCount: number;
|
|
4
|
+
}
|
|
5
|
+
export interface SuspendObserverHandle {
|
|
6
|
+
remove(): SuspendObserverState;
|
|
7
|
+
}
|
|
8
|
+
export declare function installObserver(stream: NodeJS.WriteStream, startRow: number, terminalRows: number, terminalCols: number): SuspendObserverHandle;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const CSI_BUF_MAX = 64;
|
|
2
|
+
export interface ObserverState {
|
|
3
|
+
row: number;
|
|
4
|
+
col: number;
|
|
5
|
+
scrolls: number;
|
|
6
|
+
savedRow: number;
|
|
7
|
+
savedCol: number;
|
|
8
|
+
state: ObserverEscState;
|
|
9
|
+
csiBuf: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const enum ObserverEscState {
|
|
12
|
+
Normal = 0,
|
|
13
|
+
Esc = 1,
|
|
14
|
+
Csi = 2,
|
|
15
|
+
AltScreen = 3
|
|
16
|
+
}
|
|
17
|
+
export declare function parseParam(buf: string, start: number, def: number): [number, number];
|
|
18
|
+
export declare function advanceRow(st: ObserverState, getRows: () => number): void;
|
|
19
|
+
export declare function handleCsi(st: ObserverState, final: string, getRows: () => number, getCols: () => number): boolean;
|
|
20
|
+
export declare function processChunk(chunk: unknown, st: ObserverState, getRows: () => number, getCols: () => number): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { LifecycleHost } from './terminal-compositor.lifecycle.js';
|
|
2
2
|
export declare function endTurnFlush(self: LifecycleHost): void;
|
|
3
3
|
export declare function flushPendingCommittedBand(self: LifecycleHost): void;
|
|
4
|
+
export declare function appendLinesAtCursor(lines: readonly string[], cursorRow: number, self: LifecycleHost): void;
|
|
@@ -2,6 +2,7 @@ import { type InputCoreState } from './input-core.js';
|
|
|
2
2
|
import type { AutocompleteState } from './input/autocomplete-state.js';
|
|
3
3
|
import type { ImageAttachment } from './input/attachments.js';
|
|
4
4
|
import type { CompositorInputMode, FramePlacementMode, PickerController, SubmissionPayload } from './terminal-compositor.types.js';
|
|
5
|
+
import type { SuspendObserverHandle } from './terminal-compositor.lifecycle.suspend-observer.js';
|
|
5
6
|
export interface ResetStateHost {
|
|
6
7
|
clearCommittedBand(): void;
|
|
7
8
|
overlay: string;
|
|
@@ -41,5 +42,7 @@ export interface ResetStateHost {
|
|
|
41
42
|
resizeUnsub: (() => void) | null;
|
|
42
43
|
resizeImmediateUnsub: (() => void) | null;
|
|
43
44
|
disarmRows: number;
|
|
45
|
+
suspendCommitQueue: string[];
|
|
46
|
+
suspendObserver: SuspendObserverHandle | null;
|
|
44
47
|
}
|
|
45
48
|
export declare function resetState(self: ResetStateHost): void;
|