@agentshouse/kit 0.2.1-cfb7b543f2af6 → 0.2.1-cfbadfb5b5e28
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 +33 -34
- package/dist/acp.js +91 -20
- package/dist/afk.js +17 -0
- package/dist/agents.js +91 -44
- package/dist/api.js +5 -5
- package/dist/app-git.js +10 -26
- package/dist/authority-main.js +3 -3
- package/dist/bridge.js +7 -10
- package/dist/building.js +50 -0
- package/dist/calls.js +71 -0
- package/dist/chunks.js +49 -0
- package/dist/clis.js +56 -45
- package/dist/connection.js +120 -0
- package/dist/content.js +63 -0
- package/dist/conversations.js +703 -244
- package/dist/copies.js +344 -171
- package/dist/end.js +15 -4
- package/dist/events.js +746 -210
- package/dist/files.js +139 -37
- package/dist/git.js +49 -16
- package/dist/grok.js +39 -0
- package/dist/home.js +27 -20
- package/dist/house-cli.js +98 -90
- package/dist/house-main.js +3 -3
- package/dist/instructions.js +29 -10
- package/dist/kit-cli.js +5 -8
- package/dist/kit-main.js +3 -3
- package/dist/login.js +20 -11
- package/dist/logout.js +1 -3
- package/dist/mcp.js +6 -2
- package/dist/placement.js +19 -36
- package/dist/relay.js +21 -0
- package/dist/resident.js +118 -52
- package/dist/scope.js +15 -4
- package/dist/scripts.js +255 -0
- package/dist/secret-input.js +1 -1
- package/dist/service.js +23 -1
- package/dist/sign-in.js +22 -39
- package/dist/silence.js +28 -0
- package/dist/skills.js +42 -97
- package/dist/transcription.js +88 -45
- package/dist/translate.js +19 -16
- package/dist/update.js +113 -127
- package/dist/wire.js +37 -3
- package/dist/work.js +12 -7
- package/package.json +22 -21
- package/dist/bootstrap.json +0 -24
- package/dist/chatgpt.js +0 -32
- package/dist/clis-main.js +0 -23
- package/dist/parts.js +0 -82
- package/dist/stream.js +0 -123
- package/how-we-work.md +0 -33
- package/skills/ask-matt/LICENSE +0 -21
- package/skills/ask-matt/PHASE-BOUNDARIES.md +0 -55
- package/skills/ask-matt/SKILL.md +0 -97
- package/skills/ask-matt/agents/openai.yaml +0 -5
- package/skills/code-review/LICENSE +0 -21
- package/skills/code-review/SKILL.md +0 -89
- package/skills/code-review/agents/openai.yaml +0 -3
- package/skills/codebase-design/DEEPENING.md +0 -37
- package/skills/codebase-design/DESIGN-IT-TWICE.md +0 -44
- package/skills/codebase-design/LICENSE +0 -21
- package/skills/codebase-design/SKILL.md +0 -114
- package/skills/codebase-design/agents/openai.yaml +0 -3
- package/skills/diagnosing-bugs/LICENSE +0 -21
- package/skills/diagnosing-bugs/SKILL.md +0 -138
- package/skills/diagnosing-bugs/agents/openai.yaml +0 -3
- package/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +0 -44
- package/skills/domain-modeling/ADR-FORMAT.md +0 -47
- package/skills/domain-modeling/GLOSSARY-FORMAT.md +0 -60
- package/skills/domain-modeling/LICENSE +0 -21
- package/skills/domain-modeling/SKILL.md +0 -74
- package/skills/domain-modeling/agents/openai.yaml +0 -3
- package/skills/grill-me/LICENSE +0 -21
- package/skills/grill-me/SKILL.md +0 -7
- package/skills/grill-me/agents/openai.yaml +0 -5
- package/skills/grill-with-docs/LICENSE +0 -21
- package/skills/grill-with-docs/SKILL.md +0 -7
- package/skills/grill-with-docs/agents/openai.yaml +0 -5
- package/skills/grilling/LICENSE +0 -21
- package/skills/grilling/SKILL.md +0 -30
- package/skills/grilling/agents/openai.yaml +0 -3
- package/skills/handoff/LICENSE +0 -21
- package/skills/handoff/SKILL.md +0 -16
- package/skills/handoff/agents/openai.yaml +0 -5
- package/skills/implement/LICENSE +0 -21
- package/skills/implement/SKILL.md +0 -17
- package/skills/implement/agents/openai.yaml +0 -5
- package/skills/implement-spec/LICENSE +0 -21
- package/skills/implement-spec/SKILL.md +0 -40
- package/skills/implement-spec/agents/openai.yaml +0 -5
- package/skills/improve-codebase-architecture/HTML-REPORT.md +0 -123
- package/skills/improve-codebase-architecture/LICENSE +0 -21
- package/skills/improve-codebase-architecture/SKILL.md +0 -71
- package/skills/improve-codebase-architecture/agents/openai.yaml +0 -5
- package/skills/pr/CREDITS.md +0 -3
- package/skills/pr/LICENSE +0 -21
- package/skills/pr/SKILL.md +0 -170
- package/skills/pr/agents/openai.yaml +0 -3
- package/skills/prototype/LICENSE +0 -21
- package/skills/prototype/LOGIC.md +0 -67
- package/skills/prototype/SKILL.md +0 -26
- package/skills/prototype/UI.md +0 -112
- package/skills/prototype/agents/openai.yaml +0 -3
- package/skills/research/LICENSE +0 -21
- package/skills/research/SKILL.md +0 -12
- package/skills/research/agents/openai.yaml +0 -3
- package/skills/retro/LICENSE +0 -21
- package/skills/retro/SKILL.md +0 -44
- package/skills/retro/agents/openai.yaml +0 -5
- package/skills/tdd/LICENSE +0 -21
- package/skills/tdd/SKILL.md +0 -38
- package/skills/tdd/agents/openai.yaml +0 -3
- package/skills/tdd/mocking.md +0 -59
- package/skills/tdd/tests.md +0 -77
- package/skills/teach/GLOSSARY-FORMAT.md +0 -35
- package/skills/teach/LEARNING-RECORD-FORMAT.md +0 -46
- package/skills/teach/LICENSE +0 -21
- package/skills/teach/MISSION-FORMAT.md +0 -31
- package/skills/teach/RESOURCES-FORMAT.md +0 -32
- package/skills/teach/SKILL.md +0 -140
- package/skills/teach/agents/openai.yaml +0 -5
- package/skills/to-questionnaire/LICENSE +0 -21
- package/skills/to-questionnaire/SKILL.md +0 -54
- package/skills/to-questionnaire/agents/openai.yaml +0 -5
- package/skills/to-spec/LICENSE +0 -21
- package/skills/to-spec/SKILL.md +0 -75
- package/skills/to-spec/agents/openai.yaml +0 -5
- package/skills/to-tickets/LICENSE +0 -21
- package/skills/to-tickets/SKILL.md +0 -105
- package/skills/to-tickets/agents/openai.yaml +0 -5
- package/skills/triage/AGENT-BRIEF.md +0 -207
- package/skills/triage/LICENSE +0 -21
- package/skills/triage/OUT-OF-SCOPE.md +0 -105
- package/skills/triage/SKILL.md +0 -112
- package/skills/triage/agents/openai.yaml +0 -5
- package/skills/wait-what/LICENSE +0 -21
- package/skills/wait-what/SKILL.md +0 -7
- package/skills/wait-what/agents/openai.yaml +0 -5
- package/skills/wayfinder/LICENSE +0 -21
- package/skills/wayfinder/SKILL.md +0 -128
- package/skills/wayfinder/agents/openai.yaml +0 -5
- package/skills/wizard/LICENSE +0 -21
- package/skills/wizard/SKILL.md +0 -44
- package/skills/wizard/agents/openai.yaml +0 -3
- package/skills/wizard/template.sh +0 -223
- package/skills/writing-for-agents/LICENSE +0 -21
- package/skills/writing-for-agents/SKILL-MECHANICS.md +0 -22
- package/skills/writing-for-agents/SKILL.md +0 -81
- package/skills/writing-for-agents/agents/openai.yaml +0 -3
package/dist/update.js
CHANGED
|
@@ -1,141 +1,127 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
-
import {
|
|
3
|
-
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
4
|
-
import { homedir } from 'node:os';
|
|
2
|
+
import { mkdir } from 'node:fs/promises';
|
|
5
3
|
import { join } from 'node:path';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import { downloadServed, servedRelease } from './building.js';
|
|
5
|
+
import { KIT_RELEASE } from './clis.js';
|
|
6
|
+
import { restart, updateLine } from './end.js';
|
|
7
|
+
import { kitHome, readEnrolment } from './home.js';
|
|
8
|
+
import { placedPrefix } from './placement.js';
|
|
9
|
+
import { childEnvironment, relayOrigin } from './relay.js';
|
|
10
|
+
const INSTALLER_BYTES = 1_000_000;
|
|
11
|
+
// A release's Node.js, Kit package and adapters are about a hundred megabytes, so an hour carries them at thirty kilobytes a second, and a placement still running then has hung.
|
|
12
|
+
const PLACEMENT_MS = 60 * 60_000;
|
|
13
|
+
// A refused Kit is offline until its placement succeeds, so it tries again within five minutes of its Building or this computer recovering, while a placement that fails only after its hundred-megabyte download runs at most twelve times an hour.
|
|
14
|
+
export const PLACEMENT_RETRY_MS = 5 * 60_000;
|
|
15
|
+
const REFUSED = 'kit_bootstrap_refused: ';
|
|
16
|
+
const OUTPUT_CHARACTERS = 4000;
|
|
17
|
+
function causeOf(error) {
|
|
18
|
+
if (error instanceof TypeError && error.cause instanceof Error)
|
|
19
|
+
return `the Building did not answer: ${error.cause.message}`;
|
|
20
|
+
return error instanceof Error ? error.message : String(error);
|
|
11
21
|
}
|
|
12
|
-
function
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
function placing(installer, house, prefix, signal) {
|
|
23
|
+
return new Promise((resolve) => {
|
|
24
|
+
const relay = relayOrigin();
|
|
25
|
+
const child = spawn('bash', [installer, '--house', house, '--place', prefix], {
|
|
26
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
27
|
+
env: { ...childEnvironment(), ...(relay === undefined ? {} : { HOUSE_KIT_RELAY: relay }) },
|
|
28
|
+
detached: true,
|
|
29
|
+
});
|
|
30
|
+
const stop = () => {
|
|
31
|
+
try {
|
|
32
|
+
process.kill(-child.pid, 'SIGKILL');
|
|
33
|
+
}
|
|
34
|
+
catch { }
|
|
35
|
+
};
|
|
36
|
+
signal.addEventListener('abort', stop, { once: true });
|
|
37
|
+
if (signal.aborted)
|
|
38
|
+
stop();
|
|
39
|
+
let output = '';
|
|
40
|
+
for (const stream of [child.stdout, child.stderr]) {
|
|
41
|
+
stream.setEncoding('utf8').on('data', (chunk) => {
|
|
42
|
+
output = (output + chunk).slice(-OUTPUT_CHARACTERS);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const ended = (failure) => {
|
|
46
|
+
signal.removeEventListener('abort', stop);
|
|
47
|
+
resolve(failure);
|
|
48
|
+
};
|
|
49
|
+
child.on('error', (error) => ended(error.message));
|
|
50
|
+
child.on('close', (status) => {
|
|
51
|
+
if (status === 0)
|
|
52
|
+
return ended(null);
|
|
53
|
+
if (signal.aborted)
|
|
54
|
+
return ended(`the placement did not end within ${PLACEMENT_MS / 1000} seconds`);
|
|
55
|
+
const lines = output.split('\n').filter((line) => line.trim() !== '');
|
|
56
|
+
const refused = lines.findLast((line) => line.startsWith(REFUSED));
|
|
57
|
+
ended(refused?.slice(REFUSED.length) ?? lines.at(-1) ?? `the placement ended with status ${status ?? 'a signal'}`);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
38
60
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
61
|
+
export class KitUpdate {
|
|
62
|
+
calls;
|
|
63
|
+
queue = Promise.resolve();
|
|
64
|
+
placed = null;
|
|
65
|
+
constructor(calls) {
|
|
66
|
+
this.calls = calls;
|
|
42
67
|
}
|
|
43
|
-
|
|
44
|
-
|
|
68
|
+
take(call) {
|
|
69
|
+
void this.calls.carry(call.input_id, async () => ({ result: await this.queued(() => this.update(call.release)) }));
|
|
45
70
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
async function finished(inputId) {
|
|
54
|
-
for (;;) {
|
|
55
|
-
const ack = await recorded();
|
|
56
|
-
if (ack !== null)
|
|
57
|
-
return ack;
|
|
58
|
-
// systemctl answers at once, so ten seconds only bounds a stuck service manager.
|
|
59
|
-
if ((await run('systemctl', [...manager(), 'is-active', '--quiet', unit(inputId)], 10_000)).status !== 0) {
|
|
60
|
-
return (await recorded()) ?? { refused: 'the Kit bootstrap did not finish' };
|
|
71
|
+
async takeRefused(release) {
|
|
72
|
+
for (;;) {
|
|
73
|
+
const failure = await this.queued(async () => (this.placed === null ? this.place(release, 'served') : null));
|
|
74
|
+
if (failure === null)
|
|
75
|
+
restart(`Kit ${this.placed} is placed; its supervisor starts it`);
|
|
76
|
+
process.stderr.write(`kit: ${updateLine(`Kit ${KIT_RELEASE} stays offline and tries again in ${PLACEMENT_RETRY_MS / 60_000} minutes`)}\n`);
|
|
77
|
+
await new Promise((resolve) => setTimeout(resolve, PLACEMENT_RETRY_MS));
|
|
61
78
|
}
|
|
62
|
-
// The bootstrap runs for minutes, so checking each second sees its outcome within a second at little cost.
|
|
63
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
64
79
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return new Promise((resolve) => {
|
|
68
|
-
const [command, ...args] = [
|
|
69
|
-
...elevated(),
|
|
70
|
-
'systemd-run',
|
|
71
|
-
...manager(),
|
|
72
|
-
...account(),
|
|
73
|
-
'--wait',
|
|
74
|
-
'--collect',
|
|
75
|
-
'--quiet',
|
|
76
|
-
`--unit=${unit(inputId)}`,
|
|
77
|
-
`--setenv=HOME=${homedir()}`,
|
|
78
|
-
`--setenv=HOUSE_KIT_HOME=${kitHome()}`,
|
|
79
|
-
'/bin/sh',
|
|
80
|
-
'-c',
|
|
81
|
-
record(),
|
|
82
|
-
script,
|
|
83
|
-
outcome(),
|
|
84
|
-
...placement(),
|
|
85
|
-
...flags,
|
|
86
|
-
];
|
|
87
|
-
const child = spawn(command, args, { stdio: ['ignore', 'ignore', 'inherit'] });
|
|
88
|
-
child.on('error', () => resolve({ refused: 'no service manager runs this Kit' }));
|
|
89
|
-
child.on('close', () => resolve(null));
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
export class Updates {
|
|
93
|
-
house;
|
|
94
|
-
held = new Set();
|
|
95
|
-
queue = Promise.resolve();
|
|
96
|
-
constructor(house) {
|
|
97
|
-
this.house = house;
|
|
80
|
+
placedRelease() {
|
|
81
|
+
return this.placed;
|
|
98
82
|
}
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
await this.acknowledge(inputId, await finished(inputId));
|
|
83
|
+
queued(work) {
|
|
84
|
+
const taken = this.queue.then(work);
|
|
85
|
+
this.queue = taken.catch(() => undefined);
|
|
86
|
+
return taken;
|
|
104
87
|
}
|
|
105
|
-
|
|
106
|
-
if (this.
|
|
107
|
-
return;
|
|
108
|
-
this.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
88
|
+
async update(release) {
|
|
89
|
+
if (release === (this.placed ?? KIT_RELEASE))
|
|
90
|
+
return {};
|
|
91
|
+
if (this.placed !== null)
|
|
92
|
+
return { refused: `Kit ${this.placed} is placed and starts first, once no turn is open` };
|
|
93
|
+
const failure = await this.place(release, 'named');
|
|
94
|
+
if (failure !== null)
|
|
95
|
+
return { refused: failure };
|
|
96
|
+
process.stderr.write(`kit: Kit ${release} is placed; it starts once no turn is open\n`);
|
|
97
|
+
return {};
|
|
114
98
|
}
|
|
115
|
-
async
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
99
|
+
async place(release, which) {
|
|
100
|
+
const signal = AbortSignal.timeout(PLACEMENT_MS);
|
|
101
|
+
let version = release;
|
|
102
|
+
let failure;
|
|
103
|
+
try {
|
|
104
|
+
const prefix = placedPrefix();
|
|
105
|
+
const served = await servedRelease(signal);
|
|
106
|
+
if (which === 'named' && served.version !== release)
|
|
107
|
+
throw new Error(`the Building serves Kit ${served.version}, not Kit ${release}`);
|
|
108
|
+
version = served.version;
|
|
109
|
+
if (version === KIT_RELEASE)
|
|
110
|
+
throw new Error(`the Building serves Kit ${KIT_RELEASE}, which this Kit runs`);
|
|
111
|
+
await mkdir(join(kitHome(), 'update'), { recursive: true, mode: 0o700 });
|
|
112
|
+
const installer = join(kitHome(), 'update', served.installer);
|
|
113
|
+
await downloadServed(served.installer, served.sha256, installer, signal, INSTALLER_BYTES);
|
|
114
|
+
failure = await placing(installer, (await readEnrolment()).house, prefix, signal);
|
|
124
115
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
refused
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
await this.house.deliver(`/kit/inputs/${inputId}/ack`, ack);
|
|
136
|
-
if ((await pendingInput()) !== inputId)
|
|
137
|
-
return;
|
|
138
|
-
await rm(pending(), { force: true });
|
|
139
|
-
await rm(outcome(), { force: true });
|
|
116
|
+
catch (error) {
|
|
117
|
+
failure = signal.aborted ? `the placement did not end within ${PLACEMENT_MS / 1000} seconds` : causeOf(error);
|
|
118
|
+
}
|
|
119
|
+
if (failure !== null) {
|
|
120
|
+
const refused = `Kit ${version} could not be placed: ${failure}`;
|
|
121
|
+
process.stderr.write(`kit: ${refused}\n`);
|
|
122
|
+
return refused;
|
|
123
|
+
}
|
|
124
|
+
this.placed = version;
|
|
125
|
+
return null;
|
|
140
126
|
}
|
|
141
127
|
}
|
package/dist/wire.js
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
|
+
import { newerThanHouse, updateRequired } from './end.js';
|
|
2
|
+
import { machine } from './placement.js';
|
|
1
3
|
import { refusalOf } from './refusals.js';
|
|
2
|
-
export const KIT_WIRE =
|
|
4
|
+
export const KIT_WIRE = 6;
|
|
3
5
|
export const KIT_WIRE_HEADER = 'x-house-kit-wire';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
let take = null;
|
|
7
|
+
let taken = false;
|
|
8
|
+
function unservedBy(text) {
|
|
9
|
+
let body;
|
|
10
|
+
try {
|
|
11
|
+
body = JSON.parse(text);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const error = body?.error;
|
|
17
|
+
if (error?.code !== 'kit_update_required' && error?.code !== 'kit_newer_than_house')
|
|
18
|
+
return null;
|
|
19
|
+
return typeof error.release === 'string' ? error : null;
|
|
20
|
+
}
|
|
21
|
+
export function takeUnservedRelease(taking) {
|
|
22
|
+
take = taking;
|
|
23
|
+
}
|
|
24
|
+
export function unserved() {
|
|
25
|
+
return taken;
|
|
26
|
+
}
|
|
27
|
+
export function endUnserved(text) {
|
|
28
|
+
const refused = unservedBy(text);
|
|
29
|
+
if (refused !== null && take !== null) {
|
|
30
|
+
if (!taken) {
|
|
31
|
+
taken = true;
|
|
32
|
+
take(refused.release);
|
|
33
|
+
}
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (refusalOf(text)?.code === 'kit_update_required')
|
|
37
|
+
updateRequired();
|
|
38
|
+
if (refused?.code === 'kit_newer_than_house')
|
|
39
|
+
newerThanHouse(refused.release, refused.commands[machine()]);
|
|
6
40
|
}
|
package/dist/work.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import { once } from 'node:events';
|
|
3
3
|
import { readFileSync } from 'node:fs';
|
|
4
|
-
import {
|
|
4
|
+
import { rm } from 'node:fs/promises';
|
|
5
5
|
import { createServer } from 'node:net';
|
|
6
6
|
import { join } from 'node:path';
|
|
7
7
|
import { RUNNING_JOB } from './events.js';
|
|
8
|
-
import { kitHome } from './home.js';
|
|
8
|
+
import { kitHome, socketDirectory } from './home.js';
|
|
9
9
|
const ENDED_TASK = new Set(['completed', 'failed', 'killed']);
|
|
10
10
|
const SCHEDULING = new Set(['CronCreate', 'CronDelete', 'ScheduleWakeup']);
|
|
11
11
|
const QUEUE_LIST = 'house-kit-queue-';
|
|
@@ -177,6 +177,7 @@ class ClaudeWork extends Work {
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
class CodexWork extends Work {
|
|
180
|
+
tapped;
|
|
180
181
|
threads = new Map();
|
|
181
182
|
queues = new Map();
|
|
182
183
|
goals = new Set();
|
|
@@ -193,10 +194,12 @@ class CodexWork extends Work {
|
|
|
193
194
|
heard = 0;
|
|
194
195
|
proving = -1;
|
|
195
196
|
proven = -1;
|
|
197
|
+
constructor(changed, tapped) {
|
|
198
|
+
super(changed);
|
|
199
|
+
this.tapped = tapped;
|
|
200
|
+
}
|
|
196
201
|
async open(cli) {
|
|
197
|
-
|
|
198
|
-
await mkdir(sockets, { recursive: true, mode: 0o700 });
|
|
199
|
-
this.path = join(sockets, `${randomUUID()}.sock`);
|
|
202
|
+
this.path = join(socketDirectory(), `${randomUUID()}.sock`);
|
|
200
203
|
this.server = createServer((socket) => this.connected(socket));
|
|
201
204
|
this.server.listen(this.path);
|
|
202
205
|
await once(this.server, 'listening');
|
|
@@ -276,6 +279,8 @@ class CodexWork extends Work {
|
|
|
276
279
|
}
|
|
277
280
|
stream(message, socket) {
|
|
278
281
|
const params = message.params;
|
|
282
|
+
if (message.method !== undefined)
|
|
283
|
+
this.tapped(message);
|
|
279
284
|
switch (message.method) {
|
|
280
285
|
case 'thread/status/changed':
|
|
281
286
|
this.threads.set(params.threadId, params.status.type === 'active' && params.status.activeFlags.length === 0);
|
|
@@ -339,10 +344,10 @@ class GrokWork extends Work {
|
|
|
339
344
|
return true;
|
|
340
345
|
}
|
|
341
346
|
}
|
|
342
|
-
export function workFor(kind, cwd, changed) {
|
|
347
|
+
export function workFor(kind, cwd, changed, tapped) {
|
|
343
348
|
if (kind === 'claude-agent-acp')
|
|
344
349
|
return new ClaudeWork(cwd, changed);
|
|
345
350
|
if (kind === 'codex-acp')
|
|
346
|
-
return new CodexWork(changed);
|
|
351
|
+
return new CodexWork(changed, tapped);
|
|
347
352
|
return new GrokWork(changed);
|
|
348
353
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentshouse/kit",
|
|
3
|
-
"version": "0.2.1-
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.1-cfbadfb5b5e28",
|
|
4
|
+
"description": "Kit connects an Environment to agents.house.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -12,28 +12,29 @@
|
|
|
12
12
|
"kit": "dist/kit-main.js",
|
|
13
13
|
"house": "dist/house-main.js"
|
|
14
14
|
},
|
|
15
|
-
"exports": {
|
|
16
|
-
"./bootstrap": "./dist/bootstrap.json"
|
|
17
|
-
},
|
|
18
15
|
"files": [
|
|
19
|
-
"dist"
|
|
20
|
-
"how-we-work.md",
|
|
21
|
-
"skills"
|
|
16
|
+
"dist"
|
|
22
17
|
],
|
|
23
18
|
"scripts": {
|
|
24
|
-
"
|
|
19
|
+
"bootstrap-manifest": "node scripts/bootstrap-manifest.mjs",
|
|
20
|
+
"build": "tsc -p tsconfig.build.json",
|
|
25
21
|
"engine": "mkdir -p tmp/engine && docker run --rm -v \"$PWD:/kit\" -w /kit alpine:3.24@sha256:294b683cb724975bec92580e1e685676bd4b50bda910ddb8c51d4cabeaec77e6 sh scripts/engine.sh tmp/engine",
|
|
26
|
-
"
|
|
22
|
+
"follow-skills": "node scripts/follow-skills.mjs",
|
|
23
|
+
"release-files": "node scripts/release-files.mjs",
|
|
27
24
|
"test": "tsc -p tsconfig.json && vitest run"
|
|
28
25
|
},
|
|
29
26
|
"dependencies": {
|
|
30
|
-
"@agentclientprotocol/sdk": "
|
|
31
|
-
"@agentshouse/mdmodel": "0.1.0-
|
|
27
|
+
"@agentclientprotocol/sdk": "2.4.0",
|
|
28
|
+
"@agentshouse/mdmodel": "0.1.0-cd6a8e5bc7efc",
|
|
29
|
+
"@agentshouse/session-content": "0.1.0-cad437697294e",
|
|
30
|
+
"@agentshouse/skills": "0.1.0-ca3a9a5296c61",
|
|
31
|
+
"@lydell/node-pty": "1.2.0-beta.15",
|
|
32
|
+
"micromark": "4.0.2",
|
|
32
33
|
"yaml": "2.9.1"
|
|
33
34
|
},
|
|
34
35
|
"peerDependencies": {
|
|
35
|
-
"@agentclientprotocol/claude-agent-acp": "0.
|
|
36
|
-
"@agentclientprotocol/codex-acp": "2.
|
|
36
|
+
"@agentclientprotocol/claude-agent-acp": "0.100.0",
|
|
37
|
+
"@agentclientprotocol/codex-acp": "2.5.0"
|
|
37
38
|
},
|
|
38
39
|
"peerDependenciesMeta": {
|
|
39
40
|
"@agentclientprotocol/claude-agent-acp": {
|
|
@@ -44,26 +45,26 @@
|
|
|
44
45
|
}
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@types/node": "24.
|
|
48
|
+
"@types/node": "24.19.2",
|
|
48
49
|
"@types/ws": "8.18.2",
|
|
49
50
|
"typescript": "7.0.2",
|
|
50
|
-
"vitest": "5.0.
|
|
51
|
+
"vitest": "5.0.5",
|
|
51
52
|
"ws": "8.22.0"
|
|
52
53
|
},
|
|
53
|
-
"packageManager": "npm@11.19.
|
|
54
|
+
"packageManager": "npm@11.19.1",
|
|
54
55
|
"engines": {
|
|
55
|
-
"node": "24.
|
|
56
|
-
"npm": "11.19.
|
|
56
|
+
"node": "24.22.1",
|
|
57
|
+
"npm": "11.19.1"
|
|
57
58
|
},
|
|
58
59
|
"devEngines": {
|
|
59
60
|
"runtime": {
|
|
60
61
|
"name": "node",
|
|
61
|
-
"version": "24.
|
|
62
|
+
"version": "24.22.1",
|
|
62
63
|
"onFail": "error"
|
|
63
64
|
},
|
|
64
65
|
"packageManager": {
|
|
65
66
|
"name": "npm",
|
|
66
|
-
"version": "11.19.
|
|
67
|
+
"version": "11.19.1",
|
|
67
68
|
"onFail": "error"
|
|
68
69
|
}
|
|
69
70
|
}
|
package/dist/bootstrap.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"schemaVersion": 2,
|
|
3
|
-
"version": "0.2.1-cfb7b543f2af6",
|
|
4
|
-
"hosts": {
|
|
5
|
-
"macos": {
|
|
6
|
-
"asset": {
|
|
7
|
-
"name": "connect-linux.sh",
|
|
8
|
-
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-cfb7b543f2af6/connect-linux.sh"
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
"linux": {
|
|
12
|
-
"asset": {
|
|
13
|
-
"name": "connect-linux.sh",
|
|
14
|
-
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-cfb7b543f2af6/connect-linux.sh"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"windows": {
|
|
18
|
-
"asset": {
|
|
19
|
-
"name": "connect-windows.ps1",
|
|
20
|
-
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-cfb7b543f2af6/connect-windows.ps1"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
package/dist/chatgpt.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { parseArgs } from 'node:util';
|
|
2
|
-
import { placeAppGit } from './app-git.js';
|
|
3
|
-
import { kitHome, readOwnAgent, writeOwnAgent } from './home.js';
|
|
4
|
-
import { accepted, DEFAULT_HOUSE } from './login.js';
|
|
5
|
-
const KEY_SOURCE = 'New key for a script on Connections';
|
|
6
|
-
const USAGE = `usage: kit chatgpt --key <key> [--house <origin>]
|
|
7
|
-
--key <key> a key from ${KEY_SOURCE}
|
|
8
|
-
--house <origin> the House of the key, ${DEFAULT_HOUSE} unless one is stored
|
|
9
|
-
`;
|
|
10
|
-
export async function chatgpt(argv) {
|
|
11
|
-
const { values } = parseArgs({
|
|
12
|
-
args: argv,
|
|
13
|
-
options: { key: { type: 'string' }, house: { type: 'string' }, help: { type: 'boolean', default: false } },
|
|
14
|
-
});
|
|
15
|
-
if (values.help) {
|
|
16
|
-
process.stdout.write(USAGE);
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (values.key === undefined)
|
|
20
|
-
throw new Error(`pass --key with a key from ${KEY_SOURCE}`);
|
|
21
|
-
const before = await readOwnAgent();
|
|
22
|
-
const house = values.house ?? before?.house ?? DEFAULT_HOUSE;
|
|
23
|
-
if (!(await accepted(house, values.key)))
|
|
24
|
-
throw new Error(`${house} does not accept this key; pass one from ${KEY_SOURCE}`);
|
|
25
|
-
const relay = process.env.HOUSE_KIT_RELAY || undefined;
|
|
26
|
-
await writeOwnAgent({ house, ...(relay === undefined ? {} : { relay }), credential: values.key });
|
|
27
|
-
await placeAppGit(before, await readOwnAgent()).catch((error) => process.stderr.write(`kit: ${error.message}\n`));
|
|
28
|
-
if (before !== null && before.credential !== values.key) {
|
|
29
|
-
process.stdout.write('This replaced the key this Kit home held; give each session its own HOUSE_KIT_HOME to keep its own key.\n');
|
|
30
|
-
}
|
|
31
|
-
process.stdout.write(`house now calls ${house} as you, with the key kept in ${kitHome()}.\n`);
|
|
32
|
-
}
|
package/dist/clis-main.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { setGlobalProxyFromEnv } from 'node:http';
|
|
2
|
-
import { post } from './api.js';
|
|
3
|
-
import { CLIS, below, locate, versionOf } from './clis.js';
|
|
4
|
-
import { readEnrolment } from './home.js';
|
|
5
|
-
setGlobalProxyFromEnv();
|
|
6
|
-
try {
|
|
7
|
-
const { house, credential } = (await readEnrolment());
|
|
8
|
-
const { agents } = await post(house, '/kit/agents/desired', {}, credential);
|
|
9
|
-
for (const kind of agents) {
|
|
10
|
-
const cli = await locate(kind);
|
|
11
|
-
if (cli === null)
|
|
12
|
-
continue;
|
|
13
|
-
const release = await versionOf(cli);
|
|
14
|
-
if (release === null)
|
|
15
|
-
continue;
|
|
16
|
-
const { bin, minimum } = CLIS[kind];
|
|
17
|
-
process.stdout.write(`${[bin, cli, release, minimum, below(release, minimum) ? 'old' : 'current'].join('\t')}\n`);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
process.stderr.write(`kit: ${error.message}\n`);
|
|
22
|
-
process.exitCode = 1;
|
|
23
|
-
}
|
package/dist/parts.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
export class Parts {
|
|
2
|
-
parts = [];
|
|
3
|
-
context = null;
|
|
4
|
-
emit;
|
|
5
|
-
made = [];
|
|
6
|
-
events = 0;
|
|
7
|
-
writing = null;
|
|
8
|
-
counting = null;
|
|
9
|
-
planned = null;
|
|
10
|
-
constructor(emit) {
|
|
11
|
-
this.emit = emit;
|
|
12
|
-
}
|
|
13
|
-
write(type, id, text) {
|
|
14
|
-
if (text === '')
|
|
15
|
-
return;
|
|
16
|
-
if (this.writing?.type === type && this.writing.id === id) {
|
|
17
|
-
this.parts[this.writing.index].text += text;
|
|
18
|
-
this.emit({ op: 'append', index: this.writing.index, text });
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
this.writing = { type, id, index: this.start({ type, text }) };
|
|
22
|
-
}
|
|
23
|
-
command() {
|
|
24
|
-
if (this.counting === null) {
|
|
25
|
-
this.counting = this.start({ type: 'commands', count: 1 });
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const part = this.parts[this.counting];
|
|
29
|
-
part.count++;
|
|
30
|
-
this.emit({ op: 'count', index: this.counting, count: part.count });
|
|
31
|
-
}
|
|
32
|
-
start(part) {
|
|
33
|
-
this.writing = null;
|
|
34
|
-
this.counting = null;
|
|
35
|
-
return this.add(part, ++this.events);
|
|
36
|
-
}
|
|
37
|
-
reserve() {
|
|
38
|
-
this.writing = null;
|
|
39
|
-
this.counting = null;
|
|
40
|
-
return ++this.events;
|
|
41
|
-
}
|
|
42
|
-
arrive(part, reserved) {
|
|
43
|
-
this.add(part, reserved);
|
|
44
|
-
}
|
|
45
|
-
done(index, result) {
|
|
46
|
-
const part = this.parts[index];
|
|
47
|
-
part.status = 'done';
|
|
48
|
-
part.result = result;
|
|
49
|
-
this.emit({ op: 'status', index, status: 'done', result });
|
|
50
|
-
}
|
|
51
|
-
plan(entries) {
|
|
52
|
-
if (this.planned === null) {
|
|
53
|
-
this.planned = this.start({ type: 'plan', entries });
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
this.parts[this.planned].entries = entries;
|
|
57
|
-
this.emit({ op: 'plan', index: this.planned, entries });
|
|
58
|
-
}
|
|
59
|
-
measure(context) {
|
|
60
|
-
this.context = context;
|
|
61
|
-
this.emit({ op: 'context', ...context });
|
|
62
|
-
}
|
|
63
|
-
saved() {
|
|
64
|
-
return this.parts
|
|
65
|
-
.map((part, index) => ({ part, made: this.made[index] }))
|
|
66
|
-
.sort((a, b) => a.made - b.made)
|
|
67
|
-
.map(({ part }) => part);
|
|
68
|
-
}
|
|
69
|
-
operations() {
|
|
70
|
-
return [
|
|
71
|
-
...this.parts.map((part, index) => ({ op: 'start', index, part })),
|
|
72
|
-
...(this.context === null ? [] : [{ op: 'context', ...this.context }]),
|
|
73
|
-
];
|
|
74
|
-
}
|
|
75
|
-
add(part, made) {
|
|
76
|
-
this.parts.push(part);
|
|
77
|
-
this.made.push(made);
|
|
78
|
-
const index = this.parts.length - 1;
|
|
79
|
-
this.emit({ op: 'start', index, part });
|
|
80
|
-
return index;
|
|
81
|
-
}
|
|
82
|
-
}
|