@arcanemachine/inter-agent-opencode 0.1.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/CHANGELOG.md +5 -0
- package/LICENSE.md +21 -0
- package/README.md +146 -0
- package/dist/client.d.ts +73 -0
- package/dist/client.js +409 -0
- package/dist/config.d.ts +47 -0
- package/dist/config.js +349 -0
- package/dist/errors.d.ts +35 -0
- package/dist/errors.js +95 -0
- package/dist/inbox.d.ts +31 -0
- package/dist/inbox.js +94 -0
- package/dist/protocol.d.ts +132 -0
- package/dist/protocol.js +255 -0
- package/dist/server.d.ts +49 -0
- package/dist/server.js +231 -0
- package/dist/state.d.ts +91 -0
- package/dist/state.js +1306 -0
- package/dist/tui.d.ts +115 -0
- package/dist/tui.js +996 -0
- package/package.json +40 -0
package/dist/state.d.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export declare const LEASE_VERSION = 1;
|
|
2
|
+
export declare const LEASE_REFRESH_INTERVAL_MS = 10000;
|
|
3
|
+
export declare const LEASE_EXPIRY_ALLOWANCE_MS = 30000;
|
|
4
|
+
export declare const PREFERENCES_VERSION = 1;
|
|
5
|
+
export declare const OPENCODE_STATE_DIRNAME = "opencode";
|
|
6
|
+
export type JsonObject = Record<string, unknown>;
|
|
7
|
+
export type ConnectionLease = {
|
|
8
|
+
version: 1;
|
|
9
|
+
workspacePath: string;
|
|
10
|
+
workspaceHash: string;
|
|
11
|
+
openCodeSessionID: string;
|
|
12
|
+
sessionHash: string;
|
|
13
|
+
ownerToken: string;
|
|
14
|
+
name: string;
|
|
15
|
+
label: string | null;
|
|
16
|
+
host: string;
|
|
17
|
+
port: number;
|
|
18
|
+
tls: boolean;
|
|
19
|
+
connectedAt: string;
|
|
20
|
+
heartbeatAt: string;
|
|
21
|
+
expiresAt: string;
|
|
22
|
+
};
|
|
23
|
+
export type SessionPreferences = {
|
|
24
|
+
version: 1;
|
|
25
|
+
workspacePath: string;
|
|
26
|
+
workspaceHash: string;
|
|
27
|
+
openCodeSessionID: string;
|
|
28
|
+
sessionHash: string;
|
|
29
|
+
name: string | null;
|
|
30
|
+
label: string | null;
|
|
31
|
+
autoConnect: boolean;
|
|
32
|
+
};
|
|
33
|
+
export type LeaseCheck = "fresh" | "expired" | "missing" | "malformed" | "unsupportedVersion" | "workspaceMismatch" | "sessionMismatch";
|
|
34
|
+
export type LeaseClaimInput = {
|
|
35
|
+
workspacePath: string;
|
|
36
|
+
workspaceHash: string;
|
|
37
|
+
openCodeSessionID: string;
|
|
38
|
+
sessionHash: string;
|
|
39
|
+
name: string;
|
|
40
|
+
label: string | null;
|
|
41
|
+
host: string;
|
|
42
|
+
port: number;
|
|
43
|
+
tls: boolean;
|
|
44
|
+
};
|
|
45
|
+
export type LeaseFileRead = {
|
|
46
|
+
present: boolean;
|
|
47
|
+
record?: JsonObject;
|
|
48
|
+
};
|
|
49
|
+
export type LeaseResolution = {
|
|
50
|
+
workspacePath: string;
|
|
51
|
+
workspaceHash: string;
|
|
52
|
+
sessionHash: string;
|
|
53
|
+
present: boolean;
|
|
54
|
+
lease?: ConnectionLease;
|
|
55
|
+
check: LeaseCheck;
|
|
56
|
+
};
|
|
57
|
+
export declare function isRecord(value: unknown): value is JsonObject;
|
|
58
|
+
export declare function hashScope(value: string): string;
|
|
59
|
+
export declare function workspaceKey(canonicalWorkspacePath: string): string;
|
|
60
|
+
export declare function sessionKey(openCodeSessionID: string): string;
|
|
61
|
+
export declare function canonicalWorkspacePath(workspacePath: string): string;
|
|
62
|
+
export declare function generateOwnerToken(): string;
|
|
63
|
+
export declare function assertScopeHashes(workspaceHash: string, sessionHash: string): void;
|
|
64
|
+
export declare function sessionDir(dataDir: string, workspaceHash: string, sessionHash: string): string;
|
|
65
|
+
export declare function ensureSessionDir(dataDir: string, workspaceHash: string, sessionHash: string): string;
|
|
66
|
+
export declare function ensurePrivateDir(dir: string): void;
|
|
67
|
+
export declare function readJsonFile(path: string): JsonObject;
|
|
68
|
+
export declare function stageJsonWrite(path: string, value: JsonObject): string;
|
|
69
|
+
export declare function commitJsonWrite(tempPath: string, path: string): void;
|
|
70
|
+
export declare function writeJsonAtomic(path: string, value: JsonObject): void;
|
|
71
|
+
type LeaseScopeExpectation = {
|
|
72
|
+
workspaceHash: string;
|
|
73
|
+
sessionHash: string;
|
|
74
|
+
workspacePath?: string;
|
|
75
|
+
openCodeSessionID?: string;
|
|
76
|
+
};
|
|
77
|
+
export declare function checkLease(lease: unknown, expected: LeaseScopeExpectation, now?: number): LeaseCheck;
|
|
78
|
+
export declare function readLeaseFile(dataDir: string, workspaceHash: string, sessionHash: string): LeaseFileRead;
|
|
79
|
+
export declare function claimLease(dataDir: string, input: LeaseClaimInput, now?: number): ConnectionLease;
|
|
80
|
+
export declare function refreshLease(dataDir: string, workspaceHash: string, sessionHash: string, ownerToken: string, now?: number): ConnectionLease;
|
|
81
|
+
export declare function releaseLease(dataDir: string, workspaceHash: string, sessionHash: string, ownerToken: string, now?: number): void;
|
|
82
|
+
export declare function resolveLease(dataDir: string, input: {
|
|
83
|
+
workspacePath: string;
|
|
84
|
+
openCodeSessionID: string;
|
|
85
|
+
}, now?: number): LeaseResolution;
|
|
86
|
+
export declare function readPreferences(dataDir: string, workspaceHash: string, sessionHash: string, identity?: {
|
|
87
|
+
workspacePath: string;
|
|
88
|
+
openCodeSessionID: string;
|
|
89
|
+
}): SessionPreferences | undefined;
|
|
90
|
+
export declare function writePreferences(dataDir: string, workspaceHash: string, sessionHash: string, preferences: SessionPreferences): void;
|
|
91
|
+
export {};
|