@procedures/mark 0.22.1 → 0.24.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.
@@ -1 +1 @@
1
- {"version":3,"file":"client-mode.d.ts","sourceRoot":"","sources":["../src/client-mode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,UAAU,gBAAgB;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,EAChC,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAgElC"}
1
+ {"version":3,"file":"client-mode.d.ts","sourceRoot":"","sources":["../src/client-mode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA4B,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAE5E,UAAU,gBAAgB;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,sDAAsD;AACtD,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACzG;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAiB3G;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EACnE,IAAI,EAAE,MAAM,EAAE,GACb,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAqDrC;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,EAChC,MAAM,CAAC,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAGlC"}
@@ -1,16 +1,15 @@
1
1
  /**
2
2
  * CLI Client Mode
3
3
  *
4
- * Connects to a running CLI server and executes commands remotely.
5
- * Falls back to local execution if no server is available.
4
+ * Connects to a running CLI server and executes commands remotely (the warm mode).
5
+ * Without a server, the command runs in this process (the cold mode, `command.ts`).
6
6
  */
7
7
  import { currentBuild, findServer } from "./lockfile.js";
8
8
  /**
9
- * Try to execute command via running server. The input is the procedure input that the CLI
10
- * parsed and validated already.
11
- * Returns null if no server available (should fall back to local)
9
+ * This function connects to the CLI server that a command of this run can use. It gives null when
10
+ * no such server runs: then the command runs in this process.
12
11
  */
13
- export async function tryClientMode(path, input, onItem, fsRoot) {
12
+ export async function connectCliServer(path, fsRoot) {
14
13
  // A running server of this build, started in this folder, that answers as the peer of its
15
14
  // lockfile and has a token. Otherwise the CLI runs the command itself. (Before, any server
16
15
  // with a live PID was used: relative paths resolved in the server's folder, an old build ran
@@ -26,6 +25,14 @@ export async function tryClientMode(path, input, onItem, fsRoot) {
26
25
  if (!lockfile?.token || lockfile.transport === "websocket") {
27
26
  return null;
28
27
  }
28
+ return cliServerConnection({ endpoint: lockfile.endpoint, token: lockfile.token }, path);
29
+ }
30
+ /**
31
+ * This function gives a connection to the CLI server of a lockfile for the command of a path: the
32
+ * HTTP endpoint and the token. It gives null when the client cannot load: then nothing went to
33
+ * the server, and the command runs in this process.
34
+ */
35
+ export async function cliServerConnection(server, path) {
29
36
  let client;
30
37
  let method;
31
38
  try {
@@ -34,8 +41,8 @@ export async function tryClientMode(path, input, onItem, fsRoot) {
34
41
  const { Client, HttpTransport } = clientModule;
35
42
  // Connect to server
36
43
  const transport = new HttpTransport({
37
- baseUrl: lockfile.endpoint,
38
- defaultHeaders: { Authorization: `Bearer ${lockfile.token}` },
44
+ baseUrl: server.endpoint,
45
+ defaultHeaders: { Authorization: `Bearer ${server.token}` },
39
46
  });
40
47
  client = new Client({ transport });
41
48
  // The method of the path as ProcedureServer registers it: the last segment is the operation.
@@ -47,30 +54,44 @@ export async function tryClientMode(path, input, onItem, fsRoot) {
47
54
  // Nothing was sent to the server yet - fall back to local execution
48
55
  return null;
49
56
  }
50
- // Execute remotely. From here on, do not fall back to local execution: the server may
51
- // have run (part of) the command, and running it again would repeat its side effects.
52
- try {
53
- // Each item of the response as it arrives (a streaming procedure gives many). The result
54
- // is the last item.
55
- let last;
56
- for await (const item of client.stream(method, input)) {
57
- last = { value: item };
58
- onItem?.(item);
59
- }
60
- if (!last) {
61
- throw new Error("No response received from the CLI server");
62
- }
63
- return {
64
- success: true,
65
- result: last.value,
66
- printed: onItem !== undefined,
67
- };
68
- }
69
- catch (error) {
70
- return {
71
- success: false,
72
- error: error instanceof Error ? error.message : String(error),
73
- };
74
- }
57
+ return {
58
+ async call(input, onItem, signal) {
59
+ // Execute remotely. From here on, do not fall back to local execution: the server may
60
+ // have run (part of) the command, and running it again would repeat its side effects.
61
+ try {
62
+ // Each item of the response as it arrives (a streaming procedure gives many). The result
63
+ // is the last item. The signal aborts the request, and the server aborts the call (before
64
+ // CLI-26, the call had no signal: a Ctrl-C ended this process, and the server continued).
65
+ let last;
66
+ for await (const item of client.stream(method, input, signal ? { signal } : undefined)) {
67
+ last = { value: item };
68
+ onItem?.(item);
69
+ }
70
+ if (!last) {
71
+ throw new Error("No response received from the CLI server");
72
+ }
73
+ return {
74
+ success: true,
75
+ result: last.value,
76
+ printed: onItem !== undefined,
77
+ };
78
+ }
79
+ catch (error) {
80
+ return {
81
+ success: false,
82
+ error: error instanceof Error ? error.message : String(error),
83
+ };
84
+ }
85
+ },
86
+ };
87
+ }
88
+ /**
89
+ * Try to execute command via running server. The input is the procedure input that the CLI
90
+ * parsed and validated already. The signal stops the call on the server.
91
+ * Returns null if no server available (should fall back to local)
92
+ */
93
+ export async function tryClientMode(path, input, onItem, fsRoot, signal) {
94
+ const connection = await connectCliServer(path, fsRoot);
95
+ return connection === null ? null : connection.call(input, onItem, signal);
75
96
  }
76
97
  //# sourceMappingURL=client-mode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client-mode.js","sourceRoot":"","sources":["../src/client-mode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAUzD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAc,EACd,KAAc,EACd,MAAgC,EAChC,MAAe;IAEf,0FAA0F;IAC1F,2FAA2F;IAC3F,6FAA6F;IAC7F,0FAA0F;IAC1F,qFAAqF;IACrF,2FAA2F;IAC3F,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,oFAAoF;IACpF,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACzF,8EAA8E;IAC9E,IAAI,CAAC,QAAQ,EAAE,KAAK,IAAI,QAAQ,CAA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AAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;oBACvB,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC;gBACjB,CAAC;gBACD,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;gBAC9D,CAAC;gBACD,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,MAAM,EAAE,IAAI,CAAC,KAAK;oBAClB,OAAO,EAAE,MAAM,KAAK,SAAS;iBAC9B,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;iBAC9D,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAc,EACd,KAAc,EACd,MAAgC,EAChC,MAAe,EACf,MAAoB;IAEpB,MAAM,UAAU,GAAG,MAAM,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxD,OAAO,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * The service of one `mark` command (CLI-26, decision D17).
3
+ *
4
+ * Each command that runs a procedure starts under `run()` of `@mark1russell7/service`, with the
5
+ * profile `ephemeral`. The runner owns the signals, the stop in stages and the exit. Thus this
6
+ * file installs no signal handler and calls no `process.exit`.
7
+ *
8
+ * - The warm mode: the CLI server (`mark --server`) runs the procedure. The service of the command
9
+ * has only the command, and the call goes to the server over HTTP.
10
+ * - The cold mode: the procedures host of the CLI server runs in this process, with the same
11
+ * registry and policy (`markHostOptions()`). It has no listener, no port and no lockfile. The
12
+ * call goes to the host through its local face (`localFace()` of `@procedures/peer`).
13
+ * - The command is one request of the controller `command`. A first Ctrl-C starts the stop. The
14
+ * drain aborts the signal of the request at once, and the call gets the abort.
15
+ * - After the command, `end()` asks for the stop with the exit code of the command. The process
16
+ * port then ends the process with that code.
17
+ */
18
+ import { type Lifecycle, type Profile, type RequestEnd, type RunOptions, type ServiceBuilder } from "@mark1russell7/service";
19
+ import type { Client, ProcedureRegistry } from "@procedures/client";
20
+ import type { ProcedureHost, ProcedureHostOptions, TransportConfig } from "@procedures/peer";
21
+ /** The name of the service of a command, and of the procedures host of the cold mode. */
22
+ export declare const COMMAND_SERVICE = "mark";
23
+ /** The controller of the one request of a command. */
24
+ export declare const COMMAND_CONTROLLER = "command";
25
+ /** The route of the one request of a command. A command can have effects, thus it is not idempotent. */
26
+ export declare const COMMAND_ROUTE = "RUN";
27
+ /**
28
+ * The profile of each command, in the warm mode and in the cold mode: `ephemeral`. The exit code is
29
+ * 130 after a first Ctrl-C, 143 after SIGTERM and 131 after SIGQUIT. A second signal during the
30
+ * stop ends the process at once with 1.
31
+ *
32
+ * Before CLI-26, a cold command gave 1 after a first Ctrl-C and 130 after a second one. A signal
33
+ * ended a warm command at once, and the server continued the call.
34
+ */
35
+ export declare const COMMAND_PROFILE: Profile;
36
+ /** This function declares the controller and the route of the one request of a command. */
37
+ export declare function declareCommand(svc: ServiceBuilder): ServiceBuilder;
38
+ /** Where a command runs: the options of `run()`, and if the run owns its process. */
39
+ export interface CommandProcess {
40
+ /** The options of `run()`: the process port and the clock. A port here wins over `ownsProcess`. */
41
+ readonly run?: RunOptions | undefined;
42
+ /** True when the run owns its process, as the bin of `mark` does. */
43
+ readonly ownsProcess?: boolean | undefined;
44
+ }
45
+ /**
46
+ * This function gives the options of `run()` for one command. A run that owns its process gets
47
+ * `nodeProcess`: the runner owns the signals, and it ends the process. Each other run gets a new
48
+ * `embeddedProcess()`: no signal handler, and no end of the process.
49
+ */
50
+ export declare function commandRunOptions(given?: CommandProcess): RunOptions;
51
+ /** A command that runs under `run()`. */
52
+ export interface CommandRun {
53
+ /** The lifecycle of the service of the command. */
54
+ readonly life: Lifecycle;
55
+ /**
56
+ * This method does the work of the command as the one request of the service. The signal of
57
+ * the work aborts at the start of the drain. The method gives the end of the request: `done`,
58
+ * `failed`, `refused` (the stop started before the work) or `cut` (the stop aborted the work).
59
+ */
60
+ request(work: (signal: AbortSignal) => Promise<void>): Promise<RequestEnd>;
61
+ /**
62
+ * This method asks for the stop with the exit code of the command, and gives the exit code of
63
+ * the lifecycle. A signal that started the stop first keeps its exit code. With the process of
64
+ * Node, the process ends, and the promise does not resolve.
65
+ */
66
+ end(code: number): Promise<number>;
67
+ }
68
+ /** This function gives the command of a lifecycle that `declareCommand()` declared. */
69
+ export declare function commandOf(life: Lifecycle): CommandRun;
70
+ /** This function starts the service of a command on the CLI server (the warm mode). */
71
+ export declare function startWarmCommand(where?: CommandProcess): Promise<CommandRun>;
72
+ /** The options of `markHostOptions()`. */
73
+ export interface MarkHostConfig {
74
+ /** The id of the host: `host.info` gives it as `peerId`. */
75
+ readonly id: string;
76
+ /** The registry of `mark` (`loadEcosystemRegistry()`). */
77
+ readonly registry: ProcedureRegistry;
78
+ /** The transports of the CLI server. The cold mode gives only the transport `local`. */
79
+ readonly transports: readonly TransportConfig[];
80
+ /** The token of the CLI server. The cold mode has none: each call of the local face is a call of this process. */
81
+ readonly token?: string | undefined;
82
+ /** The topic patterns of the remote events (`--events`). The default is none. */
83
+ readonly events?: readonly string[] | undefined;
84
+ }
85
+ /**
86
+ * This function gives the options of the procedures host of `mark`, for the CLI server and for the
87
+ * cold mode. Thus the two hosts serve the same procedures, with the same policy: `hostPolicy()` of
88
+ * the core, no expose list, and `events.subscribe` with the topics of `--events`.
89
+ */
90
+ export declare function markHostOptions(config: MarkHostConfig): Promise<ProcedureHostOptions>;
91
+ /** A command in this process: its service, the procedures host and a client of the host. */
92
+ export interface ColdCommand {
93
+ readonly command: CommandRun;
94
+ readonly host: ProcedureHost;
95
+ /**
96
+ * A client of the host. `stream()` and `call()` go through the local face of the host. `exec()`
97
+ * runs a procedure reference with the registry of the host, as before (its nested refs need the rules of the registry).
98
+ */
99
+ readonly client: Client;
100
+ }
101
+ /**
102
+ * The startup of a cold command that failed. The lifecycle stops the parts that started, and then
103
+ * it exits with the code 1: `life.done` gives the code. With the process of Node, the process ends.
104
+ */
105
+ export interface ColdStartFailure {
106
+ readonly errors: readonly string[];
107
+ readonly life: Lifecycle;
108
+ }
109
+ /**
110
+ * This function starts a command in this process (the cold mode): the procedures host of the CLI
111
+ * server, under `runProcedureHost()` with `COMMAND_PROFILE`. After a startup that failed, it
112
+ * gives the errors and the lifecycle.
113
+ */
114
+ export declare function startColdCommand(registry: ProcedureRegistry, where?: CommandProcess): Promise<ColdCommand | ColdStartFailure>;
115
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAoD,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC/K,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE7F,yFAAyF;AACzF,eAAO,MAAM,eAAe,SAAS,CAAC;AAEtC,sDAAsD;AACtD,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAE5C,wGAAwG;AACxG,eAAO,MAAM,aAAa,QAAQ,CAAC;AAEnC;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,OAAmB,CAAC;AAElD,2FAA2F;AAC3F,wBAAgB,c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;GAIG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAK3F;AAED,4FAA4F;AAC5F,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,KAAK,GAAE,cAAmB,GAAG,OAAO,CAAC,WAAW,GAAG,gBAAgB,CAAC,CAsBvI"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * The service of one `mark` command (CLI-26, decision D17).
3
+ *
4
+ * Each command that runs a procedure starts under `run()` of `@mark1russell7/service`, with the
5
+ * profile `ephemeral`. The runner owns the signals, the stop in stages and the exit. Thus this
6
+ * file installs no signal handler and calls no `process.exit`.
7
+ *
8
+ * - The warm mode: the CLI server (`mark --server`) runs the procedure. The service of the command
9
+ * has only the command, and the call goes to the server over HTTP.
10
+ * - The cold mode: the procedures host of the CLI server runs in this process, with the same
11
+ * registry and policy (`markHostOptions()`). It has no listener, no port and no lockfile. The
12
+ * call goes to the host through its local face (`localFace()` of `@procedures/peer`).
13
+ * - The command is one request of the controller `command`. A first Ctrl-C starts the stop. The
14
+ * drain aborts the signal of the request at once, and the call gets the abort.
15
+ * - After the command, `end()` asks for the stop with the exit code of the command. The process
16
+ * port then ends the process with that code.
17
+ */
18
+ import { embeddedProcess, ephemeral, nodeProcess, service } from "@mark1russell7/service";
19
+ /** The name of the service of a command, and of the procedures host of the cold mode. */
20
+ export const COMMAND_SERVICE = "mark";
21
+ /** The controller of the one request of a command. */
22
+ export const COMMAND_CONTROLLER = "command";
23
+ /** The route of the one request of a command. A command can have effects, thus it is not idempotent. */
24
+ export const COMMAND_ROUTE = "RUN";
25
+ /**
26
+ * The profile of each command, in the warm mode and in the cold mode: `ephemeral`. The exit code is
27
+ * 130 after a first Ctrl-C, 143 after SIGTERM and 131 after SIGQUIT. A second signal during the
28
+ * stop ends the process at once with 1.
29
+ *
30
+ * Before CLI-26, a cold command gave 1 after a first Ctrl-C and 130 after a second one. A signal
31
+ * ended a warm command at once, and the server continued the call.
32
+ */
33
+ export const COMMAND_PROFILE = ephemeral;
34
+ /** This function declares the controller and the route of the one request of a command. */
35
+ export function declareCommand(svc) {
36
+ svc.controller(COMMAND_CONTROLLER).route(COMMAND_ROUTE, { idempotent: false });
37
+ return svc;
38
+ }
39
+ /**
40
+ * This function gives the options of `run()` for one command. A run that owns its process gets
41
+ * `nodeProcess`: the runner owns the signals, and it ends the process. Each other run gets a new
42
+ * `embeddedProcess()`: no signal handler, and no end of the process.
43
+ */
44
+ export function commandRunOptions(given = {}) {
45
+ if (given.run?.process !== undefined)
46
+ return given.run;
47
+ return { ...given.run, process: given.ownsProcess === true ? nodeProcess : embeddedProcess() };
48
+ }
49
+ /** This function gives the command of a lifecycle that `declareCommand()` declared. */
50
+ export function commandOf(life) {
51
+ return {
52
+ life,
53
+ async request(work) {
54
+ const stream = life.request(COMMAND_CONTROLLER, COMMAND_ROUTE, async (signal) => {
55
+ await work(signal);
56
+ return true;
57
+ });
58
+ return (await stream.collect()).end;
59
+ },
60
+ async end(code) {
61
+ await life.shutdown("the command ended", { code });
62
+ return life.done;
63
+ },
64
+ };
65
+ }
66
+ /** This function starts the service of a command on the CLI server (the warm mode). */
67
+ export async function startWarmCommand(where = {}) {
68
+ const svc = declareCommand(service(COMMAND_SERVICE).profile(COMMAND_PROFILE));
69
+ return commandOf(await svc.run(commandRunOptions(where)));
70
+ }
71
+ /**
72
+ * This function gives the options of the procedures host of `mark`, for the CLI server and for the
73
+ * cold mode. Thus the two hosts serve the same procedures, with the same policy: `hostPolicy()` of
74
+ * the core, no expose list, and `events.subscribe` with the topics of `--events`.
75
+ */
76
+ export async function markHostOptions(config) {
77
+ const { hostPolicy } = await import("@procedures/client");
78
+ const { peerHostOptions } = await import("@procedures/peer");
79
+ const policy = hostPolicy({ ...(config.token !== undefined ? { token: config.token } : {}), events: { topics: [...(config.events ?? [])] } });
80
+ return peerHostOptions({ id: config.id, transports: [...config.transports], registry: config.registry, policy }, "procedures");
81
+ }
82
+ /**
83
+ * This function starts a command in this process (the cold mode): the procedures host of the CLI
84
+ * server, under `runProcedureHost()` with `COMMAND_PROFILE`. After a startup that failed, it
85
+ * gives the errors and the lifecycle.
86
+ */
87
+ export async function startColdCommand(registry, where = {}) {
88
+ const { Client } = await import("@procedures/client");
89
+ const { localFace } = await import("@procedures/peer");
90
+ const { runProcedureHost } = await import("@procedures/server");
91
+ const local = localFace();
92
+ const id = `cold-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
93
+ const options = await markHostOptions({ id, registry, transports: [{ type: "local" }] });
94
+ const running = await runProcedureHost({
95
+ name: COMMAND_SERVICE,
96
+ mode: "foreground",
97
+ profile: COMMAND_PROFILE,
98
+ host: { ...options, faces: { local: local.face } },
99
+ declare: (svc) => {
100
+ declareCommand(svc);
101
+ },
102
+ run: commandRunOptions(where),
103
+ });
104
+ if (running.life.state !== "running") {
105
+ return { errors: [...running.life.errors], life: running.life };
106
+ }
107
+ const client = new Client({ transport: local.transport }).useRegistry(registry);
108
+ return { command: commandOf(running.life), host: running.host, client };
109
+ }
110
+ //# sourceMappingURL=command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAuF,MAAM,wBAAwB,CAAC;AAI/K,yFAAy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C,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAChF,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1E,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 2,
3
- "fingerprint": "a37b5cb380b6541106502562b84a9f9f63e69251d7a008ffe8fbd3f869cdfbe2",
4
- "generatedAt": "2026-10-20T08:19:53.566Z",
3
+ "fingerprint": "c681926bc93e1a0b5865b92d7c68dd20dbcb679b2ef6c34a1f2aa78e2cf66e64",
4
+ "generatedAt": "2026-10-24T19:19:38.700Z",
5
5
  "commands": [
6
6
  {
7
7
  "path": [
@@ -9,7 +9,8 @@
9
9
  * The server is the background host of `mark` (decision D17): it runs under `run()` of
10
10
  * `@mark1russell7/service` through `runProcedureHost()`, with the profile `daemon` (CLI-8). The
11
11
  * runner owns the signals, the stop in stages and the exit. The lockfile is a dependency of the
12
- * service: its connect writes it, and its close removes it after the listeners close.
12
+ * service: its connect writes it, and its close removes it after the listeners close. The cold
13
+ * mode of `mark` runs the same host in its own process (`markHostOptions()`, CLI-26).
13
14
  */
14
15
  import type { ProcedureHostRunConfig } from "@procedures/server";
15
16
  export interface ServerModeOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"server-mode.d.ts","sourceRoot":"","sources":["../src/server-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAMjE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,S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,GAAG,SAAS,CAAC;IAC5B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAuCD;;;GAGG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,CAAC,EAAE,sBAAsB,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA0FpH;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED,2CAA2C;AAC3C,eAAO,MAAM,iBAAiB,YAAI,MAAM,EAAE,WAAW,EAAE,MAAM,CAAU,CAAC;AAExE;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAM3E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAUzD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAWzD"}
@@ -9,7 +9,8 @@
9
9
  * The server is the background host of `mark` (decision D17): it runs under `run()` of
10
10
  * `@mark1russell7/service` through `runProcedureHost()`, with the profile `daemon` (CLI-8). The
11
11
  * runner owns the signals, the stop in stages and the exit. The lockfile is a dependency of the
12
- * service: its connect writes it, and its close removes it after the listeners close.
12
+ * service: its connect writes it, and its close removes it after the listeners close. The cold
13
+ * mode of `mark` runs the same host in its own process (`markHostOptions()`, CLI-26).
13
14
  */
14
15
  import { print } from "./print.js";
15
16
  import { loadEcosystemRegistry } from "./ecosystem.js";
@@ -70,8 +71,8 @@ export async function startServerMode(options, run) {
70
71
  // serves events.subscribe (EVENTS.md): the topic rule is the --events patterns, else empty.
71
72
  // The bus is the global bus, which is also the ctx.bus of the procedures.
72
73
  const events = [...(options.events ?? [])];
73
- const { hostPolicy } = await import("@procedures/client");
74
- const { peerHostOptions } = await import("@procedures/peer");
74
+ // The options of the host: the same registry and policy as the cold mode of mark (CLI-26)
75
+ const { markHostOptions } = await import("./command.js");
75
76
  const { runProcedureHost } = await import("@procedures/server");
76
77
  const id = `peer-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
77
78
  // The lockfile for client discovery. A client uses this server only from the same folder,
@@ -81,7 +82,7 @@ export async function startServerMode(options, run) {
81
82
  const running = await runProcedureHost({
82
83
  name: "mark-server",
83
84
  mode: "background",
84
- host: peerHostOptions({ id, transports, registry, policy: hostPolicy({ token, events: { topics: events } }) }, "procedures"),
85
+ host: await markHostOptions({ id, registry, transports, token, events }),
85
86
  lockfile: {
86
87
  pid: process.pid,
87
88
  port,
@@ -1 +1 @@
1
- {"version":3,"file":"server-mode.js","sourceRoot":"","sources":["../src/server-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAqB9D;;GAEG;AACH,SAAS,eAAe,CAAC,OAA0B;IACjD,MAAM,UAAU,GAMX,EAAE,CAAC;IAER,0FAA0F;IAC1F,+FAA+F;IAC/F,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,WAAW,EAAE,SAAS,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC;IAEjE,IAAI,SAAS,KAAK,MAAM,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QACjD,UAAU,CAAC,IAAI,CAAC;YACd,IAAI,EAAE,MAAM;YACZ,IAAI;YACJ,IAAI;YACJ,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAC;IACL,CAAC;IAED,IAAI,SAAS,KAAK,WAAW,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QACtD,U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xD,MAAM,SAAS,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;IAC5F,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,SAAS,CAAC,SAAS,CAAC,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,IAAc;IACxC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7D,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAChE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC;QACnB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;QACpC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@procedures/mark",
4
- "version": "0.22.1",
4
+ "version": "0.24.0",
5
5
  "description": "mark: one CLI for every procedure package. It finds the procedures, parses flags by their Zod types, runs local or through a fast warm server, and asks for missing arguments.",
6
6
  "keywords": [
7
7
  "cli",
@@ -52,16 +52,17 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@clack/prompts": "^0.7.0",
55
- "@procedures/cli-run": "0.22.1",
56
- "@procedures/client": "0.22.1",
57
- "@procedures/lib": "0.22.1",
58
- "@procedures/mcp-dev-tools": "0.22.1",
59
- "@procedures/peer": "0.22.1",
60
- "@procedures/pnpm": "0.22.1",
61
- "@procedures/procedure": "0.22.1",
62
- "@procedures/server": "0.22.1",
63
- "@procedures/shell": "0.22.1",
64
- "@procedures/vitest": "0.22.1",
55
+ "@mark1russell7/service": "^0.5.8",
56
+ "@procedures/cli-run": "0.24.0",
57
+ "@procedures/client": "0.24.0",
58
+ "@procedures/lib": "0.24.0",
59
+ "@procedures/mcp-dev-tools": "0.24.0",
60
+ "@procedures/peer": "0.24.0",
61
+ "@procedures/pnpm": "0.24.0",
62
+ "@procedures/procedure": "0.24.0",
63
+ "@procedures/server": "0.24.0",
64
+ "@procedures/shell": "0.24.0",
65
+ "@procedures/vitest": "0.24.0",
65
66
  "chalk": "^5.3.0",
66
67
  "cli-table3": "^0.6.5",
67
68
  "ora": "^8.0.0",
@@ -70,44 +71,44 @@
70
71
  },
71
72
  "devDependencies": {
72
73
  "@mark1russell7/cue": "^1.0.0",
73
- "@procedures/archive": "0.22.1",
74
- "@procedures/bundle-assistant": "0.22.1",
75
- "@procedures/bundle-dev": "0.22.1",
76
- "@procedures/bundle-mcp": "0.22.1",
77
- "@procedures/claude-cli": "0.22.1",
78
- "@procedures/compiler": "0.22.1",
79
- "@procedures/cue": "0.22.1",
80
- "@procedures/dag": "0.22.1",
81
- "@procedures/docker": "0.22.1",
82
- "@procedures/env": "0.22.1",
83
- "@procedures/exif": "0.22.1",
84
- "@procedures/fs": "0.22.1",
85
- "@procedures/geo": "0.22.1",
86
- "@procedures/gh": "0.22.1",
87
- "@procedures/git": "0.22.1",
88
- "@procedures/http": "0.22.1",
89
- "@procedures/ics": "0.22.1",
90
- "@procedures/ios-backup": "0.22.1",
91
- "@procedures/json": "0.22.1",
92
- "@procedures/llm": "0.22.1",
93
- "@procedures/mail": "0.22.1",
94
- "@procedures/mongo": "0.22.1",
95
- "@procedures/node": "0.22.1",
96
- "@procedures/notify": "0.22.1",
97
- "@procedures/npm": "0.22.1",
98
- "@procedures/pdf": "0.22.1",
99
- "@procedures/privacy-scan": "0.22.1",
100
- "@procedures/restic": "0.22.1",
101
- "@procedures/s3": "0.22.1",
102
- "@procedures/schedule": "0.22.1",
103
- "@procedures/snapshot": "0.22.1",
104
- "@procedures/splay": "0.22.1",
105
- "@procedures/sqlite": "0.22.1",
106
- "@procedures/store": "0.22.1",
107
- "@procedures/systems": "0.22.1",
108
- "@procedures/tailscale": "0.22.1",
109
- "@procedures/vite": "0.22.1",
110
- "@procedures/weather": "0.22.1",
74
+ "@procedures/archive": "0.24.0",
75
+ "@procedures/bundle-assistant": "0.24.0",
76
+ "@procedures/bundle-dev": "0.24.0",
77
+ "@procedures/bundle-mcp": "0.24.0",
78
+ "@procedures/claude-cli": "0.24.0",
79
+ "@procedures/compiler": "0.24.0",
80
+ "@procedures/cue": "0.24.0",
81
+ "@procedures/dag": "0.24.0",
82
+ "@procedures/docker": "0.24.0",
83
+ "@procedures/env": "0.24.0",
84
+ "@procedures/exif": "0.24.0",
85
+ "@procedures/fs": "0.24.0",
86
+ "@procedures/geo": "0.24.0",
87
+ "@procedures/gh": "0.24.0",
88
+ "@procedures/git": "0.24.0",
89
+ "@procedures/http": "0.24.0",
90
+ "@procedures/ics": "0.24.0",
91
+ "@procedures/ios-backup": "0.24.0",
92
+ "@procedures/json": "0.24.0",
93
+ "@procedures/llm": "0.24.0",
94
+ "@procedures/mail": "0.24.0",
95
+ "@procedures/mongo": "0.24.0",
96
+ "@procedures/node": "0.24.0",
97
+ "@procedures/notify": "0.24.0",
98
+ "@procedures/npm": "0.24.0",
99
+ "@procedures/pdf": "0.24.0",
100
+ "@procedures/privacy-scan": "0.24.0",
101
+ "@procedures/restic": "0.24.0",
102
+ "@procedures/s3": "0.24.0",
103
+ "@procedures/schedule": "0.24.0",
104
+ "@procedures/snapshot": "0.24.0",
105
+ "@procedures/splay": "0.24.0",
106
+ "@procedures/sqlite": "0.24.0",
107
+ "@procedures/store": "0.24.0",
108
+ "@procedures/systems": "0.24.0",
109
+ "@procedures/tailscale": "0.24.0",
110
+ "@procedures/vite": "0.24.0",
111
+ "@procedures/weather": "0.24.0",
111
112
  "@types/node": "^22.0.0",
112
113
  "fast-check": "^4.10.2",
113
114
  "typescript": "^7.0.2",
package/src/bin.ts CHANGED
@@ -4,8 +4,11 @@
4
4
  *
5
5
  * Importing `@procedures/mark` gives the functions and runs nothing (deep dive CLI-17).
6
6
  * This file runs the CLI. `node dist/cli.js` also runs it, for the documented commands.
7
+ *
8
+ * The bin owns its process: the runner of each command owns the signals, and it ends the process
9
+ * with the exit code of the command (CLI-26).
7
10
  */
8
11
 
9
12
  import { main } from "./cli.js";
10
13
 
11
- await main(process.argv.slice(2));
14
+ await main(process.argv.slice(2), { ownsProcess: true });