@agentshouse/kit 0.2.1-c063e835a50ea → 0.2.1-c15804a0fa28d
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/bootstrap.json +4 -4
- package/dist/copies.js +24 -30
- package/dist/instructions.js +1 -1
- package/dist/skills.js +1 -1
- package/package.json +1 -1
package/dist/bootstrap.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
|
-
"version": "0.2.1-
|
|
3
|
+
"version": "0.2.1-c15804a0fa28d",
|
|
4
4
|
"hosts": {
|
|
5
5
|
"macos": {
|
|
6
6
|
"asset": {
|
|
7
7
|
"name": "connect-linux.sh",
|
|
8
|
-
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-
|
|
8
|
+
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-c15804a0fa28d/connect-linux.sh"
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
"linux": {
|
|
12
12
|
"asset": {
|
|
13
13
|
"name": "connect-linux.sh",
|
|
14
|
-
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-
|
|
14
|
+
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-c15804a0fa28d/connect-linux.sh"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"windows": {
|
|
18
18
|
"asset": {
|
|
19
19
|
"name": "connect-windows.ps1",
|
|
20
|
-
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-
|
|
20
|
+
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-c15804a0fa28d/connect-windows.ps1"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
package/dist/copies.js
CHANGED
|
@@ -41,11 +41,11 @@ function sidecar(path) {
|
|
|
41
41
|
segments.splice(-1, 0, PROVENANCE);
|
|
42
42
|
return segments.join('/');
|
|
43
43
|
}
|
|
44
|
-
function rootOf(
|
|
45
|
-
return
|
|
44
|
+
function rootOf(handle) {
|
|
45
|
+
return `/rooms/${handle}`;
|
|
46
46
|
}
|
|
47
47
|
function relative(path) {
|
|
48
|
-
return path.replace(/^\/
|
|
48
|
+
return path.replace(/^\/rooms\/[^/]+\//, '');
|
|
49
49
|
}
|
|
50
50
|
function declaredWritable(path, copy) {
|
|
51
51
|
const deepest = (scopes) => Math.max(-1, ...scopes.filter((scope) => covers(path, scope)).map((scope) => scope.length));
|
|
@@ -177,7 +177,7 @@ export class LocalCopies {
|
|
|
177
177
|
async load() {
|
|
178
178
|
const home = join(kitHome(), 'local-copies');
|
|
179
179
|
const names = (await readdir(join(home, 'rooms')).catch(() => [])).filter((name) => name.endsWith('.json'));
|
|
180
|
-
for (const path of
|
|
180
|
+
for (const path of names.map((name) => join(home, 'rooms', name))) {
|
|
181
181
|
const text = await readFile(path, 'utf8').catch(() => null);
|
|
182
182
|
if (text === null)
|
|
183
183
|
continue;
|
|
@@ -189,7 +189,7 @@ export class LocalCopies {
|
|
|
189
189
|
await this.selecting;
|
|
190
190
|
return [...this.copies.values()]
|
|
191
191
|
.filter((copy) => copy.active)
|
|
192
|
-
.map((copy) => `${rootOf(copy)}: ${copy.repository}`)
|
|
192
|
+
.map((copy) => `${rootOf(copy.room_handle)}: ${copy.repository}`)
|
|
193
193
|
.sort();
|
|
194
194
|
}
|
|
195
195
|
select() {
|
|
@@ -199,12 +199,7 @@ export class LocalCopies {
|
|
|
199
199
|
}
|
|
200
200
|
async reselect() {
|
|
201
201
|
const { local_copy: chosen } = await this.house.post('/kit/local-copy/selection', {});
|
|
202
|
-
const selected = [
|
|
203
|
-
...(chosen?.rooms ?? [])
|
|
204
|
-
.filter((room) => room.room_handle !== null)
|
|
205
|
-
.map((room) => ({ key: `rooms/${room.room_ref}`, private: false, handle: room.room_handle })),
|
|
206
|
-
...(chosen?.private === true ? [{ key: 'private', private: true, handle: null }] : []),
|
|
207
|
-
];
|
|
202
|
+
const selected = (chosen?.rooms ?? []).flatMap((room) => room.room_handle === null ? [] : [{ key: `rooms/${room.room_ref}`, handle: room.room_handle }]);
|
|
208
203
|
const keys = new Set(selected.map((scope) => scope.key));
|
|
209
204
|
const work = [];
|
|
210
205
|
for (const key of this.copies.keys()) {
|
|
@@ -288,7 +283,7 @@ export class LocalCopies {
|
|
|
288
283
|
}).catch(logged);
|
|
289
284
|
}
|
|
290
285
|
async save(copy) {
|
|
291
|
-
const path = join(kitHome(), 'local-copies',
|
|
286
|
+
const path = join(kitHome(), 'local-copies', `${copy.key}.json`);
|
|
292
287
|
await mkdir(dirname(path), { recursive: true, mode: 0o700 });
|
|
293
288
|
const temporary = `${path}.${process.pid}`;
|
|
294
289
|
await writeFile(temporary, JSON.stringify(copy), { mode: 0o600 });
|
|
@@ -296,8 +291,8 @@ export class LocalCopies {
|
|
|
296
291
|
this.copies.set(copy.key, copy);
|
|
297
292
|
return copy;
|
|
298
293
|
}
|
|
299
|
-
async read(
|
|
300
|
-
const prefixes = [rootOf(
|
|
294
|
+
async read(handle) {
|
|
295
|
+
const prefixes = [rootOf(handle)];
|
|
301
296
|
const discovery = await this.house.post('/kit/door/discover', { prefixes });
|
|
302
297
|
let bundle = await this.house.post('/kit/door/bootstrap', { prefixes });
|
|
303
298
|
if ('transfer' in bundle)
|
|
@@ -344,13 +339,13 @@ export class LocalCopies {
|
|
|
344
339
|
return;
|
|
345
340
|
}
|
|
346
341
|
const discovery = await this.house.post('/kit/door/discover', {
|
|
347
|
-
prefixes: [rootOf(copy)],
|
|
342
|
+
prefixes: [rootOf(copy.room_handle)],
|
|
348
343
|
});
|
|
349
344
|
const authority = discovery.authorities.find((entry) => entry.room_ref === copy.room_ref);
|
|
350
345
|
if (authority === undefined)
|
|
351
346
|
return;
|
|
352
347
|
if (authority.managed_replication !== 'admitted') {
|
|
353
|
-
logged(`operation_denied: ${rootOf(copy)} is not synchronized to this Environment`);
|
|
348
|
+
logged(`operation_denied: ${rootOf(copy.room_handle)} is not synchronized to this Environment`);
|
|
354
349
|
return;
|
|
355
350
|
}
|
|
356
351
|
if (JSON.stringify([authority.operations.write, authority.protected_paths]) !==
|
|
@@ -361,12 +356,12 @@ export class LocalCopies {
|
|
|
361
356
|
await this.save(await this.caughtUp(copy));
|
|
362
357
|
}
|
|
363
358
|
async materialize(scope) {
|
|
364
|
-
const read = await this.read(
|
|
359
|
+
const read = await this.read(scope.handle);
|
|
365
360
|
if (read === null) {
|
|
366
|
-
logged(`House serves nothing of ${rootOf(
|
|
361
|
+
logged(`House serves nothing of ${rootOf(scope.handle)} to copy`);
|
|
367
362
|
return;
|
|
368
363
|
}
|
|
369
|
-
const repository =
|
|
364
|
+
const repository = join(localCopies(), 'rooms', read.anchor);
|
|
370
365
|
if (await exists(repository)) {
|
|
371
366
|
logged(`${repository} already exists and House Kit leaves it as it is`);
|
|
372
367
|
return;
|
|
@@ -378,7 +373,7 @@ export class LocalCopies {
|
|
|
378
373
|
try {
|
|
379
374
|
await git(staging, ['init', '-q', '-b', BRANCH]);
|
|
380
375
|
house = await importCommits(staging, [
|
|
381
|
-
{ message: `House ${rootOf(
|
|
376
|
+
{ message: `House ${rootOf(scope.handle)}`, from: null, files: read.writable },
|
|
382
377
|
]);
|
|
383
378
|
await git(staging, ['update-ref', `refs/heads/${BRANCH}`, house]);
|
|
384
379
|
await git(staging, ['reset', '-q', '--hard']);
|
|
@@ -392,7 +387,6 @@ export class LocalCopies {
|
|
|
392
387
|
}
|
|
393
388
|
await this.save({
|
|
394
389
|
key: scope.key,
|
|
395
|
-
private: scope.private,
|
|
396
390
|
room_ref: read.anchor,
|
|
397
391
|
room_handle: scope.handle,
|
|
398
392
|
repository,
|
|
@@ -408,11 +402,11 @@ export class LocalCopies {
|
|
|
408
402
|
});
|
|
409
403
|
}
|
|
410
404
|
async received(copy) {
|
|
411
|
-
const read = await this.read(copy);
|
|
405
|
+
const read = await this.read(copy.room_handle);
|
|
412
406
|
if (read === null)
|
|
413
407
|
return copy;
|
|
414
408
|
const house = await importCommits(copy.repository, [
|
|
415
|
-
{ message: `House ${rootOf(copy)} at position ${read.position}`, from: copy.house, replaces: true, files: read.writable },
|
|
409
|
+
{ message: `House ${rootOf(copy.room_handle)} at position ${read.position}`, from: copy.house, replaces: true, files: read.writable },
|
|
416
410
|
]);
|
|
417
411
|
const removed = copy.read_only.filter((path) => !read.readOnly.has(path));
|
|
418
412
|
const readOnly = await readOnlyPlaced(copy.repository, copy.read_only, read.readOnly, removed);
|
|
@@ -435,7 +429,7 @@ export class LocalCopies {
|
|
|
435
429
|
let answer;
|
|
436
430
|
try {
|
|
437
431
|
answer = await this.house.post('/kit/door/enumerate', {
|
|
438
|
-
prefixes: [rootOf(copy)],
|
|
432
|
+
prefixes: [rootOf(copy.room_handle)],
|
|
439
433
|
positions: [{ authority: copy.room_ref, position: copy.position, log_epoch: copy.log_epoch }],
|
|
440
434
|
});
|
|
441
435
|
}
|
|
@@ -485,7 +479,7 @@ export class LocalCopies {
|
|
|
485
479
|
let { house, manifests } = copy;
|
|
486
480
|
if (files.size > 0) {
|
|
487
481
|
house = await importCommits(copy.repository, [
|
|
488
|
-
{ message: `House ${rootOf(copy)} at position ${position}`, from: copy.house, files },
|
|
482
|
+
{ message: `House ${rootOf(copy.room_handle)} at position ${position}`, from: copy.house, files },
|
|
489
483
|
]);
|
|
490
484
|
manifests = { ...manifests, [house]: { parent: copy.house, files: revisions } };
|
|
491
485
|
}
|
|
@@ -516,7 +510,7 @@ export class LocalCopies {
|
|
|
516
510
|
copy = await this.save(without(copy));
|
|
517
511
|
}
|
|
518
512
|
if (!copy.active) {
|
|
519
|
-
return { refused: true, text: `${rootOf(copy)} is no longer synced to this Environment, so House takes no push from it` };
|
|
513
|
+
return { refused: true, text: `${rootOf(copy.room_handle)} is no longer synced to this Environment, so House takes no push from it` };
|
|
520
514
|
}
|
|
521
515
|
const listed = (await git(copy.repository, ['rev-list', '--topo-order', commit])).split('\n');
|
|
522
516
|
const base = listed.find((ancestor) => ancestor in copy.manifests);
|
|
@@ -550,7 +544,7 @@ export class LocalCopies {
|
|
|
550
544
|
return this.settle(submitted, caller);
|
|
551
545
|
}
|
|
552
546
|
async derived(copy, base, commit) {
|
|
553
|
-
const root = rootOf(copy);
|
|
547
|
+
const root = rootOf(copy.room_handle);
|
|
554
548
|
const before = await tree(copy.repository, base);
|
|
555
549
|
const after = await tree(copy.repository, commit);
|
|
556
550
|
const moved = movedPaths(copy.moves, before, after);
|
|
@@ -632,7 +626,7 @@ export class LocalCopies {
|
|
|
632
626
|
const push = copy.push;
|
|
633
627
|
const current = await this.save(await this.caughtUp(copy));
|
|
634
628
|
const house = await tree(copy.repository, current.house);
|
|
635
|
-
const root = rootOf(current);
|
|
629
|
+
const root = rootOf(current.room_handle);
|
|
636
630
|
if (!(await this.landed(copy.repository, push.changes, house, await tree(copy.repository, push.commit)))) {
|
|
637
631
|
await this.save(without(current));
|
|
638
632
|
return {
|
|
@@ -688,7 +682,7 @@ export class LocalCopies {
|
|
|
688
682
|
written = [
|
|
689
683
|
...written,
|
|
690
684
|
{
|
|
691
|
-
path: `${rootOf(copy)}/${path}`,
|
|
685
|
+
path: `${rootOf(copy.room_handle)}/${path}`,
|
|
692
686
|
revision: entry === undefined ? null : (revisionAt(copy, copy.house, path) ?? null),
|
|
693
687
|
content: entry === undefined ? null : await blobText(copy.repository, entry, path),
|
|
694
688
|
},
|
|
@@ -708,7 +702,7 @@ export class LocalCopies {
|
|
|
708
702
|
}
|
|
709
703
|
const edits = new Map([...files].filter(([path, content]) => (content === null ? selected.has(path) : selected.get(path) !== blobId(content))));
|
|
710
704
|
const received = [...files.keys()].filter((path) => revisionAt(copy, copy.house, path) === revisionAt(copy, push.house, path));
|
|
711
|
-
const accepted = `House ${rootOf(copy)} with ${push.commit} accepted`;
|
|
705
|
+
const accepted = `House ${rootOf(copy.room_handle)} with ${push.commit} accepted`;
|
|
712
706
|
const house = await importCommits(copy.repository, [
|
|
713
707
|
...(edits.size === 0 ? [] : [{ message: accepted, from: push.commit, files: edits }]),
|
|
714
708
|
{
|
package/dist/instructions.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HOW_WE_WORK } from './skills.js';
|
|
2
2
|
const HOUSE_LINE = 'Work with House through the `house` CLI: run `house --help`.';
|
|
3
3
|
const FILE_LINE = 'To give the User a file or a page, upload it with `house upload_attachment` and link it; never start a server.';
|
|
4
|
-
const READ_LINE = 'Before working in a Room, read `/private/rooms/<handle>/AGENTS.md`.';
|
|
4
|
+
const READ_LINE = 'Before working in a Room, read `/rooms/private/rooms/<handle>/AGENTS.md`.';
|
|
5
5
|
const COPIES_LINE = 'House Local copies; commit, then `house push`:';
|
|
6
6
|
const UNREADABLE = /^(?:\S+: )?(?:path_not_found|room_not_found|operation_denied)\b/;
|
|
7
7
|
const FAILED = /^exit: [1-9]\d*$/;
|
package/dist/skills.js
CHANGED
|
@@ -6,7 +6,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
6
6
|
import { KIT_VERSION } from './clis.js';
|
|
7
7
|
import { kitHome, readConfiguration, readHome, writeHome } from './home.js';
|
|
8
8
|
import { refusalOf } from './refusals.js';
|
|
9
|
-
export const HOW_WE_WORK = '/private/how-we-work.md';
|
|
9
|
+
export const HOW_WE_WORK = '/rooms/private/how-we-work.md';
|
|
10
10
|
const SKILL_SET = fileURLToPath(new URL('../skills/', import.meta.url));
|
|
11
11
|
const HOW_WE_WORK_TEXT = readFileSync(new URL('../how-we-work.md', import.meta.url), 'utf8');
|
|
12
12
|
const RECORD = 'skill-set.json';
|