@oai404iao/pi-codex-minimal-tools 1.3.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.
Files changed (39) hide show
  1. package/LICENSE +28 -0
  2. package/LICENSES/Apache-2.0.txt +201 -0
  3. package/LICENSES/OpenAI-Codex-NOTICE.txt +6 -0
  4. package/README.md +410 -0
  5. package/THIRD_PARTY_NOTICES.md +97 -0
  6. package/config.schema.json +174 -0
  7. package/models.schema.json +217 -0
  8. package/package.json +87 -0
  9. package/provenance/openai-codex-eb9dceba-reserved-tools.json +140 -0
  10. package/src/activation.ts +56 -0
  11. package/src/background-image-generation.ts +574 -0
  12. package/src/capabilities.ts +146 -0
  13. package/src/codex-http.ts +133 -0
  14. package/src/codex-request-profile.ts +45 -0
  15. package/src/codex-reserved-tools.ts +323 -0
  16. package/src/codex-wire-identity.ts +182 -0
  17. package/src/fast-mode.ts +124 -0
  18. package/src/glyphs.ts +70 -0
  19. package/src/index.ts +332 -0
  20. package/src/model-catalog/catalog.ts +636 -0
  21. package/src/model-catalog/default-models.json +252 -0
  22. package/src/model-catalog/runtime.ts +113 -0
  23. package/src/model-catalog/types.ts +95 -0
  24. package/src/native-compaction.ts +393 -0
  25. package/src/patch/apply.ts +338 -0
  26. package/src/patch/parser.ts +224 -0
  27. package/src/patch/render.ts +201 -0
  28. package/src/provider-headers.ts +54 -0
  29. package/src/provider-native-tools.ts +71 -0
  30. package/src/provider-shim.ts +4338 -0
  31. package/src/providers/codex-apply-patch-tool.ts +23 -0
  32. package/src/providers/codex-apply-patch.lark +19 -0
  33. package/src/providers/openai-responses-shared.ts +1463 -0
  34. package/src/settings.ts +247 -0
  35. package/src/tools/apply-patch.ts +84 -0
  36. package/src/tools/image-generation.ts +274 -0
  37. package/src/tools/view-image.ts +98 -0
  38. package/src/tools/web-search.ts +524 -0
  39. package/src/utils/images.ts +73 -0
@@ -0,0 +1,23 @@
1
+ import { readFileSync } from "node:fs";
2
+
3
+ export const CODEX_APPLY_PATCH_DESCRIPTION = "Use the `apply_patch` tool to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.";
4
+
5
+ let grammar: string | undefined;
6
+
7
+ export function codexApplyPatchGrammar(): string {
8
+ grammar ??= readFileSync(new URL("./codex-apply-patch.lark", import.meta.url), "utf8");
9
+ return grammar;
10
+ }
11
+
12
+ export function createCodexApplyPatchCustomTool(): Record<string, unknown> {
13
+ return {
14
+ type: "custom",
15
+ name: "apply_patch",
16
+ description: CODEX_APPLY_PATCH_DESCRIPTION,
17
+ format: {
18
+ type: "grammar",
19
+ syntax: "lark",
20
+ definition: codexApplyPatchGrammar(),
21
+ },
22
+ };
23
+ }
@@ -0,0 +1,19 @@
1
+ start: begin_patch hunk+ end_patch
2
+ begin_patch: "*** Begin Patch" LF
3
+ end_patch: "*** End Patch" LF?
4
+
5
+ hunk: add_hunk | delete_hunk | update_hunk
6
+ add_hunk: "*** Add File: " filename LF add_line+
7
+ delete_hunk: "*** Delete File: " filename LF
8
+ update_hunk: "*** Update File: " filename LF change_move? change?
9
+
10
+ filename: /(.+)/
11
+ add_line: "+" /(.*)/ LF -> line
12
+
13
+ change_move: "*** Move to: " filename LF
14
+ change: (change_context | change_line)+ eof_line?
15
+ change_context: ("@@" | "@@ " /(.+)/) LF
16
+ change_line: ("+" | "-" | " ") /(.*)/ LF
17
+ eof_line: "*** End of File" LF
18
+
19
+ %import common.LF