@agentshouse/kit 0.2.1-cbff58027f078 → 0.2.1-cc21cf8f5c4d0

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/agents.js CHANGED
@@ -186,7 +186,7 @@ export class Agents {
186
186
  this.refreshing++;
187
187
  this.changed();
188
188
  const reading = this.read().then(async () => {
189
- this.desired = await this.house.deliver('/kit/agents/desired', {});
189
+ this.desired = await this.house.deliver('/kit/agents/desired/list', {});
190
190
  return this.desired;
191
191
  });
192
192
  this.reading = reading;
@@ -8,7 +8,7 @@ proxyUnlessRelayed();
8
8
  try {
9
9
  const { house, credential } = (await readEnrolment());
10
10
  try {
11
- await post(house, '/kit/agents/desired', {}, credential);
11
+ await post(house, '/kit/agents/desired/list', {}, credential);
12
12
  }
13
13
  catch (error) {
14
14
  if (!unanswered(error))
package/dist/bridge.js CHANGED
@@ -81,7 +81,7 @@ function editAnswer(forwarded) {
81
81
  export async function openBridge(house, copies, conversationId, signal) {
82
82
  const path = [join(kitHome(), 'shim'), dirname(process.execPath), await loginPath()].join(delimiter);
83
83
  const origin = (await readEnrolment()).house;
84
- const { credential } = await retrying(() => house.post(`/kit/conversations/${conversationId}/credential`, {}, signal), signal);
84
+ const { credential } = await retrying(() => house.post('/kit/conversations/credentials/issue', { conversation: conversationId }, signal), signal);
85
85
  const closed = new AbortController();
86
86
  const sent = (message, operation) => callHouse(origin, credential, message, operation, closed.signal);
87
87
  const send = async (message, operation) => {
@@ -105,7 +105,7 @@ export async function openBridge(house, copies, conversationId, signal) {
105
105
  const bytes = Buffer.from(JSON.stringify({ changes }));
106
106
  const sha256 = createHash('sha256').update(bytes).digest('hex');
107
107
  const prepared = answered(await send(call('run_command', {
108
- command: 'prepare_edit_upload',
108
+ command: 'files/batch-upload',
109
109
  arguments: { paths: changedPaths(changes), bytes: bytes.length, sha256 },
110
110
  }), operation));
111
111
  if ('refused' in prepared)
@@ -141,7 +141,7 @@ export async function openBridge(house, copies, conversationId, signal) {
141
141
  const caller = {
142
142
  key: `conversation:${conversationId}`,
143
143
  submit: async (operation, changes, held, retain) => {
144
- const inline = call('edit', { changes });
144
+ const inline = call('files_batch', { changes });
145
145
  let upload = held;
146
146
  if (upload === undefined && Buffer.byteLength(mcpBody(inline, operation)) > MCP_REQUEST_BYTES) {
147
147
  const prepared = await staged(operation, changes);
@@ -150,7 +150,7 @@ export async function openBridge(house, copies, conversationId, signal) {
150
150
  upload = prepared;
151
151
  await retain(upload);
152
152
  }
153
- return editAnswer(await send(upload === undefined ? inline : call('edit', { paths: changedPaths(changes), upload }), operation));
153
+ return editAnswer(await send(upload === undefined ? inline : call('files_batch', { paths: changedPaths(changes), upload }), operation));
154
154
  },
155
155
  };
156
156
  const local = async (path, text) => {
package/dist/calls.js CHANGED
@@ -42,7 +42,7 @@ export class Calls {
42
42
  return carried
43
43
  .then(async ({ result, returned, release }) => {
44
44
  try {
45
- await this.house.deliver(`/kit/inputs/${callId}/ack`, result);
45
+ await this.house.deliver('/kit/kit-calls/results/return', { call: callId, ...result });
46
46
  }
47
47
  finally {
48
48
  this.returned.add(callId);
@@ -88,17 +88,17 @@ export function holdConnection(handlers) {
88
88
  if (arrived.type === 'input')
89
89
  handlers.call(arrived);
90
90
  else if (arrived.type !== 'beat')
91
- handlers.notification(arrived);
91
+ handlers.oneWayCall(arrived);
92
92
  };
93
93
  opening.onerror = () => undefined;
94
94
  opening.onclose = closed;
95
95
  };
96
96
  void connect();
97
97
  return {
98
- send(notification) {
98
+ send(oneWayCall) {
99
99
  if (connection === null || connection.readyState !== WebSocket.OPEN)
100
100
  return false;
101
- connection.send(JSON.stringify(notification));
101
+ connection.send(JSON.stringify(oneWayCall));
102
102
  return true;
103
103
  },
104
104
  };
@@ -538,8 +538,7 @@ export class Conversations {
538
538
  throw new Error(`${path} is no longer an audio file`);
539
539
  return address;
540
540
  }, signal);
541
- const transcript = `/kit/conversations/${conversation.id}/messages/${messageId}/transcripts`;
542
- await step(unbridged, unlessAborted(this.kit.house.deliver(transcript, { path, text: said }, () => !signal.aborted), signal));
541
+ await step(unbridged, unlessAborted(this.kit.house.deliver('/kit/transcripts/keep', { conversation: conversation.id, message: messageId, path, text: said }, () => !signal.aborted), signal));
543
542
  blocks.push({ type: 'text', text: `${path}\nTranscript: ${said}` });
544
543
  }
545
544
  }
@@ -780,9 +779,9 @@ export class Conversations {
780
779
  conversation.options = options;
781
780
  this.kit.send({ type: 'options', conversation_id: conversation.id, options });
782
781
  }
783
- deliver(conversation, turn, event, body, current) {
782
+ deliver(conversation, turn, act, body, current) {
784
783
  this.reporting++;
785
- const delivered = conversation.reports.then(async () => this.kit.house.deliver(`/kit/conversations/${conversation.id}/turns/${turn.id}/${event}`, await body, current));
784
+ const delivered = conversation.reports.then(async () => this.kit.house.deliver(`/kit/${act}`, { conversation: conversation.id, turn: turn.id, ...(await body) }, current));
786
785
  conversation.reports = delivered
787
786
  .catch(() => undefined)
788
787
  .finally(() => {
@@ -804,7 +803,7 @@ export class Conversations {
804
803
  const turn = new Turn((operation) => this.write(conversation, turn, operation));
805
804
  conversation.turns.add(turn);
806
805
  conversation.running?.adapter.turn(true);
807
- void this.deliver(conversation, turn, 'started', {})
806
+ void this.deliver(conversation, turn, 'turns/start', {})
808
807
  .then((answer) => {
809
808
  if (answer.run === true)
810
809
  turn.quietUntil = Date.now() + ACTIVITY_REPORT_MS;
@@ -842,7 +841,7 @@ export class Conversations {
842
841
  ...(tokens === null ? {} : { tokens }),
843
842
  ...(failed === null ? {} : { failed: failed.failure }),
844
843
  }));
845
- void this.deliver(conversation, turn, 'ended', body).catch(logged);
844
+ void this.deliver(conversation, turn, 'turns/end', body).catch(logged);
846
845
  this.next(conversation);
847
846
  this.kit.changed();
848
847
  }
@@ -903,7 +902,7 @@ export class Conversations {
903
902
  const answered = new Promise((answer, fail) => {
904
903
  this.questions.set(interactionId, { conversation, answer: (response) => answer(response) });
905
904
  signal.addEventListener('abort', () => answer(null), { once: true });
906
- this.deliver(conversation, turn, 'interactions', {
905
+ this.deliver(conversation, turn, 'conversations/interaction/ask', {
907
906
  interaction_id: interactionId,
908
907
  request: { method, params },
909
908
  secret,
@@ -951,7 +950,7 @@ export class Conversations {
951
950
  if (turn === null || Date.now() < turn.quietUntil)
952
951
  return;
953
952
  turn.quietUntil = Infinity;
954
- void this.deliver(conversation, turn, 'activity', {}, () => false)
953
+ void this.deliver(conversation, turn, 'turns/activity/report', {}, () => false)
955
954
  .catch(logged)
956
955
  .finally(() => {
957
956
  turn.quietUntil = Date.now() + ACTIVITY_REPORT_MS;
@@ -1057,7 +1056,7 @@ export class Conversations {
1057
1056
  const name = `image-${++turn.images}.${mediaType.split('/')[1]}`;
1058
1057
  const sha256 = createHash('sha256').update(bytes).digest('hex');
1059
1058
  try {
1060
- const declared = (await this.deliver(conversation, turn, 'images', {
1059
+ const declared = (await this.deliver(conversation, turn, 'turns/images/declare', {
1061
1060
  name,
1062
1061
  media_type: mediaType,
1063
1062
  bytes: bytes.length,
package/dist/copies.js CHANGED
@@ -14,7 +14,7 @@ const BRANCH = 'main';
14
14
  const PROVENANCE = '_provenance';
15
15
  const IDENTITY = { GIT_COMMITTER_NAME: 'Kit', GIT_COMMITTER_EMAIL: 'house-kit@localhost' };
16
16
  const ROOMS = 'rooms/';
17
- const ENUMERATE = '/kit/door/enumerate';
17
+ const ENUMERATE = '/kit/door/changes/enumerate';
18
18
  const NOT_READY = 'not ready yet; Kit copies it once House has built it';
19
19
  const STAGED_CHUNKS = 'house-chunks';
20
20
  // A Room answered not ready is asked again on this schedule: its chunk build usually catches up within seconds, so the first asks come soon and the last repeats until it does.
@@ -236,7 +236,7 @@ export class LocalCopies {
236
236
  key: 'owner',
237
237
  submit: async (operation, changes) => {
238
238
  try {
239
- const outcome = await retrying(() => house.post('/kit/door/batch', { operation_id: operation, changes }));
239
+ const outcome = await retrying(() => house.post('/kit/door/files/batch', { operation_id: operation, changes }));
240
240
  return { accepted: outcome.contents };
241
241
  }
242
242
  catch (error) {
@@ -295,7 +295,7 @@ export class LocalCopies {
295
295
  return answered;
296
296
  }
297
297
  async fetched(refreshing, rooms) {
298
- const { local_copy: answer } = await this.house.post('/kit/local-copy/selection', rooms === undefined ? {} : { rooms });
298
+ const { local_copy: answer } = await this.house.post('/kit/local-copies/selection/read', rooms === undefined ? {} : { rooms });
299
299
  const synced = new Map(answer.rooms.map((room) => [`${ROOMS}${room.room_ref}`, room.room_handle]));
300
300
  const named = rooms === undefined ? null : new Set(rooms.map((room) => `${ROOMS}${room}`));
301
301
  const held = () => [...this.copies.values()].filter((copy) => named === null || named.has(copy.key));
@@ -445,7 +445,7 @@ export class LocalCopies {
445
445
  return copy;
446
446
  }
447
447
  async discovered(handles) {
448
- const discover = (group) => this.house.post('/kit/door/discover', { prefixes: group.map(rootOf) });
448
+ const discover = (group) => this.house.post('/kit/door/rooms/discover', { prefixes: group.map(rootOf) });
449
449
  const [first, ...rest] = handles;
450
450
  const { bounds, authorities } = await discover([first]);
451
451
  for (const group of grouped(rest, bounds.max_prefixes))
@@ -749,7 +749,7 @@ export class LocalCopies {
749
749
  const arrived = new Set(moved.values());
750
750
  const arriving = [...after].filter(([path, entry]) => before.get(path) !== entry);
751
751
  if (arriving.length > 0) {
752
- const { bounds } = await this.house.post('/kit/door/discover', { prefixes: [root] });
752
+ const { bounds } = await this.house.post('/kit/door/rooms/discover', { prefixes: [root] });
753
753
  const binary = [];
754
754
  for (const [path, entry] of arriving) {
755
755
  if (!(await isText(copy.repository, entry, bounds.max_authored_file_bytes)))
@@ -966,7 +966,7 @@ export class LocalCopies {
966
966
  return true;
967
967
  }
968
968
  async revisionText(path, wanted) {
969
- const page = await this.house.post('/kit/door/revisions', {
969
+ const page = await this.house.post('/kit/door/files/revisions/list', {
970
970
  path,
971
971
  revision: wanted,
972
972
  });
package/dist/events.js CHANGED
@@ -4,9 +4,9 @@ const HIDDEN = { shown: 'hidden' };
4
4
  const FINISHED = new Set(['completed', 'failed']);
5
5
  export const RUNNING_JOB = new Set(['running', 'paused']);
6
6
  const MESSAGE_TARGETS = new Map([
7
- ['send_agent_function_request', ['agent_function', 'agent']],
8
- ['cancel_agent_function_request', ['request']],
9
- ['send_mail', ['conversation', 'request']],
7
+ ['agent-functions/send', ['agent_function', 'agent']],
8
+ ['agent-functions/cancel', ['request']],
9
+ ['agent-functions/mail/send', ['conversation', 'request']],
10
10
  ]);
11
11
  function counted(reports) {
12
12
  const whole = reports.every((tokens) => Object.values(tokens).every((count) => Number.isSafeInteger(count) && count >= 0));
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
@@ -146,7 +146,7 @@ export async function resident() {
146
146
  }
147
147
  else if (!reported) {
148
148
  reported = true;
149
- logged(house.deliver('/kit/idle', {}, idle));
149
+ logged(house.deliver('/kit/kits/report-idle', {}, idle));
150
150
  }
151
151
  };
152
152
  const calls = new Calls(house, changed);
@@ -155,7 +155,7 @@ export async function resident() {
155
155
  agents,
156
156
  copies,
157
157
  calls,
158
- send: (notification) => connection?.send(notification) ?? false,
158
+ send: (oneWayCall) => connection?.send(oneWayCall) ?? false,
159
159
  changed,
160
160
  });
161
161
  const signIns = new SignIns(house, agents, calls);
@@ -163,7 +163,7 @@ export async function resident() {
163
163
  if (process.env.HOUSE_KIT_SANDBOX !== '1')
164
164
  takeUnservedRelease((release) => logged(update.takeRefused(release)));
165
165
  removeInputs();
166
- const scripts = new Scripts(calls, (notification) => connection?.send(notification) ?? false);
166
+ const scripts = new Scripts(calls, (oneWayCall) => connection?.send(oneWayCall) ?? false);
167
167
  for (const signal of ['SIGTERM', 'SIGINT']) {
168
168
  process.once(signal, () => {
169
169
  killDescendants();
@@ -171,7 +171,7 @@ export async function resident() {
171
171
  process.kill(process.pid, signal);
172
172
  });
173
173
  }
174
- await house.deliver('/kit/restarted', {}).catch(report);
174
+ await house.deliver('/kit/kits/report-restart', {}).catch(report);
175
175
  logged(agents.refresh());
176
176
  agents.keepCurrent();
177
177
  connection = holdConnection({
@@ -195,14 +195,14 @@ export async function resident() {
195
195
  void calls.carry(call.input_id, async () => ({ result: refused }));
196
196
  }
197
197
  },
198
- notification: (notification) => {
199
- if (notification.type === 'watching')
200
- conversations.watching(notification.watching === true);
201
- if (notification.type === 'authority_changed')
202
- logged(copies.changed(notification.rooms));
203
- if (notification.type === 'work_available' && notification.subject === 'agents')
198
+ oneWayCall: (oneWayCall) => {
199
+ if (oneWayCall.type === 'watching')
200
+ conversations.watching(oneWayCall.watching === true);
201
+ if (oneWayCall.type === 'authority_changed')
202
+ logged(copies.changed(oneWayCall.rooms));
203
+ if (oneWayCall.type === 'work_available' && oneWayCall.subject === 'agents')
204
204
  logged(agents.refresh());
205
- scripts.notified(notification);
205
+ scripts.notified(oneWayCall);
206
206
  },
207
207
  });
208
208
  }
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')
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 = 5;
5
5
  export const KIT_WIRE_HEADER = 'x-house-kit-wire';
6
6
  let take = null;
7
7
  let taken = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/kit",
3
- "version": "0.2.1-cbff58027f078",
3
+ "version": "0.2.1-cc21cf8f5c4d0",
4
4
  "description": "Kit connects an Environment to agents.house.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@agentclientprotocol/sdk": "2.0.1",
28
28
  "@agentshouse/mdmodel": "0.1.0-c4f4d37bc9d6a",
29
- "@agentshouse/skills": "0.1.0-ca0e7383018fc",
29
+ "@agentshouse/skills": "0.1.0-c0e572593a2be",
30
30
  "@lydell/node-pty": "1.2.0-beta.15",
31
31
  "yaml": "2.9.1"
32
32
  },