@ai0x0/codex-ts 0.1.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 +201 -0
- package/dist/core/src/codex_thread.d.ts +80 -0
- package/dist/core/src/codex_thread.d.ts.map +1 -0
- package/dist/core/src/codex_thread.js +167 -0
- package/dist/core/src/codex_thread.js.map +1 -0
- package/dist/core/src/index.d.ts +5 -0
- package/dist/core/src/index.d.ts.map +1 -0
- package/dist/core/src/index.js +4 -0
- package/dist/core/src/index.js.map +1 -0
- package/dist/core/src/session/turn.d.ts +34 -0
- package/dist/core/src/session/turn.d.ts.map +1 -0
- package/dist/core/src/session/turn.js +178 -0
- package/dist/core/src/session/turn.js.map +1 -0
- package/dist/core/src/tools/handlers/plan_spec.d.ts +14 -0
- package/dist/core/src/tools/handlers/plan_spec.d.ts.map +1 -0
- package/dist/core/src/tools/handlers/plan_spec.js +50 -0
- package/dist/core/src/tools/handlers/plan_spec.js.map +1 -0
- package/dist/core/src/tools/handlers/request_user_input.d.ts +17 -0
- package/dist/core/src/tools/handlers/request_user_input.d.ts.map +1 -0
- package/dist/core/src/tools/handlers/request_user_input.js +17 -0
- package/dist/core/src/tools/handlers/request_user_input.js.map +1 -0
- package/dist/core/src/tools/handlers/request_user_input_spec.d.ts +25 -0
- package/dist/core/src/tools/handlers/request_user_input_spec.d.ts.map +1 -0
- package/dist/core/src/tools/handlers/request_user_input_spec.js +51 -0
- package/dist/core/src/tools/handlers/request_user_input_spec.js.map +1 -0
- package/dist/core/src/tools/router.d.ts +30 -0
- package/dist/core/src/tools/router.d.ts.map +1 -0
- package/dist/core/src/tools/router.js +82 -0
- package/dist/core/src/tools/router.js.map +1 -0
- package/dist/core/tests/common/lib.d.ts +26 -0
- package/dist/core/tests/common/lib.d.ts.map +1 -0
- package/dist/core/tests/common/lib.js +97 -0
- package/dist/core/tests/common/lib.js.map +1 -0
- package/dist/core/tests/suite/goal.test.d.ts +6 -0
- package/dist/core/tests/suite/goal.test.d.ts.map +1 -0
- package/dist/core/tests/suite/goal.test.js +87 -0
- package/dist/core/tests/suite/goal.test.js.map +1 -0
- package/dist/core/tests/suite/plan.test.d.ts +5 -0
- package/dist/core/tests/suite/plan.test.d.ts.map +1 -0
- package/dist/core/tests/suite/plan.test.js +89 -0
- package/dist/core/tests/suite/plan.test.js.map +1 -0
- package/dist/core/tests/suite/request_user_input.test.d.ts +5 -0
- package/dist/core/tests/suite/request_user_input.test.d.ts.map +1 -0
- package/dist/core/tests/suite/request_user_input.test.js +151 -0
- package/dist/core/tests/suite/request_user_input.test.js.map +1 -0
- package/dist/core/tests/suite/resume.test.d.ts +8 -0
- package/dist/core/tests/suite/resume.test.d.ts.map +1 -0
- package/dist/core/tests/suite/resume.test.js +70 -0
- package/dist/core/tests/suite/resume.test.js.map +1 -0
- package/dist/ext/goal/src/index.d.ts +3 -0
- package/dist/ext/goal/src/index.d.ts.map +1 -0
- package/dist/ext/goal/src/index.js +3 -0
- package/dist/ext/goal/src/index.js.map +1 -0
- package/dist/ext/goal/src/spec.d.ts +13 -0
- package/dist/ext/goal/src/spec.d.ts.map +1 -0
- package/dist/ext/goal/src/spec.js +61 -0
- package/dist/ext/goal/src/spec.js.map +1 -0
- package/dist/ext/goal/src/tool.d.ts +34 -0
- package/dist/ext/goal/src/tool.d.ts.map +1 -0
- package/dist/ext/goal/src/tool.js +104 -0
- package/dist/ext/goal/src/tool.js.map +1 -0
- package/dist/protocol/src/index.d.ts +5 -0
- package/dist/protocol/src/index.d.ts.map +1 -0
- package/dist/protocol/src/index.js +2 -0
- package/dist/protocol/src/index.js.map +1 -0
- package/dist/protocol/src/plan_tool.d.ts +16 -0
- package/dist/protocol/src/plan_tool.d.ts.map +1 -0
- package/dist/protocol/src/plan_tool.js +5 -0
- package/dist/protocol/src/plan_tool.js.map +1 -0
- package/dist/protocol/src/protocol.d.ts +87 -0
- package/dist/protocol/src/protocol.d.ts.map +1 -0
- package/dist/protocol/src/protocol.js +8 -0
- package/dist/protocol/src/protocol.js.map +1 -0
- package/dist/protocol/src/request_user_input.d.ts +31 -0
- package/dist/protocol/src/request_user_input.d.ts.map +1 -0
- package/dist/protocol/src/request_user_input.js +3 -0
- package/dist/protocol/src/request_user_input.js.map +1 -0
- package/dist/protocol/src/user_input.d.ts +9 -0
- package/dist/protocol/src/user_input.d.ts.map +1 -0
- package/dist/protocol/src/user_input.js +3 -0
- package/dist/protocol/src/user_input.js.map +1 -0
- package/dist/state/src/index.d.ts +3 -0
- package/dist/state/src/index.d.ts.map +1 -0
- package/dist/state/src/index.js +2 -0
- package/dist/state/src/index.js.map +1 -0
- package/dist/state/src/runtime/goals.d.ts +48 -0
- package/dist/state/src/runtime/goals.d.ts.map +1 -0
- package/dist/state/src/runtime/goals.js +93 -0
- package/dist/state/src/runtime/goals.js.map +1 -0
- package/dist/thread-store/src/in_memory.d.ts +20 -0
- package/dist/thread-store/src/in_memory.d.ts.map +1 -0
- package/dist/thread-store/src/in_memory.js +70 -0
- package/dist/thread-store/src/in_memory.js.map +1 -0
- package/dist/thread-store/src/index.d.ts +8 -0
- package/dist/thread-store/src/index.d.ts.map +1 -0
- package/dist/thread-store/src/index.js +5 -0
- package/dist/thread-store/src/index.js.map +1 -0
- package/dist/thread-store/src/io_backend.d.ts +30 -0
- package/dist/thread-store/src/io_backend.d.ts.map +1 -0
- package/dist/thread-store/src/io_backend.js +31 -0
- package/dist/thread-store/src/io_backend.js.map +1 -0
- package/dist/thread-store/src/live_thread.d.ts +21 -0
- package/dist/thread-store/src/live_thread.d.ts.map +1 -0
- package/dist/thread-store/src/live_thread.js +42 -0
- package/dist/thread-store/src/live_thread.js.map +1 -0
- package/dist/thread-store/src/local_thread_store.d.ts +25 -0
- package/dist/thread-store/src/local_thread_store.d.ts.map +1 -0
- package/dist/thread-store/src/local_thread_store.js +96 -0
- package/dist/thread-store/src/local_thread_store.js.map +1 -0
- package/dist/thread-store/src/store.d.ts +22 -0
- package/dist/thread-store/src/store.d.ts.map +1 -0
- package/dist/thread-store/src/store.js +8 -0
- package/dist/thread-store/src/store.js.map +1 -0
- package/dist/thread-store/src/types.d.ts +72 -0
- package/dist/thread-store/src/types.d.ts.map +1 -0
- package/dist/thread-store/src/types.js +6 -0
- package/dist/thread-store/src/types.js.map +1 -0
- package/dist/tools/src/index.d.ts +5 -0
- package/dist/tools/src/index.d.ts.map +1 -0
- package/dist/tools/src/index.js +3 -0
- package/dist/tools/src/index.js.map +1 -0
- package/dist/tools/src/json_schema.d.ts +16 -0
- package/dist/tools/src/json_schema.d.ts.map +1 -0
- package/dist/tools/src/json_schema.js +26 -0
- package/dist/tools/src/json_schema.js.map +1 -0
- package/dist/tools/src/tool_spec.d.ts +21 -0
- package/dist/tools/src/tool_spec.d.ts.map +1 -0
- package/dist/tools/src/tool_spec.js +17 -0
- package/dist/tools/src/tool_spec.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in_memory.d.ts","sourceRoot":"","sources":["../../../thread-store/src/in_memory.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAEhB,YAAY,EACZ,mBAAmB,EAEnB,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAOpB,qBAAa,mBAAoB,YAAW,WAAW;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAEpD,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAcvD,WAAW,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB3D,WAAW,CACf,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,mBAAmB,CAAC;IAQzB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAMlE,oBAAoB,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAQvE,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAGzC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mirrors codex-rs/thread-store/src/in_memory.rs
|
|
3
|
+
*
|
|
4
|
+
* InMemoryThreadStore — reference implementation that works in both
|
|
5
|
+
* browser and Node.js without any I/O. Suitable for tests and ephemeral use.
|
|
6
|
+
*
|
|
7
|
+
* For durable storage supply a custom IoBackend to LocalThreadStore instead.
|
|
8
|
+
*/
|
|
9
|
+
export class InMemoryThreadStore {
|
|
10
|
+
threads = new Map();
|
|
11
|
+
async createThread(params) {
|
|
12
|
+
const now = params.createdAtMs;
|
|
13
|
+
this.threads.set(params.threadId, {
|
|
14
|
+
metadata: {
|
|
15
|
+
threadId: params.threadId,
|
|
16
|
+
preview: params.preview ?? "",
|
|
17
|
+
model: params.model,
|
|
18
|
+
createdAtMs: now,
|
|
19
|
+
updatedAtMs: now,
|
|
20
|
+
},
|
|
21
|
+
items: [],
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
async appendItems(params) {
|
|
25
|
+
// Auto-create on first append (upsert semantics, mirrors SQLite INSERT OR IGNORE)
|
|
26
|
+
if (!this.threads.has(params.threadId)) {
|
|
27
|
+
const now = Date.now();
|
|
28
|
+
this.threads.set(params.threadId, {
|
|
29
|
+
metadata: {
|
|
30
|
+
threadId: params.threadId,
|
|
31
|
+
preview: "",
|
|
32
|
+
model: "",
|
|
33
|
+
createdAtMs: now,
|
|
34
|
+
updatedAtMs: now,
|
|
35
|
+
},
|
|
36
|
+
items: [],
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const state = this.threads.get(params.threadId);
|
|
40
|
+
state.items.push(...params.items);
|
|
41
|
+
state.metadata.updatedAtMs = Date.now();
|
|
42
|
+
}
|
|
43
|
+
async loadHistory(params) {
|
|
44
|
+
const state = this.threads.get(params.threadId);
|
|
45
|
+
return {
|
|
46
|
+
threadId: params.threadId,
|
|
47
|
+
items: state ? [...state.items] : [],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
async readThread(params) {
|
|
51
|
+
const state = this.threads.get(params.threadId);
|
|
52
|
+
if (!state)
|
|
53
|
+
return null;
|
|
54
|
+
return { threadId: params.threadId, metadata: { ...state.metadata } };
|
|
55
|
+
}
|
|
56
|
+
async updateThreadMetadata(params) {
|
|
57
|
+
const state = this.threads.get(params.threadId);
|
|
58
|
+
if (!state)
|
|
59
|
+
return;
|
|
60
|
+
if (params.preview !== undefined)
|
|
61
|
+
state.metadata.preview = params.preview;
|
|
62
|
+
if (params.model !== undefined)
|
|
63
|
+
state.metadata.model = params.model;
|
|
64
|
+
state.metadata.updatedAtMs = Date.now();
|
|
65
|
+
}
|
|
66
|
+
async listThreadIds() {
|
|
67
|
+
return [...this.threads.keys()];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=in_memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in_memory.js","sourceRoot":"","sources":["../../../thread-store/src/in_memory.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAoBH,MAAM,OAAO,mBAAmB;IACb,OAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;IAE1D,KAAK,CAAC,YAAY,CAAC,MAA0B;QAC3C,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE;YAChC,QAAQ,EAAE;gBACR,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE;gBAC7B,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,WAAW,EAAE,GAAG;gBAChB,WAAW,EAAE,GAAG;aACj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CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,MAAkC;QAC3D,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS;YAAE,KAAK,CAAC,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC1E,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS;YAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QACpE,KAAK,CAAC,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAClC,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { ConversationItem, RolloutItem, CreateThreadParams, AppendThreadItemsParams, LoadThreadHistoryParams, ReadThreadParams, UpdateThreadMetadataParams, ThreadMetadata, StoredThreadHistory, StoredThread, } from "./types.js";
|
|
2
|
+
export type { ThreadStore } from "./store.js";
|
|
3
|
+
export type { IoBackend } from "./io_backend.js";
|
|
4
|
+
export { InMemoryIoBackend } from "./io_backend.js";
|
|
5
|
+
export { InMemoryThreadStore } from "./in_memory.js";
|
|
6
|
+
export { LocalThreadStore } from "./local_thread_store.js";
|
|
7
|
+
export { LiveThread } from "./live_thread.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../thread-store/src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,0BAA0B,EAC1B,cAAc,EACd,mBAAmB,EACnB,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../thread-store/src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IoBackend — the injectable storage primitive.
|
|
3
|
+
*
|
|
4
|
+
* This is the layer users replace to target different environments:
|
|
5
|
+
*
|
|
6
|
+
* Node.js → append/read lines from .jsonl files on disk
|
|
7
|
+
* Browser → append/read lines via OPFS or IndexedDB
|
|
8
|
+
* Test → in-memory Map (see InMemoryIoBackend below)
|
|
9
|
+
*
|
|
10
|
+
* It is intentionally narrow: only byte-level line I/O and thread enumeration.
|
|
11
|
+
* All serialisation is handled by LocalThreadStore.
|
|
12
|
+
*/
|
|
13
|
+
export interface IoBackend {
|
|
14
|
+
/** Append one serialised JSON line for a thread */
|
|
15
|
+
appendLine(threadId: string, line: string): Promise<void>;
|
|
16
|
+
/** Return all stored lines for a thread, in append order */
|
|
17
|
+
readLines(threadId: string): Promise<string[]>;
|
|
18
|
+
/** List all thread IDs that have at least one stored line */
|
|
19
|
+
listThreadIds(): Promise<string[]>;
|
|
20
|
+
/** Delete all stored data for a thread */
|
|
21
|
+
deleteThread(threadId: string): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
export declare class InMemoryIoBackend implements IoBackend {
|
|
24
|
+
private readonly store;
|
|
25
|
+
appendLine(threadId: string, line: string): Promise<void>;
|
|
26
|
+
readLines(threadId: string): Promise<string[]>;
|
|
27
|
+
listThreadIds(): Promise<string[]>;
|
|
28
|
+
deleteThread(threadId: string): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=io_backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"io_backend.d.ts","sourceRoot":"","sources":["../../../thread-store/src/io_backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,SAAS;IACxB,mDAAmD;IACnD,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,4DAA4D;IAC5D,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/C,6DAA6D;IAC7D,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACnC,0CAA0C;IAC1C,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C;AAID,qBAAa,iBAAkB,YAAW,SAAS;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+B;IAE/C,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMzD,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAI9C,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAIlC,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IoBackend — the injectable storage primitive.
|
|
3
|
+
*
|
|
4
|
+
* This is the layer users replace to target different environments:
|
|
5
|
+
*
|
|
6
|
+
* Node.js → append/read lines from .jsonl files on disk
|
|
7
|
+
* Browser → append/read lines via OPFS or IndexedDB
|
|
8
|
+
* Test → in-memory Map (see InMemoryIoBackend below)
|
|
9
|
+
*
|
|
10
|
+
* It is intentionally narrow: only byte-level line I/O and thread enumeration.
|
|
11
|
+
* All serialisation is handled by LocalThreadStore.
|
|
12
|
+
*/
|
|
13
|
+
// ─── InMemoryIoBackend (built-in; works in browser and Node.js) ───────────────
|
|
14
|
+
export class InMemoryIoBackend {
|
|
15
|
+
store = new Map();
|
|
16
|
+
async appendLine(threadId, line) {
|
|
17
|
+
const lines = this.store.get(threadId) ?? [];
|
|
18
|
+
lines.push(line);
|
|
19
|
+
this.store.set(threadId, lines);
|
|
20
|
+
}
|
|
21
|
+
async readLines(threadId) {
|
|
22
|
+
return [...(this.store.get(threadId) ?? [])];
|
|
23
|
+
}
|
|
24
|
+
async listThreadIds() {
|
|
25
|
+
return [...this.store.keys()];
|
|
26
|
+
}
|
|
27
|
+
async deleteThread(threadId) {
|
|
28
|
+
this.store.delete(threadId);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=io_backend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"io_backend.js","sourceRoot":"","sources":["../../../thread-store/src/io_backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAaH,iFAAiF;AAEjF,MAAM,OAAO,iBAAiB;IACX,KAAK,GAAG,IAAI,GAAG,EAAoB,CAAC;IAErD,KAAK,CAAC,UAAU,CAAC,QAAgB,EAAE,IAAY;QAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC7C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,QAAgB;QAC9B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAAgB;QACjC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mirrors codex-rs/thread-store/src/live_thread.rs
|
|
3
|
+
*
|
|
4
|
+
* LiveThread — handle for an active thread's persistence lifecycle.
|
|
5
|
+
* Keeps persistence details inside so session code stays clean.
|
|
6
|
+
*/
|
|
7
|
+
import type { ThreadStore } from "./store.js";
|
|
8
|
+
import type { ConversationItem } from "./types.js";
|
|
9
|
+
import type { EventMsg } from "../../protocol/src/protocol.js";
|
|
10
|
+
export declare class LiveThread {
|
|
11
|
+
private readonly threadId;
|
|
12
|
+
private readonly store;
|
|
13
|
+
constructor(threadId: string, store: ThreadStore);
|
|
14
|
+
/** Persist one or more conversation items */
|
|
15
|
+
appendConversationItems(items: ConversationItem[]): Promise<void>;
|
|
16
|
+
/** Persist a key event (TurnStarted, TurnComplete, etc.) */
|
|
17
|
+
appendEvent(msg: EventMsg): Promise<void>;
|
|
18
|
+
/** Load conversation history for resume */
|
|
19
|
+
loadConversationHistory(): Promise<ConversationItem[]>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=live_thread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live_thread.d.ts","sourceRoot":"","sources":["../../../thread-store/src/live_thread.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAe,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE/D,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;gBAExB,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;IAKhD,6CAA6C;IACvC,uBAAuB,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWvE,4DAA4D;IACtD,WAAW,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAO/C,2CAA2C;IACrC,uBAAuB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAU7D"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mirrors codex-rs/thread-store/src/live_thread.rs
|
|
3
|
+
*
|
|
4
|
+
* LiveThread — handle for an active thread's persistence lifecycle.
|
|
5
|
+
* Keeps persistence details inside so session code stays clean.
|
|
6
|
+
*/
|
|
7
|
+
export class LiveThread {
|
|
8
|
+
threadId;
|
|
9
|
+
store;
|
|
10
|
+
constructor(threadId, store) {
|
|
11
|
+
this.threadId = threadId;
|
|
12
|
+
this.store = store;
|
|
13
|
+
}
|
|
14
|
+
/** Persist one or more conversation items */
|
|
15
|
+
async appendConversationItems(items) {
|
|
16
|
+
const rolloutItems = items.map((item) => ({
|
|
17
|
+
kind: "ConversationItem",
|
|
18
|
+
item,
|
|
19
|
+
}));
|
|
20
|
+
await this.store.appendItems({
|
|
21
|
+
threadId: this.threadId,
|
|
22
|
+
items: rolloutItems,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** Persist a key event (TurnStarted, TurnComplete, etc.) */
|
|
26
|
+
async appendEvent(msg) {
|
|
27
|
+
await this.store.appendItems({
|
|
28
|
+
threadId: this.threadId,
|
|
29
|
+
items: [{ kind: "EventMsg", msg }],
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/** Load conversation history for resume */
|
|
33
|
+
async loadConversationHistory() {
|
|
34
|
+
const history = await this.store.loadHistory({
|
|
35
|
+
threadId: this.threadId,
|
|
36
|
+
});
|
|
37
|
+
return history.items
|
|
38
|
+
.filter((item) => item.kind === "ConversationItem")
|
|
39
|
+
.map((item) => item.item);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=live_thread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live_thread.js","sourceRoot":"","sources":["../../../thread-store/src/live_thread.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,OAAO,UAAU;IACJ,QAAQ,CAAS;IACjB,KAAK,CAAc;IAEpC,YAAY,QAAgB,EAAE,KAAkB;QAC9C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,6CAA6C;IAC7C,KAAK,CAAC,uBAAuB,CAAC,KAAyB;QACrD,MAAM,YAAY,GAAkB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACvD,IAAI,EAAE,kBAAkB;YACxB,IAAI;SACL,CAAC,CAAC,CAAC;QACJ,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;YAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,YAAY;SACpB,CAAC,CAAC;IACL,CAAC;IAED,4DAA4D;IAC5D,KAAK,CAAC,WAAW,CAAC,GAAa;QAC7B,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;YAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;SACnC,CAAC,CAAC;IACL,CAAC;IAED,2CAA2C;IAC3C,KAAK,CAAC,uBAAuB;QAC3B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;YAC3C,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QACH,OAAO,OAAO,CAAC,KAAK;aACjB,MAAM,CAAC,CAAC,IAAI,EAA8D,EAAE,CAC3E,IAAI,CAAC,IAAI,KAAK,kBAAkB,CACjC;aACA,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mirrors codex-rs/thread-store/src/local/ (LocalThreadStore)
|
|
3
|
+
*
|
|
4
|
+
* LocalThreadStore — durable ThreadStore that serialises RolloutItems as
|
|
5
|
+
* newline-delimited JSON and delegates byte I/O to an injected IoBackend.
|
|
6
|
+
*
|
|
7
|
+
* Supply any IoBackend implementation:
|
|
8
|
+
* - InMemoryIoBackend → ephemeral, works everywhere (default)
|
|
9
|
+
* - Custom Node.js impl → fs.appendFile / fs.readFile on .jsonl files
|
|
10
|
+
* - Custom browser impl → OPFS FileSystemWritableFileStream / read
|
|
11
|
+
*/
|
|
12
|
+
import type { IoBackend } from "./io_backend.js";
|
|
13
|
+
import type { ThreadStore } from "./store.js";
|
|
14
|
+
import type { AppendThreadItemsParams, CreateThreadParams, LoadThreadHistoryParams, ReadThreadParams, StoredThread, StoredThreadHistory, UpdateThreadMetadataParams } from "./types.js";
|
|
15
|
+
export declare class LocalThreadStore implements ThreadStore {
|
|
16
|
+
private readonly io;
|
|
17
|
+
constructor(io: IoBackend);
|
|
18
|
+
createThread(params: CreateThreadParams): Promise<void>;
|
|
19
|
+
appendItems(params: AppendThreadItemsParams): Promise<void>;
|
|
20
|
+
loadHistory(params: LoadThreadHistoryParams): Promise<StoredThreadHistory>;
|
|
21
|
+
readThread(params: ReadThreadParams): Promise<StoredThread | null>;
|
|
22
|
+
updateThreadMetadata(params: UpdateThreadMetadataParams): Promise<void>;
|
|
23
|
+
listThreadIds(): Promise<string[]>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=local_thread_store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local_thread_store.d.ts","sourceRoot":"","sources":["../../../thread-store/src/local_thread_store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAEhB,YAAY,EACZ,mBAAmB,EAEnB,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAcpB,qBAAa,gBAAiB,YAAW,WAAW;IACtC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,SAAS;IAEpC,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAYvD,WAAW,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAM3D,WAAW,CACf,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,mBAAmB,CAAC;IAgBzB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAgBlE,oBAAoB,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBvE,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAGzC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mirrors codex-rs/thread-store/src/local/ (LocalThreadStore)
|
|
3
|
+
*
|
|
4
|
+
* LocalThreadStore — durable ThreadStore that serialises RolloutItems as
|
|
5
|
+
* newline-delimited JSON and delegates byte I/O to an injected IoBackend.
|
|
6
|
+
*
|
|
7
|
+
* Supply any IoBackend implementation:
|
|
8
|
+
* - InMemoryIoBackend → ephemeral, works everywhere (default)
|
|
9
|
+
* - Custom Node.js impl → fs.appendFile / fs.readFile on .jsonl files
|
|
10
|
+
* - Custom browser impl → OPFS FileSystemWritableFileStream / read
|
|
11
|
+
*/
|
|
12
|
+
// Metadata is stored as a special first line in each thread's log.
|
|
13
|
+
const META_KIND = "__meta__";
|
|
14
|
+
function isMetaLine(obj) {
|
|
15
|
+
return (typeof obj === "object" &&
|
|
16
|
+
obj !== null &&
|
|
17
|
+
obj["kind"] === META_KIND);
|
|
18
|
+
}
|
|
19
|
+
export class LocalThreadStore {
|
|
20
|
+
io;
|
|
21
|
+
constructor(io) {
|
|
22
|
+
this.io = io;
|
|
23
|
+
}
|
|
24
|
+
async createThread(params) {
|
|
25
|
+
const metadata = {
|
|
26
|
+
threadId: params.threadId,
|
|
27
|
+
preview: params.preview ?? "",
|
|
28
|
+
model: params.model,
|
|
29
|
+
createdAtMs: params.createdAtMs,
|
|
30
|
+
updatedAtMs: params.createdAtMs,
|
|
31
|
+
};
|
|
32
|
+
const metaLine = { kind: META_KIND, metadata };
|
|
33
|
+
await this.io.appendLine(params.threadId, JSON.stringify(metaLine));
|
|
34
|
+
}
|
|
35
|
+
async appendItems(params) {
|
|
36
|
+
for (const item of params.items) {
|
|
37
|
+
await this.io.appendLine(params.threadId, JSON.stringify(item));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async loadHistory(params) {
|
|
41
|
+
const lines = await this.io.readLines(params.threadId);
|
|
42
|
+
const items = [];
|
|
43
|
+
for (const line of lines) {
|
|
44
|
+
try {
|
|
45
|
+
const parsed = JSON.parse(line);
|
|
46
|
+
if (!isMetaLine(parsed)) {
|
|
47
|
+
items.push(parsed);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
/* skip malformed lines */
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return { threadId: params.threadId, items };
|
|
55
|
+
}
|
|
56
|
+
async readThread(params) {
|
|
57
|
+
const lines = await this.io.readLines(params.threadId);
|
|
58
|
+
if (lines.length === 0)
|
|
59
|
+
return null;
|
|
60
|
+
for (const line of lines) {
|
|
61
|
+
try {
|
|
62
|
+
const parsed = JSON.parse(line);
|
|
63
|
+
if (isMetaLine(parsed)) {
|
|
64
|
+
return { threadId: params.threadId, metadata: parsed.metadata };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
/* skip */
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
async updateThreadMetadata(params) {
|
|
74
|
+
// Read current metadata, patch it, and append an updated meta line.
|
|
75
|
+
// The last meta line wins on read (latest-wins strategy).
|
|
76
|
+
const current = await this.readThread({ threadId: params.threadId });
|
|
77
|
+
const metadata = {
|
|
78
|
+
...(current?.metadata ?? {
|
|
79
|
+
threadId: params.threadId,
|
|
80
|
+
preview: "",
|
|
81
|
+
model: "",
|
|
82
|
+
createdAtMs: Date.now(),
|
|
83
|
+
updatedAtMs: Date.now(),
|
|
84
|
+
}),
|
|
85
|
+
...(params.preview !== undefined ? { preview: params.preview } : {}),
|
|
86
|
+
...(params.model !== undefined ? { model: params.model } : {}),
|
|
87
|
+
updatedAtMs: Date.now(),
|
|
88
|
+
};
|
|
89
|
+
const metaLine = { kind: META_KIND, metadata };
|
|
90
|
+
await this.io.appendLine(params.threadId, JSON.stringify(metaLine));
|
|
91
|
+
}
|
|
92
|
+
async listThreadIds() {
|
|
93
|
+
return this.io.listThreadIds();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=local_thread_store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local_thread_store.js","sourceRoot":"","sources":["../../../thread-store/src/local_thread_store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAgBH,mEAAmE;AACnE,MAAM,SAAS,GAAG,UAAU,CAAC;AAG7B,SAAS,UAAU,CAAC,GAAY;IAC9B,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACX,GAA+B,CAAC,MAAM,CAAC,KAAK,SAAS,CACvD,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,gBAAgB;IACE;IAA7B,YAA6B,EAAa;QAAb,OAAE,GAAF,EAAE,CAAW;IAAG,CAAC;IAE9C,KAAK,CAAC,YAAY,CAAC,MAA0B;QAC3C,MAAM,QAAQ,GAAmB;YAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE;YAC7B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAC;QACF,MAAM,QAAQ,GAAa,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;QACzD,MAAM,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;I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,EAAE,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mirrors codex-rs/thread-store/src/store.rs
|
|
3
|
+
*
|
|
4
|
+
* ThreadStore — storage-neutral thread persistence boundary.
|
|
5
|
+
* Implement this interface to provide a custom backing store.
|
|
6
|
+
*/
|
|
7
|
+
import type { AppendThreadItemsParams, CreateThreadParams, LoadThreadHistoryParams, ReadThreadParams, StoredThread, StoredThreadHistory, UpdateThreadMetadataParams } from "./types.js";
|
|
8
|
+
export interface ThreadStore {
|
|
9
|
+
/** Create a new thread record */
|
|
10
|
+
createThread(params: CreateThreadParams): Promise<void>;
|
|
11
|
+
/** Append canonical rollout items to a live thread */
|
|
12
|
+
appendItems(params: AppendThreadItemsParams): Promise<void>;
|
|
13
|
+
/** Load full rollout history for resume / replay */
|
|
14
|
+
loadHistory(params: LoadThreadHistoryParams): Promise<StoredThreadHistory>;
|
|
15
|
+
/** Read thread summary metadata */
|
|
16
|
+
readThread(params: ReadThreadParams): Promise<StoredThread | null>;
|
|
17
|
+
/** Update mutable thread metadata fields */
|
|
18
|
+
updateThreadMetadata(params: UpdateThreadMetadataParams): Promise<void>;
|
|
19
|
+
/** List all stored thread IDs */
|
|
20
|
+
listThreadIds(): Promise<string[]>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../thread-store/src/store.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD,sDAAsD;IACtD,WAAW,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5D,oDAAoD;IACpD,WAAW,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAE3E,mCAAmC;IACnC,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAEnE,4CAA4C;IAC5C,oBAAoB,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE,iCAAiC;IACjC,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../thread-store/src/store.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mirrors codex-rs/thread-store/src/types.rs (subset)
|
|
3
|
+
* mirrors codex-rs/protocol/src/protocol.rs (RolloutItem)
|
|
4
|
+
*/
|
|
5
|
+
import type { EventMsg } from "../../protocol/src/protocol.js";
|
|
6
|
+
export type ConversationItem = {
|
|
7
|
+
role: "user";
|
|
8
|
+
content: string | {
|
|
9
|
+
type: "input_text";
|
|
10
|
+
text: string;
|
|
11
|
+
}[];
|
|
12
|
+
} | {
|
|
13
|
+
role: "assistant";
|
|
14
|
+
content: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: "function_call";
|
|
17
|
+
call_id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
arguments: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: "function_call_output";
|
|
22
|
+
call_id: string;
|
|
23
|
+
output: string;
|
|
24
|
+
};
|
|
25
|
+
export type RolloutItem = {
|
|
26
|
+
kind: "ConversationItem";
|
|
27
|
+
item: ConversationItem;
|
|
28
|
+
} | {
|
|
29
|
+
kind: "EventMsg";
|
|
30
|
+
msg: EventMsg;
|
|
31
|
+
};
|
|
32
|
+
export interface CreateThreadParams {
|
|
33
|
+
threadId: string;
|
|
34
|
+
/** First user message, used as preview */
|
|
35
|
+
preview?: string | undefined;
|
|
36
|
+
model: string;
|
|
37
|
+
createdAtMs: number;
|
|
38
|
+
}
|
|
39
|
+
export interface AppendThreadItemsParams {
|
|
40
|
+
threadId: string;
|
|
41
|
+
items: RolloutItem[];
|
|
42
|
+
}
|
|
43
|
+
export interface LoadThreadHistoryParams {
|
|
44
|
+
threadId: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ReadThreadParams {
|
|
47
|
+
threadId: string;
|
|
48
|
+
}
|
|
49
|
+
export interface UpdateThreadMetadataParams {
|
|
50
|
+
threadId: string;
|
|
51
|
+
preview?: string | undefined;
|
|
52
|
+
model?: string | undefined;
|
|
53
|
+
}
|
|
54
|
+
export interface ThreadMetadata {
|
|
55
|
+
threadId: string;
|
|
56
|
+
preview: string;
|
|
57
|
+
model: string;
|
|
58
|
+
createdAtMs: number;
|
|
59
|
+
updatedAtMs: number;
|
|
60
|
+
}
|
|
61
|
+
export interface StoredThreadHistory {
|
|
62
|
+
threadId: string;
|
|
63
|
+
/** RolloutItems in append order */
|
|
64
|
+
items: RolloutItem[];
|
|
65
|
+
}
|
|
66
|
+
export interface StoredThread {
|
|
67
|
+
threadId: string;
|
|
68
|
+
metadata: ThreadMetadata;
|
|
69
|
+
/** Populated only when requested (mirrors include_history flag) */
|
|
70
|
+
history?: StoredThreadHistory | undefined;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../thread-store/src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAI/D,MAAM,MAAM,gBAAgB,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AM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,cAAc,CAAC;IACzB,mEAAmE;IACnE,OAAO,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;CAC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../thread-store/src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { JsonSchema } from "./json_schema.js";
|
|
2
|
+
export { object, string, integer, stringEnum, array } from "./json_schema.js";
|
|
3
|
+
export type { ResponsesApiTool, ToolSpec } from "./tool_spec.js";
|
|
4
|
+
export { toolSpecToRequestJson } from "./tool_spec.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../tools/src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9E,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../tools/src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** mirrors codex-rs/tools/src/json_schema helpers */
|
|
2
|
+
export interface JsonSchema {
|
|
3
|
+
type?: string | string[] | undefined;
|
|
4
|
+
description?: string | undefined;
|
|
5
|
+
properties?: Record<string, JsonSchema> | undefined;
|
|
6
|
+
required?: string[] | undefined;
|
|
7
|
+
additionalProperties?: boolean | JsonSchema | undefined;
|
|
8
|
+
items?: JsonSchema | undefined;
|
|
9
|
+
enum?: unknown[] | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare function object(properties: Record<string, JsonSchema>, required?: string[], additionalProperties?: boolean): JsonSchema;
|
|
12
|
+
export declare function string(description?: string): JsonSchema;
|
|
13
|
+
export declare function integer(description?: string): JsonSchema;
|
|
14
|
+
export declare function stringEnum(values: string[], description?: string): JsonSchema;
|
|
15
|
+
export declare function array(items: JsonSchema, description?: string): JsonSchema;
|
|
16
|
+
//# sourceMappingURL=json_schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json_schema.d.ts","sourceRoot":"","sources":["../../../tools/src/json_schema.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,SAAS,CAAC;IACpD,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAChC,oBAAoB,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;IACxD,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC/B,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;CAC9B;AAED,wBAAgB,MAAM,CACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACtC,QAAQ,CAAC,EAAE,MAAM,EAAE,EACnB,oBAAoB,CAAC,EAAE,OAAO,GAC7B,UAAU,CAOZ;AAED,wBAAgB,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,CAEvD;AAED,wBAAgB,OAAO,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,CAExD;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,CAM7E;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,CAEzE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** mirrors codex-rs/tools/src/json_schema helpers */
|
|
2
|
+
export function object(properties, required, additionalProperties) {
|
|
3
|
+
return {
|
|
4
|
+
type: "object",
|
|
5
|
+
properties,
|
|
6
|
+
...(required !== undefined ? { required } : {}),
|
|
7
|
+
...(additionalProperties !== undefined ? { additionalProperties } : {}),
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function string(description) {
|
|
11
|
+
return { type: "string", ...(description ? { description } : {}) };
|
|
12
|
+
}
|
|
13
|
+
export function integer(description) {
|
|
14
|
+
return { type: "integer", ...(description ? { description } : {}) };
|
|
15
|
+
}
|
|
16
|
+
export function stringEnum(values, description) {
|
|
17
|
+
return {
|
|
18
|
+
type: "string",
|
|
19
|
+
enum: values,
|
|
20
|
+
...(description ? { description } : {}),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function array(items, description) {
|
|
24
|
+
return { type: "array", items, ...(description ? { description } : {}) };
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=json_schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json_schema.js","sourceRoot":"","sources":["../../../tools/src/json_schema.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAYrD,MAAM,UAAU,MAAM,CACpB,UAAsC,EACtC,QAAmB,EACnB,oBAA8B;IAE9B,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,UAAU;QACV,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/C,GAAG,CAAC,oBAAoB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,WAAoB;IACzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,WAAoB;IAC1C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAgB,EAAE,WAAoB;IAC/D,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,MAAM;QACZ,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,KAAiB,EAAE,WAAoB;IAC3D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mirrors codex-rs/tools/src/tool_spec.rs
|
|
3
|
+
*
|
|
4
|
+
* Only the Function variant is needed — browser-safe tools are always
|
|
5
|
+
* plain function tools, never namespace or hosted tools.
|
|
6
|
+
*/
|
|
7
|
+
import type { JsonSchema } from "./json_schema.js";
|
|
8
|
+
export interface ResponsesApiTool {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
parameters: JsonSchema;
|
|
12
|
+
strict: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Subset of ToolSpec: Function only */
|
|
15
|
+
export type ToolSpec = {
|
|
16
|
+
type: "function";
|
|
17
|
+
tool: ResponsesApiTool;
|
|
18
|
+
};
|
|
19
|
+
/** Serialise a ToolSpec to the shape the Responses API expects */
|
|
20
|
+
export declare function toolSpecToRequestJson(spec: ToolSpec): Record<string, unknown>;
|
|
21
|
+
//# sourceMappingURL=tool_spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool_spec.d.ts","sourceRoot":"","sources":["../../../tools/src/tool_spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,wCAAwC;AACxC,MAAM,MAAM,QAAQ,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAEpE,kEAAkE;AAClE,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQ7E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mirrors codex-rs/tools/src/tool_spec.rs
|
|
3
|
+
*
|
|
4
|
+
* Only the Function variant is needed — browser-safe tools are always
|
|
5
|
+
* plain function tools, never namespace or hosted tools.
|
|
6
|
+
*/
|
|
7
|
+
/** Serialise a ToolSpec to the shape the Responses API expects */
|
|
8
|
+
export function toolSpecToRequestJson(spec) {
|
|
9
|
+
return {
|
|
10
|
+
type: "function",
|
|
11
|
+
name: spec.tool.name,
|
|
12
|
+
description: spec.tool.description,
|
|
13
|
+
parameters: spec.tool.parameters,
|
|
14
|
+
strict: spec.tool.strict,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=tool_spec.js.map
|