harborloop 0.3.0 → 0.4.0-rc.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/bin/checksums.json +12 -0
- package/bin/harbor.mjs +188 -0
- package/package.json +14 -30
- package/dist/api.d.ts +0 -109
- package/dist/api.js +0 -409
- package/dist/auth/login.d.ts +0 -14
- package/dist/auth/login.js +0 -158
- package/dist/auth/loopback.d.ts +0 -11
- package/dist/auth/loopback.js +0 -87
- package/dist/auth/pkce.d.ts +0 -7
- package/dist/auth/pkce.js +0 -14
- package/dist/auth/store.d.ts +0 -26
- package/dist/auth/store.js +0 -107
- package/dist/cli-release.d.ts +0 -31
- package/dist/cli-release.js +0 -102
- package/dist/commands/bind.d.ts +0 -23
- package/dist/commands/bind.js +0 -86
- package/dist/commands/context.d.ts +0 -12
- package/dist/commands/context.js +0 -80
- package/dist/commands/daemon.d.ts +0 -39
- package/dist/commands/daemon.js +0 -140
- package/dist/commands/doctor.d.ts +0 -16
- package/dist/commands/doctor.js +0 -937
- package/dist/commands/init.d.ts +0 -36
- package/dist/commands/init.js +0 -192
- package/dist/commands/status.d.ts +0 -5
- package/dist/commands/status.js +0 -164
- package/dist/commands/sync.d.ts +0 -40
- package/dist/commands/sync.js +0 -242
- package/dist/commands/toggle.d.ts +0 -16
- package/dist/commands/toggle.js +0 -69
- package/dist/commands/unbind.d.ts +0 -14
- package/dist/commands/unbind.js +0 -60
- package/dist/commands/workspaces.d.ts +0 -18
- package/dist/commands/workspaces.js +0 -41
- package/dist/context-budget.d.ts +0 -40
- package/dist/context-budget.js +0 -259
- package/dist/daemon/install.d.ts +0 -50
- package/dist/daemon/install.js +0 -192
- package/dist/daemon/loop.d.ts +0 -15
- package/dist/daemon/loop.js +0 -84
- package/dist/daemon/state.d.ts +0 -79
- package/dist/daemon/state.js +0 -213
- package/dist/daemon/tick.d.ts +0 -37
- package/dist/daemon/tick.js +0 -231
- package/dist/documents/apply.d.ts +0 -21
- package/dist/documents/apply.js +0 -58
- package/dist/documents/bundle.d.ts +0 -41
- package/dist/documents/bundle.js +0 -43
- package/dist/documents/inspect.d.ts +0 -12
- package/dist/documents/inspect.js +0 -33
- package/dist/documents/manifest.d.ts +0 -14
- package/dist/documents/manifest.js +0 -52
- package/dist/documents/pointer.d.ts +0 -32
- package/dist/documents/pointer.js +0 -135
- package/dist/documents/write.d.ts +0 -57
- package/dist/documents/write.js +0 -211
- package/dist/endpoints.d.ts +0 -7
- package/dist/endpoints.js +0 -15
- package/dist/env-bundle.d.ts +0 -25
- package/dist/env-bundle.js +0 -33
- package/dist/env-scan.d.ts +0 -27
- package/dist/env-scan.js +0 -41
- package/dist/env-sync.d.ts +0 -31
- package/dist/env-sync.js +0 -37
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -282
- package/dist/install-hooks.d.ts +0 -11
- package/dist/install-hooks.js +0 -64
- package/dist/lock.d.ts +0 -31
- package/dist/lock.js +0 -192
- package/dist/machine.d.ts +0 -13
- package/dist/machine.js +0 -53
- package/dist/memories.d.ts +0 -31
- package/dist/memories.js +0 -74
- package/dist/origin.d.ts +0 -4
- package/dist/origin.js +0 -59
- package/dist/paths.d.ts +0 -12
- package/dist/paths.js +0 -45
- package/dist/providers/claude.d.ts +0 -65
- package/dist/providers/claude.js +0 -412
- package/dist/providers/codex-trust.d.ts +0 -36
- package/dist/providers/codex-trust.js +0 -141
- package/dist/providers/codex.d.ts +0 -46
- package/dist/providers/codex.js +0 -520
- package/dist/providers/cursor.d.ts +0 -45
- package/dist/providers/cursor.js +0 -344
- package/dist/providers/detect.d.ts +0 -16
- package/dist/providers/detect.js +0 -70
- package/dist/providers/hook-coverage.d.ts +0 -5
- package/dist/providers/hook-coverage.js +0 -47
- package/dist/providers/hook-entry.d.ts +0 -1
- package/dist/providers/hook-entry.js +0 -8
- package/dist/providers/surfaces.d.ts +0 -19
- package/dist/providers/surfaces.js +0 -91
- package/dist/reclaim.d.ts +0 -17
- package/dist/reclaim.js +0 -33
- package/dist/render.d.ts +0 -17
- package/dist/render.js +0 -61
- package/dist/repo-sync.d.ts +0 -27
- package/dist/repo-sync.js +0 -34
- package/dist/repos.d.ts +0 -11
- package/dist/repos.js +0 -82
- package/dist/skills.d.ts +0 -84
- package/dist/skills.js +0 -383
- package/dist/slugify.d.ts +0 -1
- package/dist/slugify.js +0 -8
- package/dist/state.d.ts +0 -23
- package/dist/state.js +0 -161
- package/dist/sync-report.d.ts +0 -59
- package/dist/sync-report.js +0 -87
- package/hooks/_recall.mjs +0 -288
- package/hooks/_receipt.mjs +0 -47
- package/hooks/_shared.mjs +0 -1610
- package/hooks/_upgrade.mjs +0 -51
- package/hooks/session-capture.mjs +0 -60
- package/hooks/session-compact.mjs +0 -19
- package/hooks/session-context.mjs +0 -258
- package/hooks/session-report.mjs +0 -42
- package/hooks/session-toolcontext.mjs +0 -183
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export interface CodexHookMetadata {
|
|
2
|
-
readonly key: string;
|
|
3
|
-
readonly eventName: string;
|
|
4
|
-
readonly command: string | null;
|
|
5
|
-
readonly sourcePath: string;
|
|
6
|
-
readonly enabled: boolean;
|
|
7
|
-
readonly currentHash: string;
|
|
8
|
-
readonly trustStatus: 'managed' | 'untrusted' | 'trusted' | 'modified';
|
|
9
|
-
}
|
|
10
|
-
export interface CodexHooksListResult {
|
|
11
|
-
readonly hooks: readonly CodexHookMetadata[];
|
|
12
|
-
readonly warnings: readonly string[];
|
|
13
|
-
}
|
|
14
|
-
export interface CodexProbeHost {
|
|
15
|
-
readonly binary: string;
|
|
16
|
-
readonly env: NodeJS.ProcessEnv;
|
|
17
|
-
readonly client: {
|
|
18
|
-
readonly name: string;
|
|
19
|
-
readonly title: string;
|
|
20
|
-
readonly version: string;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export declare function listCodexHooks(opts: {
|
|
24
|
-
readonly cwd: string;
|
|
25
|
-
readonly home?: string;
|
|
26
|
-
readonly host?: CodexProbeHost;
|
|
27
|
-
}): Promise<CodexHooksListResult>;
|
|
28
|
-
export interface TrustResult {
|
|
29
|
-
readonly verified: number;
|
|
30
|
-
readonly skippedReason: string | null;
|
|
31
|
-
}
|
|
32
|
-
export declare function stampAndVerify(opts: {
|
|
33
|
-
readonly probeCwd: string;
|
|
34
|
-
readonly home?: string;
|
|
35
|
-
readonly host?: CodexProbeHost;
|
|
36
|
-
}): Promise<TrustResult>;
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
|
-
import { isOurHookCommand, resolveCodexPaths } from './codex.js';
|
|
3
|
-
const PROBE_TIMEOUT_MS = 15_000;
|
|
4
|
-
const cliHost = () => ({
|
|
5
|
-
binary: 'codex',
|
|
6
|
-
env: process.env,
|
|
7
|
-
client: { name: 'harbor-cli', title: 'harbor', version: '1.0.0' },
|
|
8
|
-
});
|
|
9
|
-
const asString = (v) => (typeof v === 'string' ? v : '');
|
|
10
|
-
function toHookMetadata(raw) {
|
|
11
|
-
if (raw === null || typeof raw !== 'object' || Array.isArray(raw))
|
|
12
|
-
return null;
|
|
13
|
-
const o = raw;
|
|
14
|
-
const key = asString(o.key);
|
|
15
|
-
if (key === '')
|
|
16
|
-
return null;
|
|
17
|
-
return {
|
|
18
|
-
key,
|
|
19
|
-
eventName: asString(o.eventName),
|
|
20
|
-
command: typeof o.command === 'string' ? o.command : null,
|
|
21
|
-
sourcePath: asString(o.sourcePath),
|
|
22
|
-
enabled: o.enabled === true,
|
|
23
|
-
currentHash: asString(o.currentHash),
|
|
24
|
-
trustStatus: asString(o.trustStatus),
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export async function listCodexHooks(opts) {
|
|
28
|
-
const host = opts.host ?? cliHost();
|
|
29
|
-
const env = { ...host.env };
|
|
30
|
-
if (opts.home !== undefined) {
|
|
31
|
-
env.CODEX_HOME = resolveCodexPaths(opts.home).codexDir;
|
|
32
|
-
}
|
|
33
|
-
return await new Promise((resolve, reject) => {
|
|
34
|
-
const child = spawn(host.binary, ['app-server'], {
|
|
35
|
-
cwd: opts.cwd,
|
|
36
|
-
env,
|
|
37
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
38
|
-
windowsHide: true,
|
|
39
|
-
});
|
|
40
|
-
let settled = false;
|
|
41
|
-
let buffer = '';
|
|
42
|
-
const finish = (fn) => {
|
|
43
|
-
if (settled)
|
|
44
|
-
return;
|
|
45
|
-
settled = true;
|
|
46
|
-
clearTimeout(timer);
|
|
47
|
-
try {
|
|
48
|
-
child.kill();
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
}
|
|
52
|
-
fn();
|
|
53
|
-
};
|
|
54
|
-
const timer = setTimeout(() => finish(() => reject(new Error('codex app-server timed out listing hooks'))), PROBE_TIMEOUT_MS);
|
|
55
|
-
child.on('error', (err) => finish(() => reject(err.code === 'ENOENT'
|
|
56
|
-
? new Error('no `codex` on PATH')
|
|
57
|
-
: err)));
|
|
58
|
-
child.on('exit', (code) => finish(() => reject(new Error(`codex app-server exited early (code ${code ?? 'null'})`))));
|
|
59
|
-
const send = (id, method, params) => {
|
|
60
|
-
child.stdin.write(`${JSON.stringify({ id, method, params })}\n`);
|
|
61
|
-
};
|
|
62
|
-
child.stdout.on('data', (chunk) => {
|
|
63
|
-
buffer += chunk.toString('utf8');
|
|
64
|
-
let newline = buffer.indexOf('\n');
|
|
65
|
-
while (newline >= 0) {
|
|
66
|
-
const line = buffer.slice(0, newline).trim();
|
|
67
|
-
buffer = buffer.slice(newline + 1);
|
|
68
|
-
newline = buffer.indexOf('\n');
|
|
69
|
-
if (line === '')
|
|
70
|
-
continue;
|
|
71
|
-
let msg;
|
|
72
|
-
try {
|
|
73
|
-
msg = JSON.parse(line);
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
if (msg.id === 1) {
|
|
79
|
-
child.stdin.write(`${JSON.stringify({ method: 'initialized', params: {} })}\n`);
|
|
80
|
-
send(2, 'hooks/list', { cwds: [opts.cwd] });
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
if (msg.id !== 2)
|
|
84
|
-
continue;
|
|
85
|
-
if (msg.error !== undefined) {
|
|
86
|
-
const detail = JSON.stringify(msg.error);
|
|
87
|
-
finish(() => reject(new Error(`codex hooks/list failed: ${detail}`)));
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
const result = msg.result;
|
|
91
|
-
const entries = Array.isArray(result?.data) ? result?.data : [];
|
|
92
|
-
const hooks = [];
|
|
93
|
-
const warnings = [];
|
|
94
|
-
for (const entry of entries) {
|
|
95
|
-
if (entry === null || typeof entry !== 'object')
|
|
96
|
-
continue;
|
|
97
|
-
const e = entry;
|
|
98
|
-
for (const h of Array.isArray(e.hooks) ? e.hooks : []) {
|
|
99
|
-
const parsed = toHookMetadata(h);
|
|
100
|
-
if (parsed !== null)
|
|
101
|
-
hooks.push(parsed);
|
|
102
|
-
}
|
|
103
|
-
for (const w of Array.isArray(e.warnings) ? e.warnings : []) {
|
|
104
|
-
if (typeof w === 'string')
|
|
105
|
-
warnings.push(w);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
finish(() => resolve({ hooks, warnings }));
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
send(1, 'initialize', {
|
|
113
|
-
clientInfo: host.client,
|
|
114
|
-
capabilities: { experimentalApi: true },
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
export async function stampAndVerify(opts) {
|
|
119
|
-
const { stampHookTrust, resolveCodexPaths: paths } = await import('./codex.js');
|
|
120
|
-
try {
|
|
121
|
-
const listed = await listCodexHooks({
|
|
122
|
-
cwd: opts.probeCwd,
|
|
123
|
-
home: opts.home,
|
|
124
|
-
host: opts.host,
|
|
125
|
-
});
|
|
126
|
-
const ours = listed.hooks.filter((h) => isOurHookCommand(h.command));
|
|
127
|
-
const identities = ours.map((h) => ({ key: h.key, currentHash: h.currentHash }));
|
|
128
|
-
const stampPath = ours[0]?.sourcePath ?? paths(opts.home).hooksJsonPath;
|
|
129
|
-
await stampHookTrust({ identities, hooksJsonPath: stampPath, home: opts.home });
|
|
130
|
-
const after = await listCodexHooks({
|
|
131
|
-
cwd: opts.probeCwd,
|
|
132
|
-
home: opts.home,
|
|
133
|
-
host: opts.host,
|
|
134
|
-
});
|
|
135
|
-
const verified = after.hooks.filter((h) => isOurHookCommand(h.command) && h.enabled && h.trustStatus === 'trusted').length;
|
|
136
|
-
return { verified, skippedReason: null };
|
|
137
|
-
}
|
|
138
|
-
catch (err) {
|
|
139
|
-
return { verified: 0, skippedReason: err.message };
|
|
140
|
-
}
|
|
141
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { type HookPaths } from './claude.js';
|
|
2
|
-
export declare const MANAGED_HOOK_EVENTS: readonly string[];
|
|
3
|
-
export interface CodexPaths {
|
|
4
|
-
readonly codexDir: string;
|
|
5
|
-
readonly configTomlPath: string;
|
|
6
|
-
readonly hooksJsonPath: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function resolveCodexPaths(home?: string): CodexPaths;
|
|
9
|
-
export declare function tomlString(value: string): string;
|
|
10
|
-
export declare function mergeMcpServer(existing: string, mcpUrl: string, token: string): string;
|
|
11
|
-
export declare function removeMcpServer(existing: string): string;
|
|
12
|
-
export declare function hasMcpServer(existing: string): boolean;
|
|
13
|
-
export declare function readInstalledToken(existing: string): string | null;
|
|
14
|
-
export declare function readInstalledMcpUrl(existing: string): string | null;
|
|
15
|
-
export interface CodexHookIdentity {
|
|
16
|
-
readonly key: string;
|
|
17
|
-
readonly currentHash: string;
|
|
18
|
-
}
|
|
19
|
-
export declare function mergeHookTrust(existing: string, hooksJsonPath: string, identities: readonly CodexHookIdentity[]): string;
|
|
20
|
-
export declare function removeHookTrust(existing: string, hooksJsonPath: string): string;
|
|
21
|
-
export declare function countHookTrustStamps(existing: string, hooksJsonPath: string): number;
|
|
22
|
-
export declare function isOurHookCommand(command: unknown): boolean;
|
|
23
|
-
export declare function mergeHooks(existing: string, paths: HookPaths): string;
|
|
24
|
-
export declare function removeHooks(existing: string): string;
|
|
25
|
-
export interface InstalledHooks {
|
|
26
|
-
readonly installed: boolean;
|
|
27
|
-
readonly commands: readonly string[];
|
|
28
|
-
readonly events: readonly string[];
|
|
29
|
-
}
|
|
30
|
-
export declare function readInstalledHooks(existing: string): InstalledHooks;
|
|
31
|
-
export declare function hasHooks(existing: string): boolean;
|
|
32
|
-
export declare function readCodexConfig(home?: string): Promise<string>;
|
|
33
|
-
export declare function readCodexHooksJson(home?: string): Promise<string>;
|
|
34
|
-
export declare function installMcpServer(opts: {
|
|
35
|
-
readonly mcpUrl: string;
|
|
36
|
-
readonly token: string;
|
|
37
|
-
readonly home?: string;
|
|
38
|
-
}): Promise<string>;
|
|
39
|
-
export declare function uninstallMcpServer(home?: string): Promise<string>;
|
|
40
|
-
export declare function installHooks(paths: HookPaths, home?: string): Promise<string>;
|
|
41
|
-
export declare function uninstallHooks(home?: string): Promise<string>;
|
|
42
|
-
export declare function stampHookTrust(opts: {
|
|
43
|
-
readonly identities: readonly CodexHookIdentity[];
|
|
44
|
-
readonly hooksJsonPath?: string;
|
|
45
|
-
readonly home?: string;
|
|
46
|
-
}): Promise<void>;
|