@inhuman.tools/plugin-sdk 0.0.0-stage → 0.2.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/LICENSE.md +7 -0
- package/README.md +104 -2
- package/dist/index.d.ts +153 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +187 -0
- package/dist/index.js.map +1 -0
- package/dist/normalize.d.ts +112 -0
- package/dist/normalize.d.ts.map +1 -0
- package/dist/normalize.js +220 -0
- package/dist/normalize.js.map +1 -0
- package/dist/projection.d.ts +37 -0
- package/dist/projection.d.ts.map +1 -0
- package/dist/projection.js +7 -0
- package/dist/projection.js.map +1 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/plugin.d.ts +1392 -0
- package/dist/schemas/plugin.d.ts.map +1 -0
- package/dist/schemas/plugin.js +242 -0
- package/dist/schemas/plugin.js.map +1 -0
- package/package.json +59 -3
- package/src/index.ts +320 -0
- package/src/normalize.ts +353 -0
- package/src/projection.ts +38 -0
- package/src/schemas/index.ts +1 -0
- package/src/schemas/plugin.ts +295 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/schemas/plugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAWX,qFAAqF;AACrF,eAAO,MAAM,kBAAkB;;;;EAAqC,CAAC;AACrE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AA6BpE,eAAO,MAAM,eAAe;;6CAnCE,KAAK,EAAE,KAAK,OAAO,YAAn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;oCACN,OAAO,UAAU,OAAO,KAAK,OAAO,UAApC,OAAO,UAAU,OAAO,KAAK,OAAO;qDAI1C,OAAO,KAAK,OAAO,WAAnB,OAAO,KAAK,OAAO;;;;;;;;;;;;;;2CA5MV,KAAK,EAAE,KAAK,OAAO,YAAnB,KAAK,EAAE,KAAK,OAAO;;;;CAkRvC,CAAC"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { asSystemPrompt } from "@inhuman.tools/harness-commons";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export const inhumanBrand = {
|
|
4
|
+
tool: Symbol.for("@inhuman.tools/InhumanTool"),
|
|
5
|
+
action: Symbol.for("@inhuman.tools/InhumanAction"),
|
|
6
|
+
plugin: Symbol.for("@inhuman.tools/InhumanPlugin"),
|
|
7
|
+
};
|
|
8
|
+
const zodType = z.custom((value) => value != null && typeof value.parse === "function", { message: "zod schema required" });
|
|
9
|
+
const fn = z.custom((value) => typeof value === "function", {
|
|
10
|
+
message: "JS function required",
|
|
11
|
+
});
|
|
12
|
+
/** `tool` is completions tools[]. `symbol` is a scheme_repl name. `both` is both. */
|
|
13
|
+
export const toolRepresentation = z.enum(["tool", "symbol", "both"]);
|
|
14
|
+
const tapeFace = z.string().trim().min(1, "tape face must be a non-empty string").nullable().default(null);
|
|
15
|
+
const toolBase = {
|
|
16
|
+
name: z.string().trim().min(1, "InhumanTool: non-empty name required"),
|
|
17
|
+
description: z.string().optional(),
|
|
18
|
+
class: z.string().optional(),
|
|
19
|
+
/** Omitted function tools are symbols. Omitted bot-calls are tools. */
|
|
20
|
+
representation: toolRepresentation.optional(),
|
|
21
|
+
input: zodType,
|
|
22
|
+
output: zodType,
|
|
23
|
+
triggersReactLoop: z.boolean().optional(),
|
|
24
|
+
isSideChannel: z.boolean().optional(),
|
|
25
|
+
tapeHidden: z.boolean().optional(),
|
|
26
|
+
question: tapeFace,
|
|
27
|
+
effect: tapeFace,
|
|
28
|
+
caption: tapeFace,
|
|
29
|
+
exam: z
|
|
30
|
+
.object({
|
|
31
|
+
program: fn,
|
|
32
|
+
admit: fn,
|
|
33
|
+
settle: fn.optional(),
|
|
34
|
+
prefixAsk: fn.optional(),
|
|
35
|
+
finish: fn.optional(),
|
|
36
|
+
})
|
|
37
|
+
.optional(),
|
|
38
|
+
};
|
|
39
|
+
export const functionToolDef = z
|
|
40
|
+
.object({
|
|
41
|
+
...toolBase,
|
|
42
|
+
type: z.literal("function").optional(),
|
|
43
|
+
run: fn.optional(),
|
|
44
|
+
})
|
|
45
|
+
.superRefine((row, ctx) => {
|
|
46
|
+
if (row.exam == null && row.run == null) {
|
|
47
|
+
ctx.addIssue({ code: "custom", message: "function requires run" });
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
function catalogShow(raw) {
|
|
51
|
+
if (raw === "silent" || raw === "omit")
|
|
52
|
+
return "omit";
|
|
53
|
+
if (raw === "turn")
|
|
54
|
+
return "turn";
|
|
55
|
+
return "result";
|
|
56
|
+
}
|
|
57
|
+
function catalogLifetime(raw) {
|
|
58
|
+
if (raw === "call")
|
|
59
|
+
return "call";
|
|
60
|
+
return "turn";
|
|
61
|
+
}
|
|
62
|
+
export const botCallToolDef = z
|
|
63
|
+
.object({
|
|
64
|
+
...toolBase,
|
|
65
|
+
type: z.literal("bot-call"),
|
|
66
|
+
target: z.string().trim().min(1, "bot-call target required"),
|
|
67
|
+
prepare: fn.optional(),
|
|
68
|
+
background: z.boolean().optional(),
|
|
69
|
+
lifetime: z.enum(["turn", "call"]).optional(),
|
|
70
|
+
show: z.enum(["result", "omit", "turn", "silent"]).optional(),
|
|
71
|
+
delivery: z.enum(["result", "silent", "turn"]).optional(),
|
|
72
|
+
deadlineMs: z.number().optional(),
|
|
73
|
+
maxResultTokens: z.number().optional(),
|
|
74
|
+
supportsNotify: z.boolean().optional(),
|
|
75
|
+
})
|
|
76
|
+
.superRefine((row, ctx) => {
|
|
77
|
+
const raw = row.show ?? row.delivery;
|
|
78
|
+
if (raw === "turn" && (row.background !== true || !(row.deadlineMs != null && row.deadlineMs > 0))) {
|
|
79
|
+
ctx.addIssue({ code: "custom", message: "show turn requires background and positive deadlineMs" });
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
.transform((row) => {
|
|
83
|
+
const { delivery: _delivery, show: rawShow, lifetime: rawLifetime, ...rest } = row;
|
|
84
|
+
return {
|
|
85
|
+
...rest,
|
|
86
|
+
show: catalogShow(rawShow ?? _delivery),
|
|
87
|
+
lifetime: catalogLifetime(rawLifetime),
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
export const toolDef = z.union([functionToolDef, botCallToolDef]);
|
|
91
|
+
export const normalizedActionDef = z.object({
|
|
92
|
+
name: z.string().trim().min(1, "InhumanAction: non-empty name required"),
|
|
93
|
+
description: z.string().optional(),
|
|
94
|
+
seat: z.enum(["session", "harness"]).default("session"),
|
|
95
|
+
input: zodType.optional(),
|
|
96
|
+
run: fn,
|
|
97
|
+
});
|
|
98
|
+
export const actionDef = normalizedActionDef;
|
|
99
|
+
const brandedTool = z.custom((value) => typeof value === "object" && value !== null && value[inhumanBrand.tool] === true, { message: "must be InhumanTool" });
|
|
100
|
+
const plainTool = z.union([functionToolDef, botCallToolDef]);
|
|
101
|
+
const brandedAction = z.custom((value) => typeof value === "object" && value !== null && value[inhumanBrand.action] === true, { message: "must be InhumanAction" });
|
|
102
|
+
const plainAction = normalizedActionDef;
|
|
103
|
+
export const envCapability = z.custom((value) => typeof value === "object" &&
|
|
104
|
+
value !== null &&
|
|
105
|
+
typeof value.name === "string" &&
|
|
106
|
+
typeof value.exports === "function", { message: "must be Arrival EnvCapability" });
|
|
107
|
+
export const REASONING_EFFORTS = ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
108
|
+
const nonempty = z.string().trim().min(1);
|
|
109
|
+
export const botMcpBindingDef = z
|
|
110
|
+
.object({
|
|
111
|
+
server: nonempty,
|
|
112
|
+
tools: z.array(nonempty).default([]),
|
|
113
|
+
approval: z.enum(["allow", "policy"]).optional(),
|
|
114
|
+
})
|
|
115
|
+
.transform((row) => ({
|
|
116
|
+
server: row.server,
|
|
117
|
+
tools: row.tools,
|
|
118
|
+
approval: row.approval === "allow" ? "allow" : "policy",
|
|
119
|
+
}));
|
|
120
|
+
export const botDef = z.preprocess((value) => {
|
|
121
|
+
if (value == null || typeof value !== "object" || Array.isArray(value))
|
|
122
|
+
return value;
|
|
123
|
+
const rec = { ...value };
|
|
124
|
+
if (rec.recipeScope === undefined && "scope" in rec)
|
|
125
|
+
rec.recipeScope = rec.scope;
|
|
126
|
+
delete rec.scope;
|
|
127
|
+
return rec;
|
|
128
|
+
}, z
|
|
129
|
+
.object({
|
|
130
|
+
name: nonempty,
|
|
131
|
+
recipeScope: z.enum(["invocation", "session", "workspace", "global"]),
|
|
132
|
+
instructions: nonempty,
|
|
133
|
+
description: z.string().trim().optional(),
|
|
134
|
+
tools: z.array(nonempty).default([]),
|
|
135
|
+
mcp: z.array(botMcpBindingDef).default([]),
|
|
136
|
+
keepAlive: z.boolean().optional(),
|
|
137
|
+
invokes: z.array(nonempty).default([]),
|
|
138
|
+
reasoningEffort: z.enum(REASONING_EFFORTS).optional(),
|
|
139
|
+
modelPreferences: z.array(nonempty).default([]),
|
|
140
|
+
skills: z.array(nonempty).default([]),
|
|
141
|
+
})
|
|
142
|
+
.transform((row) => ({
|
|
143
|
+
name: row.name,
|
|
144
|
+
recipeScope: row.recipeScope,
|
|
145
|
+
instructions: asSystemPrompt(row.instructions),
|
|
146
|
+
...(row.description === undefined || row.description === "" ? {} : { description: row.description }),
|
|
147
|
+
tools: row.tools,
|
|
148
|
+
mcp: row.mcp,
|
|
149
|
+
keepAlive: row.keepAlive === true,
|
|
150
|
+
invokes: row.invokes,
|
|
151
|
+
...(row.reasoningEffort === undefined ? {} : { reasoningEffort: row.reasoningEffort }),
|
|
152
|
+
modelPreferences: row.modelPreferences,
|
|
153
|
+
skills: row.skills,
|
|
154
|
+
})));
|
|
155
|
+
export const mcpServerDef = z.object({
|
|
156
|
+
name: nonempty,
|
|
157
|
+
visibility: z.enum(["private", "public"]),
|
|
158
|
+
scope: z.enum(["session", "workspace", "global"]),
|
|
159
|
+
transport: z.object({
|
|
160
|
+
type: z.literal("stdio"),
|
|
161
|
+
command: nonempty,
|
|
162
|
+
args: z.array(z.string()).default([]),
|
|
163
|
+
cwd: z.enum(["plugin", "workspace"]),
|
|
164
|
+
env: z
|
|
165
|
+
.union([
|
|
166
|
+
z.record(z.string(), z.string()),
|
|
167
|
+
z.custom((value) => typeof value === "function", { message: "JS function required" }),
|
|
168
|
+
])
|
|
169
|
+
.optional(),
|
|
170
|
+
}),
|
|
171
|
+
});
|
|
172
|
+
export const pluginProjectionDef = z.object({
|
|
173
|
+
initial: z.custom((value) => typeof value === "function", { message: "JS function required" }),
|
|
174
|
+
reduce: z.custom((value) => typeof value === "function", {
|
|
175
|
+
message: "JS function required",
|
|
176
|
+
}),
|
|
177
|
+
hostOnly: z
|
|
178
|
+
.custom((value) => typeof value === "function", { message: "JS function required" })
|
|
179
|
+
.optional(),
|
|
180
|
+
});
|
|
181
|
+
export const exclusiveSlotsDef = z.array(nonempty);
|
|
182
|
+
export const pluginDef = z
|
|
183
|
+
.object({
|
|
184
|
+
apiVersion: z.literal(1).optional(),
|
|
185
|
+
tools: z.array(z.union([brandedTool, plainTool])).default([]),
|
|
186
|
+
actions: z.array(z.union([brandedAction, plainAction])).default([]),
|
|
187
|
+
envCapabilities: z.array(envCapability).default([]),
|
|
188
|
+
bots: z.array(botDef).default([]),
|
|
189
|
+
mcpServers: z.array(mcpServerDef).default([]),
|
|
190
|
+
exclusiveSlots: exclusiveSlotsDef.default([]),
|
|
191
|
+
projection: pluginProjectionDef.optional(),
|
|
192
|
+
})
|
|
193
|
+
.superRefine((bag, ctx) => {
|
|
194
|
+
const seen = new Set();
|
|
195
|
+
for (const [index, action] of bag.actions.entries()) {
|
|
196
|
+
const name = typeof action === "object" && action !== null && "name" in action
|
|
197
|
+
? String(action.name ?? "")
|
|
198
|
+
: "";
|
|
199
|
+
if (seen.has(name)) {
|
|
200
|
+
ctx.addIssue({
|
|
201
|
+
code: "custom",
|
|
202
|
+
message: `action "${name}" collides`,
|
|
203
|
+
path: ["actions", index],
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
seen.add(name);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
export const toolContext = z
|
|
210
|
+
.object({
|
|
211
|
+
root: z.string().optional(),
|
|
212
|
+
signal: z.custom((value) => value instanceof AbortSignal).optional(),
|
|
213
|
+
turn: z.unknown().optional(),
|
|
214
|
+
completion: z.unknown().nullable().optional(),
|
|
215
|
+
invocation: z.unknown().optional(),
|
|
216
|
+
storage: z
|
|
217
|
+
.object({
|
|
218
|
+
session: z.unknown(),
|
|
219
|
+
invocation: z.unknown(),
|
|
220
|
+
project: z.unknown().optional(),
|
|
221
|
+
global: z.unknown().optional(),
|
|
222
|
+
propose: fn,
|
|
223
|
+
})
|
|
224
|
+
.optional(),
|
|
225
|
+
})
|
|
226
|
+
.passthrough();
|
|
227
|
+
export const inhumanShape = {
|
|
228
|
+
toolDef,
|
|
229
|
+
functionToolDef,
|
|
230
|
+
botCallToolDef,
|
|
231
|
+
actionDef,
|
|
232
|
+
normalizedActionDef,
|
|
233
|
+
pluginDef,
|
|
234
|
+
botDef,
|
|
235
|
+
botMcpBindingDef,
|
|
236
|
+
mcpServerDef,
|
|
237
|
+
pluginProjectionDef,
|
|
238
|
+
exclusiveSlotsDef,
|
|
239
|
+
toolContext,
|
|
240
|
+
envCapability,
|
|
241
|
+
};
|
|
242
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/schemas/plugin.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,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AAmB;IACnB,SAAS;IACT,MAAM;IACN,gBAAgB;IAChB,YAAY;IACZ,mBAAmB;IACnB,iBAAiB;IACjB,WAAW;IACX,aAAa;CACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inhuman.tools/plugin-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "InhumanPlugin barrel — tools, actions, optional EnvCapability.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"src",
|
|
17
|
+
"!**/__tests__"
|
|
18
|
+
],
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"zod": "^4.4.3",
|
|
21
|
+
"@inhuman.tools/harness-commons": "^0.2.0"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@here.build/arrival": "^0.10.2"
|
|
25
|
+
},
|
|
26
|
+
"peerDependenciesMeta": {
|
|
27
|
+
"@here.build/arrival": {
|
|
28
|
+
"optional": true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"eslint": "9.39.2",
|
|
33
|
+
"@types/node": "^24.0.0",
|
|
34
|
+
"typescript": "6.0.2",
|
|
35
|
+
"vitest": "4.1.0",
|
|
36
|
+
"@-internal-/eslint-configs": "0.0.0"
|
|
37
|
+
},
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/here-build/inhuman-harness.git",
|
|
42
|
+
"directory": "packages/harness-plugin-sdk"
|
|
43
|
+
},
|
|
44
|
+
"browserslist": [
|
|
45
|
+
"last 2 chrome versions",
|
|
46
|
+
"last 2 firefox versions",
|
|
47
|
+
"last 2 safari versions",
|
|
48
|
+
"ios_saf >= 16.4",
|
|
49
|
+
"node >= 22"
|
|
50
|
+
],
|
|
51
|
+
"author": "Merkle Bonsai",
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsc -p tsconfig.build.json",
|
|
57
|
+
"lint": "eslint .",
|
|
58
|
+
"lint:fix": "eslint . --fix",
|
|
59
|
+
"test": "vitest run",
|
|
60
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
61
|
+
}
|
|
6
62
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @inhuman.tools/plugin-sdk — tools, actions, envCapabilities.
|
|
3
|
+
*
|
|
4
|
+
* `export default new InhumanPlugin({ tools, actions, envCapabilities? })`.
|
|
5
|
+
* plugin.json extension format is the daemon's. This package does not parse it.
|
|
6
|
+
* `envCapabilities` is optional and rare: Arrival `EnvCapability` instances
|
|
7
|
+
* (`@here.build/arrival`, optional peer).
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { EnvCapability } from "@here.build/arrival";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
normalizeDefinitions,
|
|
15
|
+
resolveReferences,
|
|
16
|
+
type BotDefinition,
|
|
17
|
+
type McpServerDefinition,
|
|
18
|
+
type NormalizedPluginDefinition,
|
|
19
|
+
type PluginCallContext,
|
|
20
|
+
type ToolDefinition,
|
|
21
|
+
} from "./normalize.js";
|
|
22
|
+
import { type ExamAdmit, type PluginProjection } from "./projection.js";
|
|
23
|
+
import { inhumanBrand, inhumanShape, NormalizedActionDefinition, type ToolRepresentation } from "./schemas/plugin.js";
|
|
24
|
+
|
|
25
|
+
export * from "./schemas/index.js";
|
|
26
|
+
export {
|
|
27
|
+
normalizeDefinitions as normalizeDefinitions,
|
|
28
|
+
resolveReferences as resolveReferences,
|
|
29
|
+
type BotCallToolDefinition as BotCallToolDefinition,
|
|
30
|
+
type BotDefinition as BotDefinition,
|
|
31
|
+
isReasoningEffort as isReasoningEffort,
|
|
32
|
+
type ReasoningEffort as ReasoningEffort,
|
|
33
|
+
type NormalizedPluginDefinition as NormalizedPluginDefinition,
|
|
34
|
+
type PluginCallContext as PluginCallContext,
|
|
35
|
+
type ToolDefinition as ToolDefinition,
|
|
36
|
+
} from "./normalize.js";
|
|
37
|
+
export {
|
|
38
|
+
type ExamAdmit as ExamAdmit,
|
|
39
|
+
type PluginProjection as PluginProjection,
|
|
40
|
+
type PluginStorageHandles as PluginStorageHandles,
|
|
41
|
+
} from "./projection.js";
|
|
42
|
+
|
|
43
|
+
/** Coarse class for hooks / tolerance axes (open string for packs). */
|
|
44
|
+
export type ToolClass = "read" | "write" | "effect" | (string & {});
|
|
45
|
+
|
|
46
|
+
/** Host-provided membrane — not freestyle process ambient. */
|
|
47
|
+
export type ToolContext = PluginCallContext;
|
|
48
|
+
|
|
49
|
+
export type InhumanToolDef<TIn, TOut> = {
|
|
50
|
+
readonly name: string;
|
|
51
|
+
readonly description?: string;
|
|
52
|
+
/** Catalog class (`read` | `write` | `effect` | …). Missing → `effect`. */
|
|
53
|
+
readonly class?: ToolClass;
|
|
54
|
+
/**
|
|
55
|
+
* `tool` is a JSON function in completions tools[]. `symbol` is a scheme_repl
|
|
56
|
+
* name and stays off tools[]. `both` is both. Omitted function tools are
|
|
57
|
+
* symbols. Omitted bot-calls are tools.
|
|
58
|
+
*/
|
|
59
|
+
readonly representation?: ToolRepresentation;
|
|
60
|
+
readonly input: z.ZodType<TIn>;
|
|
61
|
+
readonly output: z.ZodType<TOut>;
|
|
62
|
+
readonly type?: "function" | "bot-call";
|
|
63
|
+
readonly run?: (input: TIn, ctx: ToolContext) => Promise<TOut> | TOut;
|
|
64
|
+
readonly target?: string;
|
|
65
|
+
readonly prepare?: (input: TIn, ctx: ToolContext) => unknown;
|
|
66
|
+
readonly background?: boolean;
|
|
67
|
+
readonly lifetime?: "turn" | "call";
|
|
68
|
+
readonly show?: "result" | "omit" | "turn";
|
|
69
|
+
readonly deadlineMs?: number;
|
|
70
|
+
readonly maxResultTokens?: number;
|
|
71
|
+
readonly supportsNotify?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* When false the call is not a ReACT continuer by itself. Default true.
|
|
74
|
+
* Not `class`. License skip is `isSideChannel`.
|
|
75
|
+
*/
|
|
76
|
+
readonly triggersReactLoop?: boolean;
|
|
77
|
+
/** Skips the license floor. Default false. */
|
|
78
|
+
readonly isSideChannel?: boolean;
|
|
79
|
+
/** Off the tape. Separate from `triggersReactLoop`. Default false. */
|
|
80
|
+
readonly tapeHidden?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Mustache tape faces. Null or omitted is uncovered — the TUI falls
|
|
83
|
+
* through. Kernel projects these onto `PluginSpec`. pretty-mcp grain:
|
|
84
|
+
* `question` while live/ask, `effect` when sealed, `caption` the
|
|
85
|
+
* collapsed token.
|
|
86
|
+
*/
|
|
87
|
+
readonly question?: string | null;
|
|
88
|
+
readonly effect?: string | null;
|
|
89
|
+
readonly caption?: string | null;
|
|
90
|
+
/** Admit as a frozen exam bag. Host stamps `admit` sealed on that job. */
|
|
91
|
+
readonly exam?: ExamAdmit<TIn, unknown, unknown>;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export class InhumanTool<TIn = unknown, TOut = unknown> {
|
|
95
|
+
readonly [inhumanBrand.tool] = true as const;
|
|
96
|
+
|
|
97
|
+
readonly name: string;
|
|
98
|
+
readonly description: string | undefined;
|
|
99
|
+
readonly class: ToolClass;
|
|
100
|
+
readonly representation: ToolRepresentation;
|
|
101
|
+
readonly input: z.ZodType<TIn>;
|
|
102
|
+
readonly output: z.ZodType<TOut>;
|
|
103
|
+
readonly type: "function" | "bot-call";
|
|
104
|
+
readonly target?: string;
|
|
105
|
+
readonly prepare?: (input: TIn, ctx: ToolContext) => unknown;
|
|
106
|
+
readonly background?: boolean;
|
|
107
|
+
readonly lifetime?: "turn" | "call";
|
|
108
|
+
readonly show?: "result" | "omit" | "turn";
|
|
109
|
+
readonly deadlineMs?: number;
|
|
110
|
+
readonly maxResultTokens?: number;
|
|
111
|
+
readonly supportsNotify?: boolean;
|
|
112
|
+
readonly triggersReactLoop: boolean;
|
|
113
|
+
readonly tapeHidden: boolean;
|
|
114
|
+
private readonly sideChannel: boolean;
|
|
115
|
+
readonly question: string | null;
|
|
116
|
+
readonly effect: string | null;
|
|
117
|
+
readonly caption: string | null;
|
|
118
|
+
readonly exam?: ExamAdmit<TIn, unknown, unknown>;
|
|
119
|
+
private readonly _run?: (input: TIn, ctx: ToolContext) => Promise<TOut> | TOut;
|
|
120
|
+
|
|
121
|
+
constructor(def: InhumanToolDef<TIn, TOut>) {
|
|
122
|
+
const normalized = normalizeDefinitions({ tools: [def], actions: [], envCapabilities: [] }, "InhumanTool")
|
|
123
|
+
.tools[0]!;
|
|
124
|
+
this.name = normalized.name;
|
|
125
|
+
this.description = normalized.description;
|
|
126
|
+
this.class = normalized.class ?? "effect";
|
|
127
|
+
this.representation = normalized.representation;
|
|
128
|
+
this.input = normalized.input as z.ZodType<TIn>;
|
|
129
|
+
this.output = normalized.output as z.ZodType<TOut>;
|
|
130
|
+
this.type = normalized.type;
|
|
131
|
+
if (normalized.type === "function") {
|
|
132
|
+
this._run = normalized.run as (input: TIn, ctx: ToolContext) => Promise<TOut> | TOut;
|
|
133
|
+
} else {
|
|
134
|
+
this.target = normalized.target;
|
|
135
|
+
this.prepare = normalized.prepare as (input: TIn, ctx: ToolContext) => unknown;
|
|
136
|
+
this.background = normalized.background;
|
|
137
|
+
this.lifetime = normalized.lifetime;
|
|
138
|
+
this.show = normalized.show;
|
|
139
|
+
this.deadlineMs = normalized.deadlineMs;
|
|
140
|
+
this.maxResultTokens = normalized.maxResultTokens;
|
|
141
|
+
this.supportsNotify = normalized.supportsNotify;
|
|
142
|
+
}
|
|
143
|
+
this.triggersReactLoop = normalized.triggersReactLoop;
|
|
144
|
+
this.sideChannel = normalized.isSideChannel;
|
|
145
|
+
this.tapeHidden = normalized.tapeHidden;
|
|
146
|
+
this.question = normalized.question;
|
|
147
|
+
this.effect = normalized.effect;
|
|
148
|
+
this.caption = normalized.caption;
|
|
149
|
+
this.exam = normalized.type === "function" ? normalized.exam : undefined;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Host side channel. Skips the license floor. */
|
|
153
|
+
get isSideChannel(): boolean {
|
|
154
|
+
return this.sideChannel;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** Normalized ABI record for load-boundary comparisons. */
|
|
158
|
+
toToolDefinition(): ToolDefinition<TIn, TOut> {
|
|
159
|
+
const face = {
|
|
160
|
+
question: this.question,
|
|
161
|
+
effect: this.effect,
|
|
162
|
+
caption: this.caption,
|
|
163
|
+
};
|
|
164
|
+
if (this.type === "bot-call") {
|
|
165
|
+
return {
|
|
166
|
+
type: "bot-call",
|
|
167
|
+
name: this.name,
|
|
168
|
+
description: this.description,
|
|
169
|
+
class: this.class,
|
|
170
|
+
representation: this.representation,
|
|
171
|
+
input: this.input,
|
|
172
|
+
output: this.output,
|
|
173
|
+
target: this.target!,
|
|
174
|
+
prepare: this.prepare,
|
|
175
|
+
background: this.background,
|
|
176
|
+
lifetime: this.lifetime,
|
|
177
|
+
show: this.show,
|
|
178
|
+
deadlineMs: this.deadlineMs,
|
|
179
|
+
maxResultTokens: this.maxResultTokens,
|
|
180
|
+
supportsNotify: this.supportsNotify,
|
|
181
|
+
triggersReactLoop: this.triggersReactLoop,
|
|
182
|
+
isSideChannel: this.isSideChannel,
|
|
183
|
+
tapeHidden: this.tapeHidden,
|
|
184
|
+
...face,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
type: "function",
|
|
189
|
+
name: this.name,
|
|
190
|
+
description: this.description,
|
|
191
|
+
class: this.class,
|
|
192
|
+
representation: this.representation,
|
|
193
|
+
input: this.input,
|
|
194
|
+
output: this.output,
|
|
195
|
+
run: this._run!,
|
|
196
|
+
triggersReactLoop: this.triggersReactLoop,
|
|
197
|
+
isSideChannel: this.isSideChannel,
|
|
198
|
+
tapeHidden: this.tapeHidden,
|
|
199
|
+
exam: this.exam,
|
|
200
|
+
...face,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** Parse raw args → run → parse output. Host admit path uses this. */
|
|
205
|
+
async execute(raw: unknown, ctx: ToolContext = {}): Promise<TOut> {
|
|
206
|
+
if (this.type === "bot-call") {
|
|
207
|
+
throw new TypeError(`InhumanTool(${this.name}): bot-call tools do not execute through run`);
|
|
208
|
+
}
|
|
209
|
+
if (this.exam != null && this._run == null) {
|
|
210
|
+
throw new TypeError(`InhumanTool(${this.name}): exam tools do not execute through run`);
|
|
211
|
+
}
|
|
212
|
+
const parsedCtx = inhumanShape.toolContext.parse(ctx);
|
|
213
|
+
if ((this.class === "read" || this.class === "write") && (parsedCtx.root == null || parsedCtx.root === "")) {
|
|
214
|
+
throw new TypeError(`InhumanTool(${this.name}): ctx.root string required for class ${this.class}`);
|
|
215
|
+
}
|
|
216
|
+
const input = this.input.parse(raw);
|
|
217
|
+
const out = await this._run!(input, parsedCtx as ToolContext);
|
|
218
|
+
return this.output.parse(out);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export function defineTool<TIn, TOut>(def: InhumanToolDef<TIn, TOut>): InhumanTool<TIn, TOut> {
|
|
223
|
+
return new InhumanTool(def);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** Host membrane for a JS action. Not a completion door. */
|
|
227
|
+
export type ActionContext = {
|
|
228
|
+
readonly signal?: AbortSignal;
|
|
229
|
+
readonly [key: string]: unknown;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export type ActionFn<TArgs = unknown, TOut = unknown> = (args: TArgs, ctx: ActionContext) => TOut | Promise<TOut>;
|
|
233
|
+
|
|
234
|
+
export type ActionSeat = "session" | "harness";
|
|
235
|
+
|
|
236
|
+
const actionBrand = inhumanBrand.action;
|
|
237
|
+
|
|
238
|
+
export type InhumanActionDef<TArgs = unknown, TOut = unknown> = {
|
|
239
|
+
readonly name: string;
|
|
240
|
+
readonly description?: string;
|
|
241
|
+
readonly seat?: ActionSeat;
|
|
242
|
+
readonly input?: z.ZodType<TArgs>;
|
|
243
|
+
readonly run: ActionFn<TArgs, TOut>;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
export class InhumanAction<TArgs = unknown, TOut = unknown> {
|
|
247
|
+
readonly [actionBrand] = true as const;
|
|
248
|
+
|
|
249
|
+
readonly name: string;
|
|
250
|
+
readonly description: string | undefined;
|
|
251
|
+
readonly seat: ActionSeat;
|
|
252
|
+
readonly input: z.ZodType<TArgs> | undefined;
|
|
253
|
+
readonly run: ActionFn<TArgs, TOut>;
|
|
254
|
+
|
|
255
|
+
constructor(def: InhumanActionDef<TArgs, TOut>) {
|
|
256
|
+
const parsed = inhumanShape.normalizedActionDef.parse(def);
|
|
257
|
+
this.name = parsed.name;
|
|
258
|
+
this.description = parsed.description;
|
|
259
|
+
this.seat = parsed.seat;
|
|
260
|
+
this.input = parsed.input as z.ZodType<TArgs> | undefined;
|
|
261
|
+
this.run = parsed.run as ActionFn<TArgs, TOut>;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export function defineAction<TArgs, TOut>(def: InhumanActionDef<TArgs, TOut>): InhumanAction<TArgs, TOut> {
|
|
266
|
+
return new InhumanAction(def);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/** Plugin bag accepts any tool arity; the constructor normalizes to erased instances. */
|
|
270
|
+
export type AnyInhumanTool = InhumanTool<any, any>;
|
|
271
|
+
|
|
272
|
+
export type InhumanPluginDef = {
|
|
273
|
+
readonly apiVersion?: 1;
|
|
274
|
+
readonly tools?: readonly AnyInhumanTool[];
|
|
275
|
+
readonly actions?: readonly (InhumanAction | NormalizedActionDefinition)[];
|
|
276
|
+
readonly envCapabilities?: readonly EnvCapability[];
|
|
277
|
+
readonly bots?: readonly BotDefinition[];
|
|
278
|
+
readonly mcpServers?: readonly McpServerDefinition[];
|
|
279
|
+
readonly exclusiveSlots?: readonly string[];
|
|
280
|
+
/** Pack projection over trajectory metadata plus wire stamps from the head projection. */
|
|
281
|
+
readonly projection?: PluginProjection<any, any>;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const pluginBrand = inhumanBrand.plugin;
|
|
285
|
+
|
|
286
|
+
export class InhumanPlugin {
|
|
287
|
+
readonly [pluginBrand] = true as const;
|
|
288
|
+
|
|
289
|
+
readonly apiVersion: 1;
|
|
290
|
+
readonly tools: readonly InhumanTool[];
|
|
291
|
+
readonly actions: readonly InhumanAction[];
|
|
292
|
+
readonly envCapabilities: readonly EnvCapability[];
|
|
293
|
+
readonly bots: readonly BotDefinition[];
|
|
294
|
+
readonly mcpServers: readonly McpServerDefinition[];
|
|
295
|
+
readonly exclusiveSlots: readonly string[];
|
|
296
|
+
readonly projection?: PluginProjection<any, any>;
|
|
297
|
+
readonly definition: NormalizedPluginDefinition;
|
|
298
|
+
|
|
299
|
+
constructor(def: InhumanPluginDef = {}) {
|
|
300
|
+
this.definition = resolveReferences(normalizeDefinitions(def, "InhumanPlugin"), "InhumanPlugin");
|
|
301
|
+
this.apiVersion = this.definition.apiVersion;
|
|
302
|
+
this.tools = Object.freeze(
|
|
303
|
+
this.definition.tools.map((tool) => new InhumanTool(tool as InhumanToolDef<unknown, unknown>)),
|
|
304
|
+
) as readonly InhumanTool[];
|
|
305
|
+
this.actions = Object.freeze(
|
|
306
|
+
this.definition.actions.map((action) => new InhumanAction(action as InhumanActionDef)),
|
|
307
|
+
) as readonly InhumanAction[];
|
|
308
|
+
this.envCapabilities = Object.freeze([...this.definition.envCapabilities]);
|
|
309
|
+
this.bots = Object.freeze([...this.definition.bots]);
|
|
310
|
+
this.mcpServers = Object.freeze([...this.definition.mcpServers]);
|
|
311
|
+
this.exclusiveSlots = Object.freeze([...this.definition.exclusiveSlots]);
|
|
312
|
+
this.projection = this.definition.projection;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
static isInhumanPlugin(value: unknown): value is InhumanPlugin {
|
|
316
|
+
return typeof value === "object" && value !== null && (value as { [pluginBrand]?: boolean })[pluginBrand] === true;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export { z as z } from "zod";
|