@koneeric/onetool 0.0.0-stage → 0.3.0

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.
@@ -0,0 +1,553 @@
1
+ // The two tools, run and search, over the connections.
2
+ import { resolve } from "node:path";
3
+ import { ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js";
4
+ import {
5
+ SHELL_NO_FOLDERS,
6
+ SHELL_TOOLS,
7
+ ToolError,
8
+ askMessage,
9
+ askRefusal,
10
+ cutAnswer,
11
+ decide,
12
+ decideCommand,
13
+ formatJob,
14
+ formatJobs,
15
+ formatRun,
16
+ hostDenial,
17
+ jobLimitMessage,
18
+ libraryText,
19
+ jobStarted,
20
+ jobState,
21
+ nextState,
22
+ nextStreak,
23
+ noJobMessage,
24
+ oneProgramNote,
25
+ runRequest,
26
+ searchTools,
27
+ signInMessage,
28
+ shellOffMessage,
29
+ toolValue,
30
+ withTrail,
31
+ } from "../../core/src/index.js";
32
+ import { LibraryError, checkSave, isProgramName } from "../../library/src/index.js";
33
+ import { runProgram } from "../../sandbox/src/index.js";
34
+ import { ShellError, editFile, readFile, realPlace, runCommand, writeFile } from "../../shell/src/index.js";
35
+ import { isServerError, isSignInFailure } from "./connect.js";
36
+ import { toolsWith } from "./descriptions.js";
37
+ import { makeLibrary } from "./library.js";
38
+ import { makeRecords, refused } from "./record.js";
39
+
40
+ const say = (line) => process.stderr.write(`${line}\n`);
41
+
42
+ const answer = (settings, text, isError = false) => ({
43
+ content: [{ type: "text", text: cutAnswer(text, settings.answerLimit) }],
44
+ ...(isError ? { isError: true } : {}),
45
+ });
46
+
47
+ // the decision of a call by the way a question ended
48
+ const ASKED = { decline: "no", cancel: "no answer", unsupported: "cannot ask", failed: "failed" };
49
+
50
+ // the decisions of a record that say a question reached the host
51
+ const QUESTIONED = new Set(["asked: yes", "asked: no", "asked: no answer", "asked: failed"]);
52
+
53
+ // the ended jobs kept, the lines of `progress` kept and how much of one
54
+ const ENDED_KEPT = 20;
55
+ const PROGRESS_KEPT = 10;
56
+ const PROGRESS_LINE = 1000;
57
+
58
+ const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
59
+
60
+ /**
61
+ * `list()` (async) is what tools/list answers, `call(name, args)` answers tools/call. `ready` is set by the caller: a promise
62
+ * that is settled once every connection is connected or given up. `server` is the `Server` that speaks to the host:
63
+ * it is asked through it, once its capabilities are known. `host` (host.js) holds the folders and rules of the host.
64
+ * `settingsPath` is the full path of the settings file, for the message of a server that needs a sign-in.
65
+ */
66
+ export function makeTools(settings, connections, server, host, settingsPath) {
67
+ const records = makeRecords(settings);
68
+ const library = makeLibrary(settings, host, records);
69
+ const self = {
70
+ list: async () => toolsWith(libraryText((await library.read()).programs), host.hasFolders()),
71
+ ready: Promise.resolve(),
72
+ };
73
+ // the kept state: one plain object for the life of the process
74
+ let kept = {};
75
+ // the numbers of the session, and the streak of programs in the foreground that each made one call
76
+ const numbers = { programs: 0, calls: 0 };
77
+ let streak = 0;
78
+
79
+ const catalog = () => [
80
+ ...connections.map((connection) => {
81
+ if (connection.needed) return { server: connection.name, tools: [], signIn: true };
82
+ return connection.error === null
83
+ ? { server: connection.name, tools: connection.tools }
84
+ : { server: connection.name, tools: [], error: connection.error };
85
+ }),
86
+ ...settings.bad.map(({ name, reason }) => ({ server: name, tools: [], error: `bad entry: ${reason}` })),
87
+ ...(settings.shell === null
88
+ ? []
89
+ : [host.hasFolders() ? { server: "shell", tools: SHELL_TOOLS } : { server: "shell", tools: [], error: SHELL_NO_FOLDERS }]),
90
+ ];
91
+
92
+ const visible = () =>
93
+ catalog().map((entry) => ({
94
+ ...entry,
95
+ tools: entry.tools.filter((tool) => decide(settings, entry.server, tool.name).allowed),
96
+ }));
97
+
98
+ async function search(args) {
99
+ const words = args.words;
100
+ if (words !== undefined && typeof words !== "string") {
101
+ return answer(settings, 'onetool: search takes "words", a text', true);
102
+ }
103
+ await self.ready;
104
+ await host.idle();
105
+ const { programs } = await library.read();
106
+ return answer(
107
+ settings,
108
+ searchTools(visible(), words, { limit: settings.searchLimit, programs, session: { programs: numbers.programs, calls: numbers.calls } }),
109
+ );
110
+ }
111
+
112
+ // one question open at a time, for all the programs: each call takes its turn after the one before it
113
+ let turn = Promise.resolve();
114
+
115
+ /**
116
+ * Asks the person about one call; resolves when they said yes, and rejects with the refusal otherwise. `ms` is the
117
+ * time the person has: the limit of the program of the call, and one second more.
118
+ */
119
+ async function ask(id, rule, args, signal, record, file, ms) {
120
+ const refuse = (why) => {
121
+ record.decision = `asked: ${ASKED[why]}`;
122
+ return refused(askRefusal(id, rule, why, file), "rules");
123
+ };
124
+ if (server.getClientCapabilities()?.elicitation?.form === undefined) throw refuse("unsupported");
125
+ const before = turn;
126
+ let done;
127
+ turn = new Promise((resolve) => {
128
+ done = resolve;
129
+ });
130
+ try {
131
+ await before;
132
+ // the program is gone: nobody waits for this answer
133
+ if (signal.aborted) throw new Error(`${id} failed: the program has ended`);
134
+ let outcome;
135
+ try {
136
+ outcome = await server.elicitInput(
137
+ { message: askMessage(id, rule, args, { file }), requestedSchema: { type: "object", properties: {} } },
138
+ { timeout: ms, signal },
139
+ );
140
+ } catch {
141
+ throw refuse("failed");
142
+ }
143
+ if (outcome?.action === "accept") {
144
+ record.decision = "asked: yes";
145
+ return;
146
+ }
147
+ if (outcome?.action === "decline" || outcome?.action === "cancel") throw refuse(outcome.action);
148
+ throw refuse("failed");
149
+ } finally {
150
+ done();
151
+ }
152
+ }
153
+
154
+ /** The call the host's rules are asked about for a tool of the shell, or `null` when the table gives none. */
155
+ async function shellHostCall(tool, args, folders) {
156
+ if (tool === "run") return { action: "run", command: args.command };
157
+ if (tool !== "read" && tool !== "write" && tool !== "edit") return null;
158
+ if (typeof args.path !== "string" || args.path === "") return null;
159
+ const paths = [resolve(folders[0], args.path)];
160
+ try {
161
+ const real = await realPlace(args.path, folders);
162
+ if (real !== paths[0]) paths.push(real);
163
+ } catch {
164
+ // the first path alone
165
+ }
166
+ return { action: tool, paths };
167
+ }
168
+
169
+ /** What the host's rules say of a covered call: refuses it, or gives the rule of `ask` that covers it (or `null`). */
170
+ function hostSays(id, call, record) {
171
+ const said = host.rules.decide(call);
172
+ if (said.effect === "deny") {
173
+ record.decision = "denied";
174
+ throw refused(hostDenial(id, said.rule, said.file), "rules");
175
+ }
176
+ return said.effect === "ask" ? said : null;
177
+ }
178
+
179
+ /** The four tools of the built-in server `shell`, done by this process with part `shell`. */
180
+ async function callShell(tool, args, signal, record, ms) {
181
+ const id = `shell.${tool}`;
182
+ const decision = decide(settings, "shell", tool);
183
+ if (!decision.allowed) {
184
+ record.decision = "denied";
185
+ throw refused(decision.message, "rules");
186
+ }
187
+ let rule = decision.ask;
188
+ if (rule !== undefined) record.decision = "asked: not asked";
189
+ if (!isPlainObject(args)) throw new Error(`onetool: the arguments of ${id} must be an object`);
190
+ if (tool === "run") {
191
+ if (typeof args.command !== "string" || args.command.trim() === "") {
192
+ throw new Error(`${id} failed: the command must be a text that is not empty`);
193
+ }
194
+ const byCommand = decideCommand(settings.shell, args.command);
195
+ if (!byCommand.allowed) {
196
+ record.decision = "denied";
197
+ throw refused(byCommand.message, "rules");
198
+ }
199
+ rule ??= byCommand.ask;
200
+ if (rule !== undefined) record.decision = "asked: not asked";
201
+ }
202
+ let byHost = null;
203
+ const covered = host.folders();
204
+ if (host.rules !== null && covered.length > 0) {
205
+ const call = await shellHostCall(tool, args, covered);
206
+ if (call !== null) byHost = hostSays(id, call, record);
207
+ }
208
+ if (rule !== undefined) await ask(id, rule, args, signal, record, undefined, ms);
209
+ else if (byHost !== null) {
210
+ record.decision = "asked: not asked";
211
+ await ask(id, byHost.rule, args, signal, record, byHost.file, ms);
212
+ }
213
+ const folders = host.folders();
214
+ if (folders.length === 0) throw new Error(`${id} failed: ${SHELL_NO_FOLDERS}`);
215
+ try {
216
+ switch (tool) {
217
+ case "run":
218
+ return await runCommand(args.command, { cwd: folders[0], signal });
219
+ case "read":
220
+ return await readFile(args.path, { folders });
221
+ case "write":
222
+ return await writeFile(args.path, args.text, { folders });
223
+ case "edit":
224
+ return await editFile(args.path, args.old, args.new, { folders });
225
+ default:
226
+ throw new Error(`${id} failed: not connected`);
227
+ }
228
+ } catch (err) {
229
+ if (!(err instanceof ShellError)) throw err;
230
+ if (err.outside) throw refused(`onetool: ${id} is refused: ${err.message}`, "outside");
231
+ throw new Error(`${id} failed: ${err.message}`);
232
+ }
233
+ }
234
+
235
+ /** The five tools of the built-in server `library`, done by this process with part `library`. */
236
+ async function callLibrary(tool, args, signal, record, ms) {
237
+ const id = `library.${tool}`;
238
+ const decision = decide(settings, "library", tool);
239
+ if (!decision.allowed) {
240
+ record.decision = "denied";
241
+ throw refused(decision.message, "rules");
242
+ }
243
+ if (decision.ask !== undefined) record.decision = "asked: not asked";
244
+ if (!isPlainObject(args)) throw new Error(`onetool: the arguments of ${id} must be an object`);
245
+ let checked;
246
+ if (tool === "save") {
247
+ checked = checkSave(args);
248
+ if (checked.problem !== undefined) throw new Error(checked.problem);
249
+ } else if (tool === "remove" || tool === "restore" || tool === "read") {
250
+ if (!isProgramName(args.name)) {
251
+ throw new Error(`${id} failed: the name must be 1 to 40 letters, digits or _, starting with a letter`);
252
+ }
253
+ } else if (tool !== "report") {
254
+ throw new Error(`${id} failed: not connected`);
255
+ }
256
+ if (decision.ask !== undefined) await ask(id, decision.ask, args, signal, record, undefined, ms);
257
+ try {
258
+ switch (tool) {
259
+ case "save":
260
+ return await library.save(checked.program, checked.replace);
261
+ case "remove":
262
+ return await library.remove(args.name);
263
+ case "restore":
264
+ return await library.restore(args.name);
265
+ case "read":
266
+ return await library.readProgram(args.name);
267
+ default:
268
+ return await library.report();
269
+ }
270
+ } catch (err) {
271
+ if (err instanceof LibraryError) throw new Error(`${id} failed: ${err.message}`);
272
+ throw err;
273
+ }
274
+ }
275
+
276
+ const signInServers = connections.filter((connection) => connection.signIn);
277
+
278
+ async function tellHost() {
279
+ try {
280
+ await server.sendToolListChanged();
281
+ } catch {
282
+ // a failure of the sending is ignored
283
+ }
284
+ }
285
+
286
+ /** A call met a sign-in failure: the server is sign in needed, the line is written, and the host is told once for `told`. */
287
+ async function signInFailed(connection, told) {
288
+ if (connection.needed || connection.tools === null) return;
289
+ const closing = connection.goNeeded(connection.stamp());
290
+ say(`onetool: server ${connection.name}: sign in needed`);
291
+ if (!told.sent) {
292
+ told.sent = true;
293
+ await tellHost();
294
+ }
295
+ await closing;
296
+ }
297
+
298
+ /** What is done at the beginning of a call for one sign-in server; gives whether its state changed. */
299
+ async function pickUpOne(connection) {
300
+ const stamp = connection.stamp();
301
+ if (connection.needed) {
302
+ if (stamp === null || stamp === connection.stampTried) return false;
303
+ await connection.connect();
304
+ if (connection.needed) return false;
305
+ if (connection.error !== null) say(`onetool: server ${connection.name}: not connected (${connection.error})`);
306
+ return true;
307
+ }
308
+ if (connection.withSignIn && connection.tools !== null && stamp === null) {
309
+ const closing = connection.goNeeded(null);
310
+ say(`onetool: server ${connection.name}: sign in needed`);
311
+ await closing;
312
+ return true;
313
+ }
314
+ return false;
315
+ }
316
+
317
+ // the looks at the sign-in servers are made one pass after the other: a call that arrives while one is made waits for it
318
+ let looking = Promise.resolve();
319
+
320
+ async function lookAtSignIns() {
321
+ const changes = await Promise.all(signInServers.map((connection) => pickUpOne(connection).catch(() => false)));
322
+ if (changes.includes(true)) await tellHost();
323
+ }
324
+
325
+ const pickUp = () => {
326
+ if (signInServers.length === 0) return Promise.resolve();
327
+ looking = looking.then(lookAtSignIns, lookAtSignIns);
328
+ return looking;
329
+ };
330
+
331
+ async function callTool(serverName, tool, args, signal, record, ms, told) {
332
+ if (serverName === "library") return callLibrary(tool, args, signal, record, ms);
333
+ if (settings.shell !== null && serverName === "shell") return callShell(tool, args, signal, record, ms);
334
+ const id = `${serverName}.${tool}`;
335
+ const decision = decide(settings, serverName, tool);
336
+ if (!decision.allowed) {
337
+ record.decision = "denied";
338
+ throw refused(decision.message, "rules");
339
+ }
340
+ if (decision.ask !== undefined) record.decision = "asked: not asked";
341
+ if (!isPlainObject(args)) throw new Error(`onetool: the arguments of ${id} must be an object`);
342
+ let byHost = null;
343
+ if (host.rules !== null && settings.hostServers.includes(serverName)) {
344
+ const call = host.rules.ownCall(tool, args, process.cwd());
345
+ if (call !== null) byHost = hostSays(id, call, record);
346
+ }
347
+ const connection = connections.find((candidate) => candidate.name === serverName);
348
+ if (connection?.needed) {
349
+ if (byHost !== null) record.decision = "asked: not asked";
350
+ throw new Error(`${id} failed: ${signInMessage(connection.name, settingsPath)}`);
351
+ }
352
+ if (!connection || !connection.connected) {
353
+ if (byHost !== null) record.decision = "asked: not asked";
354
+ throw new Error(`${id} failed: not connected`);
355
+ }
356
+ if (decision.ask !== undefined) await ask(id, decision.ask, args, signal, record, undefined, ms);
357
+ else if (byHost !== null) {
358
+ record.decision = "asked: not asked";
359
+ await ask(id, byHost.rule, args, signal, record, byHost.file, ms);
360
+ }
361
+ let result;
362
+ try {
363
+ result = await connection.client.callTool({ name: tool, arguments: args }, undefined, { timeout: ms, signal });
364
+ } catch (err) {
365
+ if (connection.signIn && isSignInFailure(err)) {
366
+ await signInFailed(connection, told);
367
+ throw new Error(`${id} failed: ${signInMessage(connection.name, settingsPath)}`);
368
+ }
369
+ // an address has no process to end: what the server did not say itself is told in one fixed way
370
+ if (connection.remote && !isServerError(err)) throw new Error(`${id} failed: no answer from the server`);
371
+ throw new Error(`${id} failed: ${err?.message ?? String(err)}`);
372
+ }
373
+ try {
374
+ return toolValue(result);
375
+ } catch (err) {
376
+ if (err instanceof ToolError) throw new Error(`${id} failed: ${err.message}`);
377
+ throw err;
378
+ }
379
+ }
380
+
381
+ // with the shell off or with no folder, a program that uses one of its four names is told why they are not there
382
+ const shellOffMessageOf = (result) => {
383
+ if (result.ok || result.error?.kind !== "error" || (settings.shell !== null && host.hasFolders())) return result;
384
+ const message = shellOffMessage(result.error.message, settings.shell === null ? "off" : "no-folders");
385
+ return { ...result, error: { ...result.error, message } };
386
+ };
387
+
388
+ // the jobs of the process, in the order they were started; `ended` holds the ones that have ended, the first to end first
389
+ const jobs = [];
390
+ const ended = [];
391
+ let jobCount = 0;
392
+
393
+ /**
394
+ * One program, from the host's files to the kept state: what a program in the foreground and a job both do. `seconds` is
395
+ * its limit; `program` its records; `onProgress` and `signal` are the ones handed to `runProgram`; `foreground` says that the
396
+ * program counts for the streak. Gives the result, in which a state that was too large has made an error of an `ok` result.
397
+ */
398
+ async function execute(code, { seconds, program, onProgress, signal, foreground = false }) {
399
+ await host.refresh();
400
+ // the program's library: read once, as it is when the program starts
401
+ const saved = await library.read();
402
+ const uses = [];
403
+ const names = {};
404
+ for (const connection of connections) {
405
+ if (connection.needed) names[connection.name] = true;
406
+ else if (connection.error === null) names[connection.name] = connection.tools.map((tool) => tool.name);
407
+ }
408
+ const told = { sent: false };
409
+ const withShell = host.hasFolders();
410
+ if (withShell) names.shell = SHELL_TOOLS.map((tool) => tool.name);
411
+ // stops the commands and the open question of this program, once it has ended
412
+ const controller = new AbortController();
413
+ const before = kept;
414
+ try {
415
+ const raw = await runProgram(code, {
416
+ tools: names,
417
+ callTool: async (serverName, tool, callArgs) => {
418
+ const record = program.begin(serverName, tool, callArgs);
419
+ try {
420
+ const value = await callTool(serverName, tool, callArgs, controller.signal, record, seconds * 1000 + 1000, told);
421
+ program.resolved(record, value);
422
+ return value;
423
+ } catch (err) {
424
+ program.rejected(record, err);
425
+ throw err;
426
+ }
427
+ },
428
+ timeoutMs: seconds * 1000,
429
+ state: before,
430
+ onProgress,
431
+ library: saved.programs.map(({ name, params, code: text }) => ({ name, params, code: text })),
432
+ onLibrary: (use) => uses.push(use),
433
+ ...(withShell ? { shell: true } : {}),
434
+ ...(signal === undefined ? {} : { signal }),
435
+ });
436
+ await program.close();
437
+ controller.abort();
438
+ const result = shellOffMessageOf(raw);
439
+ // the sandbox gives a state only for a program that ended with one; a timeout or a crash keeps nothing
440
+ const next = nextState(kept, before, result.state ?? before, { limit: settings.stateLimit });
441
+ kept = next.state;
442
+ const final =
443
+ next.problem !== null && result.ok ? { ok: false, error: { kind: "error", message: next.problem }, logs: result.logs } : result;
444
+ program.notes.push(...(await library.finish({ library: saved, uses, code, ok: final.ok })));
445
+ // no wait from here to the end: the programs are counted one after the other, in the order their results were there
446
+ numbers.programs += 1;
447
+ numbers.calls += program.calls.length;
448
+ if (foreground) {
449
+ const asked = program.calls.some((record) => QUESTIONED.has(record.decision));
450
+ const next = nextStreak(streak, { ok: final.ok, calls: program.calls.length, asked, lib: uses.length });
451
+ streak = next.streak;
452
+ if (next.say) program.notes.push(oneProgramNote(3));
453
+ }
454
+ return final;
455
+ } finally {
456
+ await program.close();
457
+ controller.abort();
458
+ }
459
+ }
460
+
461
+ // the answer of a program that made calls ends with its trail
462
+ const reply = (text, isError, program) =>
463
+ settings.trail && (program.calls.length > 0 || program.notes.length > 0)
464
+ ? {
465
+ content: [{ type: "text", text: withTrail(text, program.trail(), settings.answerLimit) }],
466
+ ...(isError ? { isError: true } : {}),
467
+ }
468
+ : answer(settings, text, isError);
469
+
470
+ async function runForeground(code) {
471
+ await self.ready;
472
+ await host.idle();
473
+ const program = records.program();
474
+ const result = await execute(code, { seconds: settings.timeoutSeconds, program, onProgress: () => {}, foreground: true });
475
+ return reply(formatRun(result, { timeoutSeconds: settings.timeoutSeconds }), !result.ok, program);
476
+ }
477
+
478
+ /** The job has ended: what it answers, its state, and the place of the ended jobs kept. */
479
+ function endJob(job, result) {
480
+ job.answer = formatRun(result, { timeoutSeconds: settings.backgroundSeconds });
481
+ job.state = jobState(result);
482
+ job.endedAt = Date.now();
483
+ ended.push(job);
484
+ if (ended.length > ENDED_KEPT) jobs.splice(jobs.indexOf(ended.shift()), 1);
485
+ }
486
+
487
+ async function startJob(code) {
488
+ await self.ready;
489
+ await host.idle();
490
+ // the count and the job are made in one turn of the event loop
491
+ if (jobs.filter((job) => job.state === "running").length >= settings.maxJobs) {
492
+ return answer(settings, jobLimitMessage(settings.maxJobs), true);
493
+ }
494
+ const stopper = new AbortController();
495
+ const job = {
496
+ id: `j${++jobCount}`,
497
+ state: "running",
498
+ startedAt: Date.now(),
499
+ endedAt: null,
500
+ progress: [],
501
+ progressCount: 0,
502
+ answer: null,
503
+ program: records.program(),
504
+ stopper,
505
+ };
506
+ jobs.push(job);
507
+ const onProgress = (line) => {
508
+ job.progress.push(String(line).slice(0, PROGRESS_LINE));
509
+ if (job.progress.length > PROGRESS_KEPT) job.progress.shift();
510
+ job.progressCount += 1;
511
+ };
512
+ job.finished = execute(code, { seconds: settings.backgroundSeconds, program: job.program, onProgress, signal: stopper.signal }).then(
513
+ (result) => endJob(job, result),
514
+ (err) => endJob(job, { ok: false, error: { kind: "error", message: String(err?.message ?? err) }, logs: [] }),
515
+ );
516
+ return answer(settings, jobStarted(job.id));
517
+ }
518
+
519
+ /** What `run` answers for one job: its text, with the trail once it has ended, as a fault exactly when it failed. */
520
+ function jobReply(job) {
521
+ const text = formatJob(job, Date.now());
522
+ const isError = job.state === "failed";
523
+ return job.state === "running" ? answer(settings, text, isError) : reply(text, isError, job.program);
524
+ }
525
+
526
+ async function askJob(id, stop) {
527
+ const job = jobs.find((candidate) => candidate.id === id);
528
+ if (job === undefined) return answer(settings, noJobMessage(id), true);
529
+ if (stop && job.state === "running") {
530
+ job.stopper.abort();
531
+ await job.finished;
532
+ }
533
+ return jobReply(job);
534
+ }
535
+
536
+ async function run(args) {
537
+ const request = runRequest(args);
538
+ if (request.problem !== undefined) return answer(settings, request.problem, true);
539
+ if (request.mode === "jobs") return answer(settings, formatJobs(jobs, Date.now()));
540
+ if (request.mode === "job") return askJob(request.job, request.stop);
541
+ return request.background ? startJob(request.code) : runForeground(request.code);
542
+ }
543
+
544
+ self.call = async (name, args) => {
545
+ host.start();
546
+ if (name !== "search" && name !== "run") throw new McpError(ErrorCode.InvalidParams, `unknown tool: ${name}`);
547
+ // a sign-in made or forgotten since the last call is picked up before anything else of the call
548
+ await self.ready;
549
+ await pickUp();
550
+ return name === "search" ? search(args ?? {}) : run(args ?? {});
551
+ };
552
+ return self;
553
+ }