@operad-io/cli 0.3.0 → 0.4.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operad-io/cli",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "operad: an open orchestration layer for coding agents",
5
5
  "type": "module",
6
6
  "repository": {
@@ -12,18 +12,18 @@
12
12
  "operad": "bin/operad.ts"
13
13
  },
14
14
  "dependencies": {
15
- "@operad-io/engine": "0.3.0",
16
- "@operad-io/mcp": "0.3.0",
17
- "@operad-io/shell": "0.3.0",
18
- "@operad-io/chat": "0.3.0",
19
- "@operad-io/dev": "0.3.0",
20
- "@operad-io/harness-codex": "0.3.0",
21
- "@operad-io/harness-pi": "0.3.0",
22
- "@operad-io/harness-radian": "0.3.0",
23
- "@operad-io/pool": "0.3.0",
24
- "@operad-io/bot": "0.3.0",
25
- "@operad-io/telegram": "0.3.0",
26
- "@operad-io/memory": "0.3.0"
15
+ "@operad-io/engine": "0.4.0",
16
+ "@operad-io/mcp": "0.4.0",
17
+ "@operad-io/shell": "0.4.0",
18
+ "@operad-io/chat": "0.4.0",
19
+ "@operad-io/dev": "0.4.0",
20
+ "@operad-io/harness-codex": "0.4.0",
21
+ "@operad-io/harness-pi": "0.4.0",
22
+ "@operad-io/harness-radian": "0.4.0",
23
+ "@operad-io/pool": "0.4.0",
24
+ "@operad-io/bot": "0.4.0",
25
+ "@operad-io/telegram": "0.4.0",
26
+ "@operad-io/memory": "0.4.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@operad-io/test-support": "0.0.0"
package/src/main.ts CHANGED
@@ -107,6 +107,7 @@ import {
107
107
  retryWhileBusy,
108
108
  serveStage,
109
109
  } from "./serve-guard.ts";
110
+ import { closeServeContext } from "./serve-close.ts";
110
111
  import {
111
112
  BIND_FAILED_EXIT,
112
113
  codeChecker,
@@ -3554,12 +3555,7 @@ export async function main(
3554
3555
  try {
3555
3556
  return await commandServe(context, io, lock, isSupervised, retryBind);
3556
3557
  } finally {
3557
- // Clean up the old plugin store when a serve context ends. An idle
3558
- // handle does not block writers; the busy timeout here came from
3559
- // other processes committing while a log write waited.
3560
- await context.views.close();
3561
- closePluginStore(context.registry.store);
3562
- await context.log.close();
3558
+ await closeServeContext(context, closePluginStore);
3563
3559
  }
3564
3560
  } finally {
3565
3561
  unguard();
@@ -0,0 +1,21 @@
1
+ /** What a serve context ends with: the views, the plugin store and the log. */
2
+ export interface ServeContextEnd {
3
+ readonly views: { drain(): Promise<void>; close(): void | Promise<void> };
4
+ readonly registry: { readonly store: unknown };
5
+ readonly log: { close(): void | Promise<void> };
6
+ }
7
+
8
+ /**
9
+ * Ends a serve context. Work of the context that still reads the stores (a
10
+ * standing hook, a resolve) is waited for, bounded, before they close; later
11
+ * work is dropped quietly. An idle plugin store handle does not block writers.
12
+ */
13
+ export async function closeServeContext(
14
+ context: ServeContextEnd,
15
+ closePluginStore: (store: unknown) => void,
16
+ ): Promise<void> {
17
+ await context.views.drain();
18
+ await context.views.close();
19
+ closePluginStore(context.registry.store);
20
+ await context.log.close();
21
+ }