@agentshouse/kit 0.0.1 → 0.1.0-alpha.2

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 (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1696 -2
  3. package/bin/connect-linux.sh +127 -0
  4. package/bin/kit.js +1023 -0
  5. package/package.json +33 -3
  6. package/src/acp.js +99 -0
  7. package/src/adapter-mcp.js +44 -0
  8. package/src/adapter.js +252 -0
  9. package/src/agent-logins.js +65 -0
  10. package/src/agents.js +449 -0
  11. package/src/apply.js +29 -0
  12. package/src/attach.js +52 -0
  13. package/src/binding.js +90 -0
  14. package/src/blocks.js +156 -0
  15. package/src/bridge.js +449 -0
  16. package/src/bytes.js +89 -0
  17. package/src/channel.js +37 -0
  18. package/src/command.js +109 -0
  19. package/src/configuration.js +465 -0
  20. package/src/connector-login.js +91 -0
  21. package/src/connector.js +107 -0
  22. package/src/continuation.js +61 -0
  23. package/src/contract.js +363 -0
  24. package/src/conversation-originals.js +143 -0
  25. package/src/custom/authorization.js +63 -0
  26. package/src/declaration.js +35 -0
  27. package/src/delivery.js +191 -0
  28. package/src/directory.js +102 -0
  29. package/src/draft.js +89 -0
  30. package/src/google/calendar.js +177 -0
  31. package/src/google/declared.js +146 -0
  32. package/src/google/drive.js +435 -0
  33. package/src/google/gateway.js +166 -0
  34. package/src/google/gmail.js +249 -0
  35. package/src/google/id.js +1 -0
  36. package/src/google/oauth.js +273 -0
  37. package/src/google/source.js +25 -0
  38. package/src/hook.js +376 -0
  39. package/src/host.js +121 -0
  40. package/src/house-main.js +79 -0
  41. package/src/house.js +1085 -0
  42. package/src/inbound.js +175 -0
  43. package/src/instance/google.js +1 -0
  44. package/src/launcher-main.js +19 -0
  45. package/src/launcher.js +276 -0
  46. package/src/local-files.js +113 -0
  47. package/src/login.js +274 -0
  48. package/src/mcp.js +71 -0
  49. package/src/migrator.js +248 -0
  50. package/src/mount.js +582 -0
  51. package/src/operation.js +20 -0
  52. package/src/original.js +631 -0
  53. package/src/peer.js +124 -0
  54. package/src/plan.js +57 -0
  55. package/src/question.js +316 -0
  56. package/src/refusal.js +79 -0
  57. package/src/repository.js +521 -0
  58. package/src/session-bin/house +2 -0
  59. package/src/settlement.js +57 -0
  60. package/src/setup.js +185 -0
  61. package/src/source-originals.js +116 -0
  62. package/src/source.js +286 -0
  63. package/src/starter-set/grilling/LICENSE +21 -0
  64. package/src/starter-set/grilling/SKILL.md +30 -0
  65. package/src/starter-set/grilling/agents/openai.yaml +3 -0
  66. package/src/starter-set.js +17 -0
  67. package/src/state.js +157 -0
  68. package/src/sync-library.js +293 -0
  69. package/src/sync-state.js +116 -0
  70. package/src/sync.js +477 -0
  71. package/src/telegram.js +1045 -0
  72. package/src/terminal.js +57 -0
  73. package/src/tmux.js +119 -0
  74. package/src/worker.js +756 -0
  75. package/src/workspace.js +500 -0
package/src/setup.js ADDED
@@ -0,0 +1,185 @@
1
+ import { compiledContract } from "./adapter.js";
2
+ import {
3
+ agentReadiness,
4
+ agentSignedIn,
5
+ guidedAgentLogin,
6
+ updateDeclaredAgent,
7
+ } from "./agents.js";
8
+ import { readConfiguration } from "./configuration.js";
9
+ import { connectorLogin } from "./connector-login.js";
10
+ import { GUIDED_LOGIN_TIMEOUT_MS } from "./contract.js";
11
+ import { launchBase, prepareLaunchBase } from "./directory.js";
12
+ import {
13
+ acquireSetup,
14
+ awaitSecretInput,
15
+ desiredAgents,
16
+ maintainControl,
17
+ openSession,
18
+ reportAgentCapabilities,
19
+ reportLogin,
20
+ reportSetup,
21
+ } from "./house.js";
22
+ import { KitRefusal } from "./refusal.js";
23
+
24
+ function cancelled(error) {
25
+ return error instanceof KitRefusal && error.code === "kit_command_cancelled";
26
+ }
27
+
28
+ function agentModule(context, kind) {
29
+ const recipe = compiledContract(kind).guidedLogin;
30
+ return {
31
+ category: "agent",
32
+ name: kind,
33
+ login: { integration: kind, instance: kind, service: kind },
34
+ install: async () => {
35
+ const updated = await updateDeclaredAgent(
36
+ { directory: context.directory, at: context.dependencies.now?.() },
37
+ kind,
38
+ context.dependencies,
39
+ );
40
+ if (updated.release === null) throw new KitRefusal("kit_agent_not_installed", kind);
41
+ },
42
+ signedIn: () => agentSignedIn(context.directory, kind, context.dependencies),
43
+ guided: recipe === null ? null : guidedAgentLogin(context.directory, kind, recipe),
44
+ };
45
+ }
46
+
47
+ function connectorModule(context, instance) {
48
+ const gateway = connectorLogin(instance, context.dependencies);
49
+ return {
50
+ category: "connector",
51
+ name: instance.id,
52
+ login: { integration: instance.preset, instance: instance.id, service: instance.id },
53
+ install: null,
54
+ signedIn: () =>
55
+ gateway.status(instance, { directory: context.directory, signal: context.signal }),
56
+ guided:
57
+ gateway.guided === undefined
58
+ ? null
59
+ : ({ present, signal }) =>
60
+ gateway.guided(instance, {
61
+ directory: context.directory,
62
+ dependencies: context.dependencies,
63
+ present,
64
+ signal,
65
+ }),
66
+ };
67
+ }
68
+
69
+ async function present(context, episode, ceremony, signal) {
70
+ for (;;) {
71
+ const relayed = await awaitSecretInput(context.session, episode, ceremony, signal);
72
+ if (relayed.collected !== null) return relayed.collected;
73
+ }
74
+ }
75
+
76
+ async function guidedLogin(context, module) {
77
+ let opened;
78
+ try {
79
+ opened = await reportLogin(context.session, module.login, "renewal_required", context.signal);
80
+ } catch (error) {
81
+ if (error instanceof KitRefusal && error.code === "kit_login_renewal_unsupported") {
82
+ return "unavailable";
83
+ }
84
+ throw error;
85
+ }
86
+ if (opened.episode === null) throw new KitRefusal("kit_login_rejected", module.name);
87
+ const bound = AbortSignal.any([
88
+ context.signal,
89
+ AbortSignal.timeout(context.dependencies.guidedLoginTimeoutMs ?? GUIDED_LOGIN_TIMEOUT_MS),
90
+ ]);
91
+ const outcome = await module.guided({
92
+ present: (ceremony, signal) => present(context, opened.episode, ceremony, signal),
93
+ signal: bound,
94
+ });
95
+ if (context.signal.aborted) throw new KitRefusal("kit_command_cancelled");
96
+ return outcome;
97
+ }
98
+
99
+ async function settleLogin(context, module) {
100
+ try {
101
+ await reportLogin(context.session, module.login, "authenticated", context.signal);
102
+ } catch (error) {
103
+ if (error instanceof KitRefusal && error.code === "kit_login_renewal_unsupported") return;
104
+ throw error;
105
+ }
106
+ }
107
+
108
+ async function signedIn(module) {
109
+ try {
110
+ return await module.signedIn();
111
+ } catch (error) {
112
+ if (cancelled(error)) throw error;
113
+ return false;
114
+ }
115
+ }
116
+
117
+ async function setUpModule(context, module) {
118
+ const summary = (status, reason = null) => ({
119
+ category: module.category,
120
+ name: module.name,
121
+ status,
122
+ reason,
123
+ });
124
+ if (module.install !== null) {
125
+ try {
126
+ await module.install();
127
+ } catch (error) {
128
+ if (cancelled(error)) throw error;
129
+ return summary("needs_attention", "install_failed");
130
+ }
131
+ }
132
+ if (await signedIn(module)) {
133
+ await settleLogin(context, module);
134
+ return summary("skipped");
135
+ }
136
+ if (module.guided === null) return summary("needs_attention", "login_unavailable");
137
+ const outcome = await guidedLogin(context, module);
138
+ if (outcome === "unavailable") return summary("needs_attention", "login_unavailable");
139
+ if (outcome === "cancelled") return summary("needs_attention", "login_cancelled");
140
+ if (outcome !== "ready" || !(await signedIn(module))) {
141
+ return summary("needs_attention", "login_failed");
142
+ }
143
+ await settleLogin(context, module);
144
+ return summary("ready");
145
+ }
146
+
147
+ export async function runSetup(context, request) {
148
+ await prepareLaunchBase(launchBase(context.dependencies));
149
+ const modules = [];
150
+ for (const kind of context.configuration.agents) {
151
+ modules.push(await setUpModule(context, agentModule(context, kind)));
152
+ }
153
+ for (const instance of context.configuration.instances) {
154
+ modules.push(await setUpModule(context, connectorModule(context, instance)));
155
+ }
156
+ const readiness = await agentReadiness(
157
+ { directory: context.directory },
158
+ context.configuration,
159
+ context.dependencies,
160
+ );
161
+ await reportAgentCapabilities(context.session, readiness.agents, context.signal);
162
+ await reportSetup(context.session, request, modules, context.signal);
163
+ return modules;
164
+ }
165
+
166
+ export async function setupEnvironment(options, dependencies = {}) {
167
+ const configuration = await readConfiguration(options.configuration);
168
+ const session = await openSession(options, dependencies);
169
+ return maintainControl(
170
+ session,
171
+ async (signal) => {
172
+ const pending = await acquireSetup(session, signal);
173
+ if (pending === null) return null;
174
+ const context = {
175
+ session,
176
+ configuration: { ...configuration, agents: await desiredAgents(session, signal) },
177
+ directory: options.directory,
178
+ dependencies,
179
+ signal,
180
+ };
181
+ return { request: pending.request, modules: await runSetup(context, pending.request) };
182
+ },
183
+ options.signal,
184
+ );
185
+ }
@@ -0,0 +1,116 @@
1
+ import { acceptedVersion, deliveryKey, fileDescriptor } from "./delivery.js";
2
+ import { readOriginalFile, saveCapturedOriginal } from "./original.js";
3
+ import { KitRefusal } from "./refusal.js";
4
+ import { readSourceOriginals, writeSourceOriginals } from "./state.js";
5
+
6
+ const SETTLED_ASSOCIATION = new Set(["captured_original_not_found"]);
7
+
8
+ export function sameReference(left, right) {
9
+ return left.room === right.room && left.record === right.record && left.position === right.position;
10
+ }
11
+
12
+ export function acceptedOriginals(binding, items, outcome) {
13
+ const references = [];
14
+ for (const [index, result] of outcome.items.entries()) {
15
+ if (result.outcome === "rejected") continue;
16
+ const item = items[index];
17
+ const key = deliveryKey(binding, item);
18
+ for (const [position, attachment] of item.attachments.entries()) {
19
+ if (attachment.file === undefined) continue;
20
+ const descriptor = fileDescriptor(attachment.file);
21
+ for (const room of result.rooms) {
22
+ references.push({
23
+ room: room.room,
24
+ record: room.record,
25
+ position,
26
+ accepted_version: acceptedVersion(key, position, descriptor),
27
+ path: attachment.file.path,
28
+ descriptor,
29
+ native_object_id: item.nativeObjectId,
30
+ original: null,
31
+ version: null,
32
+ save: { status: "pending", failure: null },
33
+ error: null,
34
+ });
35
+ }
36
+ }
37
+ }
38
+ return references;
39
+ }
40
+
41
+ export async function recordAcceptedOriginals(context, binding, items, outcome) {
42
+ const accepted = acceptedOriginals(binding, items, outcome);
43
+ if (accepted.length === 0) return accepted;
44
+ const held = await readSourceOriginals(context.directory, binding.instance, binding.service);
45
+ const merged = held.map((known) => {
46
+ const offered = accepted.find((reference) => sameReference(known, reference));
47
+ return offered === undefined ? known : { ...known, path: offered.path };
48
+ });
49
+ merged.push(...accepted.filter((reference) => !held.some((known) => sameReference(known, reference))));
50
+ await writeSourceOriginals(context.directory, binding.instance, binding.service, merged, context.signal);
51
+ return accepted;
52
+ }
53
+
54
+ async function declaredBytes(reference) {
55
+ try {
56
+ return await readOriginalFile(reference.path, reference.descriptor.bytes);
57
+ } catch (refusal) {
58
+ if (refusal instanceof KitRefusal && refusal.code === "original_bytes_exceeded") return null;
59
+ throw refusal;
60
+ }
61
+ }
62
+
63
+ async function saveReference(context, reference) {
64
+ const body = await declaredBytes(reference);
65
+ try {
66
+ const saved = await saveCapturedOriginal(context.session, {
67
+ room_ref: reference.room,
68
+ record: reference.record,
69
+ position: reference.position,
70
+ accepted_version: reference.accepted_version,
71
+ descriptor: reference.descriptor,
72
+ body,
73
+ signal: context.signal,
74
+ });
75
+ return { ...reference, original: saved.original, version: saved.version, save: saved.save, error: null };
76
+ } catch (refusal) {
77
+ if (!(refusal instanceof KitRefusal) || refusal.code === "kit_command_cancelled") throw refusal;
78
+ return { ...reference, error: refusal.code };
79
+ }
80
+ }
81
+
82
+ export async function saveSourceOriginals(context, binding, chosen = () => true) {
83
+ const held = await readSourceOriginals(context.directory, binding.instance, binding.service);
84
+ const reported = [];
85
+ const outstanding = [];
86
+ for (const reference of held) {
87
+ if (!chosen(reference)) {
88
+ outstanding.push(reference);
89
+ continue;
90
+ }
91
+ const settled = await saveReference(context, reference);
92
+ reported.push(settled);
93
+ if (settled.save.status !== "saved" && !SETTLED_ASSOCIATION.has(settled.error)) {
94
+ outstanding.push(settled);
95
+ }
96
+ }
97
+ if (reported.length > 0) {
98
+ await writeSourceOriginals(
99
+ context.directory,
100
+ binding.instance,
101
+ binding.service,
102
+ outstanding,
103
+ context.signal,
104
+ );
105
+ }
106
+ return reported.map((reference) => ({
107
+ room: reference.room,
108
+ record: reference.record,
109
+ position: reference.position,
110
+ native_object_id: reference.native_object_id,
111
+ original: reference.original,
112
+ version: reference.version,
113
+ save: reference.save,
114
+ error: reference.error,
115
+ }));
116
+ }
package/src/source.js ADDED
@@ -0,0 +1,286 @@
1
+ import { resolveEnvironment, runCommand } from "./command.js";
2
+ import { declaredServices, readConfiguration, sourceInstance } from "./configuration.js";
3
+ import { connectorRequest, parseConnectorRun } from "./connector.js";
4
+ import { CONNECTOR_OUTPUT_MAX_BYTES } from "./contract.js";
5
+ import {
6
+ admittedItems,
7
+ advancedCheckpoint,
8
+ deliveredItem,
9
+ deliveryKey,
10
+ healthOfRun,
11
+ itemLimit,
12
+ newCheckpoint,
13
+ stallOf,
14
+ } from "./delivery.js";
15
+ import { captureBatch, openSession } from "./house.js";
16
+ import { googlePage } from "./google/source.js";
17
+ import { houseAnswered, houseAnsweredFailure, houseFailed, KitRefusal } from "./refusal.js";
18
+ import { recordAcceptedOriginals, sameReference, saveSourceOriginals } from "./source-originals.js";
19
+ import {
20
+ readCheckpoint,
21
+ readCoverageGaps,
22
+ readDroppedItems,
23
+ readHealth,
24
+ readSourceOriginals,
25
+ recordDroppedItems,
26
+ recordHealth,
27
+ resetCheckpoints,
28
+ recordCoverageGaps,
29
+ writeCheckpoint,
30
+ } from "./state.js";
31
+
32
+ async function acquire(context, service, checkpoint, limit) {
33
+ if (context.instance.preset === "google") {
34
+ return googlePage(
35
+ {
36
+ directory: context.directory,
37
+ instance: context.instance.id,
38
+ client: context.googleOAuthClient,
39
+ service,
40
+ cursor: checkpoint.cursor,
41
+ limit,
42
+ backfillFloor:
43
+ checkpoint.backfill?.kind === "days" ? checkpoint.backfill.floor : null,
44
+ signal: context.signal,
45
+ },
46
+ context.dependencies,
47
+ );
48
+ }
49
+ const run = await runCommand({
50
+ command: service.connector.command,
51
+ environment: context.environment,
52
+ stdin: connectorRequest({ instance: context.instance.id, cursor: checkpoint.cursor, limit }),
53
+ timeoutMs: service.connector.timeoutMs,
54
+ outputMaxBytes: CONNECTOR_OUTPUT_MAX_BYTES,
55
+ signal: context.signal,
56
+ });
57
+ if (run.status !== 0) throw new KitRefusal("kit_connector_failed", `${run.status}`);
58
+ return parseConnectorRun(run.stdout, limit);
59
+ }
60
+
61
+ async function noteRefusals(context, binding, checkpoint, admitted, outcome) {
62
+ if (outcome.blocked_routes.length > 0) {
63
+ await recordCoverageGaps(
64
+ context.directory,
65
+ binding.instance,
66
+ binding.service,
67
+ outcome.blocked_routes.map((route) => ({
68
+ room: route.room,
69
+ code: route.code,
70
+ gap: route.gap,
71
+ cursor: checkpoint.cursor,
72
+ })),
73
+ );
74
+ }
75
+ const dropped = outcome.items.flatMap((result, position) =>
76
+ result.outcome === "rejected" && result.scope === "item" && result.disposition === "blocked"
77
+ ? [
78
+ {
79
+ delivery_key: deliveryKey(binding, admitted[position]),
80
+ namespace: admitted[position].namespace,
81
+ native_object_id: admitted[position].nativeObjectId,
82
+ code: result.code,
83
+ dropped_at: context.now().toISOString(),
84
+ },
85
+ ]
86
+ : [],
87
+ );
88
+ await recordDroppedItems(context.directory, binding.instance, binding.service, dropped);
89
+ }
90
+
91
+ async function noteProviderDrops(context, binding, dropped) {
92
+ if (dropped.length === 0) return;
93
+ await recordDroppedItems(
94
+ context.directory,
95
+ binding.instance,
96
+ binding.service,
97
+ dropped.map((item) => ({
98
+ delivery_key: deliveryKey(binding, item),
99
+ namespace: item.namespace,
100
+ native_object_id: item.nativeObjectId,
101
+ code: item.code,
102
+ dropped_at: context.now().toISOString(),
103
+ })),
104
+ );
105
+ }
106
+
107
+ async function openCheckpoint(context, service, binding) {
108
+ const stored = await readCheckpoint(context.directory, binding.instance, binding.service);
109
+ if (stored !== null) return stored;
110
+ const opened = newCheckpoint(service.backfill, context.now());
111
+ await writeCheckpoint(context.directory, binding.instance, binding.service, opened);
112
+ return opened;
113
+ }
114
+
115
+ async function runDeliveryLoop(context, service, progress) {
116
+ const binding = serviceBinding(context, service);
117
+ let checkpoint = await openCheckpoint(context, service, binding);
118
+ for (;;) {
119
+ const limit = itemLimit(checkpoint);
120
+ const run = await acquire(context, service, checkpoint, limit);
121
+ await noteProviderDrops(context, binding, run.dropped);
122
+ const admitted = admittedItems(checkpoint, run.items);
123
+ let outcome = { items: [], blocked_routes: [] };
124
+ if (admitted.length > 0) {
125
+ outcome = await captureBatch(context.session, {
126
+ sourceRef: service.sourceRef,
127
+ rooms: service.rooms,
128
+ items: admitted.map((item) => deliveredItem(binding, item)),
129
+ });
130
+ progress.batches += 1;
131
+ const accepted = await recordAcceptedOriginals(context, binding, admitted, outcome);
132
+ progress.attempted.push(...accepted);
133
+ progress.originals.push(
134
+ ...(await saveSourceOriginals(context, binding, (reference) =>
135
+ accepted.some((offered) => sameReference(offered, reference)),
136
+ )),
137
+ );
138
+ }
139
+ await noteRefusals(context, binding, checkpoint, admitted, outcome);
140
+ const refused = outcome.items.find((result) => result.outcome === "rejected");
141
+ if (refused !== undefined) {
142
+ progress.stall = { code: refused.code, disposition: refused.disposition };
143
+ return;
144
+ }
145
+ progress.delivered += admitted.length;
146
+ if (run.cursor === null) return;
147
+ const advanced = advancedCheckpoint(checkpoint, run.cursor, admitted.length);
148
+ await writeCheckpoint(context.directory, binding.instance, binding.service, advanced);
149
+ const darkened = outcome.blocked_routes.at(-1);
150
+ if (darkened !== undefined) {
151
+ progress.stall = stallOf(darkened.code);
152
+ return;
153
+ }
154
+ if (advanced.cursor === checkpoint.cursor) return;
155
+ if (checkpoint.backfill?.kind === "count" && advanced.backfill === null) return;
156
+ if (!run.more) return;
157
+ checkpoint = advanced;
158
+ }
159
+ }
160
+
161
+ function serviceBinding(context, service) {
162
+ return { instance: context.instance.id, service: service.service, sourceRef: service.sourceRef };
163
+ }
164
+
165
+ async function deliverService(context, service) {
166
+ const progress = { delivered: 0, batches: 0, stall: null, refused: null, attempted: [], originals: [] };
167
+ try {
168
+ const resolved =
169
+ context.instance.preset === "custom"
170
+ ? { ...context, environment: await resolveEnvironment(service.connector) }
171
+ : context;
172
+ await runDeliveryLoop(resolved, service, progress);
173
+ } catch (refusal) {
174
+ if (!(refusal instanceof KitRefusal) || refusal.code === "kit_command_cancelled") throw refusal;
175
+ progress.stall = stallOf(refusal.code, houseAnsweredFailure(refusal) ? houseFailed(refusal) : null);
176
+ if (houseAnswered(refusal)) progress.refused = { code: refusal.code, payload: refusal.payload };
177
+ }
178
+ const health = healthOfRun(progress.stall);
179
+ await recordHealth(context.directory, context.instance.id, service.service, {
180
+ ...health,
181
+ observed_at: context.now().toISOString(),
182
+ });
183
+ return {
184
+ service: service.service,
185
+ delivered: progress.delivered,
186
+ batches: progress.batches,
187
+ health,
188
+ refused: progress.refused,
189
+ originals: [
190
+ ...progress.originals,
191
+ ...(await saveSourceOriginals(
192
+ context,
193
+ serviceBinding(context, service),
194
+ (reference) => !progress.attempted.some((attempted) => sameReference(attempted, reference)),
195
+ )),
196
+ ],
197
+ };
198
+ }
199
+
200
+ export async function captureSource(options, dependencies = {}) {
201
+ const configuration = await readConfiguration(options.configuration);
202
+ const instance = sourceInstance(configuration, options.instance);
203
+ const services = declaredServices(instance, options.service ?? null);
204
+ const googleOAuthClient =
205
+ instance.preset === "google" ? dependencies.googleOAuthClient() : null;
206
+ const session = await openSession(options, dependencies);
207
+ const context = {
208
+ instance,
209
+ session,
210
+ directory: options.directory,
211
+ signal: options.signal,
212
+ now: session.now,
213
+ dependencies,
214
+ googleOAuthClient,
215
+ };
216
+ const delivered = [];
217
+ for (const service of services) delivered.push(await deliverService(context, service));
218
+ return { instance: instance.id, services: delivered };
219
+ }
220
+
221
+ export async function sourceStatus(options) {
222
+ const configuration = await readConfiguration(options.configuration);
223
+ const instance = sourceInstance(configuration, options.instance);
224
+ const services = declaredServices(instance, options.service ?? null);
225
+ const reported = [];
226
+ for (const service of services) {
227
+ reported.push({
228
+ service: service.service,
229
+ source_ref: service.sourceRef,
230
+ rooms: service.rooms,
231
+ health: (await readHealth(options.directory, instance.id, service.service)) ?? {
232
+ state: "pending",
233
+ category: null,
234
+ observed_at: null,
235
+ },
236
+ checkpoint: await readCheckpoint(options.directory, instance.id, service.service),
237
+ gaps: await readCoverageGaps(options.directory, instance.id, service.service),
238
+ dropped: await readDroppedItems(options.directory, instance.id, service.service),
239
+ originals: (await readSourceOriginals(options.directory, instance.id, service.service)).map(
240
+ (reference) => ({
241
+ room: reference.room,
242
+ record: reference.record,
243
+ position: reference.position,
244
+ native_object_id: reference.native_object_id,
245
+ save: reference.save,
246
+ error: reference.error,
247
+ }),
248
+ ),
249
+ });
250
+ }
251
+ return { instance: instance.id, preset: instance.preset, services: reported };
252
+ }
253
+
254
+ export async function retrySourceOriginals(options, dependencies = {}) {
255
+ const configuration = await readConfiguration(options.configuration);
256
+ const instance = sourceInstance(configuration, options.instance);
257
+ const services = declaredServices(instance, options.service ?? null);
258
+ const context = { instance, directory: options.directory, signal: options.signal };
259
+ const outstanding = [];
260
+ for (const service of services) {
261
+ outstanding.push((await readSourceOriginals(options.directory, instance.id, service.service)).length);
262
+ }
263
+ if (outstanding.some((count) => count > 0)) context.session = await openSession(options, dependencies);
264
+ const retried = [];
265
+ for (const [position, service] of services.entries()) {
266
+ retried.push({
267
+ service: service.service,
268
+ originals:
269
+ outstanding[position] === 0
270
+ ? []
271
+ : await saveSourceOriginals(context, serviceBinding(context, service)),
272
+ });
273
+ }
274
+ return { instance: instance.id, services: retried };
275
+ }
276
+
277
+ export async function resetSource(options, dependencies = {}) {
278
+ const configuration = await readConfiguration(options.configuration);
279
+ const instance = sourceInstance(configuration, options.instance);
280
+ declaredServices(instance, options.service);
281
+ await openSession(options, dependencies);
282
+ return {
283
+ instance: instance.id,
284
+ services: await resetCheckpoints(options.directory, instance.id, options.service),
285
+ };
286
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Matt Pocock
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: grilling
3
+ description: Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
4
+ ---
5
+
6
+ <!-- Vendored from mattpocock/skills at commit 6654f6b60cd9d5be8b54c6fafe44346dabeb3b76 (skills/productivity/grilling). MIT licensed — see LICENSE in this directory. -->
7
+
8
+ Interview the user relentlessly until you reach a shared understanding. Map this as a **design tree**: every decision branches into the decisions that hang off it.
9
+
10
+ Work the tree in **rounds**. The **frontier** is every decision whose prerequisites are already settled: the questions you can ask _now_ without guessing at answers you haven't heard yet. Ask the whole frontier in one round: number each question and give your recommended answer. Then wait for the user's answers before the next round.
11
+
12
+ Format a round like so:
13
+
14
+ ```
15
+ ❓ **Q1** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>
16
+
17
+ ➡️ <your recommended answer>
18
+
19
+ ---
20
+
21
+ ❓ **Q2** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>
22
+
23
+ ➡️ <your recommended answer>
24
+ ```
25
+
26
+ Each round the user answers reshapes the tree: settled decisions push the frontier outward and unblock questions that depended on them. Recompute the frontier and ask the next round. A question whose answer depends on another question still open in this round belongs to a _later_ round, not this one.
27
+
28
+ Finding _facts_ is your job, never the user's. When a frontier question needs a fact from the environment (filesystem, tools, etc.), dispatch a sub-agent to find it; don't ask the user for anything you could look up yourself. Don't block on it: a running exploration is an unsettled prerequisite, so only the questions downstream of it wait for the sub-agent to report; ask the rest of the frontier now. The _decisions_ are the user's: put each to them and wait.
29
+
30
+ The session is done when the frontier is empty: every branch of the design tree visited, nothing left silently assumed. Do not act on it until the user confirms you have reached a shared understanding.
@@ -0,0 +1,3 @@
1
+ interface:
2
+ display_name: "Grilling"
3
+ short_description: "Stress-test thinking a round of questions at a time"
@@ -0,0 +1,17 @@
1
+ import { cp, mkdir, symlink, writeFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ const AGENTS_INSTRUCTION = "The agents.house `house` CLI is available: run `house --help`.\n";
6
+ const GRILLING_SOURCE = fileURLToPath(new URL("starter-set/grilling/", import.meta.url));
7
+
8
+ export async function seedStarterSet(target) {
9
+ await mkdir(target, { recursive: true });
10
+ await writeFile(join(target, "AGENTS.md"), AGENTS_INSTRUCTION);
11
+ await symlink("AGENTS.md", join(target, "CLAUDE.md"));
12
+ const skills = join(target, ".agents", "skills");
13
+ await mkdir(skills, { recursive: true });
14
+ await cp(GRILLING_SOURCE, join(skills, "grilling"), { recursive: true });
15
+ await mkdir(join(target, ".claude"), { recursive: true });
16
+ await symlink(join("..", ".agents", "skills"), join(target, ".claude", "skills"));
17
+ }