@agentshouse/kit 0.2.1-alpha.9 → 0.2.1-c5262a8cc063d
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 +32 -14
- package/dist/abort.js +9 -0
- package/dist/acp.js +27 -7
- package/dist/agents.js +204 -52
- package/dist/api.js +4 -1
- package/dist/bootstrap.json +10 -14
- package/dist/bridge.js +85 -51
- package/dist/clis-main.js +23 -0
- package/dist/clis.js +102 -32
- package/dist/conversations.js +104 -27
- package/dist/copies.js +47 -38
- package/dist/git-main.js +2 -2
- package/dist/git.js +6 -2
- package/dist/home.js +32 -3
- package/dist/house-main.js +96 -41
- package/dist/instructions.js +13 -12
- package/dist/kit-main.js +4 -1
- package/dist/login.js +24 -4
- package/dist/logout.js +18 -0
- package/dist/mcp.js +38 -0
- package/dist/operation.js +7 -4
- package/dist/refusals.js +41 -0
- package/dist/resident.js +34 -9
- package/dist/secret-input.js +4 -2
- package/dist/sign-in.js +17 -5
- package/dist/skills.js +5 -10
- package/dist/stream.js +2 -3
- package/dist/transcription.js +122 -0
- package/dist/update.js +117 -0
- package/how-we-work.md +10 -12
- package/package.json +4 -7
package/README.md
CHANGED
|
@@ -6,33 +6,51 @@ through the agent CLIs you chose and gives each Agent the `house` command.
|
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
Run `curl -fsSL agents.house/kit | sh`, or `irm agents.house/kit.ps1 | iex` on
|
|
10
|
+
Windows, and again to update; options follow `sh -s --`. On macOS and Linux it
|
|
11
|
+
installs House Kit natively under your own account, without an admin password,
|
|
12
|
+
as a service that runs while you are logged in. `kit` and `house` are then on
|
|
13
|
+
your login shell's `PATH`, and your workspace is `~/AgentsHouse` unless you
|
|
14
|
+
pass `--workspace <path>`.
|
|
15
|
+
|
|
16
|
+
Add `--container` to run House Kit in one Docker container instead, with your
|
|
17
|
+
workspace mounted at `/agents/house`; your Agents then reach only that
|
|
18
|
+
workspace. On Windows 11 the container is the one choice. Append a `kit` or
|
|
19
|
+
`house` command to the container's options to run it in that container.
|
|
20
|
+
Running the command for the other choice on a connected computer asks you to
|
|
21
|
+
confirm, then replaces its Environment, whose Agents end, with a new one.
|
|
15
22
|
|
|
16
23
|
On your own Ubuntu 26.04 server, run the Linux command with `--linux` to
|
|
17
24
|
install House Kit natively, with its workspace at `/agents/house`; `kit` and
|
|
18
25
|
`house` are then on the server's `PATH`.
|
|
19
26
|
|
|
20
|
-
House Kit
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
House Kit runs the agent CLIs your login shell finds and installs a missing one
|
|
28
|
+
through that CLI's own installer. Running the command again offers to update
|
|
29
|
+
each CLI older than House Kit needs; add `--update-clis` to update every one to
|
|
30
|
+
its latest release without asking. House Kit also gives every Agent on the
|
|
31
|
+
Environment a set of agent skills. Add `--no-skills` to the command to leave
|
|
32
|
+
them out; running it again without the flag brings them back.
|
|
23
33
|
|
|
24
34
|
## Commands
|
|
25
35
|
|
|
26
36
|
`kit login` opens a link you confirm in your browser and keeps the
|
|
27
37
|
Environment's credential in `~/.house-kit`, or in `$HOUSE_KIT_HOME` when it is
|
|
28
38
|
set. Pass `--manual` to paste the code by hand on a machine without a browser,
|
|
29
|
-
and `--environment <id>` to reconnect an Environment you already have.
|
|
39
|
+
and `--environment <id>` to reconnect an Environment you already have. It also
|
|
40
|
+
connects your own agent: `house <tool>` run outside an Agent conversation calls
|
|
41
|
+
House as you, until you revoke that connection on Connections. `house help`
|
|
42
|
+
lists the Tools. `kit logout` disconnects this computer and stops House Kit; a
|
|
43
|
+
later `kit login` reconnects the same Environment.
|
|
30
44
|
|
|
31
45
|
`kit resident` keeps the Environment connected, and keeps the Rooms you chose
|
|
32
|
-
for this Environment as Git repositories under
|
|
33
|
-
Commit in one and run `house
|
|
34
|
-
House;
|
|
35
|
-
directory. Inside an Agent conversation the Agent runs `house
|
|
46
|
+
for this Environment as Git repositories under `local-copies` in the
|
|
47
|
+
workspace. Commit in one and run `house push --owner` there to send the
|
|
48
|
+
commit to House; in the container, run it through the install command from the
|
|
49
|
+
copy's directory. Inside an Agent conversation the Agent runs `house push`.
|
|
50
|
+
|
|
51
|
+
House Kit turns each audio file of your message to an Agent into text on this
|
|
52
|
+
computer before the Agent reads the message. The first audio file downloads the
|
|
53
|
+
speech engine and model, about 425 MB, into `~/.house-kit`.
|
|
36
54
|
|
|
37
55
|
## License
|
|
38
56
|
|
package/dist/abort.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function unlessAborted(work, signal) {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
const aborted = () => reject(signal.reason);
|
|
4
|
+
signal.addEventListener('abort', aborted, { once: true });
|
|
5
|
+
if (signal.aborted)
|
|
6
|
+
aborted();
|
|
7
|
+
work.then(resolve, reject).finally(() => signal.removeEventListener('abort', aborted));
|
|
8
|
+
});
|
|
9
|
+
}
|
package/dist/acp.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { ndJsonStream, PROTOCOL_VERSION, } from '@agentclientprotocol/sdk';
|
|
2
|
-
import { spawn } from 'node:child_process';
|
|
2
|
+
import { execFileSync, spawn } from 'node:child_process';
|
|
3
3
|
import { readdirSync, readFileSync } from 'node:fs';
|
|
4
4
|
import { Readable, Writable } from 'node:stream';
|
|
5
|
-
import { CLIS, KIT_VERSION,
|
|
5
|
+
import { CLIS, KIT_VERSION, adapterCommand, withoutProxy } from './clis.js';
|
|
6
6
|
export const TURN_STARTED = 'kit/turn_started';
|
|
7
7
|
export const TURN_ENDED = 'kit/turn_ended';
|
|
8
|
-
export async function startAdapter(kind, cwd, app, jobs = () => undefined, added = {}) {
|
|
9
|
-
const
|
|
8
|
+
export async function startAdapter(kind, cli, cwd, app, jobs = () => undefined, added = {}) {
|
|
9
|
+
const adapter = CLIS[kind].adapter;
|
|
10
|
+
const child = spawn(adapter === null ? cli : adapterCommand(kind), CLIS[kind].args, {
|
|
10
11
|
cwd,
|
|
11
|
-
env: { ...withoutProxy(), ...added },
|
|
12
|
+
env: { ...withoutProxy(), ...(adapter === null ? {} : { ...adapter.env, [adapter.executable]: cli }), ...added },
|
|
12
13
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
13
14
|
detached: true,
|
|
14
15
|
});
|
|
@@ -60,15 +61,29 @@ export async function startAdapter(kind, cwd, app, jobs = () => undefined, added
|
|
|
60
61
|
throw error;
|
|
61
62
|
}
|
|
62
63
|
}
|
|
64
|
+
const LISTING_BYTES = 1 << 28;
|
|
65
|
+
function listed(options) {
|
|
66
|
+
return execFileSync('ps', [options, '-o', 'pid=,ppid=,command='], { encoding: 'utf8', maxBuffer: LISTING_BYTES })
|
|
67
|
+
.split('\n')
|
|
68
|
+
.flatMap((line) => {
|
|
69
|
+
const fields = /^\s*(\d+)\s+(\d+)\s?(.*)$/.exec(line);
|
|
70
|
+
return fields === null ? [] : [[Number(fields[1]), Number(fields[2]), fields[3]]];
|
|
71
|
+
});
|
|
72
|
+
}
|
|
63
73
|
function parents() {
|
|
64
74
|
const children = new Map();
|
|
75
|
+
const adopt = (pid, parent) => children.set(parent, [...(children.get(parent) ?? []), pid]);
|
|
76
|
+
if (process.platform === 'darwin') {
|
|
77
|
+
for (const [pid, parent] of listed('-Aww'))
|
|
78
|
+
adopt(pid, parent);
|
|
79
|
+
return children;
|
|
80
|
+
}
|
|
65
81
|
for (const entry of readdirSync('/proc')) {
|
|
66
82
|
if (!/^\d+$/.test(entry))
|
|
67
83
|
continue;
|
|
68
84
|
try {
|
|
69
85
|
const stat = readFileSync(`/proc/${entry}/stat`, 'utf8');
|
|
70
|
-
|
|
71
|
-
children.set(parent, [...(children.get(parent) ?? []), Number(entry)]);
|
|
86
|
+
adopt(Number(entry), Number(stat.slice(stat.lastIndexOf(')') + 2).split(' ')[1]));
|
|
72
87
|
}
|
|
73
88
|
catch { }
|
|
74
89
|
}
|
|
@@ -96,6 +111,11 @@ function killAll(pids) {
|
|
|
96
111
|
}
|
|
97
112
|
}
|
|
98
113
|
function marked(marker) {
|
|
114
|
+
if (process.platform === 'darwin') {
|
|
115
|
+
return listed('-AEww')
|
|
116
|
+
.filter(([, , command]) => ` ${command} `.includes(` ${marker} `))
|
|
117
|
+
.map(([pid]) => pid);
|
|
118
|
+
}
|
|
99
119
|
return readdirSync('/proc')
|
|
100
120
|
.filter((entry) => {
|
|
101
121
|
try {
|
package/dist/agents.js
CHANGED
|
@@ -1,24 +1,90 @@
|
|
|
1
1
|
import { client } from '@agentclientprotocol/sdk';
|
|
2
|
-
import { readFile } from 'node:fs/promises';
|
|
3
|
-
import { startAdapter } from './acp.js';
|
|
4
|
-
import { CLIS, KIT_VERSION,
|
|
5
|
-
import { kitHome } from './home.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { readFile, realpath } from 'node:fs/promises';
|
|
3
|
+
import { killTree, startAdapter } from './acp.js';
|
|
4
|
+
import { CLIS, KIT_VERSION, below, installAdapter, installCli, locate, run, versionOf } from './clis.js';
|
|
5
|
+
import { agentBase, kitHome } from './home.js';
|
|
6
|
+
const SIGNED_OUT = { signed_in: false, models: [] };
|
|
7
|
+
function select(options, category) {
|
|
8
|
+
const option = options.find((candidate) => candidate.category === category);
|
|
9
|
+
return option?.type === 'select' ? option : undefined;
|
|
10
|
+
}
|
|
11
|
+
function values(options) {
|
|
12
|
+
return options.flatMap((entry) => ('group' in entry ? entry.options : [entry])).map((entry) => entry.value);
|
|
13
|
+
}
|
|
14
|
+
function causeOf(error) {
|
|
15
|
+
return error instanceof Error ? error.message : String(error);
|
|
16
|
+
}
|
|
17
|
+
function logged(error) {
|
|
18
|
+
process.stderr.write(`kit: ${causeOf(error)}\n`);
|
|
19
|
+
}
|
|
20
|
+
async function models(kind, adapter, known) {
|
|
21
|
+
const agent = adapter.connection.agent;
|
|
22
|
+
const opened = await agent.request('session/new', { cwd: kitHome(), mcpServers: [] });
|
|
23
|
+
let options = opened.configOptions ?? [];
|
|
24
|
+
const model = select(options, 'model');
|
|
25
|
+
if (model === undefined)
|
|
26
|
+
return [];
|
|
27
|
+
const offered = [];
|
|
28
|
+
for (const value of values(model.options)) {
|
|
29
|
+
if (select(options, 'model')?.currentValue !== value) {
|
|
30
|
+
try {
|
|
31
|
+
options = (await agent.request('session/set_config_option', { sessionId: opened.sessionId, configId: model.id, value })).configOptions;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
process.stderr.write(`kit: ${kind} refused its model ${value}: ${causeOf(error)}\n`);
|
|
35
|
+
offered.push({ model: value, efforts: known.find((entry) => entry.model === value)?.efforts ?? [] });
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const effort = select(options, 'thought_level');
|
|
40
|
+
offered.push({ model: value, efforts: effort === undefined ? [] : values(effort.options) });
|
|
10
41
|
}
|
|
42
|
+
return offered;
|
|
43
|
+
}
|
|
44
|
+
async function offer(kind, cli, known) {
|
|
45
|
+
const probe = CLIS[kind].signedIn;
|
|
46
|
+
if ('command' in probe && (await run(cli, probe.command, 30_000)).status !== 0)
|
|
47
|
+
return SIGNED_OUT;
|
|
48
|
+
let adapter;
|
|
11
49
|
try {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
50
|
+
adapter = await startAdapter(kind, cli, kitHome(), client({ name: '@agentshouse/kit' }));
|
|
51
|
+
if ('initializeMeta' in probe) {
|
|
52
|
+
const method = adapter.initialized._meta?.[probe.initializeMeta];
|
|
53
|
+
if (typeof method !== 'string' || method.length === 0)
|
|
54
|
+
return SIGNED_OUT;
|
|
55
|
+
}
|
|
56
|
+
return { signed_in: true, models: await models(kind, adapter, known.models) };
|
|
16
57
|
}
|
|
17
|
-
catch {
|
|
18
|
-
|
|
58
|
+
catch (error) {
|
|
59
|
+
process.stderr.write(`kit: ${kind} did not offer its models: ${causeOf(error)}\n`);
|
|
60
|
+
return { signed_in: adapter === undefined && 'initializeMeta' in probe ? known.signed_in : true, models: known.models };
|
|
19
61
|
}
|
|
62
|
+
finally {
|
|
63
|
+
if (adapter !== undefined)
|
|
64
|
+
killTree(adapter.child);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function reported(kind, reading) {
|
|
68
|
+
return {
|
|
69
|
+
kind,
|
|
70
|
+
release: reading.release,
|
|
71
|
+
...(reading.minimum === undefined ? {} : { minimum: reading.minimum }),
|
|
72
|
+
failure: reading.failure,
|
|
73
|
+
signed_in: reading.signed_in,
|
|
74
|
+
models: reading.models,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function tooOld(kind, release) {
|
|
78
|
+
const cli = CLIS[kind];
|
|
79
|
+
return `${cli.bin} ${release} is older than ${cli.minimum}, the oldest this Kit runs`;
|
|
80
|
+
}
|
|
81
|
+
async function sshHostKey() {
|
|
82
|
+
const listed = await run('ssh-keygen', ['-l', '-E', 'sha256', '-f', '/etc/ssh/ssh_host_ed25519_key.pub'], 10_000);
|
|
83
|
+
return listed.status === 0 ? (/^\d+ (SHA256:\S+)/.exec(listed.output)?.[1] ?? null) : null;
|
|
20
84
|
}
|
|
21
85
|
async function operatingSystem() {
|
|
86
|
+
if (process.platform === 'darwin')
|
|
87
|
+
return `macOS ${(await run('sw_vers', ['-productVersion'], 10_000)).output.trim()}`;
|
|
22
88
|
const release = await readFile('/etc/os-release', 'utf8');
|
|
23
89
|
return /^PRETTY_NAME="?([^"\n]*)"?$/m.exec(release)?.[1] ?? release;
|
|
24
90
|
}
|
|
@@ -26,19 +92,18 @@ export class Agents {
|
|
|
26
92
|
desired = { agents: [], routes: [] };
|
|
27
93
|
house;
|
|
28
94
|
reading = Promise.resolve();
|
|
95
|
+
queues = new Map();
|
|
29
96
|
installing = Promise.resolve();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
97
|
+
readings = new Map();
|
|
98
|
+
reads = new Map();
|
|
99
|
+
sending = Promise.resolve();
|
|
100
|
+
sent = null;
|
|
33
101
|
constructor(house) {
|
|
34
102
|
this.house = house;
|
|
35
103
|
}
|
|
36
104
|
read() {
|
|
37
105
|
return this.reading.then(() => undefined, () => undefined);
|
|
38
106
|
}
|
|
39
|
-
installed() {
|
|
40
|
-
return this.installing.catch(() => undefined);
|
|
41
|
-
}
|
|
42
107
|
route(agentId) {
|
|
43
108
|
return this.desired.routes.find((route) => route.agent_id === agentId);
|
|
44
109
|
}
|
|
@@ -48,43 +113,130 @@ export class Agents {
|
|
|
48
113
|
return this.desired;
|
|
49
114
|
});
|
|
50
115
|
this.reading = reading;
|
|
51
|
-
|
|
52
|
-
.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
116
|
+
return reading.then(({ agents }) => {
|
|
117
|
+
Promise.all(agents.map((kind) => this.queue(kind, () => this.load(kind))))
|
|
118
|
+
.then(() => this.report())
|
|
119
|
+
.catch(logged);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
cli(kind) {
|
|
123
|
+
return this.queue(kind, async () => {
|
|
124
|
+
const resolved = await this.resolve(kind);
|
|
125
|
+
if (!('cli' in resolved)) {
|
|
126
|
+
this.update(kind, resolved);
|
|
127
|
+
throw new Error(resolved.failure ?? tooOld(kind, resolved.release));
|
|
128
|
+
}
|
|
129
|
+
const { cli, release } = resolved;
|
|
130
|
+
const known = this.readings.get(kind);
|
|
131
|
+
const kept = known?.release === null || known?.minimum !== undefined ? SIGNED_OUT : (known ?? SIGNED_OUT);
|
|
132
|
+
if (known?.release !== release || known.minimum !== undefined) {
|
|
133
|
+
this.update(kind, { release, failure: null, signed_in: kept.signed_in, models: kept.models });
|
|
134
|
+
}
|
|
135
|
+
const read = this.nextRead(kind);
|
|
136
|
+
offer(kind, cli, kept)
|
|
137
|
+
.then((offered) => {
|
|
138
|
+
const current = this.readings.get(kind);
|
|
139
|
+
if (this.reads.get(kind) === read && current?.release === release)
|
|
140
|
+
this.update(kind, { ...current, ...offered });
|
|
141
|
+
})
|
|
142
|
+
.catch(logged);
|
|
143
|
+
return cli;
|
|
70
144
|
});
|
|
71
145
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
this.
|
|
146
|
+
located(kind) {
|
|
147
|
+
return this.queue(kind, () => this.ensure(kind));
|
|
148
|
+
}
|
|
149
|
+
async reread(kind) {
|
|
150
|
+
await this.queue(kind, async () => {
|
|
151
|
+
this.nextRead(kind);
|
|
152
|
+
this.readings.set(kind, await this.examine(kind, this.readings.get(kind) ?? SIGNED_OUT));
|
|
153
|
+
});
|
|
154
|
+
await this.report();
|
|
155
|
+
}
|
|
156
|
+
report() {
|
|
157
|
+
const sending = this.sending.catch(() => undefined).then(() => this.send());
|
|
158
|
+
this.sending = sending;
|
|
159
|
+
return sending;
|
|
160
|
+
}
|
|
161
|
+
nextRead(kind) {
|
|
162
|
+
const read = (this.reads.get(kind) ?? 0) + 1;
|
|
163
|
+
this.reads.set(kind, read);
|
|
164
|
+
return read;
|
|
165
|
+
}
|
|
166
|
+
update(kind, reading) {
|
|
167
|
+
this.readings.set(kind, reading);
|
|
168
|
+
this.report().catch(logged);
|
|
169
|
+
}
|
|
170
|
+
queue(kind, work) {
|
|
171
|
+
const queued = (this.queues.get(kind) ?? Promise.resolve()).then(work);
|
|
172
|
+
this.queues.set(kind, queued.catch(() => undefined));
|
|
173
|
+
return queued;
|
|
77
174
|
}
|
|
78
|
-
async
|
|
175
|
+
async ensure(kind) {
|
|
176
|
+
const failed = await installAdapter(kind);
|
|
177
|
+
if (failed !== null)
|
|
178
|
+
throw new Error(failed);
|
|
179
|
+
const found = await locate(kind);
|
|
180
|
+
if (found !== null)
|
|
181
|
+
return found;
|
|
182
|
+
const installing = this.installing.catch(() => undefined).then(() => installCli(kind));
|
|
183
|
+
this.installing = installing;
|
|
184
|
+
const failure = await installing;
|
|
185
|
+
if (failure !== null)
|
|
186
|
+
throw new Error(failure);
|
|
187
|
+
const installed = await locate(kind);
|
|
188
|
+
if (installed === null)
|
|
189
|
+
throw new Error(`the login shell does not find ${CLIS[kind].bin} after its install`);
|
|
190
|
+
return installed;
|
|
191
|
+
}
|
|
192
|
+
async resolve(kind) {
|
|
193
|
+
let cli;
|
|
79
194
|
try {
|
|
80
|
-
|
|
81
|
-
this.again = false;
|
|
82
|
-
await this.installing;
|
|
83
|
-
await this.report();
|
|
84
|
-
} while (this.again);
|
|
195
|
+
cli = await realpath(await this.ensure(kind));
|
|
85
196
|
}
|
|
86
|
-
|
|
87
|
-
|
|
197
|
+
catch (error) {
|
|
198
|
+
const failure = causeOf(error);
|
|
199
|
+
process.stderr.write(`kit: ${kind} did not install: ${failure}\n`);
|
|
200
|
+
return { release: null, failure, ...SIGNED_OUT };
|
|
88
201
|
}
|
|
202
|
+
const release = await versionOf(cli);
|
|
203
|
+
if (release === null)
|
|
204
|
+
return { release: null, failure: `${cli} --version names no version`, ...SIGNED_OUT };
|
|
205
|
+
const minimum = CLIS[kind].minimum;
|
|
206
|
+
if (below(release, minimum))
|
|
207
|
+
return { release, minimum, failure: null, ...SIGNED_OUT };
|
|
208
|
+
return { cli, release };
|
|
209
|
+
}
|
|
210
|
+
async examine(kind, known) {
|
|
211
|
+
const resolved = await this.resolve(kind);
|
|
212
|
+
if (!('cli' in resolved))
|
|
213
|
+
return resolved;
|
|
214
|
+
return { release: resolved.release, failure: null, ...(await offer(kind, resolved.cli, known)) };
|
|
215
|
+
}
|
|
216
|
+
async load(kind) {
|
|
217
|
+
const known = this.readings.get(kind);
|
|
218
|
+
if (known !== undefined && known.failure === null)
|
|
219
|
+
return;
|
|
220
|
+
this.nextRead(kind);
|
|
221
|
+
this.readings.set(kind, await this.examine(kind, SIGNED_OUT));
|
|
222
|
+
}
|
|
223
|
+
async send() {
|
|
224
|
+
const agents = this.desired.agents.flatMap((kind) => {
|
|
225
|
+
const reading = this.readings.get(kind);
|
|
226
|
+
return reading === undefined ? [] : [reported(kind, reading)];
|
|
227
|
+
});
|
|
228
|
+
const hostKey = await sshHostKey();
|
|
229
|
+
const body = {
|
|
230
|
+
os: await operatingSystem(),
|
|
231
|
+
kit_version: KIT_VERSION,
|
|
232
|
+
agent_base: agentBase(),
|
|
233
|
+
agents,
|
|
234
|
+
...(hostKey === null ? {} : { ssh_host_key: hostKey }),
|
|
235
|
+
};
|
|
236
|
+
const state = JSON.stringify(body);
|
|
237
|
+
if (state === this.sent)
|
|
238
|
+
return;
|
|
239
|
+
await this.house.deliver('/kit/agents/report', body);
|
|
240
|
+
this.sent = state;
|
|
89
241
|
}
|
|
90
242
|
}
|
package/dist/api.js
CHANGED
|
@@ -8,6 +8,9 @@ export class HouseRefusal extends Error {
|
|
|
8
8
|
this.text = text;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
export function retryDelay(attempt) {
|
|
12
|
+
return Math.random() * Math.min(30_000, 1000 * 2 ** attempt);
|
|
13
|
+
}
|
|
11
14
|
export async function post(house, path, body, credential, signal) {
|
|
12
15
|
const answer = await fetch(new URL(path, house), {
|
|
13
16
|
method: 'POST',
|
|
@@ -38,7 +41,7 @@ export const house = {
|
|
|
38
41
|
if (error instanceof HouseRefusal && error.status < 500)
|
|
39
42
|
throw error;
|
|
40
43
|
process.stderr.write(`kit: ${path} did not reach House: ${error.message}\n`);
|
|
41
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
44
|
+
await new Promise((resolve) => setTimeout(resolve, retryDelay(attempt)));
|
|
42
45
|
if (!current())
|
|
43
46
|
throw error;
|
|
44
47
|
}
|
package/dist/bootstrap.json
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion":
|
|
3
|
-
"version": "0.2.1-
|
|
2
|
+
"schemaVersion": 2,
|
|
3
|
+
"version": "0.2.1-c5262a8cc063d",
|
|
4
4
|
"hosts": {
|
|
5
|
+
"macos": {
|
|
6
|
+
"asset": {
|
|
7
|
+
"name": "connect-linux.sh",
|
|
8
|
+
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-c5262a8cc063d/connect-linux.sh"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
5
11
|
"linux": {
|
|
6
|
-
"command": "bash <(curl -fsSL https://github.com/agentshouse/kit/releases/download/v0.2.1-alpha.9/connect-linux.sh)",
|
|
7
12
|
"asset": {
|
|
8
13
|
"name": "connect-linux.sh",
|
|
9
|
-
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-
|
|
10
|
-
},
|
|
11
|
-
"workspace": {
|
|
12
|
-
"argument": "--workspace",
|
|
13
|
-
"quoting": "posix"
|
|
14
|
+
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-c5262a8cc063d/connect-linux.sh"
|
|
14
15
|
}
|
|
15
16
|
},
|
|
16
17
|
"windows": {
|
|
17
|
-
"command": "& ([scriptblock]::Create((irm https://github.com/agentshouse/kit/releases/download/v0.2.1-alpha.9/connect-windows.ps1)))",
|
|
18
18
|
"asset": {
|
|
19
19
|
"name": "connect-windows.ps1",
|
|
20
|
-
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-
|
|
21
|
-
},
|
|
22
|
-
"workspace": {
|
|
23
|
-
"argument": "--workspace",
|
|
24
|
-
"quoting": "powershell"
|
|
20
|
+
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-c5262a8cc063d/connect-windows.ps1"
|
|
25
21
|
}
|
|
26
22
|
}
|
|
27
23
|
}
|