@codeworksh/harness 0.0.1-dev.20260925163524 → 0.1.0-dev.20261007133219
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 +7 -11
- package/effect.d.mts +2213 -826
- package/effect.mjs +1104 -550
- package/effect.mjs.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -56,17 +56,13 @@ const echo = Plugin.define({
|
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
// A prompt plugin
|
|
59
|
+
// A prompt plugin writes the foundation and sections; the harness renders the prompt.
|
|
60
60
|
const prompt = Plugin.define({
|
|
61
61
|
id: "acme.prompt.main",
|
|
62
62
|
kind: "prompt",
|
|
63
63
|
setup(ctx) {
|
|
64
|
-
ctx.plugin.prompt.set(
|
|
65
|
-
|
|
66
|
-
.list()
|
|
67
|
-
.map((tool) => tool.name)
|
|
68
|
-
.join(", ")}`,
|
|
69
|
-
);
|
|
64
|
+
ctx.plugin.prompt.foundation.set("You are a terse assistant.");
|
|
65
|
+
ctx.plugin.prompt.sections.append(Plugin.Section.Rules, "Answer in one sentence.");
|
|
70
66
|
},
|
|
71
67
|
});
|
|
72
68
|
|
|
@@ -79,9 +75,9 @@ Hooks belong to the tool registration. Sequential or parallel scheduling, select
|
|
|
79
75
|
|
|
80
76
|
`ctx.plugin.tools.update(name, patch)` rewrites a registration's model-facing prose without replacing the tool or its hooks. A read sees only earlier contributions, so a plugin patching `promptSnippet` or `promptGuidelines` must run _before_ the tool it patches is indexed. Declaring `kind: "tool"` puts it ahead of every prompt plugin already; what it still has to get right is its position among the other tool plugins, which is the order their entries are written in.
|
|
81
77
|
|
|
82
|
-
Prompt plugins
|
|
78
|
+
Prompt plugins write into `ctx.plugin.prompt`: `foundation.set(text)` for the untagged head (the last `set` wins), and `sections.append/set/remove/get` with a `Plugin.Section` value — the built-in `Rules`, `Addendum`, `ProjectContext` and `Skills`, or a custom `Plugin.Section.define("github_pr_rules", { format: "list" })`. Sections merge by name across plugins. The harness renders the foundation, then `<tools>`, the built-in sections, `<cwd>`, and custom sections in first-write order; `tools` and `cwd` are its own. Contributions close after setup; plugins receive event publication but no subscription or background lifecycle.
|
|
83
79
|
|
|
84
|
-
Omitting `plugins` selects Bash then the default prompt, followed by the host settings' `plugins` block. An explicit array replaces all of that, and an empty one runs nothing
|
|
80
|
+
Omitting `plugins` selects Bash then the default prompt, followed by the host settings' `plugins` block. An explicit array replaces all of that, and an empty one runs nothing: the prompt is then a fallback foundation with only the harness-owned `<tools>` and `<cwd>`.
|
|
85
81
|
|
|
86
82
|
An entry is a **module** or a **configuration object**.
|
|
87
83
|
|
|
@@ -146,8 +142,8 @@ That is the reason `kind` is part of the definition rather than something the ha
|
|
|
146
142
|
A plugin package declares `@codeworksh/harness` and `effect` as **exact peer dependencies**, never as dependencies:
|
|
147
143
|
|
|
148
144
|
```jsonc
|
|
149
|
-
"peerDependencies": { "@codeworksh/harness": "0.0.1", "effect": "4.0.
|
|
150
|
-
"devDependencies": { "effect": "4.0.
|
|
145
|
+
"peerDependencies": { "@codeworksh/harness": "0.0.1", "effect": "4.0.1" },
|
|
146
|
+
"devDependencies": { "effect": "4.0.1" }
|
|
151
147
|
```
|
|
152
148
|
|
|
153
149
|
A plugin is installed into its own directory, so its Effect is a separate module instance from the harness's. Two instances of the _same_ version interoperate completely — service tags resolve by their string id, and schemas, generators and handlers all cross the boundary. Two different _versions_ do not: a tool's schema then encodes a result the harness cannot commit. Declaring the peer moves that from a runtime failure to a line during `npm install`, and `test/plugin.foreign.test.ts` holds the interop itself in place.
|