@adecore/agents 0.23.0 → 0.24.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/README.md +3 -3
- package/dist/chat/attachment-store.js +4 -5
- package/dist/chat/backend.d.ts +6 -1
- package/dist/chat/background-work.d.ts +1 -1
- package/dist/chat/background-work.js +2 -1
- package/dist/chat/chat-core.d.ts +53 -161
- package/dist/chat/chat-core.js +146 -112
- package/dist/chat/chat-log.js +3 -3
- package/dist/chat/chat-process.d.ts +21 -0
- package/dist/chat/chat-process.js +109 -9
- package/dist/chat/chat-session.d.ts +10 -17
- package/dist/chat/chat-session.js +141 -182
- package/dist/chat/chat-store.d.ts +1 -0
- package/dist/chat/chat-store.js +105 -1
- package/dist/chat/claude-backend.d.ts +4 -0
- package/dist/chat/claude-backend.js +51 -27
- package/dist/chat/claude-protocol.d.ts +12 -0
- package/dist/chat/claude-protocol.js +137 -7
- package/dist/chat/claude-title.d.ts +1 -3
- package/dist/chat/claude-title.js +11 -39
- package/dist/chat/claude-transcript.d.ts +1 -0
- package/dist/chat/claude-transcript.js +36 -17
- package/dist/chat/codex-backend.d.ts +21 -1
- package/dist/chat/codex-backend.js +168 -10
- package/dist/chat/codex-protocol.d.ts +2 -0
- package/dist/chat/codex-protocol.js +37 -3
- package/dist/chat/codex-thread.js +1 -3
- package/dist/chat/codex-transport.d.ts +3 -0
- package/dist/chat/codex-transport.js +38 -35
- package/dist/chat/context-breakdown.js +2 -2
- package/dist/chat/errors.d.ts +1 -1
- package/dist/chat/external-sessions.js +2 -2
- package/dist/chat/fixtures/claude-2.1.296-goal.json +136 -0
- package/dist/chat/fixtures/claude-projects/-work-demo/5f1c2a9e-0b7d-4c1e-9a53-3e2f8d6b7a10.jsonl +2 -0
- package/dist/chat/index.d.ts +29 -0
- package/dist/chat/index.js +23 -0
- package/dist/chat/projector.d.ts +2 -1
- package/dist/chat/projector.js +12 -3
- package/dist/chat/request-summary.js +1 -4
- package/dist/chat/subagent-settlement.js +1 -3
- package/dist/chat/thread.d.ts +3 -0
- package/dist/chat/thread.js +20 -3
- package/dist/chat/ui-queries.d.ts +2 -0
- package/dist/chat/ui-queries.js +40 -5
- package/dist/chat/ui-replies.d.ts +33 -0
- package/dist/chat/ui-replies.js +152 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.js +3 -0
- package/dist/coordination/index.d.ts +15 -0
- package/dist/coordination/index.js +16 -0
- package/dist/host/handlers.js +8 -0
- package/dist/host/index.d.ts +7 -0
- package/dist/host/index.js +7 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +10 -0
- package/dist/providers/accounts/status.js +1 -3
- package/dist/providers/claude.js +3 -1
- package/dist/providers/codex.js +3 -1
- package/dist/providers/index.d.ts +14 -0
- package/dist/providers/index.js +12 -0
- package/dist/run-process.js +54 -14
- package/dist/skills.d.ts +1 -0
- package/dist/skills.js +4 -0
- package/dist/tasks/task-coordinator.d.ts +4 -0
- package/dist/tasks/task-coordinator.js +16 -2
- package/dist/tasks/wiring.js +7 -1
- package/dist/{providers/accounts/test-accounts.d.ts → testing/accounts.d.ts} +2 -2
- package/dist/{providers/accounts/test-accounts.js → testing/accounts.js} +3 -3
- package/dist/testing/bin/fake-claude.d.ts +1 -0
- package/dist/testing/bin/fake-claude.js +6 -0
- package/dist/testing/bin/fake-codex.d.ts +1 -0
- package/dist/testing/bin/fake-codex.js +6 -0
- package/dist/{chat → testing}/fake-claude.d.ts +1 -1
- package/dist/{chat → testing}/fake-claude.js +0 -4
- package/dist/{chat → testing}/fake-cli.d.ts +1 -1
- package/dist/{chat → testing}/fake-codex.d.ts +1 -1
- package/dist/{chat → testing}/fake-codex.js +70 -8
- package/dist/testing/index.d.ts +6 -0
- package/dist/testing/index.js +7 -0
- package/dist/{outbox → testing}/manual-clock.d.ts +1 -1
- package/dist/{watch-test-helpers.d.ts → testing/watch.d.ts} +1 -1
- package/dist/usage/exchange.d.ts +5 -3
- package/dist/usage/exchange.js +25 -16
- package/dist/usage/index-file.d.ts +1 -0
- package/dist/usage/index-file.js +20 -2
- package/dist/usage/index.d.ts +9 -0
- package/dist/usage/index.js +6 -0
- package/dist/usage/limits/normalize.js +1 -3
- package/dist/usage/pricing.d.ts +5 -3
- package/dist/usage/pricing.js +28 -19
- package/dist/usage/scanner.js +39 -11
- package/dist/usage/usage-service.js +8 -3
- package/package.json +72 -11
- package/src/chat/attachment-store.ts +4 -6
- package/src/chat/backend.ts +8 -0
- package/src/chat/background-work.ts +2 -2
- package/src/chat/chat-core.ts +221 -143
- package/src/chat/chat-log.ts +3 -3
- package/src/chat/chat-process.ts +128 -8
- package/src/chat/chat-session.ts +153 -204
- package/src/chat/chat-store.ts +104 -1
- package/src/chat/claude-backend.ts +58 -26
- package/src/chat/claude-protocol.ts +147 -8
- package/src/chat/claude-title.ts +11 -39
- package/src/chat/claude-transcript.ts +38 -18
- package/src/chat/codex-backend.ts +182 -20
- package/src/chat/codex-protocol.ts +40 -5
- package/src/chat/codex-thread.ts +1 -4
- package/src/chat/codex-transport.ts +45 -35
- package/src/chat/context-breakdown.ts +2 -2
- package/src/chat/errors.ts +1 -0
- package/src/chat/external-sessions.ts +2 -2
- package/src/chat/fixtures/claude-2.1.296-goal.json +136 -0
- package/src/chat/fixtures/claude-projects/-work-demo/5f1c2a9e-0b7d-4c1e-9a53-3e2f8d6b7a10.jsonl +2 -0
- package/src/chat/index.ts +49 -0
- package/src/chat/projector.ts +13 -4
- package/src/chat/request-summary.ts +8 -5
- package/src/chat/subagent-settlement.ts +1 -4
- package/src/chat/thread.ts +22 -3
- package/src/chat/ui-queries.ts +46 -5
- package/src/chat/ui-replies.ts +187 -0
- package/src/context/index.ts +26 -0
- package/src/coordination/index.ts +67 -0
- package/src/host/handlers.ts +8 -0
- package/src/host/index.ts +8 -0
- package/src/index.ts +20 -0
- package/src/providers/accounts/status.ts +1 -4
- package/src/providers/claude.ts +3 -1
- package/src/providers/codex.ts +3 -1
- package/src/providers/index.ts +15 -0
- package/src/run-process.ts +56 -16
- package/src/skills.ts +5 -0
- package/src/tasks/task-coordinator.ts +22 -2
- package/src/tasks/wiring.ts +7 -1
- package/src/{providers/accounts/test-accounts.ts → testing/accounts.ts} +4 -4
- package/src/testing/bin/fake-claude.ts +7 -0
- package/src/testing/bin/fake-codex.ts +7 -0
- package/src/{chat → testing}/fake-claude.ts +1 -5
- package/src/{chat → testing}/fake-cli.ts +1 -1
- package/src/{chat → testing}/fake-codex.ts +75 -6
- package/src/testing/index.ts +7 -0
- package/src/{outbox → testing}/manual-clock.ts +1 -1
- package/src/{watch-test-helpers.ts → testing/watch.ts} +1 -1
- package/src/usage/exchange.ts +31 -20
- package/src/usage/index-file.ts +23 -2
- package/src/usage/index.ts +10 -0
- package/src/usage/limits/normalize.ts +1 -4
- package/src/usage/pricing.ts +34 -23
- package/src/usage/scanner.ts +48 -11
- package/src/usage/usage-service.ts +8 -3
- /package/dist/{chat → testing}/fake-cli.js +0 -0
- /package/dist/{outbox → testing}/manual-clock.js +0 -0
- /package/dist/{watch-test-helpers.js → testing/watch.js} +0 -0
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ The package brings no CLI: install Claude Code or Codex and sign in with it.
|
|
|
16
16
|
## Use
|
|
17
17
|
|
|
18
18
|
```ts
|
|
19
|
-
import { AgentHost } from '@adecore/agents/host
|
|
19
|
+
import { AgentHost } from '@adecore/agents/host';
|
|
20
20
|
|
|
21
21
|
const host = await AgentHost.open({ dataDir });
|
|
22
22
|
const disconnect = host.connect(port);
|
|
@@ -26,7 +26,7 @@ disconnect();
|
|
|
26
26
|
await host.close();
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
The root holds the file, process and error helpers; `/host`, `/chat`, `/providers`, `/usage`, `/coordination`, `/context` and `/testing` hold the rest. A module that no entry exports is internal. A new chat runs in `full-access` unless it names a runtime mode, so name one.
|
|
30
30
|
|
|
31
31
|
## Documentation
|
|
32
32
|
|
|
@@ -41,7 +41,7 @@ Every module has its own subpath, `@adecore/agents/<path>`; there is no root imp
|
|
|
41
41
|
| [Context commands](https://adecore.dev/agents/context-commands) | A command line your agents call back into |
|
|
42
42
|
| [Storage](https://adecore.dev/agents/storage) | What is written where, and the file helpers |
|
|
43
43
|
| [Testing](https://adecore.dev/agents/testing) | The fakes and the error codes |
|
|
44
|
-
| [
|
|
44
|
+
| [Exports](https://adecore.dev/agents/reference) | Every entry point and its exports |
|
|
45
45
|
|
|
46
46
|
## License
|
|
47
47
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash, randomBytes } from 'node:crypto';
|
|
2
2
|
import { link, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { extname, join } from 'node:path';
|
|
4
|
-
import { attachmentImageMime } from '@adecore/agent-contracts';
|
|
4
|
+
import { isRecord, attachmentImageMime } from '@adecore/agent-contracts';
|
|
5
5
|
// The extension the file gets on disk when its name does not carry a usable one.
|
|
6
6
|
const EXTENSIONS = {
|
|
7
7
|
'image/png': 'png',
|
|
@@ -92,12 +92,11 @@ export class AttachmentStore {
|
|
|
92
92
|
}
|
|
93
93
|
/* Where the files of one chat are; a store that keeps more of a chat's files beside them writes them here. */
|
|
94
94
|
folderOf(chatId) {
|
|
95
|
-
|
|
95
|
+
// `encodeURIComponent` leaves `.` and `..` as they are, and those would name this folder or the host's own.
|
|
96
|
+
const segment = chatId === '.' || chatId === '..' ? chatId.replaceAll('.', '%2E') : encodeURIComponent(chatId);
|
|
97
|
+
return join(this.dir, segment);
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
|
-
function isRecord(value) {
|
|
99
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
100
|
-
}
|
|
101
100
|
// What an attachment looked like before the files moved out of the thread: the bytes inline.
|
|
102
101
|
function isInline(value) {
|
|
103
102
|
return isRecord(value) && typeof value.name === 'string' && typeof value.mediaType === 'string' && typeof value.data === 'string';
|
package/dist/chat/backend.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChatAttachment, ChatAttachmentUpload, ChatFileChange, ChatQuestion, ChatSkill, ChatSubagentUsage, ChatTurnLimit, ChatWorkflow, ModelSelection, RuntimeMode } from '@adecore/agent-contracts';
|
|
1
|
+
import type { ChatAttachment, ChatAttachmentUpload, ChatFileChange, ChatGoal, ChatGoalAction, ChatQuestion, ChatSkill, ChatSubagentUsage, ChatTurnLimit, ChatWorkflow, ModelSelection, RuntimeMode } from '@adecore/agent-contracts';
|
|
2
2
|
import type { LimitsUpdate } from '../usage/limits/normalize.ts';
|
|
3
3
|
import type { SpawnChatProcess } from './chat-process.ts';
|
|
4
4
|
export interface BackendLaunch {
|
|
@@ -12,6 +12,7 @@ export interface BackendLaunch {
|
|
|
12
12
|
generation: number;
|
|
13
13
|
instructions: string | null;
|
|
14
14
|
resumeNote: string | null;
|
|
15
|
+
goal?: ChatGoal;
|
|
15
16
|
folders?: readonly string[];
|
|
16
17
|
spawn?: SpawnChatProcess;
|
|
17
18
|
saveGeneratedImage?(ref: string, upload: ChatAttachmentUpload): Promise<ChatAttachment>;
|
|
@@ -169,6 +170,9 @@ export type BackendEvent = {
|
|
|
169
170
|
} | {
|
|
170
171
|
type: 'compaction';
|
|
171
172
|
preTokens: number | null;
|
|
173
|
+
} | {
|
|
174
|
+
type: 'goal';
|
|
175
|
+
goal: ChatGoal | null;
|
|
172
176
|
} | {
|
|
173
177
|
type: 'model';
|
|
174
178
|
model: string;
|
|
@@ -214,6 +218,7 @@ export interface ChatBackend {
|
|
|
214
218
|
interrupt(): void;
|
|
215
219
|
respondApproval(requestId: string, decision: ApprovalDecision, message?: string): boolean;
|
|
216
220
|
respondQuestion(requestId: string, answers: Record<string, string>): boolean;
|
|
221
|
+
goal?(action: ChatGoalAction): Promise<void>;
|
|
217
222
|
stopTask?(taskId: string): void;
|
|
218
223
|
declineRequest?(requestId: string, message: string): boolean;
|
|
219
224
|
dismissRequest?(requestId: string): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AgentKind, type ChatBackgroundTask, type ChatItem, type ChatSubagentItem, type ChatToolItem } from '@adecore/agent-contracts';
|
|
2
2
|
export type BackgroundWork = ChatSubagentItem | ChatToolItem;
|
|
3
3
|
export declare function isBackgroundWork(item: ChatItem): item is BackgroundWork;
|
|
4
4
|
export declare function runsInBackground(item: BackgroundWork): boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HOST_TASK_ORIGIN } from '@adecore/agent-contracts';
|
|
1
2
|
/*
|
|
2
3
|
* Work a chat's CLI goes on with after the turn that started it ended: a subagent it runs in the
|
|
3
4
|
* background (Claude's `run_in_background`, every agent Codex spawns) and a Claude workflow, whose call
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
* work it delegated itself (origin `ruimte` on the wire) is that work's own.
|
|
7
8
|
*/
|
|
8
9
|
export function isBackgroundWork(item) {
|
|
9
|
-
return (item.kind === 'subagent' && item.background && item.origin !==
|
|
10
|
+
return (item.kind === 'subagent' && item.background && item.origin !== HOST_TASK_ORIGIN) || (item.kind === 'tool' && item.name === 'Workflow');
|
|
10
11
|
}
|
|
11
12
|
export function runsInBackground(item) {
|
|
12
13
|
return item.kind === 'subagent' ? item.status === 'running' : item.state === 'running';
|
package/dist/chat/chat-core.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type AgentKind, type ChatAttachment, type ChatAttachResult, type ChatAttachmentUpload, type ChatBookmark, type ChatCheckpointDiff, type ChatConfigurePayload, type ChatCreatePayload, type ChatEvent, type ChatHistoryResult, type ChatInfo, type ChatItem, type ChatQueuedMessage, type ChatUiChoicePayload, type ChatUiQueryPayload, type ChatUiLinkPayload, type ChatSkill, type ChatSubagentPayload, type ChatSubagentResult, type ChatTurnItem, type ChatVisual, type ModelSelection, type RuntimeMode } from '@adecore/agent-contracts';
|
|
2
|
-
import { ClientSinks } from '../client-sinks.ts';
|
|
1
|
+
import { type AgentKind, type ChatAttachment, type ChatAttachResult, type ChatAttachmentUpload, type ChatBookmark, type ChatCheckpointDiff, type ChatConfigurePayload, type ChatCreatePayload, type ChatEvent, type ChatHistoryResult, type ChatGoalAction, type ChatInfo, type ChatItem, type ChatQueuedMessage, type ChatUiChoicePayload, type ChatUiQueryPayload, type ChatUiLinkPayload, type ChatSkill, type ChatSubagentPayload, type ChatSubagentResult, type ChatTurnItem, type ChatVisual, type ModelSelection, type RuntimeMode } from '@adecore/agent-contracts';
|
|
3
2
|
import type { AgentEvent, AgentSink } from '../events.ts';
|
|
4
3
|
import type { OutboxOutcome } from '../outbox/outbox-worker.ts';
|
|
5
4
|
import { type AccountLaunches } from '../providers/accounts/launch.ts';
|
|
@@ -16,8 +15,7 @@ import type { ChatTitleInput } from './chat-title.ts';
|
|
|
16
15
|
import type { CodexProcessSpec } from './codex-thread.ts';
|
|
17
16
|
import type { CodexClientInfo } from './codex-transport.ts';
|
|
18
17
|
import { ComposerPreferences } from './composer-preferences.ts';
|
|
19
|
-
import {
|
|
20
|
-
import { SubagentReader, type SubagentReaderOptions } from './subagent-reader.ts';
|
|
18
|
+
import { type SubagentReaderOptions } from './subagent-reader.ts';
|
|
21
19
|
import { type ChatUiHost } from './ui-queries.ts';
|
|
22
20
|
import type { VisualInput, VisualStore } from './visual-store.ts';
|
|
23
21
|
export interface InterruptedRun {
|
|
@@ -25,6 +23,31 @@ export interface InterruptedRun {
|
|
|
25
23
|
turnId: string;
|
|
26
24
|
attempt: number;
|
|
27
25
|
}
|
|
26
|
+
export interface ChatCoreHooks {
|
|
27
|
+
admit?(chatId: string, cwd: string): Promise<void>;
|
|
28
|
+
openingSelection?(chatId: string, kind: AgentKind): ModelSelection | undefined;
|
|
29
|
+
runtimeModeFor?(chatId: string, mode: RuntimeMode): RuntimeMode;
|
|
30
|
+
instructionsFor?(chatId: string): string | null;
|
|
31
|
+
resumeNoteFor?(chatId: string): string | null;
|
|
32
|
+
foldersFor?(chatId: string): readonly string[];
|
|
33
|
+
hiddenFor?(chatId: string): boolean;
|
|
34
|
+
promptNotesFor?(chatId: string): PromptNotes | undefined;
|
|
35
|
+
referencesFor?(chatId: string): ChatReferences | undefined;
|
|
36
|
+
envFor?(chatId: string, base: Record<string, string>): Record<string, string | undefined>;
|
|
37
|
+
opened?(session: ChatSession, stored: ChatRecord | null): Promise<void>;
|
|
38
|
+
recordExtras?(chatId: string): ChatRecordExtras;
|
|
39
|
+
clearing?(chatId: string): Promise<void>;
|
|
40
|
+
cleared?(chatId: string): Promise<void>;
|
|
41
|
+
forgotten?(chatId: string): void;
|
|
42
|
+
removed?(chatId: string, chat: {
|
|
43
|
+
info: ChatInfo;
|
|
44
|
+
items: ChatItem[];
|
|
45
|
+
}): Promise<void>;
|
|
46
|
+
broadcasted?(chatId: string, event: ChatEvent): void;
|
|
47
|
+
endedAt?(chatId: string): number | null;
|
|
48
|
+
unownedReason?(chatId: string): string;
|
|
49
|
+
resumeWords?(chatId: string): Promise<ResumeWords>;
|
|
50
|
+
}
|
|
28
51
|
export interface ChatCoreOptions {
|
|
29
52
|
intelligentUi?: ChatUiHost;
|
|
30
53
|
uiFenceLanguage?: string;
|
|
@@ -43,7 +66,7 @@ export interface ChatCoreOptions {
|
|
|
43
66
|
visuals?: VisualStore;
|
|
44
67
|
onLimits?: (update: LimitsUpdate) => void;
|
|
45
68
|
claudeTitles?: {
|
|
46
|
-
forSession(agentSessionId: string, projectsDir: string): Promise<string | null>;
|
|
69
|
+
forSession(agentSessionId: string, projectsDir: string, cwd: string): Promise<string | null>;
|
|
47
70
|
};
|
|
48
71
|
nameChat?: (provider: AgentKind, input: ChatTitleInput) => Promise<string | null>;
|
|
49
72
|
subagents?: Partial<Pick<SubagentReaderOptions, 'claudeProjectsDir' | 'seams' | 'now' | 'listOnce'>>;
|
|
@@ -56,141 +79,24 @@ export interface ChatCoreOptions {
|
|
|
56
79
|
owed(chatId: string): boolean;
|
|
57
80
|
};
|
|
58
81
|
accounts?: AccountLaunches;
|
|
82
|
+
hooks?: ChatCoreHooks;
|
|
59
83
|
}
|
|
60
84
|
export declare class ChatCore {
|
|
61
|
-
protected readonly providers: ProviderRegistry;
|
|
62
|
-
protected readonly store: ChatStore | null;
|
|
63
85
|
protected readonly bookmarks: BookmarkStore | null;
|
|
64
86
|
protected readonly visuals: VisualStore | null;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
options: Record<string, string | boolean>;
|
|
79
|
-
};
|
|
80
|
-
runtimeMode: "auto" | "auto-accept-edits" | "full-access" | "supervised";
|
|
81
|
-
effectiveRuntimeMode?: "auto" | "auto-accept-edits" | "full-access" | "supervised" | undefined;
|
|
82
|
-
permissionMode?: string | undefined;
|
|
83
|
-
status: "error" | "exited" | "idle" | "needs-you" | "running";
|
|
84
|
-
running: boolean;
|
|
85
|
-
activeTurnId: string | null;
|
|
86
|
-
slashCommands: string[];
|
|
87
|
-
skills?: string[] | undefined;
|
|
88
|
-
queue?: {
|
|
89
|
-
id: string;
|
|
90
|
-
turnId?: string | undefined;
|
|
91
|
-
text: string;
|
|
92
|
-
mentions?: string[] | undefined;
|
|
93
|
-
skills?: string[] | undefined;
|
|
94
|
-
chats?: string[] | undefined;
|
|
95
|
-
attachments?: {
|
|
96
|
-
id: string;
|
|
97
|
-
name: string;
|
|
98
|
-
mime: string;
|
|
99
|
-
size: number;
|
|
100
|
-
path: string;
|
|
101
|
-
width?: number | undefined;
|
|
102
|
-
height?: number | undefined;
|
|
103
|
-
}[] | undefined;
|
|
104
|
-
createdAt: number;
|
|
105
|
-
uiChoice?: {
|
|
106
|
-
itemId: string;
|
|
107
|
-
blockId: string;
|
|
108
|
-
revision: string;
|
|
109
|
-
choiceId: string;
|
|
110
|
-
label: string;
|
|
111
|
-
sourceAt: number;
|
|
112
|
-
older: boolean;
|
|
113
|
-
values?: Record<string, unknown> | undefined;
|
|
114
|
-
at: number;
|
|
115
|
-
} | undefined;
|
|
116
|
-
quoteSource?: {
|
|
117
|
-
itemId: string;
|
|
118
|
-
} | undefined;
|
|
119
|
-
}[] | undefined;
|
|
120
|
-
queuePaused?: boolean | undefined;
|
|
121
|
-
background?: {
|
|
122
|
-
id: string;
|
|
123
|
-
kind: "monitor" | "shell";
|
|
124
|
-
description: string;
|
|
125
|
-
command: string | null;
|
|
126
|
-
startedAt: number;
|
|
127
|
-
}[] | undefined;
|
|
128
|
-
delegating?: boolean | undefined;
|
|
129
|
-
usage: {
|
|
130
|
-
contextTokens: number;
|
|
131
|
-
contextWindow: number | null;
|
|
132
|
-
costUsd: number;
|
|
133
|
-
turns: number;
|
|
134
|
-
breakdown?: {
|
|
135
|
-
toolOutput: number;
|
|
136
|
-
filesRead: number;
|
|
137
|
-
conversation: number;
|
|
138
|
-
system: number;
|
|
139
|
-
} | undefined;
|
|
140
|
-
};
|
|
141
|
-
suggestedTitle?: string | undefined;
|
|
142
|
-
hidden?: boolean | undefined;
|
|
143
|
-
forkOf?: {
|
|
144
|
-
chatId: string;
|
|
145
|
-
turnId: string;
|
|
146
|
-
at: number;
|
|
147
|
-
} | undefined;
|
|
148
|
-
resumeAtReset?: boolean | undefined;
|
|
149
|
-
limit?: {
|
|
150
|
-
kind: "overload" | "usage";
|
|
151
|
-
resetsAt?: number | undefined;
|
|
152
|
-
} | undefined;
|
|
153
|
-
resumeAt?: number | undefined;
|
|
154
|
-
requests?: {
|
|
155
|
-
requestId: string;
|
|
156
|
-
itemId: string;
|
|
157
|
-
kind: "approval" | "question";
|
|
158
|
-
createdAt: number;
|
|
159
|
-
approval?: {
|
|
160
|
-
toolName: string;
|
|
161
|
-
subject: string;
|
|
162
|
-
description: string | null;
|
|
163
|
-
path?: string | undefined;
|
|
164
|
-
files?: number | undefined;
|
|
165
|
-
diff?: string | undefined;
|
|
166
|
-
command?: string | undefined;
|
|
167
|
-
truncated?: boolean | undefined;
|
|
168
|
-
canAllowAlways: boolean;
|
|
169
|
-
allowAlways?: {
|
|
170
|
-
label: string;
|
|
171
|
-
description: string;
|
|
172
|
-
} | undefined;
|
|
173
|
-
} | undefined;
|
|
174
|
-
question?: {
|
|
175
|
-
questions: {
|
|
176
|
-
id: string;
|
|
177
|
-
header: string;
|
|
178
|
-
question: string;
|
|
179
|
-
choices: {
|
|
180
|
-
label: string;
|
|
181
|
-
description: string;
|
|
182
|
-
}[];
|
|
183
|
-
multiSelect: boolean;
|
|
184
|
-
}[];
|
|
185
|
-
async?: boolean | undefined;
|
|
186
|
-
} | undefined;
|
|
187
|
-
}[] | undefined;
|
|
188
|
-
createdAt: number;
|
|
189
|
-
}>>;
|
|
190
|
-
protected readonly sinks: ClientSinks<AgentEvent>;
|
|
191
|
-
protected readonly attached: Map<string, Set<string>>;
|
|
192
|
-
protected readonly coalescers: Map<string, DeltaCoalescer>;
|
|
193
|
-
protected readonly subagents: SubagentReader;
|
|
87
|
+
private readonly providers;
|
|
88
|
+
private readonly store;
|
|
89
|
+
private readonly accounts;
|
|
90
|
+
private readonly attachments;
|
|
91
|
+
private readonly env;
|
|
92
|
+
private readonly hooks;
|
|
93
|
+
private readonly chats;
|
|
94
|
+
private readonly creating;
|
|
95
|
+
private readonly sinks;
|
|
96
|
+
private readonly attached;
|
|
97
|
+
private readonly listChanges;
|
|
98
|
+
private readonly coalescers;
|
|
99
|
+
private readonly subagents;
|
|
194
100
|
readonly claudeProjectsDir: string;
|
|
195
101
|
readonly composerPreferences: ComposerPreferences;
|
|
196
102
|
private readonly uiQueries;
|
|
@@ -231,12 +137,14 @@ export declare class ChatCore {
|
|
|
231
137
|
};
|
|
232
138
|
observe(sink: AgentSink): () => void;
|
|
233
139
|
subscribe(clientId: string, sink: AgentSink): () => void;
|
|
140
|
+
sendTo(clientId: string, event: AgentEvent): void;
|
|
234
141
|
create(payload: ChatCreatePayload): Promise<ChatInfo>;
|
|
235
142
|
private createNow;
|
|
236
143
|
storedBackground(chatId: string): Promise<{
|
|
237
144
|
turnId: string | null;
|
|
238
145
|
items: BackgroundWork[];
|
|
239
146
|
commands: string[];
|
|
147
|
+
goal: boolean;
|
|
240
148
|
}>;
|
|
241
149
|
save(chatId: string): Promise<void>;
|
|
242
150
|
isLoading(chatId: string): boolean;
|
|
@@ -244,6 +152,7 @@ export declare class ChatCore {
|
|
|
244
152
|
protected switchAccount(session: ChatSession, requested: string): void;
|
|
245
153
|
attach(chatId: string, clientId: string, historyLimit?: number, since?: number): ChatAttachResult;
|
|
246
154
|
attachWithBookmarks(chatId: string, clientId: string, historyLimit?: number, since?: number): Promise<ChatAttachResult>;
|
|
155
|
+
private listChanged;
|
|
247
156
|
addBookmark(chatId: string, itemId: string, name?: string): Promise<ChatBookmark[]>;
|
|
248
157
|
renameBookmark(chatId: string, itemId: string, name: string): Promise<ChatBookmark[]>;
|
|
249
158
|
removeBookmark(chatId: string, itemId: string): Promise<ChatBookmark[]>;
|
|
@@ -252,14 +161,17 @@ export declare class ChatCore {
|
|
|
252
161
|
listVisuals(chatId: string): Promise<ChatVisual[]>;
|
|
253
162
|
removeVisual(chatId: string, visualId: string): Promise<ChatVisual[]>;
|
|
254
163
|
private requireVisuals;
|
|
255
|
-
history(chatId: string, cursor
|
|
164
|
+
history(chatId: string, cursor?: string, limit?: number): ChatHistoryResult;
|
|
256
165
|
detach(chatId: string, clientId: string): void;
|
|
257
166
|
detachAll(clientId: string): void;
|
|
258
167
|
subagent(clientId: string, payload: ChatSubagentPayload): Promise<ChatSubagentResult>;
|
|
259
168
|
stopSubagent(chatId: string, toolUseId: string): Promise<void>;
|
|
260
169
|
stopTask(chatId: string, taskId: string): Promise<void>;
|
|
170
|
+
goal(chatId: string, action: ChatGoalAction): Promise<void>;
|
|
261
171
|
subagentItems(chatId: string, toolUseId: string): Promise<ChatItem[]>;
|
|
262
172
|
hasStored(chatId: string): Promise<boolean>;
|
|
173
|
+
writeRecord(chatId: string, info: ChatInfo, items: ChatItem[], preambles?: string[]): Promise<void>;
|
|
174
|
+
deleteRecord(chatId: string): Promise<boolean>;
|
|
263
175
|
lastTurn(chatId: string): Promise<ChatTurnItem | null>;
|
|
264
176
|
addNote(chatId: string, level: 'info' | 'warning' | 'error', text: string): Promise<void>;
|
|
265
177
|
deliverNote(chatId: string, delivery: {
|
|
@@ -314,6 +226,7 @@ export declare class ChatCore {
|
|
|
314
226
|
unqueue(chatId: string, messageId: string): ChatQueuedMessage;
|
|
315
227
|
sendNow(chatId: string, messageId: string): void;
|
|
316
228
|
skills(chatId: string): Promise<ChatSkill[]>;
|
|
229
|
+
restart(chatId: string): Promise<void>;
|
|
317
230
|
compact(chatId: string): void;
|
|
318
231
|
clear(chatId: string, force?: boolean): Promise<void>;
|
|
319
232
|
cancel(chatId: string, subagents?: boolean): void;
|
|
@@ -321,6 +234,8 @@ export declare class ChatCore {
|
|
|
321
234
|
approve(chatId: string, requestId: string, decision: 'allow' | 'allow-always' | 'deny', message?: string): void;
|
|
322
235
|
answer(chatId: string, requestId: string, answers: Record<string, string>): void;
|
|
323
236
|
dismiss(chatId: string, itemId: string): void;
|
|
237
|
+
holdForPerson(chatId: string, key: string): boolean;
|
|
238
|
+
releaseHold(chatId: string, key: string): void;
|
|
324
239
|
kill(chatId: string): Promise<void>;
|
|
325
240
|
stop(chatId: string, reason: string): Promise<void>;
|
|
326
241
|
processTargets(): {
|
|
@@ -341,31 +256,8 @@ export declare class ChatCore {
|
|
|
341
256
|
persistAllSync(): void;
|
|
342
257
|
persisted(chatId: string): Promise<void>;
|
|
343
258
|
protected loaded(chatId: string): Promise<void>;
|
|
344
|
-
protected persist(chatId: string): void;
|
|
345
259
|
protected require(chatId: string): ChatSession;
|
|
346
|
-
|
|
347
|
-
protected resumeNoteFor(_chatId: string): string | null;
|
|
348
|
-
protected foldersFor(_chatId: string): readonly string[];
|
|
349
|
-
protected hiddenFor(_chatId: string): boolean;
|
|
350
|
-
protected promptNotesFor(_chatId: string): PromptNotes | undefined;
|
|
351
|
-
protected referencesFor(_chatId: string): ChatReferences | undefined;
|
|
352
|
-
protected envFor(_chatId: string, base: Record<string, string>): Record<string, string | undefined>;
|
|
353
|
-
protected admit(_chatId: string, _cwd: string): Promise<void>;
|
|
354
|
-
protected openingSelection(_chatId: string, _kind: AgentKind): ModelSelection | undefined;
|
|
355
|
-
protected runtimeModeFor(_chatId: string, mode: RuntimeMode): RuntimeMode;
|
|
356
|
-
protected opened(_session: ChatSession, _stored: ChatRecord | null): Promise<void>;
|
|
357
|
-
protected recordExtras(_chatId: string): ChatRecordExtras;
|
|
358
|
-
protected cleared(_chatId: string): Promise<void>;
|
|
359
|
-
protected clearing(_chatId: string): Promise<void>;
|
|
360
|
-
protected forgotten(_chatId: string): void;
|
|
361
|
-
protected removed(_chatId: string, _chat: {
|
|
362
|
-
info: ChatInfo;
|
|
363
|
-
items: ChatItem[];
|
|
364
|
-
}): Promise<void>;
|
|
365
|
-
protected broadcasted(_chatId: string, _event: ChatEvent): void;
|
|
366
|
-
protected endedAt(_chatId: string): number | null;
|
|
367
|
-
protected unownedReason(_chatId: string): string;
|
|
368
|
-
protected resumeWords(_chatId: string): Promise<ResumeWords>;
|
|
260
|
+
private persist;
|
|
369
261
|
private persistSoon;
|
|
370
262
|
private cancelWaiting;
|
|
371
263
|
private persistNow;
|