@agentshouse/kit 0.2.1-ceeaf32286734 → 0.2.1-ceffdba88db37

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/clis-main.js DELETED
@@ -1,23 +0,0 @@
1
- import { post } from './api.js';
2
- import { CLIS, below, locate, versionOf } from './clis.js';
3
- import { readEnrolment } from './home.js';
4
- import { proxyUnlessRelayed } from './relay.js';
5
- proxyUnlessRelayed();
6
- try {
7
- const { house, credential } = (await readEnrolment());
8
- const { agents } = await post(house, '/kit/agents/desired', {}, credential);
9
- for (const kind of agents) {
10
- const cli = await locate(kind);
11
- if (cli === null)
12
- continue;
13
- const release = await versionOf(cli);
14
- if (release === null)
15
- continue;
16
- const { bin, minimum } = CLIS[kind];
17
- process.stdout.write(`${[bin, cli, release, minimum, below(release, minimum) ? 'old' : 'current'].join('\t')}\n`);
18
- }
19
- }
20
- catch (error) {
21
- process.stderr.write(`kit: ${error.message}\n`);
22
- process.exitCode = 1;
23
- }
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
- }