@cotal-ai/connector-codex 0.24.0 → 0.26.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,47 @@
1
+ /**
2
+ * Codex rollout records to AG-UI events.
3
+ *
4
+ * The durable record is the thread's rollout JSONL, not the app-server notification stream. The
5
+ * stream cannot make brackets legal across a restart, which is the property the emitter exists to
6
+ * provide, so the file is the record of truth and the stream is only how the host learns a thread
7
+ * id.
8
+ *
9
+ * Every rollout record is `{timestamp, type, payload}`. `type` is the envelope kind
10
+ * (`response_item`, `event_msg`, `session_meta`, `turn_context`, `world_state`, `compacted`) and
11
+ * `payload.type` is the inner kind for the first two. This mapper reads BOTH, because the same
12
+ * inner name appears under different envelopes and means different things: `agent_message` is an
13
+ * `event_msg` mirror of an assistant turn AND a `response_item` for inter-agent traffic.
14
+ *
15
+ * Derived against a real app-server thread, not against the operator's own
16
+ * sessions: `originator` is `cotal` there and the primer records ahead of the first turn do not
17
+ * occur in an operator corpus at all.
18
+ */
19
+ import { type AguiEvent } from "@cotal-ai/connector-core";
20
+ /** One rollout line. `payload` is `unknown` on purpose: it crosses in from a file this process did
21
+ * not write, so every field is checked at the point it is read rather than trusted by its type. */
22
+ export interface CodexRecord {
23
+ timestamp?: string;
24
+ type?: string;
25
+ payload?: unknown;
26
+ }
27
+ export interface CodexMapper {
28
+ map: (record: CodexRecord) => {
29
+ runId: string;
30
+ events: AguiEvent[];
31
+ } | null;
32
+ /** Drop a run the record stream never closed, when a turn terminal says it ended. Keyed on the
33
+ * id so a newer run opened in between is left alone. */
34
+ forgetOpenRun: (runId: string) => void;
35
+ }
36
+ /**
37
+ * @param threadId The native thread id, which is `session_meta.payload.id` and the rollout
38
+ * filename key. Passed in rather than read from the file: the caller resolved the path FROM this
39
+ * id, so reading it back would make the two independently derivable and let them disagree.
40
+ * @param mintRunId Injected so a test can make runs deterministic without the mapper owning a
41
+ * source of randomness.
42
+ */
43
+ export declare function createCodexMapper(opts: {
44
+ threadId: string;
45
+ mintRunId: () => string;
46
+ }): CodexMapper;
47
+ //# sourceMappingURL=agui-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agui-map.d.ts","sourceRoot":"","sources":["../src/agui-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAcL,KAAK,SAAS,EACf,MAAM,0BAA0B,CAAC;AAElC;oGACoG;AACpG,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;IAC5E;6DACyD;IACzD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AA+CD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,MAAM,CAAA;CAAE,GAAG,WAAW,CA2LlG"}
@@ -0,0 +1,17 @@
1
+ /** Walk `<root>/sessions` for the one file whose name ends `-<threadId>.jsonl`.
2
+ *
3
+ * Returns `undefined` rather than throwing when nothing matches: `thread/start` writes NOTHING to
4
+ * disk on its own, and the host's primer inject is what materializes the file, so a caller that
5
+ * arrives in that window has to be able to wait rather than fail. */
6
+ export declare function findRollout(codexHome: string, threadId: string): string | undefined;
7
+ /** {@link findRollout}, retried until the primer has materialized the file.
8
+ *
9
+ * Bounded and loud: a thread whose rollout never appears is a real fault (the emitter would have
10
+ * no durable source at all), so this returns `undefined` after the budget rather than waiting
11
+ * forever behind a caller that cannot see it is stuck. */
12
+ export declare function waitForRollout(codexHome: string, threadId: string, opts?: {
13
+ attempts?: number;
14
+ intervalMs?: number;
15
+ sleep?: (ms: number) => Promise<void>;
16
+ }): Promise<string | undefined>;
17
+ //# sourceMappingURL=agui-rollout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agui-rollout.d.ts","sourceRoot":"","sources":["../src/agui-rollout.ts"],"names":[],"mappings":"AAcA;;;;sEAIsE;AACtE,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAkDnF;AAED;;;;2DAI2D;AAC3D,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,GACvF,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAc7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAaA,OAAO,EAA2B,KAAK,SAAS,EAAuE,MAAM,gBAAgB,CAAC;AAuG9I,eAAO,MAAM,cAAc,EAAE,SAyH5B,CAAC"}
1
+ {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAaA,OAAO,EAA2B,KAAK,SAAS,EAAuE,MAAM,gBAAgB,CAAC;AAkG9I,eAAO,MAAM,cAAc,EAAE,SA6J5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAmQA,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CA6oBlD"}
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AA8UA,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAy3BlD"}