@agentshouse/kit 0.2.1-alpha.9 → 0.2.1-c03721a31074a

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.
Files changed (136) hide show
  1. package/README.md +48 -29
  2. package/dist/abort.js +9 -0
  3. package/dist/acp.js +49 -86
  4. package/dist/agents.js +333 -52
  5. package/dist/api.js +40 -4
  6. package/dist/app-git.js +48 -0
  7. package/dist/bootstrap.json +10 -14
  8. package/dist/bridge.js +93 -78
  9. package/dist/calls.js +63 -0
  10. package/dist/chatgpt.js +32 -0
  11. package/dist/clis-main.js +23 -0
  12. package/dist/clis.js +217 -72
  13. package/dist/codex-main.js +58 -0
  14. package/dist/connection.js +126 -0
  15. package/dist/conversations.js +642 -263
  16. package/dist/copies.js +237 -173
  17. package/dist/end.js +27 -0
  18. package/dist/enrol-main.js +7 -1
  19. package/dist/events.js +525 -0
  20. package/dist/files.js +140 -17
  21. package/dist/git-main.js +2 -2
  22. package/dist/git.js +16 -10
  23. package/dist/home.js +127 -9
  24. package/dist/house-cli.js +300 -0
  25. package/dist/house-main.js +5 -102
  26. package/dist/instructions.js +16 -17
  27. package/dist/kit-cli.js +68 -0
  28. package/dist/kit-main.js +8 -16
  29. package/dist/login.js +128 -95
  30. package/dist/logout.js +19 -0
  31. package/dist/mcp.js +41 -0
  32. package/dist/operation.js +7 -4
  33. package/dist/parts.js +82 -0
  34. package/dist/placement.js +39 -0
  35. package/dist/refusals.js +53 -0
  36. package/dist/relay.js +20 -0
  37. package/dist/resident.js +139 -52
  38. package/dist/scope.js +206 -0
  39. package/dist/secret-input.js +7 -2
  40. package/dist/service-main.js +9 -0
  41. package/dist/service.js +55 -0
  42. package/dist/shell.js +3 -0
  43. package/dist/sign-in.js +50 -31
  44. package/dist/skills.js +20 -37
  45. package/dist/transcription.js +214 -0
  46. package/dist/translate.js +2 -8
  47. package/dist/update.js +163 -0
  48. package/dist/web-wizard.js +100 -0
  49. package/dist/wire.js +22 -0
  50. package/dist/work.js +346 -0
  51. package/package.json +14 -16
  52. package/dist/blocks.js +0 -51
  53. package/dist/stream.js +0 -47
  54. package/how-we-work.md +0 -25
  55. package/skills/ask-matt/LICENSE +0 -21
  56. package/skills/ask-matt/PHASE-BOUNDARIES.md +0 -55
  57. package/skills/ask-matt/SKILL.md +0 -91
  58. package/skills/ask-matt/agents/openai.yaml +0 -4
  59. package/skills/code-review/LICENSE +0 -21
  60. package/skills/code-review/SKILL.md +0 -89
  61. package/skills/code-review/agents/openai.yaml +0 -3
  62. package/skills/codebase-design/DEEPENING.md +0 -37
  63. package/skills/codebase-design/DESIGN-IT-TWICE.md +0 -44
  64. package/skills/codebase-design/LICENSE +0 -21
  65. package/skills/codebase-design/SKILL.md +0 -116
  66. package/skills/codebase-design/agents/openai.yaml +0 -3
  67. package/skills/diagnosing-bugs/LICENSE +0 -21
  68. package/skills/diagnosing-bugs/SKILL.md +0 -140
  69. package/skills/diagnosing-bugs/agents/openai.yaml +0 -3
  70. package/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +0 -44
  71. package/skills/domain-modeling/ADR-FORMAT.md +0 -47
  72. package/skills/domain-modeling/CONTEXT-FORMAT.md +0 -60
  73. package/skills/domain-modeling/LICENSE +0 -21
  74. package/skills/domain-modeling/SKILL.md +0 -76
  75. package/skills/domain-modeling/agents/openai.yaml +0 -3
  76. package/skills/grill-me/LICENSE +0 -21
  77. package/skills/grill-me/SKILL.md +0 -8
  78. package/skills/grill-me/agents/openai.yaml +0 -4
  79. package/skills/grill-with-docs/LICENSE +0 -21
  80. package/skills/grill-with-docs/SKILL.md +0 -8
  81. package/skills/grill-with-docs/agents/openai.yaml +0 -4
  82. package/skills/grilling/LICENSE +0 -21
  83. package/skills/grilling/SKILL.md +0 -30
  84. package/skills/grilling/agents/openai.yaml +0 -3
  85. package/skills/handoff/LICENSE +0 -21
  86. package/skills/handoff/SKILL.md +0 -17
  87. package/skills/handoff/agents/openai.yaml +0 -4
  88. package/skills/implement/LICENSE +0 -21
  89. package/skills/implement/SKILL.md +0 -16
  90. package/skills/implement/agents/openai.yaml +0 -4
  91. package/skills/improve-codebase-architecture/HTML-REPORT.md +0 -123
  92. package/skills/improve-codebase-architecture/LICENSE +0 -21
  93. package/skills/improve-codebase-architecture/SKILL.md +0 -72
  94. package/skills/improve-codebase-architecture/agents/openai.yaml +0 -4
  95. package/skills/prototype/LICENSE +0 -21
  96. package/skills/prototype/LOGIC.md +0 -67
  97. package/skills/prototype/SKILL.md +0 -28
  98. package/skills/prototype/UI.md +0 -112
  99. package/skills/prototype/agents/openai.yaml +0 -3
  100. package/skills/research/LICENSE +0 -21
  101. package/skills/research/SKILL.md +0 -14
  102. package/skills/research/agents/openai.yaml +0 -3
  103. package/skills/resolving-merge-conflicts/LICENSE +0 -21
  104. package/skills/resolving-merge-conflicts/SKILL.md +0 -16
  105. package/skills/resolving-merge-conflicts/agents/openai.yaml +0 -3
  106. package/skills/tdd/LICENSE +0 -21
  107. package/skills/tdd/SKILL.md +0 -40
  108. package/skills/tdd/agents/openai.yaml +0 -3
  109. package/skills/tdd/mocking.md +0 -59
  110. package/skills/tdd/tests.md +0 -77
  111. package/skills/teach/GLOSSARY-FORMAT.md +0 -35
  112. package/skills/teach/LEARNING-RECORD-FORMAT.md +0 -46
  113. package/skills/teach/LICENSE +0 -21
  114. package/skills/teach/MISSION-FORMAT.md +0 -31
  115. package/skills/teach/RESOURCES-FORMAT.md +0 -32
  116. package/skills/teach/SKILL.md +0 -141
  117. package/skills/teach/agents/openai.yaml +0 -4
  118. package/skills/to-questionnaire/LICENSE +0 -21
  119. package/skills/to-questionnaire/SKILL.md +0 -55
  120. package/skills/to-questionnaire/agents/openai.yaml +0 -4
  121. package/skills/to-spec/LICENSE +0 -21
  122. package/skills/to-spec/SKILL.md +0 -76
  123. package/skills/to-spec/agents/openai.yaml +0 -4
  124. package/skills/to-tickets/LICENSE +0 -21
  125. package/skills/to-tickets/SKILL.md +0 -106
  126. package/skills/to-tickets/agents/openai.yaml +0 -4
  127. package/skills/wait-what/LICENSE +0 -21
  128. package/skills/wait-what/SKILL.md +0 -8
  129. package/skills/wait-what/agents/openai.yaml +0 -4
  130. package/skills/wayfinder/LICENSE +0 -21
  131. package/skills/wayfinder/SKILL.md +0 -129
  132. package/skills/wayfinder/agents/openai.yaml +0 -4
  133. package/skills/writing-for-agents/LICENSE +0 -21
  134. package/skills/writing-for-agents/SKILL-MECHANICS.md +0 -22
  135. package/skills/writing-for-agents/SKILL.md +0 -83
  136. package/skills/writing-for-agents/agents/openai.yaml +0 -3
