harborai 0.5.3 → 0.5.6

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.
@@ -1,4 +1,3 @@
1
1
  import type { Hono } from 'hono';
2
- export declare function cleanupStaleAgentfsSessions(): void;
3
2
  export declare function registerExecRoute(app: Hono): void;
4
3
  //# sourceMappingURL=exec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAgFjC,wBAAgB,2BAA2B,IAAI,IAAI,CAiBlD;AA4FD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CA2KjD"}
1
+ {"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAmEjC,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAwIjD"}
@@ -1,23 +1,17 @@
1
- import { execSync, spawn } from 'node:child_process';
2
- import { existsSync, readdirSync, rmSync, statSync } from 'node:fs';
1
+ import { execSync } from 'node:child_process';
3
2
  import { homedir } from 'node:os';
4
3
  import { join } from 'node:path';
5
- import { loadProfile, orbitalUrl } from './config.js';
4
+ import { orbitalUrl, loadProfile } from './config.js';
6
5
  import { log } from './log.js';
7
6
  import { onRunStop } from './presence.js';
8
- const CONTROL_KILL_GRACE_MS = 3000;
7
+ import { runSandboxedPlugin } from './sandbox.js';
9
8
  // cwd → git remote cache (daemon is long-lived, resolve once per directory)
10
9
  const gitRemoteCache = new Map();
11
10
  function resolveGitRemote(cwd) {
12
11
  if (gitRemoteCache.has(cwd))
13
12
  return gitRemoteCache.get(cwd);
14
13
  try {
15
- const remote = execSync('git remote get-url origin', {
16
- cwd,
17
- encoding: 'utf8',
18
- timeout: 2000,
19
- stdio: ['ignore', 'pipe', 'ignore'],
20
- }).trim() || null;
14
+ const remote = execSync('git remote get-url origin', { cwd, encoding: 'utf8', timeout: 2000, stdio: ['ignore', 'pipe', 'ignore'] }).trim() || null;
21
15
  gitRemoteCache.set(cwd, remote);
22
16
  return remote;
23
17
  }
@@ -39,8 +33,7 @@ function buildPluginEnv(envPrefix, orbitalEnv) {
39
33
  TERM: process.env['TERM'] ?? 'xterm-256color',
40
34
  };
41
35
  }
42
- const pluginEnvEntries = Object.entries(orbitalEnv).filter(([key]) => key.startsWith(envPrefix));
43
- log('info', 'daemon', 'using orbital env', { keys: pluginEnvEntries.map(([k]) => k) });
36
+ log('info', 'daemon', 'using orbital env', { keys: Object.keys(orbitalEnv) });
44
37
  return {
45
38
  PATH: process.env['PATH'] ?? '',
46
39
  HOME: process.env['HOME'] ?? '',
@@ -49,54 +42,9 @@ function buildPluginEnv(envPrefix, orbitalEnv) {
49
42
  TMPDIR: process.env['TMPDIR'] ?? '/tmp',
50
43
  LANG: process.env['LANG'] ?? 'en_US.UTF-8',
51
44
  TERM: process.env['TERM'] ?? 'xterm-256color',
52
- ...Object.fromEntries(pluginEnvEntries),
45
+ ...orbitalEnv,
53
46
  };
54
47
  }
