@agentshouse/kit 0.2.1-ce47f621f90e1 → 0.2.1-ce9401bb7d372
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 +3 -4
- package/dist/acp.js +1 -1
- package/dist/afk.js +17 -0
- package/dist/agents.js +45 -13
- package/dist/api.js +11 -6
- package/dist/authority-main.js +2 -2
- package/dist/bridge.js +4 -4
- package/dist/calls.js +1 -1
- package/dist/chunks.js +49 -0
- package/dist/clis.js +16 -8
- package/dist/connection.js +25 -10
- package/dist/content.js +63 -0
- package/dist/conversations.js +236 -115
- package/dist/copies.js +293 -148
- package/dist/end.js +1 -8
- package/dist/events.js +729 -218
- package/dist/files.js +2 -2
- package/dist/git.js +44 -10
- package/dist/grok.js +39 -0
- package/dist/house-cli.js +81 -21
- package/dist/instructions.js +2 -4
- package/dist/kit-cli.js +1 -4
- package/dist/login.js +12 -5
- package/dist/logout.js +2 -2
- package/dist/mcp.js +2 -2
- package/dist/placement.js +0 -6
- package/dist/resident.js +39 -32
- package/dist/scripts.js +59 -11
- package/dist/secret-input.js +1 -1
- package/dist/transcription.js +5 -2
- package/dist/translate.js +18 -9
- package/dist/update.js +2 -1
- package/dist/wire.js +2 -10
- package/dist/work.js +9 -2
- package/package.json +12 -8
- package/dist/chatgpt.js +0 -32
- package/dist/enrol-main.js +0 -10
- package/dist/parts.js +0 -82
package/dist/secret-input.js
CHANGED
|
@@ -2,7 +2,7 @@ import { finalRefusal, retryDelay } from './api.js';
|
|
|
2
2
|
export async function holdSecretInput(house, subject, steps, waiting) {
|
|
3
3
|
for (let failures = 0; waiting();) {
|
|
4
4
|
try {
|
|
5
|
-
const held = await house.
|
|
5
|
+
const held = await house.act('secret-inputs/await', { subject, steps });
|
|
6
6
|
if (held.outcome === 'collected')
|
|
7
7
|
return held.content;
|
|
8
8
|
if (held.release !== 'held')
|
package/dist/transcription.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { chmod, mkdir, mkdtemp, readdir, readFile, rename, rm, stat } from 'node:fs/promises';
|
|
2
2
|
import { availableParallelism, tmpdir } from 'node:os';
|
|
3
3
|
import { basename, join } from 'node:path';
|
|
4
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
4
5
|
import { unlessAborted } from './abort.js';
|
|
5
6
|
import { downloadServed } from './building.js';
|
|
6
7
|
import { failureOf, run } from './clis.js';
|
|
@@ -125,7 +126,7 @@ async function install(artifacts, signal) {
|
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
function reported(next) {
|
|
128
|
-
const changed = next
|
|
129
|
+
const changed = !isDeepStrictEqual(next, readiness);
|
|
129
130
|
readiness = next;
|
|
130
131
|
return changed;
|
|
131
132
|
}
|
|
@@ -137,10 +138,12 @@ async function settle(transcribe) {
|
|
|
137
138
|
await rm(directory(), { recursive: true, force: true });
|
|
138
139
|
return reported({ installed: false, failure: null });
|
|
139
140
|
}
|
|
141
|
+
const pinned = pinnedHere();
|
|
142
|
+
if (pinned === undefined)
|
|
143
|
+
return reported({ installed: false, failure: null, no_engine: true });
|
|
140
144
|
const download = new AbortController();
|
|
141
145
|
downloading = download;
|
|
142
146
|
try {
|
|
143
|
-
const pinned = pinnedHere();
|
|
144
147
|
await install([pinned.decoder, pinned.engine, MODEL], download.signal);
|
|
145
148
|
return reported({ installed: true, failure: null });
|
|
146
149
|
}
|
package/dist/translate.js
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import { apply, parse, serialize } from '@agentshouse/mdmodel';
|
|
1
|
+
import { apply, definitionAt, HOUSE_TYPED_PATHS, parse, serialize, } from '@agentshouse/mdmodel';
|
|
2
2
|
function same(left, right) {
|
|
3
3
|
return JSON.stringify(left) === JSON.stringify(right);
|
|
4
4
|
}
|
|
5
|
-
function applied(document, changes) {
|
|
6
|
-
const result = apply(document, changes);
|
|
5
|
+
function applied(document, changes, definition) {
|
|
6
|
+
const result = apply(document, changes, definition);
|
|
7
7
|
return result.outcome === 'applied' ? serialize(result.document) : null;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
export function readDocument(content, file, model) {
|
|
10
|
+
const definitions = definitionAt(model, file, HOUSE_TYPED_PATHS);
|
|
11
|
+
const parsed = parse(content, file, definitions);
|
|
12
|
+
if (!parsed.ok)
|
|
13
|
+
return null;
|
|
14
|
+
const { document } = parsed;
|
|
15
|
+
const definition = definitions(document.type);
|
|
16
|
+
return definition !== undefined || document.type === undefined ? { document, definition } : null;
|
|
17
|
+
}
|
|
18
|
+
function components(path, before, after, text, definition) {
|
|
10
19
|
const edits = [];
|
|
11
20
|
const changes = [];
|
|
12
21
|
if (before.preamble !== after.preamble) {
|
|
@@ -33,13 +42,13 @@ function components(path, before, after, text) {
|
|
|
33
42
|
edits.push({ op: 'replace_section', path, section: name, base: prior, content: value });
|
|
34
43
|
changes.push({ kind: 'section', name, value, prior });
|
|
35
44
|
}
|
|
36
|
-
return edits.length > 0 && applied(before, changes) === text ? edits : null;
|
|
45
|
+
return edits.length > 0 && applied(before, changes, definition) === text ? edits : null;
|
|
37
46
|
}
|
|
38
|
-
export function changed(path, file, base, before, after) {
|
|
47
|
+
export function changed(path, file, base, before, after, model) {
|
|
39
48
|
if (!file.endsWith('.md'))
|
|
40
49
|
return [{ op: 'replace', path, base, content: after }];
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const structured =
|
|
50
|
+
const prior = readDocument(before, file, model);
|
|
51
|
+
const next = readDocument(after, file, model);
|
|
52
|
+
const structured = prior !== null && next !== null ? components(path, prior.document, next.document, after, prior.definition) : null;
|
|
44
53
|
return structured ?? [{ op: 'replace', path, base, content: after }];
|
|
45
54
|
}
|
package/dist/update.js
CHANGED
|
@@ -93,7 +93,8 @@ export class KitUpdate {
|
|
|
93
93
|
const failure = await this.place(release, 'named');
|
|
94
94
|
if (failure !== null)
|
|
95
95
|
return { refused: failure };
|
|
96
|
-
process.
|
|
96
|
+
const starts = process.env.HOUSE_KIT_SANDBOX === '1' ? 'when the Sandbox starts again' : 'once no turn is open';
|
|
97
|
+
process.stderr.write(`kit: Kit ${release} is placed; it starts ${starts}\n`);
|
|
97
98
|
return {};
|
|
98
99
|
}
|
|
99
100
|
async place(release, which) {
|
package/dist/wire.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { machine } from './placement.js';
|
|
1
|
+
import { updateRequired } from './end.js';
|
|
3
2
|
import { refusalOf } from './refusals.js';
|
|
4
|
-
export const KIT_WIRE = 4;
|
|
5
|
-
export const KIT_WIRE_HEADER = 'x-house-kit-wire';
|
|
6
3
|
let take = null;
|
|
7
4
|
let taken = false;
|
|
8
5
|
function unservedBy(text) {
|
|
@@ -13,10 +10,7 @@ function unservedBy(text) {
|
|
|
13
10
|
catch {
|
|
14
11
|
return null;
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
if (error?.code !== 'kit_update_required' && error?.code !== 'kit_newer_than_house')
|
|
18
|
-
return null;
|
|
19
|
-
return typeof error.release === 'string' ? error : null;
|
|
13
|
+
return body?.error?.code === 'kit_update_required' ? body.error : null;
|
|
20
14
|
}
|
|
21
15
|
export function takeUnservedRelease(taking) {
|
|
22
16
|
take = taking;
|
|
@@ -35,6 +29,4 @@ export function endUnserved(text) {
|
|
|
35
29
|
}
|
|
36
30
|
if (refusalOf(text)?.code === 'kit_update_required')
|
|
37
31
|
updateRequired();
|
|
38
|
-
if (refused?.code === 'kit_newer_than_house')
|
|
39
|
-
newerThanHouse(refused.release, refused.commands[machine()]);
|
|
40
32
|
}
|
package/dist/work.js
CHANGED
|
@@ -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,6 +194,10 @@ 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
202
|
this.path = join(socketDirectory(), `${randomUUID()}.sock`);
|
|
198
203
|
this.server = createServer((socket) => this.connected(socket));
|
|
@@ -274,6 +279,8 @@ class CodexWork extends Work {
|
|
|
274
279
|
}
|
|
275
280
|
stream(message, socket) {
|
|
276
281
|
const params = message.params;
|
|
282
|
+
if (message.method !== undefined)
|
|
283
|
+
this.tapped(message);
|
|
277
284
|
switch (message.method) {
|
|
278
285
|
case 'thread/status/changed':
|
|
279
286
|
this.threads.set(params.threadId, params.status.type === 'active' && params.status.activeFlags.length === 0);
|
|
@@ -337,10 +344,10 @@ class GrokWork extends Work {
|
|
|
337
344
|
return true;
|
|
338
345
|
}
|
|
339
346
|
}
|
|
340
|
-
export function workFor(kind, cwd, changed) {
|
|
347
|
+
export function workFor(kind, cwd, changed, tapped) {
|
|
341
348
|
if (kind === 'claude-agent-acp')
|
|
342
349
|
return new ClaudeWork(cwd, changed);
|
|
343
350
|
if (kind === 'codex-acp')
|
|
344
|
-
return new CodexWork(changed);
|
|
351
|
+
return new CodexWork(changed, tapped);
|
|
345
352
|
return new GrokWork(changed);
|
|
346
353
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentshouse/kit",
|
|
3
|
-
"version": "0.2.1-
|
|
3
|
+
"version": "0.2.1-ce9401bb7d372",
|
|
4
4
|
"description": "Kit connects an Environment to agents.house.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -19,20 +19,23 @@
|
|
|
19
19
|
"bootstrap-manifest": "node scripts/bootstrap-manifest.mjs",
|
|
20
20
|
"build": "tsc -p tsconfig.build.json",
|
|
21
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",
|
|
22
|
-
"follow-skills": "node scripts/follow-skills.mjs",
|
|
22
|
+
"follow-skills-and-kit-wire": "node scripts/follow-skills-and-kit-wire.mjs",
|
|
23
23
|
"release-files": "node scripts/release-files.mjs",
|
|
24
24
|
"test": "tsc -p tsconfig.json && vitest run"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@agentclientprotocol/sdk": "2.0
|
|
28
|
-
"@agentshouse/
|
|
29
|
-
"@agentshouse/
|
|
27
|
+
"@agentclientprotocol/sdk": "2.4.0",
|
|
28
|
+
"@agentshouse/kit-wire": "0.1.0-ce39c80194ad4",
|
|
29
|
+
"@agentshouse/mdmodel": "0.1.0-cd6a8e5bc7efc",
|
|
30
|
+
"@agentshouse/session-content": "0.1.0-cad437697294e",
|
|
31
|
+
"@agentshouse/skills": "0.1.0-c094c13538a89",
|
|
30
32
|
"@lydell/node-pty": "1.2.0-beta.15",
|
|
33
|
+
"micromark": "4.0.2",
|
|
31
34
|
"yaml": "2.9.1"
|
|
32
35
|
},
|
|
33
36
|
"peerDependencies": {
|
|
34
|
-
"@agentclientprotocol/claude-agent-acp": "0.
|
|
35
|
-
"@agentclientprotocol/codex-acp": "2.
|
|
37
|
+
"@agentclientprotocol/claude-agent-acp": "0.100.0",
|
|
38
|
+
"@agentclientprotocol/codex-acp": "2.5.0"
|
|
36
39
|
},
|
|
37
40
|
"peerDependenciesMeta": {
|
|
38
41
|
"@agentclientprotocol/claude-agent-acp": {
|
|
@@ -47,7 +50,8 @@
|
|
|
47
50
|
"@types/ws": "8.18.2",
|
|
48
51
|
"typescript": "7.0.2",
|
|
49
52
|
"vitest": "5.0.5",
|
|
50
|
-
"ws": "8.22.0"
|
|
53
|
+
"ws": "8.22.0",
|
|
54
|
+
"zod": "4.6.7"
|
|
51
55
|
},
|
|
52
56
|
"packageManager": "npm@11.19.1",
|
|
53
57
|
"engines": {
|
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(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/enrol-main.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { writeEnrolment } from './home.js';
|
|
3
|
-
const [house, environment] = process.argv.slice(2);
|
|
4
|
-
const relay = process.env.HOUSE_KIT_RELAY || undefined;
|
|
5
|
-
await writeEnrolment({
|
|
6
|
-
house: house,
|
|
7
|
-
...(relay === undefined ? {} : { relay }),
|
|
8
|
-
environment: environment,
|
|
9
|
-
credential: readFileSync(0, 'utf8').trim(),
|
|
10
|
-
});
|
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
|
-
}
|