@operad-io/harness-process 0.4.0 → 0.5.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,14 +1,14 @@
1
1
  {
2
2
  "name": "@operad-io/harness-process",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts"
7
7
  },
8
8
  "dependencies": {
9
- "@operad-io/access-match": "0.4.0",
10
- "@operad-io/engine": "0.4.0",
11
- "@operad-io/mcp": "0.4.0"
9
+ "@operad-io/access-match": "0.5.0",
10
+ "@operad-io/engine": "0.5.0",
11
+ "@operad-io/mcp": "0.5.0"
12
12
  },
13
13
  "description": "operad: the shared process and log helpers of the harness plugins",
14
14
  "repository": {
package/src/index.ts CHANGED
@@ -20,11 +20,13 @@ export * from "./fold-lines.ts";
20
20
  export * from "./jsonl-log.ts";
21
21
  export * from "./keep.ts";
22
22
  export * from "./lines.ts";
23
+ export * from "./not-set-up.ts";
23
24
  export * from "./operad-tools.ts";
24
25
  export * from "./process.ts";
25
26
  export * from "./probe-cache.ts";
26
27
  export * from "./question-form.ts";
27
28
  export * from "./refusal.ts";
29
+ export * from "./shell-word.ts";
28
30
  export * from "./skills.ts";
29
31
  export * from "./step.ts";
30
32
  export * from "./timings.ts";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The check answer for an agent that is on the machine and cannot be used until
3
+ * the person acts: it is signed out, or older than the harness's floor. The
4
+ * check passes and reports it as missing (ADR 0022 D14), under the item name
5
+ * every setup guide has a step for.
6
+ */
7
+
8
+ import type { PluginCheckReturn } from "@operad-io/engine";
9
+
10
+ export function agentNotSetUp(reason: string): PluginCheckReturn {
11
+ return { note: `not set up: ${reason}`, missing: [{ name: "check", description: reason }] };
12
+ }
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { fileURLToPath } from "node:url";
10
- import { isRecord } from "@operad-io/engine";
10
+ import { isRecord, sharedOptionalPlugins, sharedStandInPlugins } from "@operad-io/engine";
11
11
 
12
12
  /** The name the tools go by in a harness: the server's name, and the prefix claude gives its tools. */
13
13
  export const OPERAD_SERVER = "operad";
@@ -28,10 +28,18 @@ export function operadToolsOf(value: unknown): OperadTools | undefined {
28
28
  return typeof home === "string" && home.length > 0 ? { home } : undefined;
29
29
  }
30
30
 
31
- /** The program that serves the tools on stdio, and its arguments. */
31
+ /**
32
+ * The program that serves the tools on stdio, and its arguments. The offered
33
+ * plugins and the stand-ins go as arguments: a harness may start a server with
34
+ * its own environment only.
35
+ */
32
36
  export function serverCommand(tools: OperadTools): { readonly command: string; readonly args: readonly string[] } {
33
37
  const script = fileURLToPath(import.meta.resolve("@operad-io/mcp/stdio"));
34
- return { command: process.execPath, args: [script, "--home", tools.home] };
38
+ const optional = sharedOptionalPlugins();
39
+ const offered = optional === undefined ? [] : ["--optional", JSON.stringify(optional)];
40
+ const standIns = sharedStandInPlugins();
41
+ const standing = standIns === undefined ? [] : ["--stand-ins", JSON.stringify(standIns)];
42
+ return { command: process.execPath, args: [script, ...offered, ...standing, "--home", tools.home] };
35
43
  }
36
44
 
37
45
  /** A server a bot's settings list, started as this command; its name is the one its tools go by. */
@@ -0,0 +1,4 @@
1
+ /** One word of a shell command line that stands for exactly `value`. */
2
+ export function shellWord(value: string): string {
3
+ return /^[A-Za-z0-9_@%+=:,./-]+$/.test(value) ? value : `'${value.replace(/'/g, "'\\''")}'`;
4
+ }