55
- function killProcessGroup(pid, signal) {
56
- if (!pid)
57
- return;
58
- try {
59
- process.kill(-pid, signal);
60
- }
61
- catch {
62
- try {
63
- process.kill(pid, signal);
64
- }
65
- catch { }
66
- }
67
- }
68
- function stripAgentfsBanner(raw) {
69
- let s = raw;
70
- s = s.replace(/Welcome to AgentFS![\s\S]*?read-only\.\s*\n/i, '');
71
- s = s.replace(/To join this session[\s\S]*?agentfs run --session\s+\S+\s+<command>\s*\n?/g, '');
72
- s = s.replace(/^Delta layer saved to:.*\n?/gm, '');
73
- s = s.replace(/^To see what changed:.*\n?/gm, '');
74
- s = s.replace(/^\s*agentfs diff .*\n?/gm, '');
75
- s = s.replace(/\n{3,}/g, '\n\n');
76
- return s.trim();
77
- }
78
- export function cleanupStaleAgentfsSessions() {
79
- const runDir = join(homedir(), '.agentfs', 'run');
80
- if (!existsSync(runDir))
81
- return;
82
- const oneHourAgo = Date.now() - 60 * 60 * 1000;
83
- let cleaned = 0;
84
- for (const entry of readdirSync(runDir)) {
85
- if (!entry.startsWith('harbor-'))
86
- continue;
87
- const entryPath = join(runDir, entry);
88
- try {
89
- const stat = statSync(entryPath);
90
- if (stat.isDirectory() && stat.mtimeMs < oneHourAgo) {
91
- rmSync(entryPath, { recursive: true, force: true });
92
- cleaned++;
93
- }
94
- }
95
- catch { }
96
- }
97
- if (cleaned > 0)
98
- log('info', 'daemon', 'cleaned stale agentfs sessions', { count: cleaned });
99
- }
100
48
  function applyEnvMap(env, envMap) {
101
49
  if (!envMap)
102
50
  return env;
@@ -112,65 +60,7 @@ function resolveAllowPaths(paths) {
112
60
  if (!paths || paths.length === 0)
113
61
  return [];
114
62
  const home = process.env['HOME'] ?? homedir();
115
- return paths.map((p) => (p.startsWith('~/') ? join(home, p.slice(2)) : p));
116
- }
117
- function runAgentfsPlugin(options) {
118
- const sessionName = `harbor-${options.profile}-${options.runId.slice(0, 8)}`;
119
- const extraAllows = resolveAllowPaths(options.allowPaths);
120
- const allowArgs = [options.cwd, ...extraAllows].flatMap((p) => ['--allow', p]);
121
- return new Promise((resolve, reject) => {
122
- const child = spawn('agentfs', ['run', '--session', sessionName, ...allowArgs, '--', options.binary, ...options.argv], {
123
- cwd: options.cwd,
124
- env: applyEnvMap(buildPluginEnv(options.envPrefix, options.env), options.envMap),
125
- detached: true,
126
- });
127
- let stdout = '';
128
- let stderr = '';
129
- let settled = false;
130
- let stoppedByControl = false;
131
- let killTimer = null;
132
- const unsubscribe = onRunStop(options.runId, (reason) => {
133
- if (stoppedByControl || child.killed)
134
- return;
135
- stoppedByControl = true;
136
- stderr += `\n[harbor] stop requested by orbital: ${reason}\n`;
137
- killProcessGroup(child.pid, 'SIGTERM');
138
- killTimer = setTimeout(() => {
139
- killProcessGroup(child.pid, 'SIGKILL');
140
- }, CONTROL_KILL_GRACE_MS);
141
- });
142
- const clearAll = () => {
143
- unsubscribe();
144
- if (killTimer)
145
- clearTimeout(killTimer);
146
- };
147
- child.stdout.on('data', (chunk) => {
148
- stdout += chunk.toString();
149
- });
150
- child.stderr.on('data', (chunk) => {
151
- stderr += chunk.toString();
152
- });
153
- child.on('error', (error) => {
154
- if (settled)
155
- return;
156
- settled = true;
157
- clearAll();
158
- reject(error);
159
- });
160
- child.on('close', (code) => {
161
- if (settled)
162
- return;
163
- settled = true;
164
- clearAll();
165
- try {
166
- const sessionDir = join(homedir(), '.agentfs', 'run', sessionName);
167
- rmSync(sessionDir, { recursive: true, force: true });
168
- log('info', 'daemon', 'cleaned up agentfs session', { session: sessionName });
169
- }
170
- catch { }
171
- resolve({ code: code ?? 1, stdout, stderr: stripAgentfsBanner(stderr), stoppedByControl });
172
- });
173
- });
63
+ return paths.map(p => p.startsWith('~/') ? join(home, p.slice(2)) : p);
174
64
  }
175
65
  export function registerExecRoute(app) {
176
66
  app.post('/exec', async (c) => {
@@ -197,28 +87,15 @@ export function registerExecRoute(app) {
197
87
  const createRes = await fetch(`${orbitalUrl}/api/runs`, {
198
88
  method: 'POST',
199
89
  headers: { 'content-type': 'application/json', authorization: `Bearer ${profile.daemonToken}` },
200
- body: JSON.stringify({
201
- plugin: body.plugin,
202
- input: {
203
- argv: body.argv,
204
- cwd: body.cwd,
205
- profile: body.profile,
206
- origin: body.origin,
207
- gitRemote: resolveGitRemote(body.cwd),
208
- },
209
- }),
90
+ body: JSON.stringify({ plugin: body.plugin, input: { argv: body.argv, cwd: body.cwd, profile: body.profile, origin: body.origin, gitRemote: resolveGitRemote(body.cwd) } }),
210
91
  });
211
92
  if (!createRes.ok) {
212
93
  return c.json({ error: 'create_failed', details: await createRes.text() }, 502);
213
94
  }
214
- const created = (await createRes.json());
95
+ const created = await createRes.json();
215
96
  // API plugins complete inline on orbital — no daemon execution needed
216
97
  if (created.completed) {
217
- return c.json({
218
- body: created.error ?? created.result?.body ?? '',
219
- status: created.result?.status ?? 200,
220
- runId: created.runId,
221
- });
98
+ return c.json({ body: created.error ?? created.result?.body ?? '', status: created.result?.status ?? 200, runId: created.runId });
222
99
  }
223
100
  if (!created.assignment) {
224
101
  return c.json({ error: 'no_assignment', details: 'Run created but no assignment returned' }, 502);
@@ -248,29 +125,19 @@ export function registerExecRoute(app) {
248
125
  await fetch(`${orbitalUrl}/api/runs/${created.runId}/complete`, {
249
126
  method: 'POST',
250
127
  headers: { 'content-type': 'application/json', authorization: `Bearer ${profile.daemonToken}` },
251
- body: JSON.stringify({
252
- status: 'failed',
253
- output: '',
254
- error: stderr,
255
- exitCode: 127,
256
- durationMs: 0,
257
- envKeys: [],
258
- }),
128
+ body: JSON.stringify({ status: 'failed', output: '', error: stderr, exitCode: 127, durationMs: 0, envKeys: [] }),
259
129
  });
260
130
  return c.json({ ok: false, runId: created.runId, status: 'failed', stdout: '', stderr, stoppedByControl: false }, 500);
261
131
  }
262
132
  const startTime = Date.now();
263
- const result = await runAgentfsPlugin({
133
+ const result = await runSandboxedPlugin({
264
134
  binary,
265
- envPrefix,
266
- cwd: created.assignment.cwd,
267
- profile: created.assignment.profile,
268
135
  argv: created.assignment.argv,
136
+ cwd: created.assignment.cwd,
137
+ env: applyEnvMap(buildPluginEnv(envPrefix, created.assignment.env), created.assignment.envMap),
138
+ allowPaths: resolveAllowPaths(created.assignment.sandbox?.allowPaths),
269
139
  runId: created.runId,
270
- daemonToken: profile.daemonToken,
271
- env: created.assignment.env,
272
- allowPaths: created.assignment.sandbox?.allowPaths,
273
- envMap: created.assignment.envMap,
140
+ onStop: (cb) => onRunStop(created.runId, cb),
274
141
  });
275
142
  const status = result.code === 0 && !result.stoppedByControl ? 'completed' : 'failed';
276
143
  const error = result.stoppedByControl
@@ -286,7 +153,7 @@ export function registerExecRoute(app) {
286
153
  error,
287
154
  exitCode: result.code,
288
155
  durationMs: Date.now() - startTime,
289
- envKeys: Object.keys(orbitalEnv).filter((k) => k.startsWith(envPrefix)),
156
+ envKeys: Object.keys(orbitalEnv).filter(k => k.startsWith(envPrefix)),
290
157
  }),
291
158
  });
292
159
  return c.json({
@@ -1 +1 @@
1
- {"version":3,"file":"exec.js","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,4EAA4E;AAC5E,MAAM,cAAc,GAAG,IAAI,GAAG,EAAyB,CAAC;AAExD,SAAS,gBAAgB,CAAC,GAAW;IACpC,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO,cAAc,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC;IAC7D,IAAI,CAAC;QACJ,MAAM,MAAM,GACX,QAAQ,CAAC,2BAA2B,EAAE;YACrC,GAAG;YACH,QAAQ,EAAE,MAAM;YAChB,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SACnC,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;QACnB,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAChC,OAAO,MAAM,CAAC;IACf,CAAC;IAAC,MAAM,CAAC;QACR,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,C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M;gBACrB,KAAK;gBACL,QAAQ,EAAE,MAAM,CAAC,IAAI;gBACrB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;gBAClC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;aACtE,CAAC;SACH,CAAC,CAAC;QAEH,OAAO,CAAC,CAAC,IAAI,CAAC;YACZ,EAAE,EAAE,MAAM,KAAK,WAAW;YAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM;YACN,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,MAAM,EAAE,KAAK,IAAI,EAAE;YACnB,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;SAC1C,EAAE,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -6,7 +6,8 @@ import { dirname } from 'node:path';
6
6
  import { SOCKET_PATH, IDLE_TIMEOUT_MS, TCP_PORT_START, loadAllProfiles } from './config.js';
7
7
  import { log } from './log.js';
8
8
  import { writeLockfile, cleanup, checkExistingDaemon, tryTcpFallback } from './ipc.js';
9
- import { registerExecRoute, cleanupStaleAgentfsSessions } from './exec.js';
9
+ import { registerExecRoute } from './exec.js';
10
+ import { initSandbox } from './sandbox.js';
10
11
  import { connectPresenceWs, refreshTokensIfNeeded } from './presence.js';
11
12
  const app = new Hono();
12
13
  const daemonSecret = crypto.randomUUID();
@@ -44,7 +45,7 @@ if (checkExistingDaemon()) {
44
45
  log('error', 'daemon', 'another instance is already running');
45
46
  process.exit(1);
46
47
  }
47
- cleanupStaleAgentfsSessions();
48
+ await initSandbox();
48
49
  // Clean up stale socket file
49
50
  try {
50
51
  unlinkSync(SOCKET_PATH);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","s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CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AACrD,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAA0B,EAAE,EAAE;IAChD,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,qCAAqC,EAAE,CAAC;QAC1G,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,gDAAgD,CAAC,CAAC;QACxE,cAAc,CAAC,GAAG,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;IACjE,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,EAAE;IAC9B,WAAW,CAAC,WAAW,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /** Initialize SandboxManager once at daemon startup. */
2
+ export declare function initSandbox(): Promise<void>;
3
+ export declare function runSandboxedPlugin(options: {
4
+ binary: string;
5
+ argv: string[];
6
+ cwd: string;
7
+ env: Record<string, string>;
8
+ allowPaths?: string[];
9
+ onStop: (cb: (reason: string) => void) => () => void;
10
+ runId: string;
11
+ }): Promise<{
12
+ code: number;
13
+ stdout: string;
14
+ stderr: string;
15
+ stoppedByControl: boolean;
16
+ }>;
17
+ //# sourceMappingURL=sandbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AAMA,wDAAwD;AACxD,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAiBjD;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;IACrD,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,CAAC,CAoDvF"}
@@ -0,0 +1,92 @@
1
+ import { SandboxManager } from '@anthropic-ai/sandbox-runtime';
2
+ import { spawn } from 'node:child_process';
3
+ import { log } from './log.js';
4
+ let initialized = false;
5
+ /** Initialize SandboxManager once at daemon startup. */
6
+ export async function initSandbox() {
7
+ if (initialized)
8
+ return;
9
+ try {
10
+ await SandboxManager.initialize({
11
+ filesystem: {
12
+ denyRead: ['~/.ssh', '~/.gnupg'],
13
+ allowWrite: ['.', '/tmp'],
14
+ denyWrite: [],
15
+ },
16
+ });
17
+ initialized = true;
18
+ log('info', 'daemon', 'sandbox initialized (srt)');
19
+ }
20
+ catch (err) {
21
+ log('warn', 'daemon', 'sandbox init failed, falling back to unsandboxed execution', {
22
+ error: err instanceof Error ? err.message : String(err),
23
+ });
24
+ }
25
+ }
26
+ export async function runSandboxedPlugin(options) {
27
+ const KILL_GRACE_MS = 3000;
28
+ const cmd = [options.binary, ...options.argv].join(' ');
29
+ let sandboxedCmd;
30
+ if (initialized) {
31
+ try {
32
+ sandboxedCmd = await SandboxManager.wrapWithSandbox(cmd);
33
+ }
34
+ catch (err) {
35
+ log('warn', 'daemon', 'sandbox wrap failed, running unsandboxed', {
36
+ error: err instanceof Error ? err.message : String(err),
37
+ });
38
+ sandboxedCmd = cmd;
39
+ }
40
+ }
41
+ else {
42
+ sandboxedCmd = cmd;
43
+ }
44
+ return new Promise((resolve, reject) => {
45
+ const child = spawn(sandboxedCmd, {
46
+ shell: true,
47
+ cwd: options.cwd,
48
+ env: options.env,
49
+ detached: true,
50
+ });
51
+ let stdout = '';
52
+ let stderr = '';
53
+ let settled = false;
54
+ let stoppedByControl = false;
55
+ let killTimer = null;
56
+ const unsubscribe = options.onStop((reason) => {
57
+ if (stoppedByControl || child.killed)
58
+ return;
59
+ stoppedByControl = true;
60
+ stderr += `\n[harbor] stop requested by orbital: ${reason}\n`;
61
+ killProcessGroup(child.pid, 'SIGTERM');
62
+ killTimer = setTimeout(() => { killProcessGroup(child.pid, 'SIGKILL'); }, KILL_GRACE_MS);
63
+ });
64
+ const clearAll = () => { unsubscribe(); if (killTimer)
65
+ clearTimeout(killTimer); };
66
+ child.stdout?.on('data', (chunk) => { stdout += chunk.toString(); });
67
+ child.stderr?.on('data', (chunk) => { stderr += chunk.toString(); });
68
+ child.on('error', (error) => { if (settled)
69
+ return; settled = true; clearAll(); reject(error); });
70
+ child.on('close', (code) => {
71
+ if (settled)
72
+ return;
73
+ settled = true;
74
+ clearAll();
75
+ resolve({ code: code ?? 1, stdout, stderr: stderr.trim(), stoppedByControl });
76
+ });
77
+ });
78
+ }
79
+ function killProcessGroup(pid, signal) {
80
+ if (!pid)
81
+ return;
82
+ try {
83
+ process.kill(-pid, signal);
84
+ }
85
+ catch {
86
+ try {
87
+ process.kill(pid, signal);
88
+ }
89
+ catch { }
90
+ }
91
+ }
92
+ //# sourceMappingURL=sandbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA6B,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAAE,KAAK,EAAE,MA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
  name: "discovery",
20
20
  description: "Discover what plugins an agent can use through Harbor, check readiness, and understand what's blocking access. Use when asked what Harbor can do, what tools are available, or why a plugin isn't working.",
21
- content: "---\nname: discovery\ndescription: Discover what plugins an agent can use through Harbor, check readiness, and understand what's blocking access. Use when asked what Harbor can do, what tools are available, or why a plugin isn't working.\n---\n\nUse this skill when the agent needs to understand what tools and services it can access through Harbor.\n\n## Rules\n\n- Use `harbor` CLI commands only. Never access Harbor internals.\n- A plugin being listed does not mean the agent has access — check lease status.\n- If access is missing, use `harbor request` to ask the operator — but only for plugins you need right now. Never bulk-request all available plugins.\n- Prefer routing tool use through Harbor when available — it gives the operator observability into what the agent is doing and why.\n\n## Discovery\n\n```bash\n# What plugins exist in the Harbor catalog?\nharbor plugins\n\n# What tools does a specific plugin expose?\nharbor plugins tools search.exa\nharbor plugins tools search.exa --json # machine-readable\n\n# What's my current access status?\nharbor status\n\n# Read the skill for a specific plugin\nharbor skills get harbor-plugin-exa\n```\n\n`harbor status` shows each plugin the operator has configured, whether there's an active lease, and whether required secrets are set:\n\n```\nPlugins (3 ready, 2 available, 10 missing secrets):\n ready (can run now):\n ✓ infra.modal lease: active (expires in 23h)\n ✓ services.gh lease: active (expires in 6d)\n ✓ search.exa lease: active (expires in 23h)\n available (operator has secrets, needs lease):\n ○ ai.openrouter → harbor request ai.openrouter\n ○ media.replicate → harbor request media.replicate\n```\n\n## Running a plugin\n\n```bash\n# Infrastructure (runs locally via daemon)\nharbor p.infra.modal volume list\nharbor p.services.gh issue list --repo owner/repo\nharbor p.infra.flyio status\n\n# Search (runs remotely on orbital — secrets never leave the server)\nharbor p.search.exa search --query \"latest AI safety research\"\nharbor p.search.brave search --query \"kubernetes networking\"\n\n# AI (routed through orbital)\nharbor p.ai.openrouter chat --model anthropic/claude-sonnet-4 --prompt \"Summarize this\"\n\n# Media generation (runs remotely)\nharbor p.media.replicate run stability-ai/sdxl --prompt \"a harbor at sunset\"\n```\n\nThe `p.<slug>` pattern works for all plugin types. The daemon handles routing — CLI plugins run locally in a sandbox, API plugins execute remotely on orbital with operator-managed secrets.\n\n## When access is denied\n\nIf a plugin run fails with `lease_required` or `plugin_setup_required`:\n\n```bash\n# Ask the operator for access\nharbor request search.exa\n\n# Explain the context\nharbor msg \"I need search.exa to research the user's question about distributed systems\"\n```\n\nThe operator sees the request in their dashboard and can approve with one click. Every request and approval is logged.\n\n## Why use Harbor for tool access\n\nHarbor routes all tool use through a single control plane:\n- **Observability** — the operator sees every run, its duration, exit code, and which agent triggered it\n- **Lease control** — the operator can revoke access at any time, and active runs are killed\n- **Secret management** — API keys are stored server-side and injected at runtime, never exposed to the agent\n- **Audit trail** — every run creates 4-6 events with full timeline\n- **Sandbox isolation** — CLI plugins run in an [agentfs](https://github.com/tursodatabase/agentfs) sandbox with restricted filesystem access (install: `curl -fsSL https://agentfs.ai/install | bash`)\n\nWhen both Harbor and a direct tool path exist, prefer Harbor — it's the same tool with observability and safety built in.\n\n## Plugin categories\n\n| Category | Examples | How they run |\n|----------|----------|--------------|\n| infra | modal, flyio, railway, vercel, do | CLI binary locally via agentfs sandbox |\n| services | gh, linear, composio | CLI binary locally (linear: `brew install schpet/tap/linear` on macOS, `npm i -g @schpet/linear-cli` on Linux) |\n| search | exa, brave, serper, tavily | HTTP from orbital (secrets server-side) |\n| media | replicate, fal | HTTP from orbital |\n| ai | openrouter, grok | HTTP from orbital |\n| mcp | any MCP server | MCP protocol via gateway |\n\n## Checking messages from operator\n\n```bash\nharbor messages\n```\n\nThe operator can send instructions, context, or approvals through the messaging system.\n",
21
+ content: "---\nname: discovery\ndescription: Discover what plugins an agent can use through Harbor, check readiness, and understand what's blocking access. Use when asked what Harbor can do, what tools are available, or why a plugin isn't working.\n---\n\nUse this skill when the agent needs to understand what tools and services it can access through Harbor.\n\n## Rules\n\n- Use `harbor` CLI commands only. Never access Harbor internals.\n- A plugin being listed does not mean the agent has access — check lease status.\n- If access is missing, use `harbor request` to ask the operator — but only for plugins you need right now. Never bulk-request all available plugins.\n- Prefer routing tool use through Harbor when available — it gives the operator observability into what the agent is doing and why.\n\n## Discovery\n\n```bash\n# What plugins exist in the Harbor catalog?\nharbor plugins\n\n# What tools does a specific plugin expose?\nharbor plugins tools search.exa\nharbor plugins tools search.exa --json # machine-readable\n\n# What's my current access status?\nharbor status\n\n# Read the skill for a specific plugin\nharbor skills get harbor-plugin-exa\n```\n\n`harbor status` shows each plugin the operator has configured, whether there's an active lease, and whether required secrets are set:\n\n```\nPlugins (3 ready, 2 available, 10 missing secrets):\n ready (can run now):\n ✓ infra.modal lease: active (expires in 23h)\n ✓ services.gh lease: active (expires in 6d)\n ✓ search.exa lease: active (expires in 23h)\n available (operator has secrets, needs lease):\n ○ ai.openrouter → harbor request ai.openrouter\n ○ media.replicate → harbor request media.replicate\n```\n\n## Running a plugin\n\n```bash\n# Infrastructure (runs locally via daemon)\nharbor p.infra.modal volume list\nharbor p.services.gh issue list --repo owner/repo\nharbor p.infra.flyio status\n\n# Search (runs remotely on orbital — secrets never leave the server)\nharbor p.search.exa search --query \"latest AI safety research\"\nharbor p.search.brave search --query \"kubernetes networking\"\n\n# AI (routed through orbital)\nharbor p.ai.openrouter chat --model anthropic/claude-sonnet-4 --prompt \"Summarize this\"\n\n# Media generation (runs remotely)\nharbor p.media.replicate run stability-ai/sdxl --prompt \"a harbor at sunset\"\n```\n\nThe `p.<slug>` pattern works for all plugin types. The daemon handles routing — CLI plugins run locally in a sandbox, API plugins execute remotely on orbital with operator-managed secrets.\n\n## When access is denied\n\nIf a plugin run fails with `lease_required` or `plugin_setup_required`:\n\n```bash\n# Ask the operator for access\nharbor request search.exa\n\n# Explain the context\nharbor msg \"I need search.exa to research the user's question about distributed systems\"\n```\n\nThe operator sees the request in their dashboard and can approve with one click. Every request and approval is logged.\n\n## Why use Harbor for tool access\n\nHarbor routes all tool use through a single control plane:\n- **Observability** — the operator sees every run, its duration, exit code, and which agent triggered it\n- **Lease control** — the operator can revoke access at any time, and active runs are killed\n- **Secret management** — API keys are stored server-side and injected at runtime, never exposed to the agent\n- **Audit trail** — every run creates 4-6 events with full timeline\n- **Sandbox isolation** — CLI plugins run in a sandbox (Anthropic Sandbox Runtime) with restricted filesystem and network access\n\nWhen both Harbor and a direct tool path exist, prefer Harbor — it's the same tool with observability and safety built in.\n\n## Plugin categories\n\n| Category | Examples | How they run |\n|----------|----------|--------------|\n| infra | modal, flyio, railway, vercel, do | CLI binary locally via srt sandbox |\n| services | gh, linear, composio | CLI binary locally (linear: `brew install schpet/tap/linear` on macOS, `npm i -g @schpet/linear-cli` on Linux) |\n| search | exa, brave, serper, tavily | HTTP from orbital (secrets server-side) |\n| media | replicate, fal | HTTP from orbital |\n| ai | openrouter, grok | HTTP from orbital |\n| mcp | any MCP server | MCP protocol via gateway |\n\n## Checking messages from operator\n\n```bash\nharbor messages\n```\n\nThe operator can send instructions, context, or approvals through the messaging system.\n",
22
22
  },
23
23
  {
24
24
  name: "execution",
25
25
  description: "Execute plugin commands through Harbor with proper error handling, lease awareness, and operator communication. Use when running Harbor plugins, handling plugin failures, or coordinating with the operator during execution.",
26
- content: "---\nname: execution\ndescription: Execute plugin commands through Harbor with proper error handling, lease awareness, and operator communication. Use when running Harbor plugins, handling plugin failures, or coordinating with the operator during execution.\n---\n\nUse this skill when the agent needs to execute tools through Harbor and handle the results properly.\n\n## Rules\n\n- Always check `harbor status` before first plugin use in a session.\n- If a run fails, read the error before retrying — don't retry blindly.\n- If access is denied, request it — don't work around Harbor.\n- **Only request plugins you actually need for the current task.** Never bulk-request all available plugins. Request one at a time, only when you have a concrete reason to use it.\n- Use `harbor msg` to communicate context to the operator when needed.\n- Prefer routing all external tool use through Harbor — it provides observability, sandboxing, and operator control that direct tool access doesn't.\n\n## Execution pattern\n\n```bash\n# 1. Check access first\nharbor status\n\n# 2. Run the plugin\nharbor p.infra.modal volume list\nharbor p.services.gh issue create --repo owner/repo --title \"Bug fix\" --body \"Details...\"\nharbor p.search.exa search --query \"kubernetes best practices\"\n\n# 3. If denied, request access\nharbor request infra.modal\nharbor msg \"I need modal access to deploy the user's GPU workload\"\n```\n\n## Handling failures\n\n| Error | What happened | What to do |\n|-------|---------------|------------|\n| `plugin_setup_required` | Operator hasn't enabled this plugin | `harbor request <plugin>` |\n| `lease_required` | No active lease for this plugin | `harbor request <plugin>` |\n| `lease_expired` | Lease timed out | `harbor request <plugin>` |\n| `Token missing` | Secrets not configured by operator | `harbor msg \"Plugin needs API keys configured in the dashboard\"` |\n| `unauthorized` | Daemon token expired | `harbor setup status` to refresh |\n| Run killed mid-execution | Operator revoked the lease | Stop and report — the operator intentionally stopped you |\n\n## Operator communication\n\n```bash\n# Send a message to the operator\nharbor msg \"Starting deployment to modal — this will take ~2 minutes\"\n\n# Check for messages from the operator\nharbor messages\n\n# Request a specific plugin\nharbor request search.exa\n```\n\nMessages give the operator context about what the agent is doing and why. More context = faster approvals and better trust.\n\n## Multi-step workflows\n\nFor complex tasks that need multiple plugins, request only the ones you need:\n\n```bash\n# Check access first\nharbor status\n\n# Request only the specific plugins your task requires — never request all available plugins\nharbor request search.exa --reason \"Need to research distributed consensus for the user's question\"\n\n# Execute, then request the next plugin when you actually need it\nharbor p.search.exa search --query \"distributed consensus algorithms 2026\"\n# ... process results ...\nharbor request services.gh --reason \"Need to file research findings as issues\"\nharbor p.services.gh issue create --repo team/research --title \"Consensus survey\" --body \"$SUMMARY\"\n```\n\n**Do not** loop through `harbor status` output and request every plugin. Only request what you need, when you need it.\n\n## Run inspection\n\n```bash\n# Check what happened in a run\nharbor runs get <run-id>\n```\n\nShows the full event timeline: created → lease_authorized → assigned → completed/failed, plus origin metadata (which agent, from which repo, PID chain) and any stop signals from the operator.\n\n## Why Harbor over direct tool access\n\nWhen you have both options — e.g. you could call the Exa API directly or use `harbor p.search.exa` — prefer Harbor:\n\n1. **No secret handling** — you never see API keys. Orbital injects them server-side.\n2. **Automatic audit** — every call is logged with timing, agent identity, and outcome.\n3. **Lease control** — the operator can revoke at any time if something goes wrong.\n4. **Sandbox isolation** — CLI plugins run in a restricted filesystem via [agentfs](https://github.com/tursodatabase/agentfs). Install with `curl -fsSL https://agentfs.ai/install | bash`. On Linux (Ubuntu 23.10+), you may need `sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0` to allow FUSE/user-namespace mounts.\n5. **Operator trust** — the more the operator sees in Harbor's dashboard, the more access they'll grant.\n",
26
+ content: "---\nname: execution\ndescription: Execute plugin commands through Harbor with proper error handling, lease awareness, and operator communication. Use when running Harbor plugins, handling plugin failures, or coordinating with the operator during execution.\n---\n\nUse this skill when the agent needs to execute tools through Harbor and handle the results properly.\n\n## Rules\n\n- Always check `harbor status` before first plugin use in a session.\n- If a run fails, read the error before retrying — don't retry blindly.\n- If access is denied, request it — don't work around Harbor.\n- **Only request plugins you actually need for the current task.** Never bulk-request all available plugins. Request one at a time, only when you have a concrete reason to use it.\n- Use `harbor msg` to communicate context to the operator when needed.\n- Prefer routing all external tool use through Harbor — it provides observability, sandboxing, and operator control that direct tool access doesn't.\n\n## Execution pattern\n\n```bash\n# 1. Check access first\nharbor status\n\n# 2. Run the plugin\nharbor p.infra.modal volume list\nharbor p.services.gh issue create --repo owner/repo --title \"Bug fix\" --body \"Details...\"\nharbor p.search.exa search --query \"kubernetes best practices\"\n\n# 3. If denied, request access\nharbor request infra.modal\nharbor msg \"I need modal access to deploy the user's GPU workload\"\n```\n\n## Handling failures\n\n| Error | What happened | What to do |\n|-------|---------------|------------|\n| `plugin_setup_required` | Operator hasn't enabled this plugin | `harbor request <plugin>` |\n| `lease_required` | No active lease for this plugin | `harbor request <plugin>` |\n| `lease_expired` | Lease timed out | `harbor request <plugin>` |\n| `Token missing` | Secrets not configured by operator | `harbor msg \"Plugin needs API keys configured in the dashboard\"` |\n| `unauthorized` | Daemon token expired | `harbor setup status` to refresh |\n| Run killed mid-execution | Operator revoked the lease | Stop and report — the operator intentionally stopped you |\n\n## Operator communication\n\n```bash\n# Send a message to the operator\nharbor msg \"Starting deployment to modal — this will take ~2 minutes\"\n\n# Check for messages from the operator\nharbor messages\n\n# Request a specific plugin\nharbor request search.exa\n```\n\nMessages give the operator context about what the agent is doing and why. More context = faster approvals and better trust.\n\n## Multi-step workflows\n\nFor complex tasks that need multiple plugins, request only the ones you need:\n\n```bash\n# Check access first\nharbor status\n\n# Request only the specific plugins your task requires — never request all available plugins\nharbor request search.exa --reason \"Need to research distributed consensus for the user's question\"\n\n# Execute, then request the next plugin when you actually need it\nharbor p.search.exa search --query \"distributed consensus algorithms 2026\"\n# ... process results ...\nharbor request services.gh --reason \"Need to file research findings as issues\"\nharbor p.services.gh issue create --repo team/research --title \"Consensus survey\" --body \"$SUMMARY\"\n```\n\n**Do not** loop through `harbor status` output and request every plugin. Only request what you need, when you need it.\n\n## Run inspection\n\n```bash\n# Check what happened in a run\nharbor runs get <run-id>\n```\n\nShows the full event timeline: created → lease_authorized → assigned → completed/failed, plus origin metadata (which agent, from which repo, PID chain) and any stop signals from the operator.\n\n## Why Harbor over direct tool access\n\nWhen you have both options — e.g. you could call the Exa API directly or use `harbor p.search.exa` — prefer Harbor:\n\n1. **No secret handling** — you never see API keys. Orbital injects them server-side.\n2. **Automatic audit** — every call is logged with timing, agent identity, and outcome.\n3. **Lease control** — the operator can revoke at any time if something goes wrong.\n4. **Sandbox isolation** — CLI plugins run in a sandbox (Anthropic Sandbox Runtime) with restricted filesystem and network access.\n5. **Operator trust** — the more the operator sees in Harbor's dashboard, the more access they'll grant.\n",
27
27
  },
28
28
  {
29
29
  name: "infra-do",
@@ -1 +1 @@
1
- {"version":3,"file":"skills-embedded.js","sourceRoot":"","sources":["../src/skills-embedded.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAI3E,MAAM,CAAC,MAAM,MAAM,GAAoB;IACrC;QACE,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,6FAA6F;QAC1G,OAAO,EAAE,80EAA80E;KACx1E;IACD;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,gHAAgH;QAC7H,OAAO,EAAE,6/EAA6/E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,uHAAuH;QACpI,OAAO,EAAE,4kEAA4kE;KACtlE;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,6FAA6F;QAC1G,OAAO,EAAE,63DAA63D;KACv4D;IACD;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,mFAAmF;QAChG,OAAO,EAAE,gjEAAgjE;KAC1jE;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,iGAAiG;QAC9G,OAAO,EAAE,ylMAAylM;KACnmM;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,gVAAgV;QAC7V,OAAO,EAAE,6qSAA6qS;KACvrS;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"skills-embedded.js","sourceRoot":"","sources":["../src/skills-embedded.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAI3E,MAAM,CAAC,MAAM,MAAM,GAAoB;IACrC;QACE,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,6FAA6F;QAC1G,OAAO,EAAE,80EAA80E;KACx1E;IACD;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,gHAAgH;QAC7H,OAAO,EAAE,6/EAA6/E;KACvgF;IACD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,yLAAyL;QACtM,OAAO,EAAE,guIAAguI;KAC1uI;IACD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,4MAA4M;QACzN,OAAO,EAAE,g2IAAg2I;KAC12I;IACD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,gOAAgO;QAC7O,OAAO,EAAE,gsIAAgsI;KAC1sI;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,sGAAsG;QACnH,OA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E,kBAAkB;QACxB,WAAW,EAAE,gVAAgV;QAC7V,OAAO,EAAE,6qSAA6qS;KACvrS;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harborai",
3
- "version": "0.5.3",
3
+ "version": "0.5.6",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "harbor": "dist/index.js"