@makaio/client-codex 1.0.0-dev-1779051654000
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 +21 -0
- package/README.md +103 -0
- package/descriptor.json +21 -0
- package/dist/codex-client-session-service-DD2LkxP1.mjs +1551 -0
- package/dist/definition.d.ts +90 -0
- package/dist/definition.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +4 -0
- package/dist/package.d.ts +18 -0
- package/dist/package.d.ts.map +1 -0
- package/dist/runtime/client-settings.d.ts +149 -0
- package/dist/runtime/client-settings.d.ts.map +1 -0
- package/dist/runtime/codex-client-session-service.d.ts +148 -0
- package/dist/runtime/codex-client-session-service.d.ts.map +1 -0
- package/dist/runtime/config-prime-handler.d.ts +37 -0
- package/dist/runtime/config-prime-handler.d.ts.map +1 -0
- package/dist/runtime/hook-normalizer.d.ts +79 -0
- package/dist/runtime/hook-normalizer.d.ts.map +1 -0
- package/dist/runtime/namespace.d.ts +193 -0
- package/dist/runtime/namespace.d.ts.map +1 -0
- package/dist/runtime/package.d.ts +22 -0
- package/dist/runtime/package.d.ts.map +1 -0
- package/dist/runtime/package.mjs +33 -0
- package/dist/runtime/schemas.d.ts +26 -0
- package/dist/runtime/schemas.d.ts.map +1 -0
- package/dist/runtime/session-config-handler.d.ts +40 -0
- package/dist/runtime/session-config-handler.d.ts.map +1 -0
- package/dist/runtime/settings-paths.d.ts +43 -0
- package/dist/runtime/settings-paths.d.ts.map +1 -0
- package/dist/runtime/wiring.d.ts +88 -0
- package/dist/runtime/wiring.d.ts.map +1 -0
- package/dist/schemas/config.d.ts +306 -0
- package/dist/schemas/config.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +9 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/wiring.d.ts +108 -0
- package/dist/schemas/wiring.d.ts.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.mjs +8 -0
- package/dist/src-DkIyzWF3.mjs +19 -0
- package/package.json +49 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex client namespace registration.
|
|
3
|
+
*
|
|
4
|
+
* Registers `client:codex` on the singleton bus using the shared
|
|
5
|
+
* {@link createClientNamespace} factory, which pre-registers the raw catch-all
|
|
6
|
+
* hook ingress subject `hook.received` with the canonical
|
|
7
|
+
* {@link RawClientHookPayloadSchema}.
|
|
8
|
+
*
|
|
9
|
+
* Additional subjects registered here:
|
|
10
|
+
* - `config.hooks.list` — list effective hook configuration
|
|
11
|
+
* - `config.hooks.add` — add a hook entry to a config scope
|
|
12
|
+
* - `config.hooks.remove` — remove hook entries matching a pattern
|
|
13
|
+
* - `config.prime` — blocking config-prime lifecycle hook
|
|
14
|
+
* - `wiring.list` — list all wiring entries with installation status
|
|
15
|
+
* - `wiring.apply` — install wiring entries into the target scope
|
|
16
|
+
* - `wiring.remove` — uninstall wiring entries from the target scope
|
|
17
|
+
* - `sessionConfig.setup` — seed an isolated session config directory
|
|
18
|
+
*
|
|
19
|
+
* **Subject conventions:**
|
|
20
|
+
* - Raw Codex-native events flow in the `client:codex.*` namespace only.
|
|
21
|
+
* - Normalized lifecycle observations flow in the global `client.session.*`
|
|
22
|
+
* namespace after the {@link CodexHookNormalizer} maps them.
|
|
23
|
+
* @packageDocumentation
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Typed bus subjects for the Codex client namespace (`client:codex.*`).
|
|
27
|
+
*
|
|
28
|
+
* Exposes the raw hook ingress subject, config management subjects, wiring
|
|
29
|
+
* management subjects, the config-prime lifecycle hook, and the session config
|
|
30
|
+
* setup subject:
|
|
31
|
+
* - `CodexClientSubjects.hook.received` → `client:codex.hook.received`
|
|
32
|
+
* - `CodexClientSubjects.config.hooks.list` → `client:codex.config.hooks.list`
|
|
33
|
+
* - `CodexClientSubjects.config.hooks.add` → `client:codex.config.hooks.add`
|
|
34
|
+
* - `CodexClientSubjects.config.hooks.remove` → `client:codex.config.hooks.remove`
|
|
35
|
+
* - `CodexClientSubjects.config.prime` → `client:codex.config.prime`
|
|
36
|
+
* - `CodexClientSubjects.wiring.list` → `client:codex.wiring.list`
|
|
37
|
+
* - `CodexClientSubjects.wiring.apply` → `client:codex.wiring.apply`
|
|
38
|
+
* - `CodexClientSubjects.wiring.remove` → `client:codex.wiring.remove`
|
|
39
|
+
* - `CodexClientSubjects.sessionConfig.setup` → `client:codex.sessionConfig.setup`
|
|
40
|
+
*/
|
|
41
|
+
export declare const CodexClientSubjects: import("@makaio/framework/core").BusSubjects<import("@makaio/framework/core").FlatSubjectDefinitions<`client:${string}`, {
|
|
42
|
+
'hook.received': import("zod").ZodObject<{
|
|
43
|
+
eventName: import("zod").ZodString;
|
|
44
|
+
receivedAt: import("zod").ZodNumber;
|
|
45
|
+
payload: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
|
|
46
|
+
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
47
|
+
}, import("zod/v4/core").$strip>;
|
|
48
|
+
} & {
|
|
49
|
+
'config.hooks.list': {
|
|
50
|
+
request: import("zod").ZodObject<{
|
|
51
|
+
projectDir: import("zod").ZodOptional<import("zod").ZodString>;
|
|
52
|
+
eventName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
53
|
+
}, import("zod/v4/core").$strip>;
|
|
54
|
+
response: import("zod").ZodObject<{
|
|
55
|
+
effective: import("zod").ZodArray<import("zod").ZodObject<{
|
|
56
|
+
event: import("zod").ZodString;
|
|
57
|
+
matcher: import("zod").ZodOptional<import("zod").ZodString>;
|
|
58
|
+
command: import("zod").ZodString;
|
|
59
|
+
timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
60
|
+
}, import("zod/v4/core").$strip>>;
|
|
61
|
+
perScope: import("zod").ZodArray<import("zod").ZodObject<{
|
|
62
|
+
scope: import("zod").ZodEnum<{
|
|
63
|
+
global: "global";
|
|
64
|
+
project: "project";
|
|
65
|
+
}>;
|
|
66
|
+
path: import("zod").ZodString;
|
|
67
|
+
writable: import("zod").ZodBoolean;
|
|
68
|
+
hooks: import("zod").ZodArray<import("zod").ZodObject<{
|
|
69
|
+
event: import("zod").ZodString;
|
|
70
|
+
matcher: import("zod").ZodOptional<import("zod").ZodString>;
|
|
71
|
+
command: import("zod").ZodString;
|
|
72
|
+
timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
73
|
+
}, import("zod/v4/core").$strip>>;
|
|
74
|
+
}, import("zod/v4/core").$strip>>;
|
|
75
|
+
}, import("zod/v4/core").$strip>;
|
|
76
|
+
};
|
|
77
|
+
'config.hooks.add': {
|
|
78
|
+
request: import("zod").ZodObject<{
|
|
79
|
+
event: import("zod").ZodString;
|
|
80
|
+
matcher: import("zod").ZodOptional<import("zod").ZodString>;
|
|
81
|
+
command: import("zod").ZodString;
|
|
82
|
+
timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
83
|
+
projectDir: import("zod").ZodOptional<import("zod").ZodString>;
|
|
84
|
+
scope: import("zod").ZodEnum<{
|
|
85
|
+
global: "global";
|
|
86
|
+
project: "project";
|
|
87
|
+
}>;
|
|
88
|
+
}, import("zod/v4/core").$strip>;
|
|
89
|
+
response: import("zod").ZodObject<{
|
|
90
|
+
added: import("zod").ZodBoolean;
|
|
91
|
+
}, import("zod/v4/core").$strip>;
|
|
92
|
+
};
|
|
93
|
+
'config.hooks.remove': {
|
|
94
|
+
request: import("zod").ZodObject<{
|
|
95
|
+
projectDir: import("zod").ZodOptional<import("zod").ZodString>;
|
|
96
|
+
scope: import("zod").ZodEnum<{
|
|
97
|
+
global: "global";
|
|
98
|
+
project: "project";
|
|
99
|
+
}>;
|
|
100
|
+
event: import("zod").ZodString;
|
|
101
|
+
match: import("zod").ZodObject<{
|
|
102
|
+
commandContains: import("zod").ZodString;
|
|
103
|
+
}, import("zod/v4/core").$strip>;
|
|
104
|
+
}, import("zod/v4/core").$strip>;
|
|
105
|
+
response: import("zod").ZodObject<{
|
|
106
|
+
removed: import("zod").ZodNumber;
|
|
107
|
+
}, import("zod/v4/core").$strip>;
|
|
108
|
+
};
|
|
109
|
+
'wiring.list': {
|
|
110
|
+
request: import("zod").ZodObject<{
|
|
111
|
+
projectDir: import("zod").ZodOptional<import("zod").ZodString>;
|
|
112
|
+
makaioCommand: import("zod").ZodString;
|
|
113
|
+
}, import("zod/v4/core").$strip>;
|
|
114
|
+
response: import("zod").ZodObject<{
|
|
115
|
+
entries: import("zod").ZodArray<import("zod").ZodObject<{
|
|
116
|
+
group: import("zod").ZodString;
|
|
117
|
+
name: import("zod").ZodString;
|
|
118
|
+
installed: import("zod").ZodBoolean;
|
|
119
|
+
command: import("zod").ZodString;
|
|
120
|
+
}, import("zod/v4/core").$strip>>;
|
|
121
|
+
}, import("zod/v4/core").$strip>;
|
|
122
|
+
};
|
|
123
|
+
'wiring.apply': {
|
|
124
|
+
request: import("zod").ZodObject<{
|
|
125
|
+
scope: import("zod").ZodEnum<{
|
|
126
|
+
global: "global";
|
|
127
|
+
project: "project";
|
|
128
|
+
}>;
|
|
129
|
+
projectDir: import("zod").ZodOptional<import("zod").ZodString>;
|
|
130
|
+
makaioCommand: import("zod").ZodString;
|
|
131
|
+
}, import("zod/v4/core").$strip>;
|
|
132
|
+
response: import("zod").ZodObject<{
|
|
133
|
+
applied: import("zod").ZodNumber;
|
|
134
|
+
skipped: import("zod").ZodNumber;
|
|
135
|
+
}, import("zod/v4/core").$strip>;
|
|
136
|
+
};
|
|
137
|
+
'wiring.remove': {
|
|
138
|
+
request: import("zod").ZodObject<{
|
|
139
|
+
scope: import("zod").ZodEnum<{
|
|
140
|
+
global: "global";
|
|
141
|
+
project: "project";
|
|
142
|
+
}>;
|
|
143
|
+
projectDir: import("zod").ZodOptional<import("zod").ZodString>;
|
|
144
|
+
}, import("zod/v4/core").$strip>;
|
|
145
|
+
response: import("zod").ZodObject<{
|
|
146
|
+
removed: import("zod").ZodNumber;
|
|
147
|
+
}, import("zod/v4/core").$strip>;
|
|
148
|
+
};
|
|
149
|
+
'config.prime': {
|
|
150
|
+
request: import("zod").ZodObject<{
|
|
151
|
+
clientId: import("zod").ZodString;
|
|
152
|
+
configDir: import("zod").ZodString;
|
|
153
|
+
phase: import("zod").ZodEnum<{
|
|
154
|
+
"managed-install": "managed-install";
|
|
155
|
+
"profile-create": "profile-create";
|
|
156
|
+
"session-create": "session-create";
|
|
157
|
+
}>;
|
|
158
|
+
binaryVersion: import("zod").ZodOptional<import("zod").ZodString>;
|
|
159
|
+
adapterName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
160
|
+
projectDir: import("zod").ZodOptional<import("zod").ZodString>;
|
|
161
|
+
}, import("zod/v4/core").$strip>;
|
|
162
|
+
response: import("zod").ZodObject<{
|
|
163
|
+
primed: import("zod").ZodBoolean;
|
|
164
|
+
}, import("zod/v4/core").$strip>;
|
|
165
|
+
};
|
|
166
|
+
'sessionConfig.setup': {
|
|
167
|
+
request: import("zod").ZodObject<{
|
|
168
|
+
sessionDir: import("zod").ZodString;
|
|
169
|
+
baseConfigDir: import("zod").ZodString;
|
|
170
|
+
projectDir: import("zod").ZodOptional<import("zod").ZodString>;
|
|
171
|
+
platform: import("zod").ZodEnum<{
|
|
172
|
+
darwin: "darwin";
|
|
173
|
+
linux: "linux";
|
|
174
|
+
win32: "win32";
|
|
175
|
+
}>;
|
|
176
|
+
configInheritance: import("zod").ZodEnum<{
|
|
177
|
+
"auth-only": "auth-only";
|
|
178
|
+
empty: "empty";
|
|
179
|
+
full: "full";
|
|
180
|
+
}>;
|
|
181
|
+
}, import("zod/v4/core").$strip>;
|
|
182
|
+
response: import("zod").ZodObject<{
|
|
183
|
+
env: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
184
|
+
}, import("zod/v4/core").$strip>;
|
|
185
|
+
};
|
|
186
|
+
}>, `client:${string}`>;
|
|
187
|
+
/**
|
|
188
|
+
* Fully-qualified namespace domain string for the Codex client.
|
|
189
|
+
*
|
|
190
|
+
* Value: `'client:codex'`
|
|
191
|
+
*/
|
|
192
|
+
export declare const CODEX_CLIENT_NAMESPACE: string;
|
|
193
|
+
//# sourceMappingURL=namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../src/runtime/namespace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAqBH;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAAW,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAAkB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex client runtime package.
|
|
3
|
+
*
|
|
4
|
+
* Exports the {@link MakaioExtension} manifest for the Codex client runtime and
|
|
5
|
+
* re-exports the namespace subjects for client-native integrations.
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
import type { IMakaioBus } from '@makaio/framework/bus';
|
|
9
|
+
import type { MakaioNodeExtension } from '@makaio/framework/contracts';
|
|
10
|
+
export { CodexClientSubjects, CODEX_CLIENT_NAMESPACE } from './namespace.js';
|
|
11
|
+
export { CodexClientSessionService } from './codex-client-session-service.js';
|
|
12
|
+
export { normalizeCodexHook } from './hook-normalizer.js';
|
|
13
|
+
export type { CodexNormalizedEvent, CodexNormalizedSubject } from './hook-normalizer.js';
|
|
14
|
+
/**
|
|
15
|
+
* MakaioExtension manifest for the Codex client session normalization service.
|
|
16
|
+
*
|
|
17
|
+
* Creates a {@link CodexClientSessionService} that bridges raw
|
|
18
|
+
* `client:codex.hook.received` events into normalized `client.session.*`
|
|
19
|
+
* observations when the Codex descriptor server entry activates.
|
|
20
|
+
*/
|
|
21
|
+
export declare const codexClientRuntimePackage: MakaioNodeExtension<IMakaioBus>;
|
|
22
|
+
//# sourceMappingURL=package.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../src/runtime/package.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEzF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,EAAE,mBAAmB,CAAC,UAAU,CAWrE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { i as normalizeCodexHook, n as CODEX_CLIENT_NAMESPACE, r as CodexClientSubjects, t as CodexClientSessionService } from "../codex-client-session-service-DD2LkxP1.mjs";
|
|
2
|
+
import { dep } from "@makaio/framework/contracts";
|
|
3
|
+
|
|
4
|
+
//#region src/runtime/package.ts
|
|
5
|
+
/**
|
|
6
|
+
* Codex client runtime package.
|
|
7
|
+
*
|
|
8
|
+
* Exports the {@link MakaioExtension} manifest for the Codex client runtime and
|
|
9
|
+
* re-exports the namespace subjects for client-native integrations.
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* MakaioExtension manifest for the Codex client session normalization service.
|
|
14
|
+
*
|
|
15
|
+
* Creates a {@link CodexClientSessionService} that bridges raw
|
|
16
|
+
* `client:codex.hook.received` events into normalized `client.session.*`
|
|
17
|
+
* observations when the Codex descriptor server entry activates.
|
|
18
|
+
*/
|
|
19
|
+
const codexClientRuntimePackage = {
|
|
20
|
+
name: "codex.runtime",
|
|
21
|
+
displayName: "Codex Client Runtime",
|
|
22
|
+
version: "0.1.0",
|
|
23
|
+
dependencies: [dep("makaio.clients-core")],
|
|
24
|
+
/**
|
|
25
|
+
* Create the Codex client session service bound to the runtime bus.
|
|
26
|
+
* @param ctx - Runtime package context
|
|
27
|
+
* @returns Uninitialized Codex client session service
|
|
28
|
+
*/
|
|
29
|
+
create: (ctx) => new CodexClientSessionService(ctx.bus)
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { CODEX_CLIENT_NAMESPACE, CodexClientSessionService, CodexClientSubjects, codexClientRuntimePackage, normalizeCodexHook };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex client runtime schemas and hook event name constants.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the shared raw hook payload schema for Codex client consumers.
|
|
5
|
+
* The Codex CLI uses the canonical {@link RawClientHookPayloadSchema} delivered
|
|
6
|
+
* on `client:codex.hook.received`.
|
|
7
|
+
*
|
|
8
|
+
* The hook name constants below are the canonical event names reported in the
|
|
9
|
+
* `eventName` field of {@link RawClientHookPayload} by the Codex CLI.
|
|
10
|
+
* @see https://github.com/openai/codex
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
export { RawClientHookPayloadSchema, type RawClientHookPayload } from '@makaio/framework/clients';
|
|
14
|
+
/**
|
|
15
|
+
* Hook events emitted by Codex that map to the v1 observed-semantics set.
|
|
16
|
+
*
|
|
17
|
+
* These are the events the normalizer translates into `client.session.*` bus
|
|
18
|
+
* emissions. Any event NOT listed here is left as raw `client:codex`
|
|
19
|
+
* namespace data only.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CODEX_HOOK_SESSION_START = "SessionStart";
|
|
22
|
+
export declare const CODEX_HOOK_USER_PROMPT_SUBMIT = "UserPromptSubmit";
|
|
23
|
+
export declare const CODEX_HOOK_PRE_TOOL_USE = "PreToolUse";
|
|
24
|
+
export declare const CODEX_HOOK_POST_TOOL_USE = "PostToolUse";
|
|
25
|
+
export declare const CODEX_HOOK_STOP = "Stop";
|
|
26
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/runtime/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,0BAA0B,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE7F;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,iBAAiB,CAAC;AACvD,eAAO,MAAM,6BAA6B,qBAAqB,CAAC;AAChE,eAAO,MAAM,uBAAuB,eAAe,CAAC;AACpD,eAAO,MAAM,wBAAwB,gBAAgB,CAAC;AACtD,eAAO,MAAM,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex session config setup handler.
|
|
3
|
+
*
|
|
4
|
+
* Implements the `client:codex.sessionConfig.setup` delegation request by
|
|
5
|
+
* materializing the Codex config files needed for an isolated session
|
|
6
|
+
* directory.
|
|
7
|
+
*
|
|
8
|
+
* The handler copies `config.toml` and `auth.json` from the base config
|
|
9
|
+
* directory (when present) into the session-scoped directory, then primes the
|
|
10
|
+
* session directory to ensure `check_for_update_on_startup = false` is set.
|
|
11
|
+
*
|
|
12
|
+
* When `sessionDir` and `baseConfigDir` resolve to the same path (the
|
|
13
|
+
* framework passes `sessionDir` as `baseConfigDir` when no profile is
|
|
14
|
+
* configured) the copy step is skipped and only the prime step runs.
|
|
15
|
+
*
|
|
16
|
+
* Returns `{ env: { CODEX_HOME: sessionDir } }` so the spawned Codex process
|
|
17
|
+
* inherits the isolated session directory as its configuration root.
|
|
18
|
+
* @packageDocumentation
|
|
19
|
+
*/
|
|
20
|
+
import type { SessionConfigSetupRequest, SessionConfigSetupResponse } from '@makaio/framework/contracts/client';
|
|
21
|
+
/**
|
|
22
|
+
* Handle `client:codex.sessionConfig.setup` by seeding the session-scoped
|
|
23
|
+
* directory with the appropriate Codex config files.
|
|
24
|
+
*
|
|
25
|
+
* Steps:
|
|
26
|
+
* 1. Create `sessionDir` (recursive, no-op when it already exists).
|
|
27
|
+
* 2. When `sessionDir` and `baseConfigDir` are distinct paths, copy
|
|
28
|
+
* `config.toml` and `auth.json` from `baseConfigDir` into `sessionDir`
|
|
29
|
+
* (each copy is skipped when the source file does not exist).
|
|
30
|
+
* 3. Prime `sessionDir` via {@link handleCodexConfigPrime} to ensure
|
|
31
|
+
* `check_for_update_on_startup = false` is set.
|
|
32
|
+
* @param payload - Session config setup delegation payload. Only `sessionDir`,
|
|
33
|
+
* `baseConfigDir`, and `projectDir` are used; `platform` and
|
|
34
|
+
* `configInheritance` are accepted for interface compatibility but are not
|
|
35
|
+
* required for Codex's simpler config model.
|
|
36
|
+
* @returns Environment variables for the spawned Codex process: `CODEX_HOME`
|
|
37
|
+
* pointing to `sessionDir`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function handleCodexSessionConfigSetup(payload: SessionConfigSetupRequest): Promise<SessionConfigSetupResponse>;
|
|
40
|
+
//# sourceMappingURL=session-config-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-config-handler.d.ts","sourceRoot":"","sources":["../../src/runtime/session-config-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAwBtG;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,0BAA0B,CAAC,CAkBrC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex client settings path resolution.
|
|
3
|
+
*
|
|
4
|
+
* Provides a pure utility for computing the filesystem paths where Codex
|
|
5
|
+
* stores its `hooks.json` configuration files — one global path under the
|
|
6
|
+
* resolved Codex config directory and an optional project-scoped path.
|
|
7
|
+
*
|
|
8
|
+
* No filesystem I/O is performed; callers are responsible for reading,
|
|
9
|
+
* writing, or watching the returned paths.
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Resolved filesystem paths for Codex `hooks.json` configuration files.
|
|
14
|
+
*
|
|
15
|
+
* The global path is always present. The project-scoped path is present
|
|
16
|
+
* only when a `projectDir` was supplied to {@link resolveCodexSettingsPaths}.
|
|
17
|
+
*/
|
|
18
|
+
export interface CodexSettingsPaths {
|
|
19
|
+
/** Absolute path to the global `hooks.json` file — always present. */
|
|
20
|
+
readonly globalHooks: string;
|
|
21
|
+
/**
|
|
22
|
+
* Absolute path to `{projectDir}/.codex/hooks.json`.
|
|
23
|
+
*
|
|
24
|
+
* `null` when no `projectDir` was provided to
|
|
25
|
+
* {@link resolveCodexSettingsPaths}.
|
|
26
|
+
*/
|
|
27
|
+
readonly projectHooks: string | null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the filesystem paths for Codex `hooks.json` configuration files.
|
|
31
|
+
*
|
|
32
|
+
* This is a pure function: it performs no I/O and has no side effects.
|
|
33
|
+
* The returned paths may or may not exist on disk.
|
|
34
|
+
* @param projectDir - Absolute path to the project root directory. When
|
|
35
|
+
* provided, {@link CodexSettingsPaths.projectHooks} is set to
|
|
36
|
+
* `{projectDir}/.codex/hooks.json`. When omitted, `projectHooks` is `null`.
|
|
37
|
+
* @param configDir - Optional Codex config root. When omitted, the global
|
|
38
|
+
* hooks path falls back to `~/.codex/hooks.json`.
|
|
39
|
+
* @returns Resolved paths for the global and optional project-scoped Codex
|
|
40
|
+
* hooks configuration files.
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolveCodexSettingsPaths(projectDir?: string, configDir?: string): CodexSettingsPaths;
|
|
43
|
+
//# sourceMappingURL=settings-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-paths.d.ts","sourceRoot":"","sources":["../../src/runtime/settings-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAED;;;;;;;;;;;;GAYG;AAQH,wBAAgB,yBAAyB,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,kBAAkB,CAMrG"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex wiring helpers.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions that translate between the Codex `hooks.json` configuration
|
|
5
|
+
* and the framework wiring contract. No bus dependency — callers are
|
|
6
|
+
* responsible for providing a {@link CodexClientSettings} instance and
|
|
7
|
+
* dispatching responses onto the bus.
|
|
8
|
+
*
|
|
9
|
+
* ## Wiring groups
|
|
10
|
+
* - `session-events` — one entry per hook event declared in the Codex client
|
|
11
|
+
* definition that maps to a `client.session.*` framework subject. When
|
|
12
|
+
* fired by the Codex CLI these hooks invoke a command of the form
|
|
13
|
+
* `makaio hook received codex <EventName>`, which the framework ingress
|
|
14
|
+
* bridge picks up and normalises.
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
*/
|
|
17
|
+
import type { ClientWiringEntry, ClientWiringApplyResponse, ClientWiringRemoveResponse } from '@makaio/framework/clients';
|
|
18
|
+
import type { CodexClientSettings } from './client-settings.js';
|
|
19
|
+
import type { CodexScope } from '../schemas/config.js';
|
|
20
|
+
/**
|
|
21
|
+
* Minimal settings API required by Codex wiring helpers.
|
|
22
|
+
*
|
|
23
|
+
* The concrete {@link CodexClientSettings} class satisfies this shape, while
|
|
24
|
+
* tests can provide a structurally typed fake without unsafe casts.
|
|
25
|
+
*/
|
|
26
|
+
export interface CodexWiringSettings {
|
|
27
|
+
/** List effective hook configuration. */
|
|
28
|
+
listHooks: CodexClientSettings['listHooks'];
|
|
29
|
+
/** Add a hook definition to a scope. */
|
|
30
|
+
addHook: CodexClientSettings['addHook'];
|
|
31
|
+
/** Remove hook definitions from a scope. */
|
|
32
|
+
removeHook: CodexClientSettings['removeHook'];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Substring used to identify Makaio-managed Codex hook commands.
|
|
36
|
+
*
|
|
37
|
+
* The full command for a given event takes the form:
|
|
38
|
+
* `<makaioCommand> hook received codex <EventName>`
|
|
39
|
+
*
|
|
40
|
+
* This sentinel is written verbatim by {@link applyCodexWiring} and used as
|
|
41
|
+
* the `commandContains` filter in {@link removeCodexWiring}.
|
|
42
|
+
*/
|
|
43
|
+
export declare const CODEX_HOOK_COMMAND_SENTINEL = "hook received codex";
|
|
44
|
+
/**
|
|
45
|
+
* Build the wiring entry list, annotated with installation status, by
|
|
46
|
+
* comparing the expected entries against the currently installed Codex hooks.
|
|
47
|
+
*
|
|
48
|
+
* Reads hooks from the global scope only when `projectDir` is absent; includes
|
|
49
|
+
* project-scope hooks when `projectDir` is provided.
|
|
50
|
+
* @param settings - {@link CodexClientSettings} instance for hook I/O.
|
|
51
|
+
* @param makaioCommand - Base makaio shell command written into the config.
|
|
52
|
+
* @param projectDir - Optional absolute project directory. When absent only
|
|
53
|
+
* the global scope is checked.
|
|
54
|
+
* @returns Object containing all wiring entries with `installed` flags.
|
|
55
|
+
*/
|
|
56
|
+
export declare function buildCodexWiringList(settings: CodexWiringSettings, makaioCommand: string, projectDir?: string): Promise<{
|
|
57
|
+
entries: ClientWiringEntry[];
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Install all session-event wiring entries into the specified scope.
|
|
61
|
+
*
|
|
62
|
+
* The operation uses replace semantics when `makaioCommand` changes: if a hook
|
|
63
|
+
* for an event already contains the sentinel but with a different command
|
|
64
|
+
* prefix, the old hook is removed before the new one is added. When the
|
|
65
|
+
* identical command is already present the entry is skipped unchanged.
|
|
66
|
+
* @param settings - {@link CodexClientSettings} instance for hook I/O.
|
|
67
|
+
* @param scope - Target scope (`'global'` or `'project'`).
|
|
68
|
+
* @param makaioCommand - Base makaio shell command written into each hook.
|
|
69
|
+
* @param projectDir - Absolute project directory. Required when `scope` is
|
|
70
|
+
* `'project'`; ignored for `'global'`.
|
|
71
|
+
* @returns Counts of applied (newly written or replaced) and skipped (already
|
|
72
|
+
* present) entries.
|
|
73
|
+
*/
|
|
74
|
+
export declare function applyCodexWiring(settings: CodexWiringSettings, scope: CodexScope, makaioCommand: string, projectDir?: string): Promise<ClientWiringApplyResponse>;
|
|
75
|
+
/**
|
|
76
|
+
* Remove all Makaio-managed session-event wiring entries from the specified
|
|
77
|
+
* scope.
|
|
78
|
+
*
|
|
79
|
+
* Entries that are not present are silently ignored — the operation is
|
|
80
|
+
* idempotent.
|
|
81
|
+
* @param settings - {@link CodexClientSettings} instance for hook I/O.
|
|
82
|
+
* @param scope - Target scope (`'global'` or `'project'`).
|
|
83
|
+
* @param projectDir - Absolute project directory. Required when `scope` is
|
|
84
|
+
* `'project'`; ignored for `'global'`.
|
|
85
|
+
* @returns Count of entries actually removed from the config file.
|
|
86
|
+
*/
|
|
87
|
+
export declare function removeCodexWiring(settings: CodexWiringSettings, scope: CodexScope, projectDir?: string): Promise<ClientWiringRemoveResponse>;
|
|
88
|
+
//# sourceMappingURL=wiring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wiring.d.ts","sourceRoot":"","sources":["../../src/runtime/wiring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAGrH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,yCAAyC;IACzC,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC5C,wCAAwC;IACxC,OAAO,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACxC,4CAA4C;IAC5C,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;CAC/C;AAMD;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,wBAAwB,CAAC;AAkBjE;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,mBAAmB,EAC7B,aAAa,EAAE,MAAM,EACrB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC;IAAE,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAAC,CAgB3C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,mBAAmB,EAC7B,KAAK,EAAE,UAAU,EACjB,aAAa,EAAE,MAAM,EACrB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,yBAAyB,CAAC,CA4CpC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,mBAAmB,EAC7B,KAAK,EAAE,UAAU,EACjB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,0BAA0B,CAAC,CAcrC"}
|