agent-afk 5.202.1 → 5.203.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.
Files changed (36) hide show
  1. package/dist/agent/session/agent-session.d.ts +1 -0
  2. package/dist/agent/session-ledger-project.d.ts +103 -0
  3. package/dist/agent/session-ledger-reader.d.ts +8 -0
  4. package/dist/agent/session-ledger.d.ts +4 -63
  5. package/dist/agent/subagent/fork-types.d.ts +2 -1
  6. package/dist/agent/subagent.d.ts +3 -0
  7. package/dist/agent/types/session-types.d.ts +20 -0
  8. package/dist/cli.mjs +685 -685
  9. package/dist/index.mjs +229 -229
  10. package/dist/telegram.mjs +301 -301
  11. package/dist/web-server/frontend/app-approvals.d.ts +7 -0
  12. package/dist/web-server/frontend/app-views.d.ts +3 -0
  13. package/dist/web-server/frontend/at-file-panel.d.ts +5 -0
  14. package/dist/web-server/frontend/bg-jobs-panel.d.ts +14 -0
  15. package/dist/web-server/frontend/diff-viewer.d.ts +17 -0
  16. package/dist/web-server/frontend/ledger-adapter.d.ts +7 -2
  17. package/dist/web-server/frontend/memory-panel.d.ts +6 -0
  18. package/dist/web-server/frontend/model-selector.d.ts +10 -0
  19. package/dist/web-server/frontend/render-approvals.d.ts +22 -0
  20. package/dist/web-server/frontend/render-incremental.d.ts +1 -0
  21. package/dist/web-server/frontend/render.d.ts +3 -22
  22. package/dist/web-server/frontend/schedules-view.d.ts +1 -0
  23. package/dist/web-server/frontend/session-status.d.ts +11 -0
  24. package/dist/web-server/frontend/subagent-tree.d.ts +27 -0
  25. package/dist/web-server/frontend/thinking-panel.d.ts +3 -0
  26. package/dist/web-server/frontend/tool-trace-panel.d.ts +2 -0
  27. package/dist/web-server/frontend/view-model.d.ts +19 -1
  28. package/dist/web-server/routes.bg-jobs.d.ts +3 -0
  29. package/dist/web-server/routes.memory.d.ts +3 -0
  30. package/dist/web-server/routes.models.d.ts +6 -0
  31. package/dist/web-ui-assets/app.js +45 -45
  32. package/dist/web-ui-assets/approvals.css +3 -1
  33. package/dist/web-ui-assets/index.html +19 -10
  34. package/dist/web-ui-assets/schedules.css +2 -3
  35. package/dist/web-ui-assets/styles.css +263 -1
  36. package/package.json +1 -1
@@ -104,5 +104,6 @@ export declare class AgentSession implements IAgentSession {
104
104
  cacheReadTokens?: number;
105
105
  cacheCreationTokens?: number;
106
106
  }, costUsd?: number): void;
107
+ pushSidebandEvent(event: OutputEvent): void;
107
108
  private assertCanSend;
108
109
  }
