-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Add some types and a basic test to the SDK #4472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
…esponse items - Only push assistant_message items to response items list - Set finalResponse directly from assistant_message text - Remove redundant getFinalResponse helper - Update tests to match changed item structure - Enable noImplicitAny in tsconfig for stricter type checking
…date tests - exec.ts: CodexExec now requires apiKey and baseUrl as part of exec args, removing hardcoded/test values. - index.ts: - CodexExec instantiated with only executablePath. - Codex stores options and provides to Conversation. - Conversation passes baseUrl/apiKey to exec, adds runStreamed. - Simplifies event handling, correct types. - Standardizes double
…acking, and add runStreamed test
…ests - Add support for resuming Codex threads by ID (Codex.resumeThread) - Track thread ID in Thread, wire through to CodexExec - Accept optional baseUrl, apiKey in Codex, CodexExec, Thread constructors - CodexExec.run now passes through sessionId, adds "resume" args if provided - startResponsesTestProxy: support multiple response bodies, record requests - Update and expand
- Added [email protected] to sdk/typescript dependencies - Added [email protected] to devDependencies (and lock related deps) - Updated jest, ts-jest, and config snapshots to include ts-node - Locked new supporting packages required for ts-node - No source code changes
… tsconfig to use ESNext module and bundler resolution
const thread = codex.startThread(); | ||
const rl = createInterface({ input, output }); | ||
|
||
const handleItemCompleted = (item: ConversationItem): void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note this style is less verbose:
const handleItemCompleted = (item: ConversationItem): void => { | |
function handleItemCompleted(item: ConversationItem): void { |
sdk/typescript/src/index.ts
Outdated
|
||
export class Codex { | ||
constructor() { | ||
private exec: CodexExec; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move these into their own files (codex.ts
, thread.ts
) so it makes it easier to find the definitions using ordinary file search? I think it's generally cleaner if index.ts
is only exports and no defs, anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on it
sessionId?: string | null; | ||
}; | ||
|
||
export class CodexExec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have some sort of dispose()
or shutdown()
method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exec invocations are relatively finite today, we should add support for abort controller though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a separate PR
sdk/typescript/src/exec.ts
Outdated
const exitCode: number | null = await new Promise((resolve) => { | ||
child.once("exit", (code) => resolve(code)); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not check code
and use that to resolve
vs reject
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On it
…pgrade @typescript-eslint deps, refactor to function declarations in tests
…ove unused globby and related packages from lockfile
No description provided.