@agentconnect/host 0.2.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/host.d.ts +36 -0
- package/dist/host.js +920 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -0
- package/dist/observed.d.ts +7 -0
- package/dist/observed.js +69 -0
- package/dist/providers/claude.d.ts +12 -0
- package/dist/providers/claude.js +1188 -0
- package/dist/providers/codex.d.ts +11 -0
- package/dist/providers/codex.js +908 -0
- package/dist/providers/cursor.d.ts +11 -0
- package/dist/providers/cursor.js +866 -0
- package/dist/providers/index.d.ts +5 -0
- package/dist/providers/index.js +111 -0
- package/dist/providers/local.d.ts +9 -0
- package/dist/providers/local.js +114 -0
- package/dist/providers/utils.d.ts +33 -0
- package/dist/providers/utils.js +284 -0
- package/dist/types.d.ts +252 -0
- package/dist/types.js +1 -0
- package/package.json +43 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { createHostBridge, startDevHost } from './host.js';
|
|
2
|
+
export type { AgentConnectBridge, DevHostOptions, HostLogger, HostMode, HostOptions, } from './host.js';
|
|
3
|
+
export type { AppManifest, BackendState, CommandResult, CollectFilesOptions, FileEntry, FileStat, InstallResult, LineParser, ModelInfo, ObservedCapabilities, ObservedTracker, PackageManagerType, ProcessHandle, Provider, ProviderDetail, ProviderDetailLevel, ProviderId, ProviderInfo, ProviderLoginOptions, ProviderStatus, ReasoningEffort, RegistryApp, RegistryAppVersion, RegistryIndex, RegistryValidationResult, RpcError, RpcErrorCode, RpcId, RpcRequest, RpcResponse, RpcSuccess, SessionEvent, SessionState, SignatureData, ValidationError, ValidationWarning, } from './types.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createHostBridge, startDevHost } from './host.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ObservedTracker } from './types.js';
|
|
2
|
+
export interface ObservedTrackerOptions {
|
|
3
|
+
basePath: string;
|
|
4
|
+
appId: string;
|
|
5
|
+
requested?: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function createObservedTracker({ basePath, appId, requested, }: ObservedTrackerOptions): ObservedTracker;
|
package/dist/observed.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
export function createObservedTracker({ basePath, appId, requested = [], }) {
|
|
4
|
+
const requestedList = Array.isArray(requested) ? requested.filter(Boolean) : [];
|
|
5
|
+
const dirPath = path.join(basePath, '.agentconnect');
|
|
6
|
+
const filePath = path.join(dirPath, 'observed-capabilities.json');
|
|
7
|
+
const observed = new Set();
|
|
8
|
+
let writeTimer = null;
|
|
9
|
+
function load() {
|
|
10
|
+
if (!fs.existsSync(filePath))
|
|
11
|
+
return;
|
|
12
|
+
try {
|
|
13
|
+
const raw = fs.readFileSync(filePath, 'utf8');
|
|
14
|
+
const parsed = JSON.parse(raw);
|
|
15
|
+
if (Array.isArray(parsed?.observed)) {
|
|
16
|
+
for (const entry of parsed.observed) {
|
|
17
|
+
if (typeof entry === 'string' && entry)
|
|
18
|
+
observed.add(entry);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// ignore parse errors
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function snapshot() {
|
|
27
|
+
return {
|
|
28
|
+
appId,
|
|
29
|
+
requested: requestedList,
|
|
30
|
+
observed: Array.from(observed).sort(),
|
|
31
|
+
updatedAt: new Date().toISOString(),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function flush() {
|
|
35
|
+
if (writeTimer) {
|
|
36
|
+
clearTimeout(writeTimer);
|
|
37
|
+
writeTimer = null;
|
|
38
|
+
}
|
|
39
|
+
const payload = JSON.stringify(snapshot(), null, 2);
|
|
40
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
41
|
+
fs.writeFileSync(filePath, payload);
|
|
42
|
+
}
|
|
43
|
+
function scheduleFlush() {
|
|
44
|
+
if (writeTimer)
|
|
45
|
+
return;
|
|
46
|
+
writeTimer = setTimeout(() => {
|
|
47
|
+
flush();
|
|
48
|
+
}, 400);
|
|
49
|
+
}
|
|
50
|
+
function record(capability) {
|
|
51
|
+
const value = typeof capability === 'string' ? capability.trim() : '';
|
|
52
|
+
if (!value)
|
|
53
|
+
return;
|
|
54
|
+
if (observed.has(value))
|
|
55
|
+
return;
|
|
56
|
+
observed.add(value);
|
|
57
|
+
scheduleFlush();
|
|
58
|
+
}
|
|
59
|
+
function list() {
|
|
60
|
+
return Array.from(observed).sort();
|
|
61
|
+
}
|
|
62
|
+
load();
|
|
63
|
+
return {
|
|
64
|
+
record,
|
|
65
|
+
list,
|
|
66
|
+
snapshot,
|
|
67
|
+
flush,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ProviderStatus, RunPromptOptions, RunPromptResult, InstallResult, ProviderLoginOptions, ModelInfo } from '../types.js';
|
|
2
|
+
export declare function getClaudeCommand(): string;
|
|
3
|
+
export declare function listClaudeModels(): Promise<ModelInfo[]>;
|
|
4
|
+
export declare function listClaudeRecentModels(): Promise<ModelInfo[]>;
|
|
5
|
+
export declare function ensureClaudeInstalled(): Promise<InstallResult>;
|
|
6
|
+
export declare function getClaudeStatus(): Promise<ProviderStatus>;
|
|
7
|
+
export declare function getClaudeFastStatus(): Promise<ProviderStatus>;
|
|
8
|
+
export declare function updateClaude(): Promise<ProviderStatus>;
|
|
9
|
+
export declare function loginClaude(options?: ProviderLoginOptions): Promise<{
|
|
10
|
+
loggedIn: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function runClaudePrompt({ prompt, resumeSessionId, model, cwd, providerDetailLevel, onEvent, signal, }: RunPromptOptions): Promise<RunPromptResult>;
|