@cotal-ai/connector-codex 0.147.8 → 0.148.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.
@@ -0,0 +1,40 @@
1
+ /** What Codex records about the thread a call came from. */
2
+ export interface CodexThreadFacts {
3
+ id: string;
4
+ /** The thread's rollout file, or undefined for a thread Codex does not persist. */
5
+ path?: string;
6
+ cwd: string;
7
+ }
8
+ /** The executable of the Codex process that launched this server. The plugin's server is that
9
+ * process's direct child, so its own binary, and so its own queue semantics, answer for it. */
10
+ export declare function codexParentBinary(ppid?: number): string;
11
+ export declare class CodexController {
12
+ private readonly o;
13
+ private child?;
14
+ private ready?;
15
+ private next;
16
+ private readonly waiting;
17
+ /** One queue change per thread at a time, so a read-then-add cannot race another. */
18
+ private readonly serial;
19
+ constructor(o: {
20
+ bin: string;
21
+ env: NodeJS.ProcessEnv;
22
+ codexHome: string;
23
+ });
24
+ private start;
25
+ private send;
26
+ private call;
27
+ /** The thread as Codex records it, with its rollout checked to be its own, in this home. */
28
+ read(threadId: string): Promise<CodexThreadFacts>;
29
+ private list;
30
+ private alone;
31
+ /** Refuse unless this Codex serves the queue for the thread. */
32
+ supported(threadId: string): Promise<void>;
33
+ /** Queue `text` under `key` unless a submission with that key is already waiting. True when this
34
+ * call queued it. */
35
+ offer(threadId: string, key: string, text: string): Promise<boolean>;
36
+ /** Remove every waiting submission whose key starts with `key` and that `keep` does not keep. */
37
+ withdraw(threadId: string, key: string, keep?: (clientUserMessageId: string) => boolean): Promise<number>;
38
+ close(): void;
39
+ }
40
+ //# sourceMappingURL=native-queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-queue.d.ts","sourceRoot":"","sources":["../src/native-queue.ts"],"names":[],"mappings":"AA4BA,4DAA4D;AAC5D,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG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out from `start`, a position taken from the file itself. Codex appends
6
+ * to the rollout, so a change to the file is what asks the emitter to read. */
7
+ export declare function startCodexPersonalEvents(agent: MeshAgent, config: AgentConfig, env: NodeJS.ProcessEnv, threadId: string, rollout: string, start: string): CodexPersonalEvents;
8
+ //# sourceMappingURL=personal-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personal-events.d.ts","sourceRoot":"","sources":["../src/personal-events.ts"],"names":[],"mappings":"AASA,OAAO,EAEsC,KAAK,WAAW,EAAE,KAAK,SAAS,EAC5E,MAAM,0BAA0B,CAAC;AAKlC,MAAM,WAAW,mBAAmB;IAClC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED;gFACgF;AAChF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,EACpG,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,mBAAmB,CAqCvE"}
@@ -0,0 +1,34 @@
1
+ import { type GatewayHost } from "@cotal-ai/connector-core";
2
+ import type { CodexThreadFacts } from "./native-queue.js";
3
+ /** How often a pending request is replayed to the authority while the person decides, and how long
4
+ * past its expiry a replay may still bring the recorded decision. */
5
+ declare const WATCH: {
6
+ pollMs: number;
7
+ graceMs: number;
8
+ };
9
+ /** What the person decided about the conversation's pending request. */
10
+ export interface ApprovalNotice {
11
+ name: string;
12
+ status: "approved" | "denied" | "expired";
13
+ id: string;
14
+ }
15
+ export interface CodexPersonalHostOptions {
16
+ cotal: () => readonly string[];
17
+ env: NodeJS.ProcessEnv;
18
+ /** Codex's own record of a thread. */
19
+ thread: (id: string) => Promise<CodexThreadFacts>;
20
+ /** Tell the conversation what the person decided. */
21
+ notify?: (thread: string, notice: ApprovalNotice) => void;
22
+ /** A connection stopped serving: withdraw anything queued for it. */
23
+ released?: (thread: string, connection: string) => void;
24
+ watch?: typeof WATCH;
25
+ }
26
+ export interface CodexPersonalHost extends GatewayHost {
27
+ threadFor(connection: string): string | undefined;
28
+ closeAll(): Promise<void>;
29
+ }
30
+ /** The thread a tool call came from, from the metadata Codex attaches to it. */
31
+ export declare function codexThreadOf(meta: Readonly<Record<string, unknown>> | undefined): string;
32
+ export declare function createCodexPersonalHost(o: CodexPersonalHostOptions): CodexPersonalHost;
33
+ export {};
34
+ //# sourceMappingURL=personal-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personal-host.d.ts","sourceRoot":"","sources":["../src/personal-host.ts"],"names":[],"mappings":"AASA,OAAO,EAAkI,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5L,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAK1D;sEACsE;AACtE,QAAA,MAAM,KAAK;;;CAAsC,CAAC;AAGlD,wEAAwE;AACxE,MAAM,WAAW,cAAc;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE;AAEvG,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,SAAS,MAAM,EAAE,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,sCAAsC;IACtC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAClD,qDAAqD;IACrD,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1D,qEAAqE;IACrE,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAClD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AA2BD,gFAAgF;AAChF,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,GAAG,MAAM,CAQzF;AA0BD,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,wBAAwB,GAAG,iBAAiB,CAwMtF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=personal-main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personal-main.d.ts","sourceRoot":"","sources":["../src/personal-main.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { type ApprovalNotice } from "./personal-host.js";
2
+ /** Every queued notice is marked as Cotal's, so the conversation never reads it as the person's. */
3
+ export declare const NOTICE = "[Cotal notice: automated, not written by the person]";
4
+ /** The notice that starts a turn when messages are waiting. It names the connection and nothing a
5
+ * peer wrote. */
6
+ export declare function wakeNotice(connection: string): string;
7
+ export declare function approvalNotice(n: ApprovalNotice): string;
8
+ export declare function serveCodexPersonal(): Promise<void>;
9
+ //# sourceMappingURL=personal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personal.d.ts","sourceRoot":"","sources":["../src/personal.ts"],"names":[],"mappings":"AAeA,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAElF,oGAAoG;AACpG,eAAO,MAAM,MAAM,yDAAyD,CAAC;AAI7E;kBACkB;AAClB,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,CAIxD;AAmBD,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CA8DxD"}