package/README.md CHANGED
@@ -1,41 +1,60 @@
1
- # House Kit
1
+ # Kit
2
2
 
3
- House Kit connects an Environment, a Linux computer or server, to
4
- [agents.house](https://agents.house). It runs your Agents' conversations
5
- through the agent CLIs you chose and gives each Agent the `house` command.
3
+ Kit connects an Environment, a Linux computer or server, to [agents.house](https://agents.house). It runs
4
+ your Agents' conversations through the agent CLIs you chose and gives each Agent the `house` command.
6
5
 
7
6
  ## Install
8
7
 
9
- Connect a computer from agents.house. It gives you the one command that
10
- installs House Kit on that computer and updates it when you run it again. On
11
- Linux, macOS and Windows 11 it runs House Kit in one Docker container with
12
- your workspace, `~/AgentsHouse` unless you pass `--workspace <path>`, mounted
13
- at `/agents/house`. Append a `kit` or `house` command to the same command to
14
- run it in that container.
15
-
16
- On your own Ubuntu 26.04 server, run the Linux command with `--linux` to
17
- install House Kit natively, with its workspace at `/agents/house`; `kit` and
8
+ Run `sh -c 'kit=$(curl -fsSL "$0") || { echo "Kit could not be downloaded; run this command again." >&2; exit 1; }; eval "$kit"' agents.house/kit`,
9
+ or `& { try { $kit = irm agents.house/kit.ps1 } catch { throw 'Kit could not be downloaded; run this command again.' }; & ([scriptblock]::Create($kit)) @args }` on Windows, which run nothing of a failed download, and again to update; options follow `agents.house/kit`.
10
+ On macOS and Linux it installs Kit natively under your own account, without an admin password, as a service that runs
11
+ while you are logged in. `kit` and `house` are then on your login shell's `PATH`, and your workspace is `~/AgentsHouse` unless you
12
+ pass `--workspace <path>`.
13
+
14
+ Add `--container` to run Kit in one Docker container instead, with your
15
+ workspace mounted at `/agents/house`; your Agents then reach only that
16
+ workspace. On Windows 11 the container is the one choice. Append a `kit` or `house` command to the container's options to run it in that container.
17
+ Running the command for the other choice on a connected computer asks you to
18
+ confirm, then replaces its Environment, whose Agents end, with a new one. Running it with a different `HOUSE_KIT_HOME`
19
+ from the running Kit process asks you to confirm before it replaces that process, and leaves the earlier Kit home as it was.
20
+
21
+ On your own Linux server, run the Linux command with `--linux` to
22
+ install Kit natively, with its workspace at `/agents/house`; `kit` and
18
23
  `house` are then on the server's `PATH`.
19
24
 
20
- House Kit also gives every Agent on the Environment a set of agent skills. Add
21
- `--no-skills` to the command to leave them out; running it again without the
22
- flag brings them back.
25
+ Kit runs the agent CLIs your login shell finds and installs a missing one
26
+ through that CLI's own installer. Running the command again offers to update
27
+ each CLI older than Kit needs; add `--update-clis` to update every one to
28
+ its latest release without asking. Kit also gives every Agent on the
29
+ Environment the agent skills of `@agentshouse/skills`, at the version each Kit
30
+ release installs. Add `--no-skills` to the command to leave them out; running it again without the flag brings them back.
23
31
 
24
32
  ## Commands
25
33
 
26
- `kit login` opens a link you confirm in your browser and keeps the
27
- Environment's credential in `~/.house-kit`, or in `$HOUSE_KIT_HOME` when it is
28
- 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.
30
-
31
- `kit resident` keeps the Environment connected, and keeps the Rooms you chose
32
- for this Environment as Git repositories under `/agents/house/working-copies`.
33
- Commit in one and run `house git push --owner` there to send the commit to
34
- House; on a computer, run it through the install command from the copy's
35
- directory. Inside an Agent conversation the Agent runs `house git push`.
34
+ `kit login` opens or prints a link you confirm in any browser, on this computer
35
+ or another, continues on its own and keeps the Environment's credential in
36
+ `$HOUSE_KIT_HOME` when it is set, else in `~/.house-kit`, or in `house-kit-<uid>` under the temporary directory when your home is read-only. `--environment <id>`
37
+ reconnects an Environment you already have; `--rooms <ref>[,<ref>...]` gives it
38
+ only those Rooms and `--no-private` every Room but your Private Room; `--code <code>` connects immediately without a link.
39
+ A login also connects your own agent: outside an Agent conversation, `house <tool>` calls
40
+ House as you and `git` clones and pushes your Apps at `<house>/app/` as you, each through the Kit
41
+ home `$HOUSE_KIT_HOME` names where it runs, until you revoke that connection on Connections. `house help` lists the Tools. Codex sessions started after a
42
+ login run a lone `house` command outside their sandbox. `kit logout` disconnects this
43
+ computer, stops the Kit process and ends your own agent's connection, so `house` and `git` no
44
+ longer act as you here; a later `kit login` reconnects the same Environment, or connects
45
+ this computer as a new one when House no longer holds it.
46
+ In a container you do not control, such as ChatGPT's, `npm i -g @agentshouse/kit` and `kit chatgpt --key <key>` with a key made on Connections let `house <tool>` act as you, starting and configuring nothing else.
47
+
48
+ `kit resident` keeps the Environment connected and, as it connects, copies the text of each Room you chose for it as a
49
+ Git repository in the workspace's `local-copies`, and keeps a Room's copy as it is, no longer refreshing it, once the
50
+ Room may no longer be copied here. `house fetch` does the same and records House's changes on each copy's
51
+ `refs/house/received`; rebase onto it, commit and run `house push --owner` in the copy, through the install command in
52
+ the container. An Agent runs both, without `--owner`. `house upload` and `house download` move a Room's other files straight between disk and House's store, and a broken upload resumes on its own.
53
+
54
+ Kit turns each audio file your message to an Agent links into text on this computer before the Agent reads it, and keeps a message whose audio it cannot turn into text from starting. While transcription is on, the speech engine and model use about 425 MB beside the Environment's credential; turning it off deletes them.
55
+
56
+ When you press Run on a Web Wizard's page, Kit runs its script with `bash` in a terminal on this computer, as you, in the home and directory it runs agent CLIs from, with your login shell's `PATH`; the page shows that terminal and takes your typing, and closing the page, or Kit losing its connection to House, ends the script and its child processes. Kit keeps nothing the script prints or you type.
36
57
 
37
58
  ## License
38
59
 
39
- MIT
40
-
41
- The skills come from [mattpocock/skills](https://github.com/mattpocock/skills); thank you, Matt Pocock.
60
+ MIT.
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,47 +1,66 @@
1
1
  import { ndJsonStream, PROTOCOL_VERSION, } from '@agentclientprotocol/sdk';
2
2
  import { spawn } from 'node:child_process';
3
- import { readdirSync, readFileSync } from 'node:fs';
4
3
  import { Readable, Writable } from 'node:stream';
5
- import { CLIS, KIT_VERSION, cliCommand, withoutProxy } from './clis.js';
6
- export const TURN_STARTED = 'kit/turn_started';
7
- export const TURN_ENDED = 'kit/turn_ended';
8
- export async function startAdapter(kind, cwd, app, jobs = () => undefined, added = {}) {
9
- const child = spawn(cliCommand(kind), CLIS[kind].args, {
4
+ import { CLIS, KIT_RELEASE, adapterCommand, withoutProxy } from './clis.js';
5
+ import { killTree } from './scope.js';
6
+ const RETIRED = 'the CLI was retired';
7
+ export async function startAdapter(kind, cli, cwd, app, events = () => undefined, added = {}, signal, scope = null) {
8
+ const adapter = CLIS[kind].adapter;
9
+ const started = [adapter === null ? cli : adapterCommand(kind), CLIS[kind].args];
10
+ const [command, args] = scope?.command(...started) ?? started;
11
+ const child = spawn(command, args, {
10
12
  cwd,
11
- env: { ...withoutProxy(), ...added },
13
+ env: { ...withoutProxy(), ...(adapter === null ? {} : { ...adapter.env, [adapter.executable]: cli }), ...added },
12
14
  stdio: ['pipe', 'pipe', 'pipe'],
13
15
  detached: true,
14
16
  });
17
+ let owned = true;
18
+ let retired = false;
15
19
  let stderr = '';
16
20
  child.stderr.on('data', (chunk) => {
17
21
  stderr = (stderr + chunk.toString('utf8')).slice(-4000);
18
22
  });
19
- const exited = new Promise((resolve) => {
20
- child.on('error', (error) => resolve(`the CLI did not start: ${error.message}`));
21
- child.on('exit', (code, signal) => {
22
- const last = stderr.trim().split('\n').at(-1);
23
- resolve(`the CLI exited with ${code ?? signal}${last ? `: ${last}` : ''}`);
24
- });
25
- });
26
23
  const stream = ndJsonStream(Writable.toWeb(child.stdin), Readable.toWeb(child.stdout));
27
24
  const connection = app.connect({
28
25
  writable: stream.writable,
29
26
  readable: stream.readable.pipeThrough(new TransformStream({
30
27
  transform(message, controller) {
31
- const notice = message;
32
- const job = CLIS[kind].job(notice);
33
- if (job !== null)
34
- jobs(job);
35
- if (!notice.params?.update?.sessionUpdate?.startsWith('async_task_'))
28
+ const read = message;
29
+ if (owned)
30
+ events(read);
31
+ if (read.id !== undefined || (read.method !== 'session/update' && !read.method.startsWith('_'))) {
36
32
  controller.enqueue(message);
37
- if (CLIS[kind].turnStarted(notice))
38
- controller.enqueue({ jsonrpc: '2.0', method: TURN_STARTED });
39
- if (CLIS[kind].turnEnded(notice))
40
- controller.enqueue({ jsonrpc: '2.0', method: TURN_ENDED });
33
+ }
41
34
  },
42
35
  })),
43
36
  });
44
- void exited.then((cause) => connection.close(new Error(cause)));
37
+ const { promise: lost, resolve: lose } = Promise.withResolvers();
38
+ const exited = new Promise((resolve) => {
39
+ const end = (cause) => {
40
+ if (owned)
41
+ lose(cause);
42
+ owned = false;
43
+ connection.close(new Error(cause));
44
+ resolve(cause);
45
+ };
46
+ child.on('error', (error) => end(`the CLI did not start: ${error.message}`));
47
+ child.on('exit', (code, signal) => {
48
+ const last = stderr.trim().split('\n').at(-1);
49
+ end(`the CLI exited with ${code ?? signal}${last ? `: ${last}` : ''}`);
50
+ });
51
+ });
52
+ const retire = () => {
53
+ owned = false;
54
+ if (retired)
55
+ return;
56
+ retired = true;
57
+ if (child.pid !== undefined)
58
+ killTree(child);
59
+ scope?.kill();
60
+ connection.close(new Error(RETIRED));
61
+ };
62
+ signal?.addEventListener('abort', retire, { once: true });
63
+ child.on('exit', () => signal?.removeEventListener('abort', retire));
45
64
  try {
46
65
  const initialized = await connection.agent.request('initialize', {
47
66
  protocolVersion: PROTOCOL_VERSION,
@@ -49,72 +68,16 @@ export async function startAdapter(kind, cwd, app, jobs = () => undefined, added
49
68
  fs: { readTextFile: false, writeTextFile: false },
50
69
  terminal: false,
51
70
  elicitation: { form: {} },
52
- _meta: { jetbrains: { air: { version: 1, capabilities: ['asyncTasks'] } } },
71
+ session: { compaction: {}, notices: {} },
72
+ _meta: { jetbrains: { air: { version: 1, capabilities: CLIS[kind].air } } },
53
73
  },
54
- clientInfo: { name: '@agentshouse/kit', version: KIT_VERSION },
74
+ clientInfo: { name: '@agentshouse/kit', version: KIT_RELEASE },
55
75
  });
56
- return { child, connection, initialized, exited };
76
+ scope?.entered(child.pid);
77
+ return { connection, initialized, exited, lost, retire };
57
78
  }
58
79
  catch (error) {
59
- child.kill('SIGKILL');
80
+ retire();
60
81
  throw error;
61
82
  }
62
83
  }
63
- function parents() {
64
- const children = new Map();
65
- for (const entry of readdirSync('/proc')) {
66
- if (!/^\d+$/.test(entry))
67
- continue;
68
- try {
69
- const stat = readFileSync(`/proc/${entry}/stat`, 'utf8');
70
- const parent = Number(stat.slice(stat.lastIndexOf(')') + 2).split(' ')[1]);
71
- children.set(parent, [...(children.get(parent) ?? []), Number(entry)]);
72
- }
73
- catch { }
74
- }
75
- return children;
76
- }
77
- function descendants(roots) {
78
- const children = parents();
79
- const tree = [];
80
- const pending = roots.flatMap((root) => children.get(root) ?? []);
81
- while (pending.length > 0) {
82
- const pid = pending.pop();
83
- tree.push(pid);
84
- pending.push(...(children.get(pid) ?? []));
85
- }
86
- return tree;
87
- }
88
- function killAll(pids) {
89
- for (const pid of pids) {
90
- for (const target of [-pid, pid]) {
91
- try {
92
- process.kill(target, 'SIGKILL');
93
- }
94
- catch { }
95
- }
96
- }
97
- }
98
- function marked(marker) {
99
- return readdirSync('/proc')
100
- .filter((entry) => {
101
- try {
102
- return /^\d+$/.test(entry) && readFileSync(`/proc/${entry}/environ`, 'utf8').split('\0').includes(marker);
103
- }
104
- catch {
105
- return false;
106
- }
107
- })
108
- .map(Number);
109
- }
110
- export function killTree(child) {
111
- killAll([child.pid, ...descendants([child.pid])]);
112
- }
113
- export function killMarked(marker) {
114
- const pids = marked(marker);
115
- killAll([...pids, ...descendants(pids)]);
116
- }
117
- export function killDescendants() {
118
- const pids = marked(`HOUSE_KIT_RESIDENT=${process.pid}`);
119
- killAll([...pids, ...descendants([process.pid, ...pids])]);
120
- }