@anureo/adapter-claude 0.2.0 → 0.3.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 +107 -12
- package/package.json +23 -23
- package/src/adapter.d.ts +253 -0
- package/src/adapter.js +1328 -0
- package/src/catalog.d.ts +26 -0
- package/src/catalog.js +168 -0
- package/src/file-changes.d.ts +22 -0
- package/src/file-changes.js +124 -0
- package/src/index.d.ts +4 -0
- package/src/index.js +4 -0
- package/src/options.d.ts +47 -0
- package/src/options.js +0 -0
- package/src/output-schema.d.ts +17 -0
- package/src/output-schema.js +23 -0
- package/src/store.d.ts +71 -0
- package/src/store.js +223 -0
- package/src/turn-error.d.ts +11 -0
- package/src/turn-error.js +74 -0
- package/dist/catalog.d.ts +0 -8
- package/dist/catalog.js +0 -1087
- package/dist/file-changes.d.ts +0 -6
- package/dist/index.d.ts +0 -88
- package/dist/index.js +0 -1000
- package/dist/store.d.ts +0 -23
- package/dist/store.js +0 -141
package/dist/file-changes.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { FileChange, Item } from '@anureo/protocol';
|
|
2
|
-
/** Tool inputs prove fragments, never whole-file creation or fragment line positions. */
|
|
3
|
-
export declare function claudeFileChanges(name: string, input: unknown, result?: unknown): FileChange[] | undefined;
|
|
4
|
-
export declare function completeClaudeTool(previous: Extract<Item, {
|
|
5
|
-
type: 'toolCall';
|
|
6
|
-
}>, block: Record<string, unknown>): Item;
|
package/dist/index.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { query, getSessionMessages, getSessionInfo, forkSession, type Options, type Query, type SDKMessage, type SessionStore } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
-
import { type BackendSession, type HarnessAdapter, type SessionEventSink, type SessionMethod } from "@anureo/sdk";
|
|
3
|
-
import { type Capabilities, type AhpRequestMap, type AhpResultMap, type InitializeParams, type InitializeResult, type SessionBinding, type SessionOpenParams } from "@anureo/protocol";
|
|
4
|
-
import { FileSessionStore } from "./store.js";
|
|
5
|
-
export type ClaudeQuery = AsyncIterable<SDKMessage> & Pick<Query, "interrupt" | "setModel" | "setPermissionMode" | "setMaxThinkingTokens" | "applyFlagSettings" | "rewindFiles" | "supportedModels" | "close">;
|
|
6
|
-
export type ClaudeQueryFactory = (params: Parameters<typeof query>[0]) => ClaudeQuery;
|
|
7
|
-
export interface ClaudeAdapterOptions {
|
|
8
|
-
command?: string;
|
|
9
|
-
executable?: string;
|
|
10
|
-
args?: string[];
|
|
11
|
-
env?: Record<string, string | undefined>;
|
|
12
|
-
stateDir?: string;
|
|
13
|
-
/** Keep stateDir for adapter files only; do not export CLAUDE_CONFIG_DIR (the CLI's default home and its login are used). */
|
|
14
|
-
defaultHome?: boolean;
|
|
15
|
-
queryFactory?: ClaudeQueryFactory;
|
|
16
|
-
sessionStore?: SessionStore;
|
|
17
|
-
getSessionMessages?: typeof getSessionMessages;
|
|
18
|
-
getSessionInfo?: typeof getSessionInfo;
|
|
19
|
-
forkSession?: typeof forkSession;
|
|
20
|
-
enableFileCheckpointing?: boolean;
|
|
21
|
-
/** Script-based external executables can specify the interpreter; native binaries need none. */
|
|
22
|
-
executableRuntime?: "node" | "bun" | "deno";
|
|
23
|
-
}
|
|
24
|
-
export declare class ClaudeNativeAdapter implements HarnessAdapter {
|
|
25
|
-
readonly options: ClaudeAdapterOptions;
|
|
26
|
-
readonly sessionStore?: SessionStore;
|
|
27
|
-
private readonly defaultStore?;
|
|
28
|
-
private readonly sessions;
|
|
29
|
-
readonly turnMaps: Map<string, Record<string, string>>;
|
|
30
|
-
private disposed;
|
|
31
|
-
readonly env: Record<string, string | undefined>;
|
|
32
|
-
constructor(options?: ClaudeAdapterOptions);
|
|
33
|
-
get capabilities(): Capabilities;
|
|
34
|
-
initialize(params: InitializeParams): Promise<InitializeResult>;
|
|
35
|
-
openSession(params: SessionOpenParams, sink: SessionEventSink): Promise<BackendSession>;
|
|
36
|
-
listModels(cwd?: string): Promise<Awaited<ReturnType<Query["supportedModels"]>>>;
|
|
37
|
-
queryOptions(cwd: string): Options;
|
|
38
|
-
dispose(): Promise<void>;
|
|
39
|
-
}
|
|
40
|
-
export declare class ClaudeBackendSession implements BackendSession {
|
|
41
|
-
private readonly adapter;
|
|
42
|
-
private readonly params;
|
|
43
|
-
private readonly sink;
|
|
44
|
-
private readonly fileStore?;
|
|
45
|
-
binding: SessionBinding;
|
|
46
|
-
readonly capabilities: Capabilities;
|
|
47
|
-
private query?;
|
|
48
|
-
private input?;
|
|
49
|
-
private active?;
|
|
50
|
-
private generation;
|
|
51
|
-
private closed;
|
|
52
|
-
private config;
|
|
53
|
-
private capabilityRevision;
|
|
54
|
-
private model?;
|
|
55
|
-
private turns;
|
|
56
|
-
private historySnapshots;
|
|
57
|
-
/** Native fast-mode outcome as the CLI reports it (the setting may be on but not in effect). */
|
|
58
|
-
private fastMode?;
|
|
59
|
-
private storeKeys;
|
|
60
|
-
private sessionTitle?;
|
|
61
|
-
private metadataTail;
|
|
62
|
-
private metadataPending?;
|
|
63
|
-
/** Observe the public SDK store; title records themselves remain opaque. */
|
|
64
|
-
private observedStore;
|
|
65
|
-
private refreshMetadata;
|
|
66
|
-
constructor(adapter: ClaudeNativeAdapter, params: SessionOpenParams, sink: SessionEventSink, fileStore?: FileSessionStore | undefined);
|
|
67
|
-
private get nativeId();
|
|
68
|
-
open(): Promise<void>;
|
|
69
|
-
private hasHistory;
|
|
70
|
-
private trackFastMode;
|
|
71
|
-
private snapshot;
|
|
72
|
-
private startQuery;
|
|
73
|
-
private pump;
|
|
74
|
-
private mapMessage;
|
|
75
|
-
private streamEvent;
|
|
76
|
-
private blockItem;
|
|
77
|
-
private completeBlock;
|
|
78
|
-
private notice;
|
|
79
|
-
private permissionRequest;
|
|
80
|
-
private elicitationRequest;
|
|
81
|
-
private messages;
|
|
82
|
-
private boundaryPoint;
|
|
83
|
-
execute<M extends SessionMethod>(method: M, params: AhpRequestMap[M]): Promise<AhpResultMap[M]>;
|
|
84
|
-
private readHistory;
|
|
85
|
-
dispose(): Promise<void>;
|
|
86
|
-
}
|
|
87
|
-
export declare function createClaudeAdapter(options?: ClaudeAdapterOptions): ClaudeNativeAdapter;
|
|
88
|
-
export { FileSessionStore } from "./store.js";
|