@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 ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2026 Merkle Bonsai
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,105 @@
1
- # Temporary Holding Version
1
+ # `@inhuman.tools/plugin-sdk`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Tools, actions, bots, and bundled MCP. Not the host, not `plugin.json`.
4
+
5
+ ## Public surface
6
+
7
+ Bot `instructions` is `SystemPrompt` from `@inhuman.tools/harness-commons` — `` prompt.system`…` ``. User-turn text is `UserPrompt`.
8
+
9
+ ```ts
10
+ import {
11
+ InhumanAction,
12
+ InhumanPlugin,
13
+ InhumanTool,
14
+ normalizeDefinitions,
15
+ resolveReferences,
16
+ validateSupportedVersion,
17
+ z,
18
+ type BotDefinition,
19
+ type McpServerDefinition,
20
+ type PluginCallContext,
21
+ type ToolDefinition,
22
+ } from "@inhuman.tools/plugin-sdk";
23
+
24
+ const search = new InhumanTool({
25
+ type: "function",
26
+ name: "example_search",
27
+ class: "read",
28
+ input: z.object({ q: z.string() }),
29
+ output: z.object({ ok: z.boolean() }),
30
+ async run(input, ctx) {
31
+ return { ok: true };
32
+ },
33
+ });
34
+
35
+ const recall = new InhumanTool({
36
+ type: "bot-call",
37
+ name: "tingle",
38
+ target: "scout",
39
+ input: z.object({ prompt: z.string() }),
40
+ output: z.object({ kind: z.literal("miss") }),
41
+ prepare: (input, ctx) => ({ prompt: input.prompt }),
42
+ background: true,
43
+ lifetime: "turn",
44
+ show: "turn",
45
+ deadlineMs: 5_000,
46
+ supportsNotify: false,
47
+ });
48
+
49
+ export default new InhumanPlugin({
50
+ apiVersion: 1,
51
+ tools: [search, recall],
52
+ bots: [{ name: "scout", scope: "invocation", instructions: "…" }],
53
+ actions: [new InhumanAction({ name: "simplify", run: async () => ({ ok: true }) })],
54
+ });
55
+ ```
56
+
57
+ ## Tool kinds
58
+
59
+ | `type` | Body | Host admit path |
60
+ |--------|------|-----------------|
61
+ | `"function"` (default when `run` only) | `run(input, ctx)` | `tool.execute(raw, ctx)` |
62
+ | `"bot-call"` | `prepare(input, ctx)` optional; `target` names a local bot | licensed AgentCall; no public `call__…` wrapper |
63
+
64
+ ## Plugin bag fields
65
+
66
+ | Field | Role |
67
+ |-------|------|
68
+ | `tools` | catalog verbs (`function` or `bot-call`) |
69
+ | `bots` | named workers compiled into internal recipes |
70
+ | `mcpServers` | bundled stdio MCP; `visibility: "private"` \| `"public"` |
71
+ | `exclusiveSlots` | mutual exclusion (e.g. one foreground memory provider) |
72
+ | `actions` | named JSON-RPC actions |
73
+ | `envCapabilities` | rare Arrival env extensions |
74
+ | `projection` | reducer + loop-end hooks over trajectory metadata |
75
+
76
+ Tool flags (not `class`):
77
+
78
+ | Flag | Default | Role |
79
+ |------|---------|------|
80
+ | `triggersReactLoop` | `true` | `false` = not work (same-round, not a ReACT continuer). Only host side-channel names skip the license |
81
+ | `tapeHidden` | `false` | off the tape. Separate bit. |
82
+ | `question` / `effect` / `caption` | — | Mustache tape faces. Kernel projects them onto `PluginSpec`. Empty = uncovered. |
83
+ | `exam` | — | admit as a frozen ProgrammaticJob; host seals `admit`, then `settle` on close |
84
+
85
+ `ctx.storage` is the prefix projection for this plugin. `propose(action)` writes metadata onto **this** job. The next state is the computed projection, not a field.
86
+
87
+ ## Callbacks (named points only)
88
+
89
+ - `run` — native function tool body
90
+ - `prepare` — bot-call input derivation with graph context (`turn`, `completion`, `invocation`)
91
+ - `transport.env` — bundled MCP child environment
92
+
93
+ Rejected: routing closures (`writer.tool()`), object-identity targets, treating `show: "omit"` as a marker hint.
94
+
95
+ ## Load boundary
96
+
97
+ Constructors and plain records normalize identically:
98
+
99
+ ```text
100
+ validateSupportedVersion → normalizeDefinitions → resolveReferences → install
101
+ ```
102
+
103
+ Also: `defineTool` / `defineAction`, brand guards, re-export of `z`. `envCapabilities` is optional (`@here.build/arrival` peer).
104
+
105
+ The daemon parses `extensions.tools.inhuman` and `import`s this module. This package does not import harness-server or harness-sdk at runtime.
@@ -0,0 +1,153 @@
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
+ import type { EnvCapability } from "@here.build/arrival";
10
+ import { z } from "zod";
11
+ import { type BotDefinition, type McpServerDefinition, type NormalizedPluginDefinition, type PluginCallContext, type ToolDefinition } from "./normalize.js";
12
+ import { type ExamAdmit, type PluginProjection } from "./projection.js";
13
+ import { inhumanBrand, NormalizedActionDefinition, type ToolRepresentation } from "./schemas/plugin.js";
14
+ export * from "./schemas/index.js";
15
+ export { normalizeDefinitions as normalizeDefinitions, resolveReferences as resolveReferences, type BotCallToolDefinition as BotCallToolDefinition, type BotDefinition as BotDefinition, isReasoningEffort as isReasoningEffort, type ReasoningEffort as ReasoningEffort, type NormalizedPluginDefinition as NormalizedPluginDefinition, type PluginCallContext as PluginCallContext, type ToolDefinition as ToolDefinition, } from "./normalize.js";
16
+ export { type ExamAdmit as ExamAdmit, type PluginProjection as PluginProjection, type PluginStorageHandles as PluginStorageHandles, } from "./projection.js";
17
+ /** Coarse class for hooks / tolerance axes (open string for packs). */
18
+ export type ToolClass = "read" | "write" | "effect" | (string & {});
19
+ /** Host-provided membrane — not freestyle process ambient. */
20
+ export type ToolContext = PluginCallContext;
21
+ export type InhumanToolDef<TIn, TOut> = {
22
+ readonly name: string;
23
+ readonly description?: string;
24
+ /** Catalog class (`read` | `write` | `effect` | …). Missing → `effect`. */
25
+ readonly class?: ToolClass;
26
+ /**
27
+ * `tool` is a JSON function in completions tools[]. `symbol` is a scheme_repl
28
+ * name and stays off tools[]. `both` is both. Omitted function tools are
29
+ * symbols. Omitted bot-calls are tools.
30
+ */
31
+ readonly representation?: ToolRepresentation;
32
+ readonly input: z.ZodType<TIn>;
33
+ readonly output: z.ZodType<TOut>;
34
+ readonly type?: "function" | "bot-call";
35
+ readonly run?: (input: TIn, ctx: ToolContext) => Promise<TOut> | TOut;
36
+ readonly target?: string;
37
+ readonly prepare?: (input: TIn, ctx: ToolContext) => unknown;
38
+ readonly background?: boolean;
39
+ readonly lifetime?: "turn" | "call";
40
+ readonly show?: "result" | "omit" | "turn";
41
+ readonly deadlineMs?: number;
42
+ readonly maxResultTokens?: number;
43
+ readonly supportsNotify?: boolean;
44
+ /**
45
+ * When false the call is not a ReACT continuer by itself. Default true.
46
+ * Not `class`. License skip is `isSideChannel`.
47
+ */
48
+ readonly triggersReactLoop?: boolean;
49
+ /** Skips the license floor. Default false. */
50
+ readonly isSideChannel?: boolean;
51
+ /** Off the tape. Separate from `triggersReactLoop`. Default false. */
52
+ readonly tapeHidden?: boolean;
53
+ /**
54
+ * Mustache tape faces. Null or omitted is uncovered — the TUI falls
55
+ * through. Kernel projects these onto `PluginSpec`. pretty-mcp grain:
56
+ * `question` while live/ask, `effect` when sealed, `caption` the
57
+ * collapsed token.
58
+ */
59
+ readonly question?: string | null;
60
+ readonly effect?: string | null;
61
+ readonly caption?: string | null;
62
+ /** Admit as a frozen exam bag. Host stamps `admit` sealed on that job. */
63
+ readonly exam?: ExamAdmit<TIn, unknown, unknown>;
64
+ };
65
+ export declare class InhumanTool<TIn = unknown, TOut = unknown> {
66
+ readonly [inhumanBrand.tool]: true;
67
+ readonly name: string;
68
+ readonly description: string | undefined;
69
+ readonly class: ToolClass;
70
+ readonly representation: ToolRepresentation;
71
+ readonly input: z.ZodType<TIn>;
72
+ readonly output: z.ZodType<TOut>;
73
+ readonly type: "function" | "bot-call";
74
+ readonly target?: string;
75
+ readonly prepare?: (input: TIn, ctx: ToolContext) => unknown;
76
+ readonly background?: boolean;
77
+ readonly lifetime?: "turn" | "call";
78
+ readonly show?: "result" | "omit" | "turn";
79
+ readonly deadlineMs?: number;
80
+ readonly maxResultTokens?: number;
81
+ readonly supportsNotify?: boolean;
82
+ readonly triggersReactLoop: boolean;
83
+ readonly tapeHidden: boolean;
84
+ private readonly sideChannel;
85
+ readonly question: string | null;
86
+ readonly effect: string | null;
87
+ readonly caption: string | null;
88
+ readonly exam?: ExamAdmit<TIn, unknown, unknown>;
89
+ private readonly _run?;
90
+ constructor(def: InhumanToolDef<TIn, TOut>);
91
+ /** Host side channel. Skips the license floor. */
92
+ get isSideChannel(): boolean;
93
+ /** Normalized ABI record for load-boundary comparisons. */
94
+ toToolDefinition(): ToolDefinition<TIn, TOut>;
95
+ /** Parse raw args → run → parse output. Host admit path uses this. */
96
+ execute(raw: unknown, ctx?: ToolContext): Promise<TOut>;
97
+ }
98
+ export declare function defineTool<TIn, TOut>(def: InhumanToolDef<TIn, TOut>): InhumanTool<TIn, TOut>;
99
+ /** Host membrane for a JS action. Not a completion door. */
100
+ export type ActionContext = {
101
+ readonly signal?: AbortSignal;
102
+ readonly [key: string]: unknown;
103
+ };
104
+ export type ActionFn<TArgs = unknown, TOut = unknown> = (args: TArgs, ctx: ActionContext) => TOut | Promise<TOut>;
105
+ export type ActionSeat = "session" | "harness";
106
+ declare const actionBrand: symbol;
107
+ export type InhumanActionDef<TArgs = unknown, TOut = unknown> = {
108
+ readonly name: string;
109
+ readonly description?: string;
110
+ readonly seat?: ActionSeat;
111
+ readonly input?: z.ZodType<TArgs>;
112
+ readonly run: ActionFn<TArgs, TOut>;
113
+ };
114
+ export declare class InhumanAction<TArgs = unknown, TOut = unknown> {
115
+ readonly [actionBrand]: true;
116
+ readonly name: string;
117
+ readonly description: string | undefined;
118
+ readonly seat: ActionSeat;
119
+ readonly input: z.ZodType<TArgs> | undefined;
120
+ readonly run: ActionFn<TArgs, TOut>;
121
+ constructor(def: InhumanActionDef<TArgs, TOut>);
122
+ }
123
+ export declare function defineAction<TArgs, TOut>(def: InhumanActionDef<TArgs, TOut>): InhumanAction<TArgs, TOut>;
124
+ /** Plugin bag accepts any tool arity; the constructor normalizes to erased instances. */
125
+ export type AnyInhumanTool = InhumanTool<any, any>;
126
+ export type InhumanPluginDef = {
127
+ readonly apiVersion?: 1;
128
+ readonly tools?: readonly AnyInhumanTool[];
129
+ readonly actions?: readonly (InhumanAction | NormalizedActionDefinition)[];
130
+ readonly envCapabilities?: readonly EnvCapability[];
131
+ readonly bots?: readonly BotDefinition[];
132
+ readonly mcpServers?: readonly McpServerDefinition[];
133
+ readonly exclusiveSlots?: readonly string[];
134
+ /** Pack projection over trajectory metadata plus wire stamps from the head projection. */
135
+ readonly projection?: PluginProjection<any, any>;
136
+ };
137
+ declare const pluginBrand: symbol;
138
+ export declare class InhumanPlugin {
139
+ readonly [pluginBrand]: true;
140
+ readonly apiVersion: 1;
141
+ readonly tools: readonly InhumanTool[];
142
+ readonly actions: readonly InhumanAction[];
143
+ readonly envCapabilities: readonly EnvCapability[];
144
+ readonly bots: readonly BotDefinition[];
145
+ readonly mcpServers: readonly McpServerDefinition[];
146
+ readonly exclusiveSlots: readonly string[];
147
+ readonly projection?: PluginProjection<any, any>;
148
+ readonly definition: NormalizedPluginDefinition;
149
+ constructor(def?: InhumanPluginDef);
150
+ static isInhumanPlugin(value: unknown): value is InhumanPlugin;
151
+ }
152
+ export { z as z } from "zod";
153
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAgB,0BAA0B,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEtH,cAAc,oBAAoB,CAAC;AACnC,OAAO,EACL,oBAAoB,IAAI,oBAAoB,EAC5C,iBAAiB,IAAI,iBAAiB,EACtC,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,aAAa,IAAI,aAAa,EACnC,iBAAiB,IAAI,iBAAiB,EACtC,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,cAAc,IAAI,cAAc,GACtC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,SAAS,IAAI,SAAS,EAC3B,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,oBAAoB,IAAI,oBAA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SAAS,aAAa,EAAE,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACpD,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACjD,QAAQ,CAAC,UAAU,EAAE,0BAA0B,CAAC;gBAEpC,GAAG,GAAE,gBAAqB;IAgBtC,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa;CAG/D;AAED,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,187 @@
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
+ import { normalizeDefinitions, resolveReferences, } from "./normalize.js";
10
+ import { inhumanBrand, inhumanShape } from "./schemas/plugin.js";
11
+ export * from "./schemas/index.js";
12
+ export { normalizeDefinitions as normalizeDefinitions, resolveReferences as resolveReferences, isReasoningEffort as isReasoningEffort, } from "./normalize.js";
13
+ export class InhumanTool {
14
+ [inhumanBrand.tool] = true;
15
+ name;
16
+ description;
17
+ class;
18
+ representation;
19
+ input;
20
+ output;
21
+ type;
22
+ target;
23
+ prepare;
24
+ background;
25
+ lifetime;
26
+ show;
27
+ deadlineMs;
28
+ maxResultTokens;
29
+ supportsNotify;
30
+ triggersReactLoop;
31
+ tapeHidden;
32
+ sideChannel;
33
+ question;
34
+ effect;
35
+ caption;
36
+ exam;
37
+ _run;
38
+ constructor(def) {
39
+ const normalized = normalizeDefinitions({ tools: [def], actions: [], envCapabilities: [] }, "InhumanTool")
40
+ .tools[0];
41
+ this.name = normalized.name;
42
+ this.description = normalized.description;
43
+ this.class = normalized.class ?? "effect";
44
+ this.representation = normalized.representation;
45
+ this.input = normalized.input;
46
+ this.output = normalized.output;
47
+ this.type = normalized.type;
48
+ if (normalized.type === "function") {
49
+ this._run = normalized.run;
50
+ }
51
+ else {
52
+ this.target = normalized.target;
53
+ this.prepare = normalized.prepare;
54
+ this.background = normalized.background;
55
+ this.lifetime = normalized.lifetime;
56
+ this.show = normalized.show;
57
+ this.deadlineMs = normalized.deadlineMs;
58
+ this.maxResultTokens = normalized.maxResultTokens;
59
+ this.supportsNotify = normalized.supportsNotify;
60
+ }
61
+ this.triggersReactLoop = normalized.triggersReactLoop;
62
+ this.sideChannel = normalized.isSideChannel;
63
+ this.tapeHidden = normalized.tapeHidden;
64
+ this.question = normalized.question;
65
+ this.effect = normalized.effect;
66
+ this.caption = normalized.caption;
67
+ this.exam = normalized.type === "function" ? normalized.exam : undefined;
68
+ }
69
+ /** Host side channel. Skips the license floor. */
70
+ get isSideChannel() {
71
+ return this.sideChannel;
72
+ }
73
+ /** Normalized ABI record for load-boundary comparisons. */
74
+ toToolDefinition() {
75
+ const face = {
76
+ question: this.question,
77
+ effect: this.effect,
78
+ caption: this.caption,
79
+ };
80
+ if (this.type === "bot-call") {
81
+ return {
82
+ type: "bot-call",
83
+ name: this.name,
84
+ description: this.description,
85
+ class: this.class,
86
+ representation: this.representation,
87
+ input: this.input,
88
+ output: this.output,
89
+ target: this.target,
90
+ prepare: this.prepare,
91
+ background: this.background,
92
+ lifetime: this.lifetime,
93
+ show: this.show,
94
+ deadlineMs: this.deadlineMs,
95
+ maxResultTokens: this.maxResultTokens,
96
+ supportsNotify: this.supportsNotify,
97
+ triggersReactLoop: this.triggersReactLoop,
98
+ isSideChannel: this.isSideChannel,
99
+ tapeHidden: this.tapeHidden,
100
+ ...face,
101
+ };
102
+ }
103
+ return {
104
+ type: "function",
105
+ name: this.name,
106
+ description: this.description,
107
+ class: this.class,
108
+ representation: this.representation,
109
+ input: this.input,
110
+ output: this.output,
111
+ run: this._run,
112
+ triggersReactLoop: this.triggersReactLoop,
113
+ isSideChannel: this.isSideChannel,
114
+ tapeHidden: this.tapeHidden,
115
+ exam: this.exam,
116
+ ...face,
117
+ };
118
+ }
119
+ /** Parse raw args → run → parse output. Host admit path uses this. */
120
+ async execute(raw, ctx = {}) {
121
+ if (this.type === "bot-call") {
122
+ throw new TypeError(`InhumanTool(${this.name}): bot-call tools do not execute through run`);
123
+ }
124
+ if (this.exam != null && this._run == null) {
125
+ throw new TypeError(`InhumanTool(${this.name}): exam tools do not execute through run`);
126
+ }
127
+ const parsedCtx = inhumanShape.toolContext.parse(ctx);
128
+ if ((this.class === "read" || this.class === "write") && (parsedCtx.root == null || parsedCtx.root === "")) {
129
+ throw new TypeError(`InhumanTool(${this.name}): ctx.root string required for class ${this.class}`);
130
+ }
131
+ const input = this.input.parse(raw);
132
+ const out = await this._run(input, parsedCtx);
133
+ return this.output.parse(out);
134
+ }
135
+ }
136
+ export function defineTool(def) {
137
+ return new InhumanTool(def);
138
+ }
139
+ const actionBrand = inhumanBrand.action;
140
+ export class InhumanAction {
141
+ [actionBrand] = true;
142
+ name;
143
+ description;
144
+ seat;
145
+ input;
146
+ run;
147
+ constructor(def) {
148
+ const parsed = inhumanShape.normalizedActionDef.parse(def);
149
+ this.name = parsed.name;
150
+ this.description = parsed.description;
151
+ this.seat = parsed.seat;
152
+ this.input = parsed.input;
153
+ this.run = parsed.run;
154
+ }
155
+ }
156
+ export function defineAction(def) {
157
+ return new InhumanAction(def);
158
+ }
159
+ const pluginBrand = inhumanBrand.plugin;
160
+ export class InhumanPlugin {
161
+ [pluginBrand] = true;
162
+ apiVersion;
163
+ tools;
164
+ actions;
165
+ envCapabilities;
166
+ bots;
167
+ mcpServers;
168
+ exclusiveSlots;
169
+ projection;
170
+ definition;
171
+ constructor(def = {}) {
172
+ this.definition = resolveReferences(normalizeDefinitions(def, "InhumanPlugin"), "InhumanPlugin");
173
+ this.apiVersion = this.definition.apiVersion;
174
+ this.tools = Object.freeze(this.definition.tools.map((tool) => new InhumanTool(tool)));
175
+ this.actions = Object.freeze(this.definition.actions.map((action) => new InhumanAction(action)));
176
+ this.envCapabilities = Object.freeze([...this.definition.envCapabilities]);
177
+ this.bots = Object.freeze([...this.definition.bots]);
178
+ this.mcpServers = Object.freeze([...this.definition.mcpServers]);
179
+ this.exclusiveSlots = Object.freeze([...this.definition.exclusiveSlots]);
180
+ this.projection = this.definition.projection;
181
+ }
182
+ static isInhumanPlugin(value) {
183
+ return typeof value === "object" && value !== null && value[pluginBrand] === true;
184
+ }
185
+ }
186
+ export { z as z } from "zod";
187
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EACL,oBAAoB,EACpB,iBAAiB,GAMlB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAuD,MAAM,qBAAqB,CAAC;AAEtH,cAAc,oBAAoB,CAAC;AACnC,OAAO,EACL,oBAAoB,IAAI,oBAAoB,EAC5C,iBAAiB,IAAI,iBAAiB,EAGtC,iBAAiB,IAAI,iBAAiB,GAKvC,MAAM,gBAAgB,CAAC;AA0DxB,MAAM,OAAO,WAAW;IACb,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,IAAa,CAAC;IAEpC,IAAI,CAAS;IACb,WAAW,CAAqB;IAChC,KAAK,CAAY;IACjB,cAAc,CAAqB;IACnC,KAAK,CAAiB;IACtB,MAAM,CAAkB;IACxB,IAAI,CAA0B;IAC9B,MAAM,CAAU;IAChB,OAAO,CAA6C;IACpD,UAAU,CAAW;IACrB,QAAQ,CAAmB;IAC3B,IAAI,CAA8B;IAClC,UAAU,CAAU;IACpB,eAAe,CAAU;IACzB,cAAc,CAAW;IACzB,iBAAiB,CAAU;IAC3B,UAAU,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IAAI,CAAC,CAAC,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;QACjE,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC;QACzE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;IAC/C,CAAC;IAED,MAAM,CAAC,eAAe,CAAC,KAAc;QACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAK,KAAqC,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACrH,CAAC;CACF;AAED,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,CAAC"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Load-boundary normalize for plugin ABI v1. Produces plain records; branding
3
+ * and instanceof are not part of the contract.
4
+ */
5
+ import type { EnvCapability } from "@here.build/arrival";
6
+ import type { SystemPrompt } from "@inhuman.tools/harness-commons";
7
+ import { ZodType } from "zod";
8
+ import type { ExamAdmit, PluginProjection, PluginStorageHandles } from "./projection.js";
9
+ import { REASONING_EFFORTS, type ToolRepresentation, NormalizedActionDefinition } from "./schemas/plugin.js";
10
+ export type PluginCallContext = {
11
+ readonly root?: string;
12
+ readonly turn?: unknown;
13
+ readonly completion?: unknown | null;
14
+ readonly invocation?: unknown;
15
+ readonly signal?: AbortSignal;
16
+ /** Prefix projection for this plugin. Tool body proposes metadata via `propose`. */
17
+ readonly storage?: PluginStorageHandles;
18
+ readonly [key: string]: unknown;
19
+ };
20
+ export type BotMcpBinding = {
21
+ readonly server: string;
22
+ readonly tools: readonly string[];
23
+ readonly approval?: "allow" | "policy";
24
+ };
25
+ export type ReasoningEffort = (typeof REASONING_EFFORTS)[number];
26
+ export declare function isReasoningEffort(value: unknown): value is ReasoningEffort;
27
+ export type BotDefinition = {
28
+ readonly name: string;
29
+ readonly recipeScope: "invocation" | "session" | "workspace" | "global";
30
+ readonly instructions: SystemPrompt;
31
+ /** Parent-facing one-liner. Inventory speech. */
32
+ readonly description?: string;
33
+ readonly tools?: readonly string[];
34
+ readonly mcp?: readonly BotMcpBinding[];
35
+ readonly keepAlive?: boolean;
36
+ /** Other bot names this concept may invoke. Same-plugin, resolved at load. */
37
+ readonly invokes?: readonly string[];
38
+ readonly reasoningEffort?: ReasoningEffort;
39
+ /** Ordered try-list of catalog model ids. Applied at mint when a resolver exists. */
40
+ readonly modelPreferences?: readonly string[];
41
+ readonly skills?: readonly string[];
42
+ };
43
+ export type McpServerDefinition = {
44
+ readonly name: string;
45
+ readonly visibility: "private" | "public";
46
+ readonly scope: "session" | "workspace" | "global";
47
+ readonly transport: {
48
+ readonly type: "stdio";
49
+ readonly command: string;
50
+ readonly args: readonly string[];
51
+ readonly cwd: "plugin" | "workspace";
52
+ readonly env?: Record<string, string> | ((ctx: {
53
+ readonly pluginRoot: string;
54
+ readonly workspaceRoot: string;
55
+ }) => Record<string, string>);
56
+ };
57
+ };
58
+ export type FunctionToolDefinition<I = unknown, O = unknown> = {
59
+ readonly type: "function";
60
+ readonly name: string;
61
+ readonly description?: string;
62
+ readonly class?: string;
63
+ readonly representation: ToolRepresentation;
64
+ readonly input: ZodType<I>;
65
+ readonly output: ZodType<O>;
66
+ readonly run: (input: I, ctx: PluginCallContext) => O | Promise<O>;
67
+ readonly triggersReactLoop: boolean;
68
+ readonly isSideChannel: boolean;
69
+ readonly tapeHidden: boolean;
70
+ readonly question: string | null;
71
+ readonly effect: string | null;
72
+ readonly caption: string | null;
73
+ readonly exam?: ExamAdmit<I, unknown, unknown>;
74
+ };
75
+ export type BotCallToolDefinition<I = unknown, O = unknown> = {
76
+ readonly type: "bot-call";
77
+ readonly name: string;
78
+ readonly description?: string;
79
+ readonly class?: string;
80
+ readonly representation: ToolRepresentation;
81
+ readonly input: ZodType<I>;
82
+ readonly output: ZodType<O>;
83
+ readonly target: string;
84
+ readonly prepare?: (input: I, ctx: PluginCallContext) => unknown;
85
+ readonly background?: boolean;
86
+ readonly lifetime?: "turn" | "call";
87
+ readonly show?: "result" | "omit" | "turn";
88
+ readonly deadlineMs?: number;
89
+ readonly maxResultTokens?: number;
90
+ readonly supportsNotify?: boolean;
91
+ readonly triggersReactLoop: boolean;
92
+ readonly isSideChannel: boolean;
93
+ readonly tapeHidden: boolean;
94
+ readonly question: string | null;
95
+ readonly effect: string | null;
96
+ readonly caption: string | null;
97
+ };
98
+ export type ToolDefinition<I = unknown, O = unknown> = FunctionToolDefinition<I, O> | BotCallToolDefinition<I, O>;
99
+ export type NormalizedPluginDefinition = {
100
+ readonly apiVersion: 1;
101
+ readonly tools: readonly ToolDefinition[];
102
+ readonly bots: readonly BotDefinition[];
103
+ readonly mcpServers: readonly McpServerDefinition[];
104
+ readonly actions: readonly NormalizedActionDefinition[];
105
+ readonly envCapabilities: readonly EnvCapability[];
106
+ readonly exclusiveSlots: readonly string[];
107
+ readonly projection?: PluginProjection<any, any>;
108
+ };
109
+ export declare function validateSupportedVersion(bag: Record<string, unknown>, pluginName?: string): void;
110
+ export declare function normalizeDefinitions(exported: unknown, pluginName?: string): NormalizedPluginDefinition;
111
+ export declare function resolveReferences(definition: NormalizedPluginDefinition, pluginName?: string): NormalizedPluginDefinition;
112
+ //# sourceMappingURL=normalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../src/normalize.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAK,OAAO,EAAE,MAAM,KAAK,CAAC;AAEjC,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MA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