@manehorizons/cadence-types 1.9.0 → 1.10.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/dist/host.d.ts +85 -8
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +23 -1
- package/dist/host.js.map +1 -1
- package/package.json +1 -1
package/dist/host.d.ts
CHANGED
|
@@ -1,10 +1,87 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type AbstractEvent } from './events.js';
|
|
3
|
+
/**
|
|
4
|
+
* Capability descriptor a host adapter declares about its environment. The
|
|
5
|
+
* core uses it to decide which abstract events the host can deliver and which
|
|
6
|
+
* of them can block. Zod schema kept in parity with {@link AbstractEventZ}; the
|
|
7
|
+
* `HostCapabilities` type is derived from it so the schema is the single
|
|
8
|
+
* source of truth.
|
|
9
|
+
*/
|
|
10
|
+
export declare const HostCapabilitiesZ: z.ZodObject<{
|
|
11
|
+
hooks: z.ZodArray<z.ZodEnum<{
|
|
12
|
+
"session-start": "session-start";
|
|
13
|
+
"user-prompt": "user-prompt";
|
|
14
|
+
"pre-tool-edit": "pre-tool-edit";
|
|
15
|
+
"post-tool-edit": "post-tool-edit";
|
|
16
|
+
"session-stop": "session-stop";
|
|
17
|
+
"subagent-result": "subagent-result";
|
|
18
|
+
"skill-invoke": "skill-invoke";
|
|
19
|
+
}>>;
|
|
20
|
+
slashCommands: z.ZodBoolean;
|
|
21
|
+
skillSystem: z.ZodEnum<{
|
|
22
|
+
none: "none";
|
|
23
|
+
native: "native";
|
|
24
|
+
prompted: "prompted";
|
|
25
|
+
}>;
|
|
26
|
+
blockingHooks: z.ZodArray<z.ZodEnum<{
|
|
27
|
+
"session-start": "session-start";
|
|
28
|
+
"user-prompt": "user-prompt";
|
|
29
|
+
"pre-tool-edit": "pre-tool-edit";
|
|
30
|
+
"post-tool-edit": "post-tool-edit";
|
|
31
|
+
"session-stop": "session-stop";
|
|
32
|
+
"subagent-result": "subagent-result";
|
|
33
|
+
"skill-invoke": "skill-invoke";
|
|
34
|
+
}>>;
|
|
35
|
+
subagentSpawn: z.ZodEnum<{
|
|
36
|
+
none: "none";
|
|
37
|
+
native: "native";
|
|
38
|
+
"shell-out": "shell-out";
|
|
39
|
+
}>;
|
|
40
|
+
streamingOutput: z.ZodBoolean;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export type HostCapabilities = z.infer<typeof HostCapabilitiesZ>;
|
|
43
|
+
/**
|
|
44
|
+
* Version of the host-adapter contract (capabilities + event map + payload
|
|
45
|
+
* extraction + install surface). Integer, breaking-only — bumped when an
|
|
46
|
+
* existing adapter would need code changes to keep conforming.
|
|
47
|
+
*/
|
|
48
|
+
export declare const ADAPTER_CONTRACT_VERSION = 1;
|
|
49
|
+
/**
|
|
50
|
+
* Normalized payload the core dispatcher consumes, extracted by an adapter
|
|
51
|
+
* from a host's raw event. `files` for edit-tool events; `skill` for
|
|
52
|
+
* skill-invoke events. Host-facing adapters own the extraction; this is the
|
|
53
|
+
* core-facing shape they must produce.
|
|
54
|
+
*/
|
|
55
|
+
export interface ExtractedPayload {
|
|
56
|
+
files?: string[];
|
|
57
|
+
skill?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The host-adapter contract. An adapter package translates a host's lifecycle
|
|
61
|
+
* into the abstract events the core already speaks, declares its capabilities,
|
|
62
|
+
* extracts payloads, and installs itself into the host.
|
|
63
|
+
*
|
|
64
|
+
* Only the core-facing surface is pinned here. Install option shapes are
|
|
65
|
+
* intrinsically host-specific, so they are left as type parameters rather than
|
|
66
|
+
* coupled to any one host. Runtime plumbing a host needs internally (request
|
|
67
|
+
* routing, locating its own install) is a documented responsibility, not part
|
|
68
|
+
* of this type — see the "write your own adapter" guide.
|
|
69
|
+
*
|
|
70
|
+
* @typeParam HookOpts - host-specific options for {@link HostAdapter.installHooks}
|
|
71
|
+
* @typeParam CommandOpts - host-specific options for {@link HostAdapter.installCommands}
|
|
72
|
+
*/
|
|
73
|
+
export interface HostAdapter<HookOpts = unknown, CommandOpts = unknown> {
|
|
74
|
+
/** Contract version this adapter targets; must equal {@link ADAPTER_CONTRACT_VERSION}. */
|
|
75
|
+
readonly contractVersion: number;
|
|
76
|
+
/** What the host environment can do. */
|
|
77
|
+
readonly capabilities: HostCapabilities;
|
|
78
|
+
/** Map a host lifecycle event name to its abstract event, or null if unmapped. */
|
|
79
|
+
mapEvent(hostEvent: string, toolName?: string): AbstractEvent | null;
|
|
80
|
+
/** Extract the normalized payload from a host's raw event. */
|
|
81
|
+
extractPayload(raw: unknown): ExtractedPayload | undefined;
|
|
82
|
+
/** Wire the host's lifecycle hooks to the cadence shim, under project `root`. */
|
|
83
|
+
installHooks(root: string, options?: HookOpts): Promise<unknown> | unknown;
|
|
84
|
+
/** Install the host's slash-command (or equivalent) surface, under project `root`. */
|
|
85
|
+
installCommands(root: string, options?: CommandOpts): Promise<unknown> | unknown;
|
|
9
86
|
}
|
|
10
87
|
//# sourceMappingURL=host.d.ts.map
|
package/dist/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAO5B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,WAAW,CAAC,QAAQ,GAAG,OAAO,EAAE,WAAW,GAAG,OAAO;IACpE,0FAA0F;IAC1F,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,wCAAwC;IACxC,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAC;IACxC,kFAAkF;IAClF,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAAC;IACrE,8DAA8D;IAC9D,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,GAAG,SAAS,CAAC;IAC3D,iFAAiF;IACjF,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAC3E,sFAAsF;IACtF,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CAClF"}
|
package/dist/host.js
CHANGED
|
@@ -1,2 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AbstractEventZ } from './events.js';
|
|
3
|
+
/**
|
|
4
|
+
* Capability descriptor a host adapter declares about its environment. The
|
|
5
|
+
* core uses it to decide which abstract events the host can deliver and which
|
|
6
|
+
* of them can block. Zod schema kept in parity with {@link AbstractEventZ}; the
|
|
7
|
+
* `HostCapabilities` type is derived from it so the schema is the single
|
|
8
|
+
* source of truth.
|
|
9
|
+
*/
|
|
10
|
+
export const HostCapabilitiesZ = z.object({
|
|
11
|
+
hooks: z.array(AbstractEventZ),
|
|
12
|
+
slashCommands: z.boolean(),
|
|
13
|
+
skillSystem: z.enum(['native', 'prompted', 'none']),
|
|
14
|
+
blockingHooks: z.array(AbstractEventZ),
|
|
15
|
+
subagentSpawn: z.enum(['native', 'shell-out', 'none']),
|
|
16
|
+
streamingOutput: z.boolean(),
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Version of the host-adapter contract (capabilities + event map + payload
|
|
20
|
+
* extraction + install surface). Integer, breaking-only — bumped when an
|
|
21
|
+
* existing adapter would need code changes to keep conforming.
|
|
22
|
+
*/
|
|
23
|
+
export const ADAPTER_CONTRACT_VERSION = 1;
|
|
2
24
|
//# sourceMappingURL=host.js.map
|
package/dist/host.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;IAC9B,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE;IAC1B,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACnD,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;IACtC,aAAa,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IACtD,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE;CAC7B,CAAC,CAAC;AAIH;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC"}
|