@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/README.md +14 -15
- package/dist/acp.js +1 -1
- package/dist/afk.js +17 -0
- package/dist/agents.js +54 -25
- package/dist/api.js +11 -6
- package/dist/authority-main.js +2 -2
- package/dist/bridge.js +4 -4
- package/dist/building.js +7 -3
- package/dist/calls.js +1 -1
- package/dist/chunks.js +49 -0
- package/dist/clis.js +35 -57
- package/dist/connection.js +24 -20
- package/dist/content.js +63 -0
- package/dist/conversations.js +236 -115
- package/dist/copies.js +293 -148
- package/dist/end.js +2 -9
- package/dist/events.js +729 -218
- package/dist/files.js +2 -2
- package/dist/git.js +44 -10
- package/dist/grok.js +39 -0
- package/dist/home.js +0 -7
- package/dist/house-cli.js +81 -21
- package/dist/instructions.js +2 -4
- package/dist/kit-cli.js +1 -4
- package/dist/login.js +12 -5
- package/dist/logout.js +2 -2
- package/dist/mcp.js +2 -2
- package/dist/placement.js +9 -23
- package/dist/resident.js +44 -37
- package/dist/scope.js +12 -4
- package/dist/scripts.js +59 -11
- package/dist/secret-input.js +1 -1
- package/dist/transcription.js +5 -2
- package/dist/translate.js +18 -9
- package/dist/update.js +105 -159
- package/dist/wire.js +19 -9
- package/dist/work.js +9 -2
- package/package.json +12 -8
- package/dist/chatgpt.js +0 -32
- package/dist/clis-main.js +0 -23
- package/dist/parts.js +0 -82
package/dist/clis.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { randomUUID } from 'node:crypto';
|
|
3
3
|
import { constants, readFileSync } from 'node:fs';
|
|
4
|
-
import { access, mkdir, readFile, rename,
|
|
4
|
+
import { access, mkdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
5
5
|
import { homedir, userInfo } from 'node:os';
|
|
6
6
|
import { delimiter, dirname, isAbsolute, join } from 'node:path';
|
|
7
|
-
import {
|
|
8
|
-
import { kitHome } from './home.js';
|
|
7
|
+
import { releaseDirectory } from './placement.js';
|
|
9
8
|
import { childEnvironment } from './relay.js';
|
|
10
9
|
const HOUSE_EXECUTABLES = /^host_executable\(name = "house", paths = (\[.*\])\)$/m;
|
|
11
10
|
function houseRule(houses) {
|
|
@@ -21,6 +20,7 @@ const RAW_SUBTYPES = [
|
|
|
21
20
|
'hook_started',
|
|
22
21
|
'hook_response',
|
|
23
22
|
];
|
|
23
|
+
const RAW_TYPES = ['result', 'user', 'assistant', 'rate_limit_event', 'prompt_suggestion'];
|
|
24
24
|
async function executable(path) {
|
|
25
25
|
try {
|
|
26
26
|
await access(path, constants.X_OK);
|
|
@@ -63,6 +63,14 @@ export async function allowHouseInCodex(path) {
|
|
|
63
63
|
await rename(temporary, file);
|
|
64
64
|
}
|
|
65
65
|
async function nothing() { }
|
|
66
|
+
function claudeQuestionFields(request) {
|
|
67
|
+
const properties = request.requestedSchema?.properties ?? {};
|
|
68
|
+
return Object.keys(properties).filter((name) => properties[name]._meta?.jetbrains?.air?.customAnswer !== undefined);
|
|
69
|
+
}
|
|
70
|
+
function codexQuestionFields(request) {
|
|
71
|
+
const { _meta, requestedSchema } = request;
|
|
72
|
+
return _meta?.codex === undefined ? [] : (requestedSchema?.required ?? []);
|
|
73
|
+
}
|
|
66
74
|
function answered(error) {
|
|
67
75
|
return typeof error === 'object' && error !== null ? error : {};
|
|
68
76
|
}
|
|
@@ -72,8 +80,9 @@ function bridgeInClaudeSandbox(bridge) {
|
|
|
72
80
|
export const CLIS = {
|
|
73
81
|
'codex-acp': {
|
|
74
82
|
bin: 'codex',
|
|
75
|
-
minimum: '0.
|
|
83
|
+
minimum: '0.165.0',
|
|
76
84
|
install: 'curl -fsSL https://chatgpt.com/codex/install.sh | sh',
|
|
85
|
+
update: 'codex update',
|
|
77
86
|
adapter: {
|
|
78
87
|
package: '@agentclientprotocol/codex-acp',
|
|
79
88
|
bin: 'codex-acp',
|
|
@@ -87,16 +96,17 @@ export const CLIS = {
|
|
|
87
96
|
const { code, data } = answered(error);
|
|
88
97
|
return code === -32603 && typeof data?.details === 'string' && data.details.startsWith('no rollout found');
|
|
89
98
|
},
|
|
90
|
-
renames: true,
|
|
91
99
|
allowHouse: allowHouseInCodex,
|
|
100
|
+
questionFields: codexQuestionFields,
|
|
92
101
|
signedIn: { command: ['login', 'status'] },
|
|
93
102
|
login: { args: ['login', '--device-auth'], code: 'show' },
|
|
94
103
|
air: ['asyncTasks', 'nativeSubagentSessions'],
|
|
95
104
|
},
|
|
96
105
|
'claude-agent-acp': {
|
|
97
106
|
bin: 'claude',
|
|
98
|
-
minimum: '2.1.
|
|
107
|
+
minimum: '2.1.316',
|
|
99
108
|
install: 'curl -fsSL https://claude.ai/install.sh | bash',
|
|
109
|
+
update: 'claude update',
|
|
100
110
|
adapter: {
|
|
101
111
|
package: '@agentclientprotocol/claude-agent-acp',
|
|
102
112
|
bin: 'claude-agent-acp',
|
|
@@ -105,20 +115,19 @@ export const CLIS = {
|
|
|
105
115
|
},
|
|
106
116
|
args: [],
|
|
107
117
|
fullAccess: 'bypassPermissions',
|
|
108
|
-
sessionMeta: (bridge
|
|
118
|
+
sessionMeta: (bridge) => ({
|
|
109
119
|
claudeCode: {
|
|
110
120
|
options: {
|
|
111
121
|
allowedTools: ['Bash(house:*)'],
|
|
112
122
|
includeHookEvents: true,
|
|
113
|
-
title,
|
|
114
123
|
settings: { sandbox: { network: bridgeInClaudeSandbox(bridge) } },
|
|
115
124
|
},
|
|
116
|
-
emitRawSDKMessages: [...RAW_SUBTYPES.map((subtype) => ({ type: 'system', subtype })), { type
|
|
125
|
+
emitRawSDKMessages: [...RAW_SUBTYPES.map((subtype) => ({ type: 'system', subtype })), ...RAW_TYPES.map((type) => ({ type }))],
|
|
117
126
|
},
|
|
118
127
|
}),
|
|
119
128
|
unknownSession: (error) => answered(error).code === -32002,
|
|
120
|
-
renames: false,
|
|
121
129
|
allowHouse: nothing,
|
|
130
|
+
questionFields: claudeQuestionFields,
|
|
122
131
|
signedIn: { command: ['auth', 'status'] },
|
|
123
132
|
login: { args: ['auth', 'login', '--claudeai'], code: 'collect', rejected: 'Invalid code' },
|
|
124
133
|
air: ['asyncTasks', 'sessionFailure'],
|
|
@@ -127,13 +136,14 @@ export const CLIS = {
|
|
|
127
136
|
bin: 'grok',
|
|
128
137
|
minimum: '1.0.46',
|
|
129
138
|
install: 'curl -fsSL https://x.ai/cli/install.sh | bash',
|
|
139
|
+
update: 'grok update',
|
|
130
140
|
adapter: null,
|
|
131
141
|
args: ['--sandbox', 'off', 'agent', '--always-approve', '--no-leader', 'stdio'],
|
|
132
142
|
fullAccess: null,
|
|
133
143
|
sessionMeta: () => ({}),
|
|
134
144
|
unknownSession: (error) => answered(error).data?.code === 'FS_NOT_FOUND',
|
|
135
|
-
renames: false,
|
|
136
145
|
allowHouse: nothing,
|
|
146
|
+
questionFields: () => [],
|
|
137
147
|
signedIn: { initializeMeta: 'defaultAuthMethodId' },
|
|
138
148
|
login: { args: ['login', '--device-auth'], code: 'show' },
|
|
139
149
|
air: ['asyncTasks'],
|
|
@@ -142,25 +152,13 @@ export const CLIS = {
|
|
|
142
152
|
const KIT_PACKAGE = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
143
153
|
export const KIT_RELEASE = KIT_PACKAGE.version;
|
|
144
154
|
const VERSION = /\d+\.\d+\.\d+(?:-[0-9A-Za-z.]+)?/;
|
|
145
|
-
// An install still running after fifteen minutes is ended
|
|
155
|
+
// An install or update still running after fifteen minutes is ended as failed, so a hung download can neither hold its CLI's report nor keep the Kit busy.
|
|
146
156
|
const INSTALL_MS = 15 * 60_000;
|
|
147
157
|
// A login shell or a version read is ended after half a minute, so a profile that waits for input cannot stall the report.
|
|
148
158
|
const READ_MS = 30_000;
|
|
149
159
|
const CAUSE_CHARACTERS = 4000;
|
|
150
|
-
function prefix(kind) {
|
|
151
|
-
return join(kitHome(), 'agents', kind);
|
|
152
|
-
}
|
|
153
160
|
export function adapterCommand(kind) {
|
|
154
|
-
return join(
|
|
155
|
-
}
|
|
156
|
-
async function installedAdapter(kind) {
|
|
157
|
-
try {
|
|
158
|
-
const manifest = join(prefix(kind), 'node_modules', CLIS[kind].adapter.package, 'package.json');
|
|
159
|
-
return JSON.parse(await readFile(manifest, 'utf8')).version;
|
|
160
|
-
}
|
|
161
|
-
catch {
|
|
162
|
-
return null;
|
|
163
|
-
}
|
|
161
|
+
return join(releaseDirectory(KIT_RELEASE), 'adapters', kind, 'node_modules', '.bin', CLIS[kind].adapter.bin);
|
|
164
162
|
}
|
|
165
163
|
export function run(command, args, timeoutMs, detached = false, signal) {
|
|
166
164
|
return new Promise((resolve) => {
|
|
@@ -204,38 +202,15 @@ export function failureOf(ran, program) {
|
|
|
204
202
|
export function adapterArchive(kind) {
|
|
205
203
|
return `${kind}-${KIT_PACKAGE.peerDependencies[CLIS[kind].adapter.package]}.tar.gz`;
|
|
206
204
|
}
|
|
207
|
-
|
|
208
|
-
const adapter = CLIS[kind].adapter;
|
|
209
|
-
if (adapter === null)
|
|
210
|
-
return null;
|
|
211
|
-
if ((await installedAdapter(kind)) === KIT_PACKAGE.peerDependencies[adapter.package])
|
|
212
|
-
return null;
|
|
213
|
-
const name = adapterArchive(kind);
|
|
214
|
-
const archive = `${prefix(kind)}.tar.gz`;
|
|
205
|
+
async function bounded(program, work, signal) {
|
|
215
206
|
const deadline = AbortSignal.timeout(INSTALL_MS);
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
return `House serves no ${name}`;
|
|
221
|
-
await rm(prefix(kind), { recursive: true, force: true });
|
|
222
|
-
await mkdir(prefix(kind), { recursive: true });
|
|
223
|
-
await downloadServed(name, sha256, archive, bounded);
|
|
224
|
-
const ran = await run('tar', ['-xzf', archive, '-C', prefix(kind)], INSTALL_MS, true, signal);
|
|
225
|
-
return ran.status === 0 ? null : failureOf(ran, 'tar');
|
|
226
|
-
}
|
|
227
|
-
catch (error) {
|
|
228
|
-
if (deadline.aborted && signal?.aborted !== true)
|
|
229
|
-
return `${name} did not arrive within ${INSTALL_MS / 1000} seconds`;
|
|
230
|
-
return error instanceof Error ? error.message : String(error);
|
|
231
|
-
}
|
|
232
|
-
finally {
|
|
233
|
-
await rm(archive, { force: true });
|
|
234
|
-
}
|
|
207
|
+
const ran = await work(signal === undefined ? deadline : AbortSignal.any([signal, deadline]));
|
|
208
|
+
if (deadline.aborted && signal?.aborted !== true)
|
|
209
|
+
return `${program} did not end within ${INSTALL_MS / 1000} seconds`;
|
|
210
|
+
return ran.status === 0 ? null : failureOf(ran, program);
|
|
235
211
|
}
|
|
236
|
-
export
|
|
237
|
-
|
|
238
|
-
return ran.status === 0 ? null : failureOf(ran, 'the install');
|
|
212
|
+
export function installCli(kind, signal) {
|
|
213
|
+
return bounded('the install', (within) => run('bash', ['-o', 'pipefail', '-c', CLIS[kind].install], INSTALL_MS, true, within), signal);
|
|
239
214
|
}
|
|
240
215
|
function loginShell() {
|
|
241
216
|
return process.env.SHELL || userInfo().shell;
|
|
@@ -243,8 +218,8 @@ function loginShell() {
|
|
|
243
218
|
const FOUND = 'house-kit-cli ';
|
|
244
219
|
const LOOKUP = `found=$(command -v "$1") || exit 0; case $found in /*) ;; *) found=$(pwd -P)/$found ;; esac; printf "${FOUND}%s\\n" "$found"`;
|
|
245
220
|
const USER_BIN = 'case ":$PATH:" in *":$HOME/.local/bin:"*) ;; *) PATH="$PATH:$HOME/.local/bin" ;; esac; export PATH';
|
|
246
|
-
function inLoginShell(script, argument = '', signal) {
|
|
247
|
-
return run(loginShell(), ['-l', '-i', '-c', `exec /bin/sh -c '${USER_BIN}; ${script}' sh ${argument}`],
|
|
221
|
+
function inLoginShell(script, argument = '', signal, timeoutMs = READ_MS) {
|
|
222
|
+
return run(loginShell(), ['-l', '-i', '-c', `exec /bin/sh -c '${USER_BIN}; ${script}' sh ${argument}`], timeoutMs, true, signal);
|
|
248
223
|
}
|
|
249
224
|
export async function onLoginPath(program, signal) {
|
|
250
225
|
const ran = await inLoginShell(LOOKUP, program, signal);
|
|
@@ -253,6 +228,9 @@ export async function onLoginPath(program, signal) {
|
|
|
253
228
|
export function locate(kind, signal) {
|
|
254
229
|
return onLoginPath(CLIS[kind].bin, signal);
|
|
255
230
|
}
|
|
231
|
+
export function updateCli(kind) {
|
|
232
|
+
return bounded('the update', (within) => inLoginShell(CLIS[kind].update, '', within, INSTALL_MS));
|
|
233
|
+
}
|
|
256
234
|
export async function loginPath() {
|
|
257
235
|
const marker = 'house-kit-path ';
|
|
258
236
|
const ran = await inLoginShell(`printf "${marker}%s\\n" "$PATH"`);
|
package/dist/connection.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import { KIT_CONNECTION_PATH, KIT_CONNECTION_PROTOCOL_PREFIX, KIT_WIRE, } from '@agentshouse/kit-wire';
|
|
1
2
|
import { subscribe } from 'node:diagnostics_channel';
|
|
3
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
2
4
|
import { HouseRefusal, retryDelay } from './api.js';
|
|
3
5
|
import { end, REPLACED, signInAgain } from './end.js';
|
|
4
6
|
import { readEnrolment } from './home.js';
|
|
5
7
|
import { relayed } from './relay.js';
|
|
6
8
|
import { Silence } from './silence.js';
|
|
7
|
-
import { endUnserved,
|
|
8
|
-
const
|
|
9
|
-
const SUBPROTOCOL = `house.kit.stream.${KIT_WIRE}`;
|
|
9
|
+
import { endUnserved, unserved } from './wire.js';
|
|
10
|
+
const SUBPROTOCOL = `${KIT_CONNECTION_PROTOCOL_PREFIX}${KIT_WIRE}`;
|
|
10
11
|
const REFUSAL_HEADER = 'x-house-refusal';
|
|
11
12
|
// House beats each Kit connection every thirty seconds, so two silent beats mean this Kit process cannot hear House.
|
|
12
13
|
export const CONNECTION_SILENCE_MS = 60_000;
|
|
14
|
+
// A stopping Kit waits up to two seconds for House to answer its close, so what it sent last reaches House and a House that does not answer holds no stop.
|
|
15
|
+
const CLOSE_ANSWER_MS = 2_000;
|
|
13
16
|
function connectionUrl(house) {
|
|
14
|
-
const url = new URL(
|
|
17
|
+
const url = new URL(KIT_CONNECTION_PATH, house);
|
|
15
18
|
url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
16
19
|
return url;
|
|
17
20
|
}
|
|
@@ -25,18 +28,18 @@ function header(headers, name) {
|
|
|
25
28
|
let refused = null;
|
|
26
29
|
subscribe('undici:request:headers', (message) => {
|
|
27
30
|
const { request, response } = message;
|
|
28
|
-
if (!request.path.endsWith(
|
|
31
|
+
if (!request.path.endsWith(KIT_CONNECTION_PATH))
|
|
29
32
|
return;
|
|
30
|
-
refused = new HouseRefusal(
|
|
33
|
+
refused = new HouseRefusal(KIT_CONNECTION_PATH, response.statusCode, header(response.headers, REFUSAL_HEADER) || response.statusText);
|
|
31
34
|
});
|
|
32
35
|
export function holdConnection(handlers) {
|
|
33
36
|
let connection = null;
|
|
34
37
|
let socket = null;
|
|
35
|
-
let paused = false;
|
|
36
38
|
let failures = 0;
|
|
39
|
+
let stopping = false;
|
|
37
40
|
const connect = async () => {
|
|
38
41
|
const { house, credential } = (await readEnrolment());
|
|
39
|
-
if (
|
|
42
|
+
if (socket !== null || unserved() || stopping)
|
|
40
43
|
return;
|
|
41
44
|
refused = null;
|
|
42
45
|
const opening = new WebSocket(relayed(connectionUrl(house)), {
|
|
@@ -55,6 +58,8 @@ export function holdConnection(handlers) {
|
|
|
55
58
|
connection = null;
|
|
56
59
|
handlers.closed();
|
|
57
60
|
process.stderr.write(`kit: connection closed ${event.code} ${event.reason}\n`);
|
|
61
|
+
if (stopping)
|
|
62
|
+
return;
|
|
58
63
|
if (event.reason === 'replaced')
|
|
59
64
|
end(REPLACED);
|
|
60
65
|
if (event.reason === 'credential_rejected' || refused?.status === 401) {
|
|
@@ -65,8 +70,6 @@ export function holdConnection(handlers) {
|
|
|
65
70
|
endUnserved(refused.text);
|
|
66
71
|
if (!opened && refused !== null)
|
|
67
72
|
process.stderr.write(`kit: ${refused.message}\n`);
|
|
68
|
-
if (paused)
|
|
69
|
-
return;
|
|
70
73
|
// A closed connection reopens in one to three seconds, spread so Kit processes one restart closed return apart; an opening House refused or left unanswered backs off on the jittered curve, retryable or not, since a resident outlives a House deploy.
|
|
71
74
|
setTimeout(() => void connect(), opened ? 1000 + Math.random() * 2000 : retryDelay(failures++));
|
|
72
75
|
};
|
|
@@ -91,26 +94,27 @@ export function holdConnection(handlers) {
|
|
|
91
94
|
if (arrived.type === 'input')
|
|
92
95
|
handlers.call(arrived);
|
|
93
96
|
else if (arrived.type !== 'beat')
|
|
94
|
-
handlers.
|
|
97
|
+
handlers.oneWayCall(arrived);
|
|
95
98
|
};
|
|
96
99
|
opening.onerror = () => undefined;
|
|
97
100
|
opening.onclose = closed;
|
|
98
101
|
};
|
|
99
102
|
void connect();
|
|
100
103
|
return {
|
|
101
|
-
send(
|
|
104
|
+
send(oneWayCall) {
|
|
102
105
|
if (connection === null || connection.readyState !== WebSocket.OPEN)
|
|
103
106
|
return false;
|
|
104
|
-
connection.send(JSON.stringify(
|
|
107
|
+
connection.send(JSON.stringify(oneWayCall));
|
|
105
108
|
return true;
|
|
106
109
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
socket
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
close() {
|
|
111
|
+
stopping = true;
|
|
112
|
+
const open = socket;
|
|
113
|
+
if (open === null)
|
|
114
|
+
return Promise.resolve();
|
|
115
|
+
const answered = new Promise((resolve) => open.addEventListener('close', () => resolve(), { once: true }));
|
|
116
|
+
open.close();
|
|
117
|
+
return Promise.race([answered, delay(CLOSE_ANSWER_MS)]);
|
|
114
118
|
},
|
|
115
119
|
};
|
|
116
120
|
}
|
package/dist/content.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { applied } from '@agentshouse/session-content';
|
|
2
|
+
function whole(part, parent) {
|
|
3
|
+
return { ...part, parent };
|
|
4
|
+
}
|
|
5
|
+
export class Content {
|
|
6
|
+
parts = [];
|
|
7
|
+
emit;
|
|
8
|
+
keys = new Map();
|
|
9
|
+
writing = new Map();
|
|
10
|
+
planned = null;
|
|
11
|
+
constructor(emit) {
|
|
12
|
+
this.emit = emit;
|
|
13
|
+
}
|
|
14
|
+
index(key) {
|
|
15
|
+
return this.keys.get(key);
|
|
16
|
+
}
|
|
17
|
+
write(type, id, parent, text) {
|
|
18
|
+
if (text === '')
|
|
19
|
+
return;
|
|
20
|
+
const writing = this.writing.get(parent);
|
|
21
|
+
if (writing?.type === type && writing.id === id) {
|
|
22
|
+
this.apply({ op: 'append', index: writing.index, text });
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const index = this.add(parent, { type, text });
|
|
26
|
+
this.writing.set(parent, { type, id, index });
|
|
27
|
+
}
|
|
28
|
+
put(key, parent, part) {
|
|
29
|
+
const index = this.keys.get(key);
|
|
30
|
+
if (index === undefined) {
|
|
31
|
+
const added = this.add(parent, part);
|
|
32
|
+
this.keys.set(key, added);
|
|
33
|
+
return added;
|
|
34
|
+
}
|
|
35
|
+
const changed = whole(part, this.parts[index].parent);
|
|
36
|
+
if (JSON.stringify(changed) !== JSON.stringify(this.parts[index]))
|
|
37
|
+
this.apply({ op: 'set', index, part: changed });
|
|
38
|
+
return index;
|
|
39
|
+
}
|
|
40
|
+
plan(entries) {
|
|
41
|
+
if (this.planned === null) {
|
|
42
|
+
this.planned = this.add(null, { type: 'plan', entries });
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
this.apply({ op: 'set', index: this.planned, part: { type: 'plan', parent: null, entries } });
|
|
46
|
+
}
|
|
47
|
+
add(parent, part) {
|
|
48
|
+
this.writing.delete(parent);
|
|
49
|
+
return this.arrived(parent, part);
|
|
50
|
+
}
|
|
51
|
+
arrived(parent, part) {
|
|
52
|
+
const index = this.parts.length;
|
|
53
|
+
this.apply({ op: 'start', index, part: whole(part, parent) });
|
|
54
|
+
return index;
|
|
55
|
+
}
|
|
56
|
+
operations() {
|
|
57
|
+
return this.parts.map((part, index) => ({ op: 'start', index, part }));
|
|
58
|
+
}
|
|
59
|
+
apply(operation) {
|
|
60
|
+
this.parts = applied(this.parts, operation);
|
|
61
|
+
this.emit(operation);
|
|
62
|
+
}
|
|
63
|
+
}
|