@@ -0,0 +1,103 @@
1
+ import type { OutputEvent } from './types/session-types.js';
2
+ import type { ElicitationRequest, ElicitationResult } from './types/sdk-types.js';
3
+ export type LedgerRecord = {
4
+ v: 1;
5
+ ts: number;
6
+ } & LedgerPayload;
7
+ export type LedgerPayload = {
8
+ kind: 'meta';
9
+ sessionId: string;
10
+ model: string;
11
+ cwd?: string;
12
+ surface?: string;
13
+ traceLabel?: string | null;
14
+ } | {
15
+ kind: 'user';
16
+ text: string;
17
+ } | {
18
+ kind: 'assistant';
19
+ text: string;
20
+ } | {
21
+ kind: 'thinking';
22
+ text: string;
23
+ } | {
24
+ kind: 'tool';
25
+ toolName: string;
26
+ input: string;
27
+ } | {
28
+ kind: 'tool_error';
29
+ toolName?: string;
30
+ content: string;
31
+ } | {
32
+ kind: 'tool_result';
33
+ toolUseId: string;
34
+ content: string;
35
+ durationMs?: number;
36
+ toolName?: string;
37
+ } | {
38
+ kind: 'done';
39
+ costUsd?: number;
40
+ durationMs?: number;
41
+ inputTokens?: number;
42
+ outputTokens?: number;
43
+ cacheReadTokens?: number;
44
+ stopReason?: string;
45
+ } | {
46
+ kind: 'error';
47
+ message: string;
48
+ } | {
49
+ kind: 'paused';
50
+ resetsAt?: string;
51
+ } | {
52
+ kind: 'resumed';
53
+ } | {
54
+ kind: 'tool_activity';
55
+ activeCount: number;
56
+ activeToolUseIds: string[];
57
+ } | {
58
+ kind: 'rate_limit';
59
+ retryAfterMs?: number;
60
+ } | {
61
+ kind: 'progress';
62
+ message: string;
63
+ } | {
64
+ kind: 'subagent_lifecycle';
65
+ subagentId: string;
66
+ status: string;
67
+ model?: string;
68
+ agentType?: string;
69
+ durationMs?: number;
70
+ totalCostUsd?: number;
71
+ outputBytes?: number;
72
+ errorClass?: string;
73
+ errorMessage?: string;
74
+ promptHead?: string;
75
+ } | {
76
+ kind: 'background_job';
77
+ jobId: string;
78
+ status: string;
79
+ label?: string;
80
+ } | {
81
+ kind: 'plan_mode';
82
+ mode: string;
83
+ } | {
84
+ kind: 'elicitation';
85
+ reqId: string;
86
+ request: ElicitationRequest;
87
+ } | {
88
+ kind: 'elicitation_response';
89
+ reqId: string;
90
+ result: ElicitationResult;
91
+ hmac: string;
92
+ } | {
93
+ kind: 'abort_request';
94
+ nonce: string;
95
+ hmac: string;
96
+ } | {
97
+ kind: 'closed';
98
+ reason?: string;
99
+ };
100
+ export declare const MAX_TEXT_LEN = 8000;
101
+ export declare const MAX_TOOL_INPUT_LEN = 400;
102
+ export declare function clip(text: string, max: number): string;
103
+ export declare function projectOutputEvent(event: OutputEvent): LedgerPayload | null;
@@ -0,0 +1,8 @@
1
+ import type { LedgerRecord } from './session-ledger.js';
2
+ export declare function parseRecord(line: string): LedgerRecord | null;
3
+ export declare function ledgerExists(sessionId: string): Promise<boolean>;
4
+ export declare function readLedger(sessionId: string): AsyncGenerator<LedgerRecord>;
5
+ export declare function tailLedger(sessionId: string, opts?: {
6
+ fromStart?: boolean;
7
+ signal?: AbortSignal;
8
+ }): AsyncGenerator<LedgerRecord>;
@@ -1,60 +1,7 @@
1
1
  import type { OutputEvent } from './types/session-types.js';
