@operad-io/harness-process 0.0.1 → 0.1.1
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 +12 -0
- package/package.json +4 -4
- package/src/always-allow.ts +6 -5
- package/src/ask-call.ts +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# @operad-io/harness-process
|
|
2
|
+
|
|
3
|
+
**Shared process and log helpers for the harness plugins.** The code the harness packages have in common: running a child process with a wall time and a stall limit, its logs, and an ACP client.
|
|
4
|
+
|
|
5
|
+
This package is part of [operad](https://github.com/operad-io/operad). Most people install only [`@operad-io/cli`](https://www.npmjs.com/package/@operad-io/cli).
|
|
6
|
+
|
|
7
|
+
## Documentation
|
|
8
|
+
|
|
9
|
+
- User guide: [docs/user/index.md](https://github.com/operad-io/operad/blob/main/docs/user/index.md)
|
|
10
|
+
- Website: <https://operad.io>
|
|
11
|
+
|
|
12
|
+
MIT licensed.
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operad-io/harness-process",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./src/index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@operad-io/engine": "0.
|
|
10
|
-
"@operad-io/mcp": "0.
|
|
9
|
+
"@operad-io/engine": "0.1.1",
|
|
10
|
+
"@operad-io/mcp": "0.1.1"
|
|
11
11
|
},
|
|
12
|
-
"description": "operad: the shared process and log helpers of the harness plugins
|
|
12
|
+
"description": "operad: the shared process and log helpers of the harness plugins",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
15
|
"url": "git+https://github.com/operad-io/operad.git",
|
package/src/always-allow.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The access profile's user layer: the calls a person answered `allow_always`
|
|
3
|
-
* for, in `$OPERAD_HOME/access-user.json` (
|
|
4
|
-
*
|
|
3
|
+
* for, in `$OPERAD_HOME/access-user.json` (ADR 0025 D3, D4 and D7; the rule
|
|
4
|
+
* for a background run is still in `docs/backlog/operad-sandbox.md`). A missing
|
|
5
|
+
* file is an empty list. A file that cannot be read is
|
|
5
6
|
* reported by the step that reads it and treated as empty. Writes take the
|
|
6
7
|
* platform file lock and replace the file atomically.
|
|
7
8
|
*/
|
|
@@ -164,8 +165,8 @@ export function alwaysAllowFromGrant(access: unknown, cwd: string): AlwaysAllowE
|
|
|
164
165
|
|
|
165
166
|
/**
|
|
166
167
|
* The profile a step passes on: its own entries plus the user layer, or no
|
|
167
|
-
* entries at all in a run no person's message started (`operad-sandbox.md
|
|
168
|
-
*
|
|
168
|
+
* entries at all in a run no person's message started (`docs/backlog/operad-sandbox.md`,
|
|
169
|
+
* not in an ADR yet).
|
|
169
170
|
*/
|
|
170
171
|
export function accessWithAlwaysAllow(
|
|
171
172
|
access: unknown,
|
|
@@ -190,7 +191,7 @@ const MESSAGE_SOURCES = new Set(["ios", "telegram", "cli", "tui", "other"]);
|
|
|
190
191
|
* a message event from one of the chat's own client sources is a person's
|
|
191
192
|
* message in that conversation. Every other event (a schedule, a webhook, an
|
|
192
193
|
* incoming message from another source, a run's own event) is a background run
|
|
193
|
-
* (`operad-sandbox.md
|
|
194
|
+
* (`docs/backlog/operad-sandbox.md`, not in an ADR yet).
|
|
194
195
|
*/
|
|
195
196
|
export function personStarted(trigger: unknown): boolean {
|
|
196
197
|
if (trigger === undefined || trigger === null) return true;
|
package/src/ask-call.ts
CHANGED
|
@@ -92,7 +92,8 @@ export function canAsk(access: unknown): boolean {
|
|
|
92
92
|
/**
|
|
93
93
|
* The question for one call. The grace and `onTimeout` are the kernel's
|
|
94
94
|
* defaults. `allowAlways` is false in a background run, which neither consults
|
|
95
|
-
* the user layer nor offers to remember a call (`operad-sandbox.md
|
|
95
|
+
* the user layer nor offers to remember a call (`docs/backlog/operad-sandbox.md`,
|
|
96
|
+
* not in an ADR yet).
|
|
96
97
|
*/
|
|
97
98
|
export function askRequest(call: AskCall, allowAlways = false): AskRequest {
|
|
98
99
|
const prompt =
|
|
@@ -121,7 +122,7 @@ export function askRequest(call: AskCall, allowAlways = false): AskRequest {
|
|
|
121
122
|
|
|
122
123
|
/**
|
|
123
124
|
* The question of a harness that cannot enforce a one-time permission
|
|
124
|
-
* (`radian`;
|
|
125
|
+
* (`radian`; ADR 0008 D1 to D5): no grant, and a refusal
|
|
125
126
|
* once the grace passes, because a late `allow_once` could not be carried out.
|
|
126
127
|
*/
|
|
127
128
|
export function degradedAskRequest(prompt: string): AskRequest {
|