@agentic-kit/harness 0.13.0 → 0.15.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/README.md +4 -2
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/tools/tool.d.ts +88 -0
- package/esm/tools/tool.js +10 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +2 -2
- package/tools/tool.d.ts +88 -0
- package/tools/tool.js +13 -0
package/README.md
CHANGED
|
@@ -26,6 +26,7 @@ Code only: **no skills are bundled**. Skills are pulled at runtime from [`constr
|
|
|
26
26
|
- **Ordered overlays** — layer skill sources (hardened base → team overlays → private known-gaps), last write wins by skill name, with include/exclude filters and transitive `requires:` expansion.
|
|
27
27
|
- **Confirm gating** — a host-neutral gate for mutating db tools: per-run decline memory (equivalent-args retries are auto-blocked), short-circuits for runnable projects, and structured previews your UI renders.
|
|
28
28
|
- **Run gate** — a policy (`allow` / `deny` / `ask`) plus an approval rendezvous, so a cloud run's `rm -rf` can be answered from a browser tab. The gate settles the decision and records it; an adapter only maps its harness's tool-call event onto it.
|
|
29
|
+
- **Neutral tool contract** — `HarnessTool`: a name, a label, a description, zod parameters, and `execute(params, { cwd, signal })`. A tool states what it is and does; converting it to a vendor's tool shape is the adapter's job, so the same tools bind to a second harness untouched.
|
|
29
30
|
- **Harness adapter contract** — `HarnessAdapter` / `HarnessRun`: a harness is identified by an `id`, the `transcriptFormat` its entries are recorded under, and `startRun`. Nothing in the platform names a vendor.
|
|
30
31
|
- **Blueprint logic** — `expandBlueprintDefaults()`, the zod `BlueprintZod`/JSON-Schema `BlueprintSchema`, field type/default parsing, and policy-provisioning tables.
|
|
31
32
|
- **Appstash state** — everything lives in the [`appstash`](https://www.npmjs.com/package/appstash) `~/.constructive/{config,cache,data,logs}` layout; project directories are untouched.
|
|
@@ -74,7 +75,8 @@ materializeSkills(dirs.materializedDir, skills, {
|
|
|
74
75
|
- **Resolution** — `SkillsManifest`, `DirectorySkillSource` (agentskills.io layout: `<skill>/SKILL.md` + references/scripts), `resolveSkills()`, `materializeSkills()` with `{{VAR}}` substitution.
|
|
75
76
|
- **Gating** — `createConfirmGate()`, `buildConfirmPrompt()`, `MUTATING_DB_TOOLS`, `ConfirmPreview`; adapters map host events onto `GateToolCallEvent`/`GateResult` 1:1.
|
|
76
77
|
- **Run gate** — `createRunGate()`, `RunGatePolicy` / `RunGateRule` / `RunGateVerdict`, `ApprovalChannel` with `pollingApprovalChannel()` / `staticApprovalChannel()`, and `RunGateDecisionRecord` for the audit trail.
|
|
77
|
-
- **
|
|
78
|
+
- **Tools** — `HarnessTool`, `AnyHarnessTool`, `HarnessToolContext`, `HarnessToolResult`, `HarnessToolContent`, `defineHarnessTool()` (identity, for param inference).
|
|
79
|
+
- **Adapters** — `HarnessAdapter`, `HarnessRun`; [`@agentic-kit/pi`](https://www.npmjs.com/package/@agentic-kit/pi) is the first implementation, and its `toPiTool()` is the only place a tool meets a harness SDK.
|
|
78
80
|
- **Blueprints** — `expandBlueprintDefaults()`, `BlueprintZod`/`BlueprintSchema`, field types/defaults, policy provisioning.
|
|
79
81
|
|
|
80
82
|
## Hosts
|
|
@@ -91,7 +93,7 @@ The same harness powers multiple hosts:
|
|
|
91
93
|
|
|
92
94
|
## Roadmap
|
|
93
95
|
|
|
94
|
-
-
|
|
96
|
+
- Lift the Constructive db tools out of `@agentic-kit/pi` into their own harness-neutral package, now that nothing in them names a harness.
|
|
95
97
|
- Shared host adapter package and `.claude`/MCP export surfaces.
|
|
96
98
|
|
|
97
99
|
## Related
|
package/esm/index.d.ts
CHANGED
package/esm/index.js
CHANGED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* A tool a harness can run, described without reference to any harness.
|
|
4
|
+
*
|
|
5
|
+
* The vendor-specific parts of a tool definition are its parameter encoding
|
|
6
|
+
* (pi wants TypeBox, an MCP server wants JSON Schema, dsh wants its own
|
|
7
|
+
* `ToolDefinition`), the arguments its runner threads through `execute`, and
|
|
8
|
+
* its terminal rendering. None of that is a property of the tool itself: what
|
|
9
|
+
* `add_records` *is* is a name, a description the model reads, a parameter
|
|
10
|
+
* shape, and a function from validated params to text plus structured details.
|
|
11
|
+
*
|
|
12
|
+
* So that is all this states. An adapter maps it onto its own runner
|
|
13
|
+
* (`toPiTool` in `@agentic-kit/pi`), which is the only place a tool's
|
|
14
|
+
* shape meets a harness SDK.
|
|
15
|
+
*/
|
|
16
|
+
/** Text the model reads back from a call. */
|
|
17
|
+
export interface HarnessToolText {
|
|
18
|
+
type: 'text';
|
|
19
|
+
text: string;
|
|
20
|
+
}
|
|
21
|
+
/** An image the model reads back from a call, base64-encoded. */
|
|
22
|
+
export interface HarnessToolImage {
|
|
23
|
+
type: 'image';
|
|
24
|
+
data: string;
|
|
25
|
+
mimeType: string;
|
|
26
|
+
}
|
|
27
|
+
export type HarnessToolContent = HarnessToolImage | HarnessToolText;
|
|
28
|
+
/**
|
|
29
|
+
* What a call returns: content for the model, details for logs and UI.
|
|
30
|
+
*
|
|
31
|
+
* `details` is the tool's own structured record of what it did — the run log
|
|
32
|
+
* stores it, a surface renders it, and tests assert on it, none of which should
|
|
33
|
+
* have to parse the text meant for the model.
|
|
34
|
+
*/
|
|
35
|
+
export interface HarnessToolResult<TDetails = unknown> {
|
|
36
|
+
content: HarnessToolContent[];
|
|
37
|
+
details: TDetails;
|
|
38
|
+
/**
|
|
39
|
+
* Hint that the agent should stop after this batch of calls. Harnesses that
|
|
40
|
+
* have no such notion ignore it.
|
|
41
|
+
*/
|
|
42
|
+
terminate?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* What a tool may know about the call it is serving.
|
|
46
|
+
*
|
|
47
|
+
* Deliberately thin: everything a Constructive tool needs is the directory the
|
|
48
|
+
* session is rooted at (the project it resolves its context and credentials
|
|
49
|
+
* from) and the signal that says the run was abandoned. A tool that reaches for
|
|
50
|
+
* more than this is reaching into a harness.
|
|
51
|
+
*/
|
|
52
|
+
export interface HarnessToolContext {
|
|
53
|
+
/** Working directory of the run — the project the tool acts on. */
|
|
54
|
+
readonly cwd: string;
|
|
55
|
+
/** Aborted when the run is cancelled, if the harness offers one. */
|
|
56
|
+
readonly signal?: AbortSignal;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A tool, parameterized by its zod parameter schema.
|
|
60
|
+
*
|
|
61
|
+
* Parameters are zod because that is where the descriptions the model reads
|
|
62
|
+
* live, and every other encoding is derivable from it — an adapter converts,
|
|
63
|
+
* the tool never does.
|
|
64
|
+
*/
|
|
65
|
+
export interface HarnessTool<TParams extends z.ZodType = z.ZodType, TDetails = unknown> {
|
|
66
|
+
/** Name the model calls, snake_case. */
|
|
67
|
+
name: string;
|
|
68
|
+
/** Human-readable label for a surface. */
|
|
69
|
+
label: string;
|
|
70
|
+
/** Description the model reads to decide whether to call it. */
|
|
71
|
+
description: string;
|
|
72
|
+
/** One-line summary for a system prompt's tool list, when the harness has one. */
|
|
73
|
+
promptSnippet?: string;
|
|
74
|
+
/** Guideline bullets to append to the system prompt while this tool is active. */
|
|
75
|
+
promptGuidelines?: string[];
|
|
76
|
+
parameters: TParams;
|
|
77
|
+
execute(params: z.output<TParams>, ctx: HarnessToolContext): Promise<HarnessToolResult<TDetails>>;
|
|
78
|
+
}
|
|
79
|
+
/** A tool of any parameter shape — what a registry or an adapter holds. */
|
|
80
|
+
export type AnyHarnessTool = HarnessTool<z.ZodType, any>;
|
|
81
|
+
/**
|
|
82
|
+
* Identity, for inference.
|
|
83
|
+
*
|
|
84
|
+
* Assigning a tool to a variable typed as `HarnessTool` widens its params to
|
|
85
|
+
* `z.ZodType` and loses `z.output` in `execute`; passing it through this keeps
|
|
86
|
+
* both, exactly as pi's `defineTool` does for its own definitions.
|
|
87
|
+
*/
|
|
88
|
+
export declare function defineHarnessTool<TParams extends z.ZodType, TDetails = unknown>(tool: HarnessTool<TParams, TDetails>): HarnessTool<TParams, TDetails>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity, for inference.
|
|
3
|
+
*
|
|
4
|
+
* Assigning a tool to a variable typed as `HarnessTool` widens its params to
|
|
5
|
+
* `z.ZodType` and loses `z.output` in `execute`; passing it through this keeps
|
|
6
|
+
* both, exactly as pi's `defineTool` does for its own definitions.
|
|
7
|
+
*/
|
|
8
|
+
export function defineHarnessTool(tool) {
|
|
9
|
+
return tool;
|
|
10
|
+
}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -41,4 +41,5 @@ __exportStar(require("./skills/registry"), exports);
|
|
|
41
41
|
__exportStar(require("./skills/source"), exports);
|
|
42
42
|
__exportStar(require("./skills/update-check"), exports);
|
|
43
43
|
__exportStar(require("./stash"), exports);
|
|
44
|
+
__exportStar(require("./tools/tool"), exports);
|
|
44
45
|
__exportStar(require("./types"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentic-kit/harness",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
5
5
|
"description": "Host-agnostic Constructive harness core — skill overlay resolution, materialization, and on-disk layout for harness hosts (desktop, CLI, MCP)",
|
|
6
6
|
"main": "index.js",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"@types/semver": "^7.8.0"
|
|
39
39
|
},
|
|
40
40
|
"keywords": [],
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "d4bb5506059e1dfb28f2766e6d18e8d946db632d"
|
|
42
42
|
}
|
package/tools/tool.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* A tool a harness can run, described without reference to any harness.
|
|
4
|
+
*
|
|
5
|
+
* The vendor-specific parts of a tool definition are its parameter encoding
|
|
6
|
+
* (pi wants TypeBox, an MCP server wants JSON Schema, dsh wants its own
|
|
7
|
+
* `ToolDefinition`), the arguments its runner threads through `execute`, and
|
|
8
|
+
* its terminal rendering. None of that is a property of the tool itself: what
|
|
9
|
+
* `add_records` *is* is a name, a description the model reads, a parameter
|
|
10
|
+
* shape, and a function from validated params to text plus structured details.
|
|
11
|
+
*
|
|
12
|
+
* So that is all this states. An adapter maps it onto its own runner
|
|
13
|
+
* (`toPiTool` in `@agentic-kit/pi`), which is the only place a tool's
|
|
14
|
+
* shape meets a harness SDK.
|
|
15
|
+
*/
|
|
16
|
+
/** Text the model reads back from a call. */
|
|
17
|
+
export interface HarnessToolText {
|
|
18
|
+
type: 'text';
|
|
19
|
+
text: string;
|
|
20
|
+
}
|
|
21
|
+
/** An image the model reads back from a call, base64-encoded. */
|
|
22
|
+
export interface HarnessToolImage {
|
|
23
|
+
type: 'image';
|
|
24
|
+
data: string;
|
|
25
|
+
mimeType: string;
|
|
26
|
+
}
|
|
27
|
+
export type HarnessToolContent = HarnessToolImage | HarnessToolText;
|
|
28
|
+
/**
|
|
29
|
+
* What a call returns: content for the model, details for logs and UI.
|
|
30
|
+
*
|
|
31
|
+
* `details` is the tool's own structured record of what it did — the run log
|
|
32
|
+
* stores it, a surface renders it, and tests assert on it, none of which should
|
|
33
|
+
* have to parse the text meant for the model.
|
|
34
|
+
*/
|
|
35
|
+
export interface HarnessToolResult<TDetails = unknown> {
|
|
36
|
+
content: HarnessToolContent[];
|
|
37
|
+
details: TDetails;
|
|
38
|
+
/**
|
|
39
|
+
* Hint that the agent should stop after this batch of calls. Harnesses that
|
|
40
|
+
* have no such notion ignore it.
|
|
41
|
+
*/
|
|
42
|
+
terminate?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* What a tool may know about the call it is serving.
|
|
46
|
+
*
|
|
47
|
+
* Deliberately thin: everything a Constructive tool needs is the directory the
|
|
48
|
+
* session is rooted at (the project it resolves its context and credentials
|
|
49
|
+
* from) and the signal that says the run was abandoned. A tool that reaches for
|
|
50
|
+
* more than this is reaching into a harness.
|
|
51
|
+
*/
|
|
52
|
+
export interface HarnessToolContext {
|
|
53
|
+
/** Working directory of the run — the project the tool acts on. */
|
|
54
|
+
readonly cwd: string;
|
|
55
|
+
/** Aborted when the run is cancelled, if the harness offers one. */
|
|
56
|
+
readonly signal?: AbortSignal;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A tool, parameterized by its zod parameter schema.
|
|
60
|
+
*
|
|
61
|
+
* Parameters are zod because that is where the descriptions the model reads
|
|
62
|
+
* live, and every other encoding is derivable from it — an adapter converts,
|
|
63
|
+
* the tool never does.
|
|
64
|
+
*/
|
|
65
|
+
export interface HarnessTool<TParams extends z.ZodType = z.ZodType, TDetails = unknown> {
|
|
66
|
+
/** Name the model calls, snake_case. */
|
|
67
|
+
name: string;
|
|
68
|
+
/** Human-readable label for a surface. */
|
|
69
|
+
label: string;
|
|
70
|
+
/** Description the model reads to decide whether to call it. */
|
|
71
|
+
description: string;
|
|
72
|
+
/** One-line summary for a system prompt's tool list, when the harness has one. */
|
|
73
|
+
promptSnippet?: string;
|
|
74
|
+
/** Guideline bullets to append to the system prompt while this tool is active. */
|
|
75
|
+
promptGuidelines?: string[];
|
|
76
|
+
parameters: TParams;
|
|
77
|
+
execute(params: z.output<TParams>, ctx: HarnessToolContext): Promise<HarnessToolResult<TDetails>>;
|
|
78
|
+
}
|
|
79
|
+
/** A tool of any parameter shape — what a registry or an adapter holds. */
|
|
80
|
+
export type AnyHarnessTool = HarnessTool<z.ZodType, any>;
|
|
81
|
+
/**
|
|
82
|
+
* Identity, for inference.
|
|
83
|
+
*
|
|
84
|
+
* Assigning a tool to a variable typed as `HarnessTool` widens its params to
|
|
85
|
+
* `z.ZodType` and loses `z.output` in `execute`; passing it through this keeps
|
|
86
|
+
* both, exactly as pi's `defineTool` does for its own definitions.
|
|
87
|
+
*/
|
|
88
|
+
export declare function defineHarnessTool<TParams extends z.ZodType, TDetails = unknown>(tool: HarnessTool<TParams, TDetails>): HarnessTool<TParams, TDetails>;
|
package/tools/tool.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineHarnessTool = defineHarnessTool;
|
|
4
|
+
/**
|
|
5
|
+
* Identity, for inference.
|
|
6
|
+
*
|
|
7
|
+
* Assigning a tool to a variable typed as `HarnessTool` widens its params to
|
|
8
|
+
* `z.ZodType` and loses `z.output` in `execute`; passing it through this keeps
|
|
9
|
+
* both, exactly as pi's `defineTool` does for its own definitions.
|
|
10
|
+
*/
|
|
11
|
+
function defineHarnessTool(tool) {
|
|
12
|
+
return tool;
|
|
13
|
+
}
|