2
- import type { ElicitationRequest, ElicitationResult } from './types/sdk-types.js';
3
- export type LedgerRecord = {
4
- v: 1;
5
- ts: number;
6
- } & LedgerPayload;
7
- export type LedgerPayload = {
8
- kind: 'meta';
9
- sessionId: string;
10
- model: string;
11
- cwd?: string;
12
- surface?: string;
13
- traceLabel?: string | null;
14
- } | {
15
- kind: 'user';
16
- text: string;
17
- } | {
18
- kind: 'assistant';
19
- text: string;
20
- } | {
21
- kind: 'tool';
22
- toolName: string;
23
- input: string;
24
- } | {
25
- kind: 'tool_error';
26
- toolName?: string;
27
- content: string;
28
- } | {
29
- kind: 'done';
30
- costUsd?: number;
31
- durationMs?: number;
32
- } | {
33
- kind: 'error';
34
- message: string;
35
- } | {
36
- kind: 'paused';
37
- resetsAt?: string;
38
- } | {
39
- kind: 'resumed';
40
- } | {
41
- kind: 'elicitation';
42
- reqId: string;
43
- request: ElicitationRequest;
44
- } | {
45
- kind: 'elicitation_response';
46
- reqId: string;
47
- result: ElicitationResult;
48
- hmac: string;
49
- } | {
50
- kind: 'abort_request';
51
- nonce: string;
52
- hmac: string;
53
- } | {
54
- kind: 'closed';
55
- reason?: string;
56
- };
57
- export declare function projectOutputEvent(event: OutputEvent): LedgerPayload | null;
2
+ export type { LedgerRecord, LedgerPayload } from './session-ledger-project.js';
3
+ export { projectOutputEvent } from './session-ledger-project.js';
4
+ export { ledgerExists, readLedger, tailLedger } from './session-ledger-reader.js';
58
5
  export declare class SessionLedgerWriter {
59
6
  private readonly sessionId;
60
7
  private readonly ledgerPath;
@@ -67,16 +14,10 @@ export declare class SessionLedgerWriter {
67
14
  private readyResolve;
68
15
  constructor(sessionId: string);
69
16
  get active(): boolean;
70
- record(payload: LedgerPayload): void;
17
+ record(payload: import('./session-ledger-project.js').LedgerPayload): void;
71
18
  recordEvent(event: OutputEvent): void;
72
19
  recordUser(text: string): void;
73
20
  private _openStream;
74
21
  private _writeLine;
75
22
  close(reason?: string): Promise<void>;
76
23
  }
77
- export declare function ledgerExists(sessionId: string): Promise<boolean>;
78
- export declare function readLedger(sessionId: string): AsyncGenerator<LedgerRecord>;
79
- export declare function tailLedger(sessionId: string, opts?: {
80
- fromStart?: boolean;
81
- signal?: AbortSignal;
82
- }): AsyncGenerator<LedgerRecord>;
@@ -3,7 +3,7 @@ import type { CanUseTool } from '../types/sdk-types.js';
3
3
  import type { WorkspaceStore } from '../workspace/workspace-store.js';
4
4
  import type { HookRegistry } from '../hooks.js';
5
5
  import type { AgentConfig, IAgentSession } from '../types.js';
6
- import type { SubagentProgressSink } from '../types/session-types.js';
6
+ import type { SubagentProgressSink, OutputEvent } from '../types/session-types.js';
7
7
  import type { TraceSink } from '../trace/index.js';
8
8
  import type { Surface } from '../awareness/types.js';
9
9
  import type { PhaseRole } from '../tools/nesting.js';
@@ -39,4 +39,5 @@ export interface SubagentManagerOptions {
39
39
  onSubagentSucceeded?: (usage: import('./result.js').SubagentTrace['usage'], costUsd: number | undefined) => void;
40
40
  workspaceStore?: WorkspaceStore;
41
41
  sessionLabel?: string;
42
+ outputEventSink?: (event: OutputEvent) => void;
42
43
  }
@@ -1,4 +1,5 @@
1
1
  import { type ChildAbortedListener } from './abort-graph.js';
2
+ import type { OutputEvent } from './types/session-types.js';
2
3
  import type { AbortOrigin, TraceSink } from './trace/index.js';
3
4
  import { type ReadScopeInputs } from './subagent-read-scope.js';
4
5
  import { type SubagentHandle } from './subagent/handle.js';
@@ -33,11 +34,13 @@ export declare class SubagentManager {
33
34
  private rootController;
34
35
  private counter;
35
36
  private onSubagentSucceededCb;
37
+ private outputEventSink;
36
38
  constructor(options?: SubagentManagerOptions);
37
39
  list(): Array<Pick<SubagentHandle, 'id' | 'status'>>;
38
40
  get(id: string): SubagentHandle | undefined;
39
41
  onChildAborted(listener: ChildAbortedListener): () => void;
40
42
  setOnSubagentSucceeded(cb: (usage: import('./subagent/result.js').SubagentTrace['usage'], costUsd: number | undefined) => void): void;
43
+ setOutputEventSink(sink: (event: OutputEvent) => void): void;
41
44
  setCwd(cwd: string): void;
42
45
  setTraceWriter(writer: TraceSink | undefined): void;
43
46
  getReadScopeInputs(): ReadScopeInputs;
@@ -86,6 +86,26 @@ export type OutputEvent = {
86
86
  type: 'resumed';
87
87
  hotSwapped: boolean;
88
88
  accountId?: string;
89
+ } | {
90
+ type: 'subagent_lifecycle';
91
+ subagentId: string;
92
+ status: 'started' | 'succeeded' | 'failed' | 'cancelled';
93
+ model?: string;
94
+ agentType?: string;
95
+ durationMs?: number;
96
+ totalCostUsd?: number;
97
+ outputBytes?: number;
98
+ errorClass?: string;
99
+ errorMessage?: string;
100
+ promptHead?: string;
101
+ } | {
102
+ type: 'background_job';
103
+ jobId: string;
104
+ status: 'started' | 'completed' | 'failed' | 'cancelled' | 'delivered';
105
+ label?: string;
106
+ } | {
107
+ type: 'plan_mode';
108
+ mode: 'plan' | 'implement' | 'default';
89
109
  };
90
110
  export interface ProgressEvent {
91
111
  taskId: string;