@agentshouse/kit 0.2.1-ce47f621f90e1 → 0.2.1-ce8e5419af3f9

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/dist/files.js CHANGED
@@ -27,7 +27,7 @@ export function inspectedFile(answer) {
27
27
  media_type: typeof inspected.media_type === 'string' ? inspected.media_type : null,
28
28
  };
29
29
  }
30
- function paused(milliseconds) {
30
+ export function paused(milliseconds) {
31
31
  return new Promise((resolve) => setTimeout(resolve, milliseconds));
32
32
  }
33
33
  export function storeRefusal(act, status) {
@@ -140,5 +140,5 @@ export async function downloaded(address, fetching, destination, name) {
140
140
  }
141
141
  export async function fetched(url, signal) {
142
142
  const answer = await fetch(relayed(url), { signal });
143
- return { status: answer.status, body: answer.body ?? Readable.from([]) };
143
+ return { status: answer.status, body: answer.body === null ? Readable.from([]) : Readable.fromWeb(answer.body) };
144
144
  }
package/dist/git.js CHANGED
@@ -70,18 +70,52 @@ function data(text) {
70
70
  const bytes = Buffer.from(text, 'utf8');
71
71
  return [Buffer.from(`data ${bytes.length}\n`), bytes, Buffer.from('\n')];
72
72
  }
73
- export async function importCommits(repository, commits) {
74
- const stream = [];
73
+ function written(stream, bytes) {
74
+ return new Promise((resolve, reject) => {
75
+ stream.write(bytes, (error) => (error ? reject(error) : resolve()));
76
+ });
77
+ }
78
+ async function imported(stream, commits) {
79
+ await written(stream, Buffer.from('feature done\n'));
75
80
  for (const [index, commit] of commits.entries()) {
76
- stream.push(Buffer.from(`commit ${HOUSE_REF}\nmark :${index + 1}\ncommitter ${COMMITTER} ${Math.floor(Date.now() / 1000)} +0000\n`), ...data(commit.message), ...(commit.from === null ? [] : [Buffer.from(`from ${commit.from}\n`)]), ...(commit.merge === undefined ? [] : [Buffer.from(`merge ${commit.merge}\n`)]), ...(commit.replaces === true ? [Buffer.from('deleteall\n')] : []));
77
- for (const [path, content] of commit.files) {
78
- if (content === null)
79
- stream.push(Buffer.from(`D ${quoted(path)}\n`));
80
- else
81
- stream.push(Buffer.from(`M 100644 inline ${quoted(path)}\n`), ...data(content));
81
+ await written(stream, Buffer.concat([
82
+ Buffer.from(`commit ${HOUSE_REF}\nmark :${index + 1}\ncommitter ${COMMITTER} ${Math.floor(Date.now() / 1000)} +0000\n`),
83
+ ...data(commit.message),
84
+ ...(commit.from === null ? [] : [Buffer.from(`from ${commit.from}\n`)]),
85
+ ...(commit.merge === undefined ? [] : [Buffer.from(`merge ${commit.merge}\n`)]),
86
+ ...(commit.replaces === true ? [Buffer.from('deleteall\n')] : []),
87
+ ]));
88
+ for await (const [path, content] of commit.files) {
89
+ await written(stream, content === null
90
+ ? Buffer.from(`D ${quoted(path)}\n`)
91
+ : Buffer.concat([Buffer.from(`M 100644 inline ${quoted(path)}\n`), ...data(content)]));
82
92
  }
83
- stream.push(Buffer.from('\n'));
93
+ await written(stream, Buffer.from('\n'));
94
+ }
95
+ await written(stream, Buffer.from('done\n'));
96
+ }
97
+ export async function importCommits(repository, commits) {
98
+ const child = spawn('git', ['fast-import', '--quiet', '--force'], { cwd: repository, env: childEnvironment() });
99
+ let stderr = '';
100
+ child.stdout.resume();
101
+ child.stderr.on('data', (chunk) => {
102
+ stderr += chunk.toString('utf8');
103
+ });
104
+ child.stdin.on('error', () => undefined);
105
+ const closed = new Promise((resolve, reject) => {
106
+ child.on('error', reject);
107
+ child.on('close', resolve);
108
+ });
109
+ try {
110
+ await imported(child.stdin, commits);
111
+ child.stdin.end();
112
+ }
113
+ catch (error) {
114
+ child.stdin.destroy();
115
+ await closed;
116
+ throw error.code === 'EPIPE' ? new Error(`git fast-import failed: ${stderr.trim()}`) : error;
84
117
  }
85
- await git(repository, ['fast-import', '--quiet', '--force'], Buffer.concat(stream));
118
+ if ((await closed) !== 0)
119
+ throw new Error(`git fast-import failed: ${stderr.trim()}`);
86
120
  return revision(repository, HOUSE_REF);
87
121
  }
package/dist/grok.js ADDED
@@ -0,0 +1,39 @@
1
+ const PLAN = 'plan';
2
+ const PLAN_ABANDONED = 'abandoned';
3
+ const PLAN_FIELD = {
4
+ type: 'string',
5
+ title: 'Approve this plan?',
6
+ oneOf: [
7
+ { const: 'approved', title: 'Approve' },
8
+ { const: PLAN_ABANDONED, title: 'Abandon' },
9
+ ],
10
+ };
11
+ function form(sessionId, message, properties) {
12
+ return { mode: 'form', sessionId, message, requestedSchema: { type: 'object', properties } };
13
+ }
14
+ function questionField({ options, multiSelect }, title) {
15
+ const choices = options.map(({ label, description }) => ({ const: label, title: label, description }));
16
+ return multiSelect === true ? { type: 'array', title, items: { anyOf: choices } } : { type: 'string', title, oneOf: choices };
17
+ }
18
+ export function grokQuestionForm({ sessionId, questions }) {
19
+ const lone = questions.length === 1;
20
+ return form(sessionId, questions.map(({ question }) => question).join('\n\n'), Object.fromEntries(questions.map((one) => [one.question, questionField(one, lone ? 'Answer' : one.question)])));
21
+ }
22
+ function answerText(value) {
23
+ return Array.isArray(value) ? value.join(', ') : String(value);
24
+ }
25
+ function contentOf(response) {
26
+ return response.action === 'accept' ? (response.content ?? {}) : {};
27
+ }
28
+ export function grokQuestionAnswer(response) {
29
+ if (response.action !== 'accept')
30
+ return { outcome: 'cancelled' };
31
+ const answers = Object.entries(contentOf(response)).map(([question, value]) => [question, answerText(value)]);
32
+ return { outcome: 'accepted', answers: Object.fromEntries(answers) };
33
+ }
34
+ export function grokPlanForm({ sessionId, planContent }) {
35
+ return form(sessionId, planContent, { [PLAN]: PLAN_FIELD });
36
+ }
37
+ export function grokPlanAnswer(response) {
38
+ return { outcome: contentOf(response)[PLAN] ?? PLAN_ABANDONED };
39
+ }
package/dist/house-cli.js CHANGED
@@ -23,8 +23,8 @@ const ARGUMENTS = `the arguments are one JSON object in single quotes, like hous
23
23
  const CLOSED = "this conversation's House connection is closed; nothing to do from here";
24
24
  const SANDBOXED = "your CLI's sandbox kept house from House; run house directly, not through another program";
25
25
  const REVOKED = 'this conversation no longer has House access; nothing to do from here';
26
- const UNCONNECTED = "this computer's own agent has no House connection; run kit login, or kit chatgpt --key <key> with a script key";
27
- const DISCONNECTED = "House no longer accepts this computer's own agent; run kit login, or kit chatgpt --key <key> with a script key";
26
+ const UNCONNECTED = "this computer's own agent has no House connection; run kit login";
27
+ const DISCONNECTED = "House no longer accepts this computer's own agent; run kit login";
28
28
  const UNCONFIRMED = 'with no result; a write may or may not have taken effect, so read before you repeat it';
29
29
  const socketPath = process.env.HOUSE_BRIDGE;
30
30
  const MEDIA_TYPES = new Map([
@@ -1,5 +1,4 @@
1
1
  import { agentInstructions } from '@agentshouse/skills';
2
- import { HOUSE_REF } from './git.js';
3
2
  const OWNER_RULES = '/rooms/private/owner-rules.md';
4
3
  const UNREADABLE = /^(?:\S+: )?(?:path_not_found|room_not_found|operation_denied)\b/;
5
4
  const FAILED = /^exit: [1-9]\d*$/;
@@ -26,7 +25,6 @@ async function readOwnerRules(bridge) {
26
25
  }
27
26
  return document;
28
27
  }
29
- export async function instructions(bridge, base, copies) {
30
- const lines = agentInstructions(HOUSE_REF, copies);
31
- return [lines.join('\n'), base, (await readOwnerRules(bridge)).replace(/\n$/, '')].filter((part) => part !== '').join('\n\n');
28
+ export async function instructions(bridge, base) {
29
+ return [agentInstructions().join('\n'), base, (await readOwnerRules(bridge)).replace(/\n$/, '')].filter((part) => part !== '').join('\n\n');
32
30
  }
package/dist/kit-cli.js CHANGED
@@ -1,11 +1,10 @@
1
1
  import { parseArgs } from 'node:util';
2
2
  import { answerGitCredential } from './app-git.js';
3
- import { chatgpt } from './chatgpt.js';
4
3
  import { login } from './login.js';
5
4
  import { logout } from './logout.js';
6
5
  import { proxyUnlessRelayed } from './relay.js';
7
6
  import { resident } from './resident.js';
8
- const USAGE = 'usage: kit <login|logout|resident|chatgpt>\n';
7
+ const USAGE = 'usage: kit <login|logout|resident>\n';
9
8
  const COMMANDS = new Map([
10
9
  [
11
10
  'logout',
@@ -40,8 +39,6 @@ proxyUnlessRelayed();
40
39
  async function run() {
41
40
  if (command === 'login')
42
41
  return login(argv);
43
- if (command === 'chatgpt')
44
- return chatgpt(argv);
45
42
  if (command === '--help') {
46
43
  parseArgs({ args: argv });
47
44
  process.stdout.write(USAGE);
package/dist/login.js CHANGED
@@ -11,7 +11,7 @@ import { selectRelay } from './relay.js';
11
11
  import { startService } from './service.js';
12
12
  import { placeSkillSet } from './skills.js';
13
13
  import { endUnserved } from './wire.js';
14
- export const DEFAULT_HOUSE = 'https://agents.house';
14
+ const DEFAULT_HOUSE = 'https://agents.house';
15
15
  const OPENER = process.platform === 'darwin' ? 'open' : 'xdg-open';
16
16
  // Polling every two seconds brings the User's confirmation to the waiting Kit moments after they give it.
17
17
  const POLL_INTERVAL_MS = 2000;
@@ -20,7 +20,7 @@ function open(link) {
20
20
  .on('error', () => undefined)
21
21
  .unref();
22
22
  }
23
- export async function accepted(house, credential) {
23
+ async function accepted(house, credential) {
24
24
  const checked = await callHouse(house, credential, rpc('tools/list', {}));
25
25
  if (checked.status === 200)
26
26
  return true;
package/dist/logout.js CHANGED
@@ -4,7 +4,7 @@ export async function logout() {
4
4
  const enrolled = await readEnrolment();
5
5
  if (enrolled !== null) {
6
6
  try {
7
- await post(enrolled.house, '/kit/logout', {}, enrolled.credential);
7
+ await post(enrolled.house, '/kit/kits/log-out', {}, enrolled.credential);
8
8
  }
9
9
  catch (error) {
10
10
  if (!(error instanceof HouseRefusal && error.status === 401))
package/dist/resident.js CHANGED
@@ -111,12 +111,6 @@ function connected() {
111
111
  }
112
112
  async function started() {
113
113
  await connected();
114
- watch(kitHome(), () => {
115
- if (enrolled())
116
- return;
117
- killDescendants();
118
- process.exit(1);
119
- });
120
114
  await placeSkillSet((await readEnrolment()).house);
121
115
  await mkdir(agentBase(), { recursive: true });
122
116
  await installShim(join(kitHome(), 'shim', 'git'), 'git-main');
@@ -127,6 +121,7 @@ export async function resident() {
127
121
  const copies = new LocalCopies(house);
128
122
  await copies.load();
129
123
  await serveOwner(copies);
124
+ await copies.swept();
130
125
  await started().catch((error) => {
131
126
  report(error);
132
127
  process.exit(1);
@@ -135,17 +130,28 @@ export async function resident() {
135
130
  const agents = new Agents(house, () => changed());
136
131
  let connection = null;
137
132
  let reported = false;
133
+ let stopping = false;
134
+ const stop = async (then) => {
135
+ if (stopping)
136
+ return;
137
+ stopping = true;
138
+ conversations.stopped();
139
+ killDescendants();
140
+ await connection?.close();
141
+ then();
142
+ };
138
143
  const idle = () => calls.idle() && conversations.idle() && agents.idle();
139
144
  const changed = () => {
140
145
  if (!idle()) {
141
146
  reported = false;
142
147
  }
143
148
  else if (update.placedRelease() !== null && conversations.quiet()) {
144
- restart(`Kit ${update.placedRelease()} is placed; its supervisor starts it`);
149
+ const placed = update.placedRelease();
150
+ void stop(() => restart(`Kit ${placed} is placed; its supervisor starts it`));
145
151
  }
146
152
  else if (!reported) {
147
153
  reported = true;
148
- logged(house.deliver('/kit/idle', {}, idle));
154
+ logged(house.deliver('/kit/kits/report-idle', {}, idle));
149
155
  }
150
156
  };
151
157
  const calls = new Calls(house, changed);
@@ -154,7 +160,7 @@ export async function resident() {
154
160
  agents,
155
161
  copies,
156
162
  calls,
157
- send: (notification) => connection?.send(notification) ?? false,
163
+ send: (oneWayCall) => connection?.send(oneWayCall) ?? false,
158
164
  changed,
159
165
  });
160
166
  const signIns = new SignIns(house, agents, calls);
@@ -162,17 +168,24 @@ export async function resident() {
162
168
  if (process.env.HOUSE_KIT_SANDBOX !== '1')
163
169
  takeUnservedRelease((release) => logged(update.takeRefused(release)));
164
170
  removeInputs();
165
- const scripts = new Scripts(calls, (notification) => connection?.send(notification) ?? false);
171
+ const scripts = new Scripts(calls, (oneWayCall) => connection?.send(oneWayCall) ?? false);
166
172
  for (const signal of ['SIGTERM', 'SIGINT']) {
167
173
  process.once(signal, () => {
168
- killDescendants();
169
- removeInputs();
170
- process.kill(process.pid, signal);
174
+ void stop(() => {
175
+ removeInputs();
176
+ process.kill(process.pid, signal);
177
+ });
171
178
  });
172
179
  }
173
- await house.deliver('/kit/restarted', {}).catch(report);
180
+ const unenrolled = () => {
181
+ if (!enrolled())
182
+ void stop(() => process.exit(1));
183
+ };
184
+ watch(kitHome(), unenrolled);
185
+ unenrolled();
186
+ await house.deliver('/kit/kits/report-restart', {}).catch(report);
174
187
  logged(agents.refresh());
175
- agents.keepCurrent();
188
+ agents.keepCurrent(() => process.env.HOUSE_KIT_SANDBOX === '1' && reported);
176
189
  connection = holdConnection({
177
190
  opened: () => {
178
191
  conversations.opened();
@@ -194,14 +207,12 @@ export async function resident() {
194
207
  void calls.carry(call.input_id, async () => ({ result: refused }));
195
208
  }
196
209
  },
197
- notification: (notification) => {
198
- if (notification.type === 'watching')
199
- conversations.watching(notification.watching === true);
200
- if (notification.type === 'authority_changed')
201
- logged(copies.changed(notification.rooms));
202
- if (notification.type === 'work_available' && notification.subject === 'agents')
210
+ oneWayCall: (oneWayCall) => {
211
+ if (oneWayCall.type === 'watching')
212
+ conversations.watching(oneWayCall.watching === true);
213
+ if (oneWayCall.type === 'work_available' && oneWayCall.subject === 'agents')
203
214
  logged(agents.refresh());
204
- scripts.notified(notification);
215
+ scripts.notified(oneWayCall);
205
216
  },
206
217
  });
207
218
  }
package/dist/scripts.js CHANGED
@@ -130,15 +130,15 @@ export class Scripts {
130
130
  start(call) {
131
131
  void this.calls.carry(call.input_id, () => this.run(call.input_id, planned(call)));
132
132
  }
133
- notified(notification) {
134
- const run = this.runs.get(String(notification.wizard));
133
+ notified(oneWayCall) {
134
+ const run = this.runs.get(String(oneWayCall.wizard));
135
135
  if (run === undefined)
136
136
  return;
137
- if (notification.type === 'wizard_input')
138
- this.typed(run, String(notification.data));
139
- if (notification.type === 'wizard_size')
140
- this.resized(run, { cols: Number(notification.cols), rows: Number(notification.rows) });
141
- if (notification.type === 'wizard_end' && run.plan.terminal === 'page')
137
+ if (oneWayCall.type === 'wizard_input')
138
+ this.typed(run, String(oneWayCall.data));
139
+ if (oneWayCall.type === 'wizard_size')
140
+ this.resized(run, { cols: Number(oneWayCall.cols), rows: Number(oneWayCall.rows) });
141
+ if (oneWayCall.type === 'wizard_end' && run.plan.terminal === 'page')
142
142
  this.end(run, {});
143
143
  }
144
144
  disconnected() {
@@ -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.post(`/kit/secret-input/${subject}`, { steps });
5
+ const held = await house.post('/kit/secret-inputs/await', { subject, steps });
6
6
  if (held.outcome === 'collected')
7
7
  return held.content;
8
8
  if (held.release !== 'held')
@@ -34,6 +34,7 @@ const NOT_INSTALLED = "the speech engine is not installed on the Agent's Environ
34
34
  const NOT_DOWNLOADED = 'an audio file this message links could not be downloaded; send the message again';
35
35
  const UNDECODABLE = 'an audio file this message links could not be decoded';
36
36
  const UNTRANSCRIBED = 'an audio file this message links could not be transcribed';
37
+ const NO_ENGINE = 'there is no transcription engine for this computer';
37
38
  let held = Promise.resolve();
38
39
  let holding = Promise.resolve();
39
40
  let setting = null;
@@ -78,7 +79,10 @@ function ready() {
78
79
  throw new Error(NOT_INSTALLED);
79
80
  }
80
81
  function pinnedHere() {
81
- return ENGINES[`${process.platform}-${process.arch}`];
82
+ const engine = ENGINES[`${process.platform}-${process.arch}`];
83
+ if (engine === undefined)
84
+ throw new Error(NO_ENGINE);
85
+ return engine;
82
86
  }
83
87
  const DOWNLOADS = 3;
84
88
  async function downloadedAgain(artifact, signal) {
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 components(path, before, after, text) {
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 parsedBefore = parse(before, file);
42
- const parsedAfter = parse(after, file);
43
- const structured = parsedBefore.ok && parsedAfter.ok ? components(path, parsedBefore.document, parsedAfter.document, after) : null;
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/wire.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { newerThanHouse, updateRequired } from './end.js';
2
2
  import { machine } from './placement.js';
3
3
  import { refusalOf } from './refusals.js';
4
- export const KIT_WIRE = 4;
4
+ export const KIT_WIRE = 6;
5
5
  export const KIT_WIRE_HEADER = 'x-house-kit-wire';
6
6
  let take = null;
7
7
  let taken = false;
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-ce47f621f90e1",
3
+ "version": "0.2.1-ce8e5419af3f9",
4
4
  "description": "Kit connects an Environment to agents.house.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -24,15 +24,17 @@
24
24
  "test": "tsc -p tsconfig.json && vitest run"
25
25
  },
26
26
  "dependencies": {
27
- "@agentclientprotocol/sdk": "2.0.1",
28
- "@agentshouse/mdmodel": "0.1.0-c4f4d37bc9d6a",
29
- "@agentshouse/skills": "0.1.0-cdd0f15bef719",
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-c33c14a1acda2",
30
31
  "@lydell/node-pty": "1.2.0-beta.15",
32
+ "micromark": "4.0.2",
31
33
  "yaml": "2.9.1"
32
34
  },
33
35
  "peerDependencies": {
34
- "@agentclientprotocol/claude-agent-acp": "0.94.0",
35
- "@agentclientprotocol/codex-acp": "2.2.2"
36
+ "@agentclientprotocol/claude-agent-acp": "0.100.0",
37
+ "@agentclientprotocol/codex-acp": "2.5.0"
36
38
  },
37
39
  "peerDependenciesMeta": {
38
40
  "@agentclientprotocol/claude-agent-acp": {
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/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
- }