@poe-platform/safe-bash 0.1.821 → 0.1.823

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 (93) hide show
  1. package/dist/safe-bash/chunks/{chunk-HNT2MR4W.js → chunk-363QOIDR.js} +2 -1
  2. package/dist/safe-bash/chunks/chunk-AGHV53VF.js +42 -0
  3. package/dist/safe-bash/chunks/{chunk-VF3Q2V3E.js → chunk-RAFD5ZAH.js} +1 -1
  4. package/dist/safe-bash/chunks/{chunk-67QE3JLU.js → chunk-TZRVK3NU.js} +1 -1
  5. package/dist/safe-bash/chunks/{chunk-IRJS54AA.js → chunk-VWLQDZFF.js} +20 -12
  6. package/dist/safe-bash/chunks/{chunk-NAETSXBW.js → chunk-ZJAXMB5M.js} +1 -1
  7. package/dist/safe-bash/command-chunks/{chunk-QX3WKBLI.js → chunk-36FV6BAG.js} +5 -3
  8. package/dist/safe-bash/command-chunks/{chunk-ZSHXZ3XG.js → chunk-3EAZRKI4.js} +7 -7
  9. package/dist/safe-bash/command-chunks/chunk-64HIOP7Q.js +993 -0
  10. package/dist/safe-bash/command-chunks/{chunk-WOT2YXBT.js → chunk-7ZQVMPSB.js} +213 -42
  11. package/dist/safe-bash/command-chunks/{chunk-GRFJKJFN.js → chunk-AVSINNZ6.js} +233 -3
  12. package/dist/safe-bash/command-chunks/{chunk-BZLLQWRK.js → chunk-E5CDHXFA.js} +2 -2
  13. package/dist/safe-bash/command-chunks/{chunk-RHXV2KG5.js → chunk-EO3RYGUZ.js} +1010 -58
  14. package/dist/safe-bash/command-chunks/{chunk-MCUDSE4H.js → chunk-EWECMOQ5.js} +1 -1
  15. package/dist/safe-bash/command-chunks/{chunk-RTUDDAAY.js → chunk-O3KFOFJM.js} +1 -1
  16. package/dist/safe-bash/command-chunks/{chunk-SLD5A7IL.js → chunk-OU5UEUZN.js} +1 -1
  17. package/dist/safe-bash/command-chunks/{chunk-RKAL5VFP.js → chunk-PLVFJ6FF.js} +255 -616
  18. package/dist/safe-bash/command-chunks/{chunk-CJIFJ45R.js → chunk-QBCEAYQT.js} +1 -1
  19. package/dist/safe-bash/command-chunks/{chunk-4Q3HP33O.js → chunk-RGKHTSUY.js} +146 -123
  20. package/dist/safe-bash/command-chunks/{chunk-I7MEH76L.js → chunk-UYNJF5QN.js} +1 -1
  21. package/dist/safe-bash/command-chunks/{chunk-IAHYG67O.js → chunk-V5ZBRM5R.js} +3 -3
  22. package/dist/safe-bash/command-chunks/{chunk-R4NPYXQX.js → chunk-WDTWJFPK.js} +320 -67
  23. package/dist/safe-bash/command-chunks/{chunk-GQV5RWMN.js → chunk-ZFXHSFTU.js} +1 -1
  24. package/dist/safe-bash/command-chunks/{prompt-tool-debug-ERJKK3XZ.js → prompt-tool-debug-3POFNRYP.js} +5 -5
  25. package/dist/safe-bash/commands/bc/index.browser.js +1 -1
  26. package/dist/safe-bash/commands/llm/index.browser.js +3 -1
  27. package/dist/safe-bash/commands/llm/index.js +1 -1
  28. package/dist/safe-bash/commands/python/executor.browser.js +12 -1
  29. package/dist/safe-bash/commands/python/executor.js +1 -1
  30. package/dist/safe-bash/commands/python/index.browser.js +23 -1
  31. package/dist/safe-bash/commands/python/index.js +1 -1
  32. package/dist/safe-bash/core.browser.js +2 -2
  33. package/dist/safe-bash/full-core.browser.js +30 -6
  34. package/dist/safe-bash/plugins/index.browser.js +3 -3
  35. package/dist/safe-bash/registry-entry.browser.js +2 -2
  36. package/dist/safe-bash/search.browser.js +1 -1
  37. package/dist/safe-bash/shell/runtime.d.ts +2 -2
  38. package/dist/safe-bash/shell/runtime.js +11 -2
  39. package/dist/safe-bash/shell/sync-extra-evaluators.js +12 -12
  40. package/dist/safe-bash/shell-entry.browser.js +2 -2
  41. package/dist/safe-bash-command-llm/collections.js +24 -65
  42. package/dist/safe-bash-command-llm/command.js +6 -6
  43. package/dist/safe-bash-command-llm/fragment-loaders.d.ts +3 -2
  44. package/dist/safe-bash-command-llm/index.d.ts +3 -2
  45. package/dist/safe-bash-command-llm/index.js +10 -8
  46. package/dist/safe-bash-command-llm/loader-provider.d.ts +25 -0
  47. package/dist/safe-bash-command-llm/openai-sse.js +2 -2
  48. package/dist/safe-bash-command-llm/openai.js +4 -4
  49. package/dist/safe-bash-command-llm/providers/index.js +4 -4
  50. package/dist/safe-bash-command-llm/providers/openai.js +4 -4
  51. package/dist/safe-bash-command-llm/python-unicode.d.ts +2 -0
  52. package/dist/safe-bash-command-llm/templates.d.ts +7 -2
  53. package/dist/safe-bash-command-llm/types.d.ts +7 -1
  54. package/dist/safe-bash-command-mcp/index.browser.js +3 -0
  55. package/dist/safe-bash-command-mcp/index.js +3 -0
  56. package/dist/safe-bash-command-patch/index.js +2 -2
  57. package/dist/safe-bash-command-patch/patch-publication.js +1 -1
  58. package/dist/safe-bash-command-patch/patch.js +2 -2
  59. package/dist/safe-bash-command-python/build-backend.d.ts +51 -0
  60. package/dist/safe-bash-command-python/build-dependencies.d.ts +12 -0
  61. package/dist/safe-bash-command-python/build-environment.d.ts +3 -0
  62. package/dist/safe-bash-command-python/build-wheel.d.ts +8 -0
  63. package/dist/safe-bash-command-python/executor.d.ts +12 -2
  64. package/dist/safe-bash-command-python/executor.js +26 -4
  65. package/dist/safe-bash-command-python/index.js +26 -4
  66. package/dist/safe-bash-command-python/jspi.js +2 -2
  67. package/dist/safe-bash-command-python/llm-assets-node.js +1 -1
  68. package/dist/safe-bash-command-python/llm-fragment-loader.d.ts +6 -0
  69. package/dist/safe-bash-command-python/llm-functions-loader.d.ts +5 -1
  70. package/dist/safe-bash-command-python/llm-loader-discovery.d.ts +13 -0
  71. package/dist/safe-bash-command-python/llm-package-manager.d.ts +7 -0
  72. package/dist/safe-bash-command-python/llm-template-loader.d.ts +6 -0
  73. package/dist/safe-bash-command-python/manifest.d.ts +13 -0
  74. package/dist/safe-bash-command-python/provisioning.d.ts +33 -5
  75. package/dist/safe-bash-command-python/provisioning.js +1 -1
  76. package/dist/safe-bash-command-python/source-environment.d.ts +9 -0
  77. package/dist/safe-bash-command-python/source-snapshot.d.ts +8 -0
  78. package/dist/safe-bash-command-python/worker.js +3 -185
  79. package/dist/safe-bash-csv-engine/index.js +1 -1
  80. package/dist/safe-bash-csv-engine/python-iso2022.d.ts +21 -0
  81. package/dist/safe-bash-csv-engine/python-utf7.d.ts +18 -0
  82. package/dist/safe-bash-csv-engine/text-decoder.d.ts +2 -0
  83. package/dist/safe-bash-csv-engine/text-decoder.js +7 -3
  84. package/dist/safe-bash-zip-engine/index.js +1 -1
  85. package/dist/safe-bash-zip-engine/zip/repair.js +1 -1
  86. package/dist/safe-bash-zip-engine/zip/sfx.js +1 -1
  87. package/dist/safe-bash-zip-engine/zip-format.d.ts +3 -1
  88. package/dist/safe-bash-zip-engine/zip-format.js +1 -1
  89. package/dist/safe-playwright-cloudflare/shell-browser-resource.d.ts +1 -1
  90. package/dist/safe-playwright-cloudflare/shell-browser-resource.js +35 -20
  91. package/package.json +3 -3
  92. package/dist/safe-bash/chunks/chunk-PSD2RSOS.js +0 -31
  93. package/dist/safe-bash/command-chunks/chunk-5EFNQ6FY.js +0 -458
@@ -1,8 +1,11 @@
1
1
  // packages/safe-bash/src/commands/python/executor.ts
2
- import { PythonFailure, PythonPackageConflictError, createPythonExecutorCommands, createPythonExecutorPool, createPythonHostBridge, createPythonJspiAssets, createPythonJspiExecutor, createPythonJspiNativeCall, createPythonJspiStatResult, createPythonJspiTrampoline, createPythonLlmCapability, createPythonLlmToolLoader, createPythonPackageCache, createPythonPackageEnvironment, createPythonPackageManifestStore, createPythonShellCapability, inspectPythonCapabilities, installPythonLlmDependencies, installPythonLlmPackages, pythonDocumentPackages, pythonExecutorCommands, pythonHostFailureCode, pythonLlmDependencies, pythonLlmPackages } from "../../../safe-bash-command-python/executor.js";
2
+ import { PythonFailure, PythonPackageConflictError, createPythonBuildBackend, createPythonBuildDependencies, createPythonBuildEnvironment, createPythonExecutorCommands, createPythonExecutorPool, createPythonHostBridge, createPythonJspiAssets, createPythonJspiExecutor, createPythonJspiNativeCall, createPythonJspiStatResult, createPythonJspiTrampoline, createPythonLlmCapability, createPythonLlmFragmentLoader, createPythonLlmLoaderDiscovery, createPythonLlmLoaderProvider, createPythonLlmPackageManager, createPythonLlmTemplateLoader, createPythonLlmToolLoader, createPythonPackageCache, createPythonPackageEnvironment, createPythonPackageManifestStore, createPythonShellCapability, createPythonSourcePackageEnvironment, createPythonSourceSnapshot, inspectPythonCapabilities, installPythonLlmDependencies, installPythonLlmPackages, publishPythonBuildWheel, pythonDocumentPackages, pythonExecutorCommands, pythonHostFailureCode, pythonLlmDependencies, pythonLlmPackages } from "../../../safe-bash-command-python/executor.js";
3
3
  export {
4
4
  PythonFailure,
5
5
  PythonPackageConflictError,
6
+ createPythonBuildBackend,
7
+ createPythonBuildDependencies,
8
+ createPythonBuildEnvironment,
6
9
  createPythonExecutorCommands,
7
10
  createPythonExecutorPool,
8
11
  createPythonHostBridge,
@@ -12,14 +15,22 @@ export {
12
15
  createPythonJspiStatResult,
13
16
  createPythonJspiTrampoline,
14
17
  createPythonLlmCapability,
18
+ createPythonLlmFragmentLoader,
19
+ createPythonLlmLoaderDiscovery,
20
+ createPythonLlmLoaderProvider,
21
+ createPythonLlmPackageManager,
22
+ createPythonLlmTemplateLoader,
15
23
  createPythonLlmToolLoader,
16
24
  createPythonPackageCache,
17
25
  createPythonPackageEnvironment,
18
26
  createPythonPackageManifestStore,
19
27
  createPythonShellCapability,
28
+ createPythonSourcePackageEnvironment,
29
+ createPythonSourceSnapshot,
20
30
  inspectPythonCapabilities,
21
31
  installPythonLlmDependencies,
22
32
  installPythonLlmPackages,
33
+ publishPythonBuildWheel,
23
34
  pythonDocumentPackages,
24
35
  pythonExecutorCommands,
25
36
  pythonHostFailureCode,
@@ -1,2 +1,2 @@
1
- export { "PythonFailure", "PythonPackageConflictError", "createPythonExecutorCommands", "createPythonExecutorPool", "createPythonHostBridge", "createPythonJspiAssets", "createPythonJspiExecutor", "createPythonJspiNativeCall", "createPythonJspiStatResult", "createPythonJspiTrampoline", "createPythonLlmCapability", "createPythonLlmToolLoader", "createPythonPackageCache", "createPythonPackageEnvironment", "createPythonPackageManifestStore", "createPythonShellCapability", "inspectPythonCapabilities", "installPythonLlmDependencies", "installPythonLlmPackages", "pythonDocumentPackages", "pythonExecutorCommands", "pythonHostFailureCode", "pythonLlmDependencies", "pythonLlmPackages" } from "../../../safe-bash-command-python/executor.js";
1
+ export { "PythonFailure", "PythonPackageConflictError", "createPythonBuildBackend", "createPythonBuildDependencies", "createPythonBuildEnvironment", "createPythonExecutorCommands", "createPythonExecutorPool", "createPythonHostBridge", "createPythonJspiAssets", "createPythonJspiExecutor", "createPythonJspiNativeCall", "createPythonJspiStatResult", "createPythonJspiTrampoline", "createPythonLlmCapability", "createPythonLlmFragmentLoader", "createPythonLlmLoaderDiscovery", "createPythonLlmLoaderProvider", "createPythonLlmPackageManager", "createPythonLlmTemplateLoader", "createPythonLlmToolLoader", "createPythonPackageCache", "createPythonPackageEnvironment", "createPythonPackageManifestStore", "createPythonShellCapability", "createPythonSourcePackageEnvironment", "createPythonSourceSnapshot", "inspectPythonCapabilities", "installPythonLlmDependencies", "installPythonLlmPackages", "publishPythonBuildWheel", "pythonDocumentPackages", "pythonExecutorCommands", "pythonHostFailureCode", "pythonLlmDependencies", "pythonLlmPackages" } from "../../../safe-bash-command-python/executor.js";
2
2
  //# sourceMappingURL=executor.js.map
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  PythonFailure,
3
3
  PythonPackageConflictError,
4
+ createPythonBuildBackend,
5
+ createPythonBuildDependencies,
6
+ createPythonBuildEnvironment,
4
7
  createPythonCommands,
5
8
  createPythonExecutorCommands,
6
9
  createPythonExecutorPool,
@@ -11,24 +14,35 @@ import {
11
14
  createPythonJspiStatResult,
12
15
  createPythonJspiTrampoline,
13
16
  createPythonLlmCapability,
17
+ createPythonLlmFragmentLoader,
18
+ createPythonLlmLoaderDiscovery,
19
+ createPythonLlmLoaderProvider,
20
+ createPythonLlmPackageManager,
21
+ createPythonLlmTemplateLoader,
14
22
  createPythonLlmToolLoader,
15
23
  createPythonPackageCache,
16
24
  createPythonPackageEnvironment,
17
25
  createPythonPackageManifestStore,
18
26
  createPythonShellCapability,
27
+ createPythonSourcePackageEnvironment,
28
+ createPythonSourceSnapshot,
19
29
  inspectPythonCapabilities,
20
30
  installPythonLlmDependencies,
21
31
  installPythonLlmPackages,
32
+ publishPythonBuildWheel,
22
33
  pythonCommands,
23
34
  pythonDocumentPackages,
24
35
  pythonExecutorCommands,
25
36
  pythonHostFailureCode,
26
37
  pythonLlmDependencies,
27
38
  pythonLlmPackages
28
- } from "../../chunks/chunk-PSD2RSOS.js";
39
+ } from "../../chunks/chunk-AGHV53VF.js";
29
40
  export {
30
41
  PythonFailure,
31
42
  PythonPackageConflictError,
43
+ createPythonBuildBackend,
44
+ createPythonBuildDependencies,
45
+ createPythonBuildEnvironment,
32
46
  createPythonCommands,
33
47
  createPythonExecutorCommands,
34
48
  createPythonExecutorPool,
@@ -39,14 +53,22 @@ export {
39
53
  createPythonJspiStatResult,
40
54
  createPythonJspiTrampoline,
41
55
  createPythonLlmCapability,
56
+ createPythonLlmFragmentLoader,
57
+ createPythonLlmLoaderDiscovery,
58
+ createPythonLlmLoaderProvider,
59
+ createPythonLlmPackageManager,
60
+ createPythonLlmTemplateLoader,
42
61
  createPythonLlmToolLoader,
43
62
  createPythonPackageCache,
44
63
  createPythonPackageEnvironment,
45
64
  createPythonPackageManifestStore,
46
65
  createPythonShellCapability,
66
+ createPythonSourcePackageEnvironment,
67
+ createPythonSourceSnapshot,
47
68
  inspectPythonCapabilities,
48
69
  installPythonLlmDependencies,
49
70
  installPythonLlmPackages,
71
+ publishPythonBuildWheel,
50
72
  pythonCommands,
51
73
  pythonDocumentPackages,
52
74
  pythonExecutorCommands,
@@ -1,2 +1,2 @@
1
- export { "PythonFailure", "PythonPackageConflictError", "createPythonCommands", "createPythonExecutorCommands", "createPythonExecutorPool", "createPythonHostBridge", "createPythonJspiAssets", "createPythonJspiExecutor", "createPythonJspiNativeCall", "createPythonJspiStatResult", "createPythonJspiTrampoline", "createPythonLlmCapability", "createPythonLlmToolLoader", "createPythonPackageCache", "createPythonPackageEnvironment", "createPythonPackageManifestStore", "createPythonShellCapability", "inspectPythonCapabilities", "installPythonLlmDependencies", "installPythonLlmPackages", "pythonCommands", "pythonDocumentPackages", "pythonExecutorCommands", "pythonHostFailureCode", "pythonLlmDependencies", "pythonLlmPackages" } from "../../../safe-bash-command-python/index.js";
1
+ export { "PythonFailure", "PythonPackageConflictError", "createPythonBuildBackend", "createPythonBuildDependencies", "createPythonBuildEnvironment", "createPythonCommands", "createPythonExecutorCommands", "createPythonExecutorPool", "createPythonHostBridge", "createPythonJspiAssets", "createPythonJspiExecutor", "createPythonJspiNativeCall", "createPythonJspiStatResult", "createPythonJspiTrampoline", "createPythonLlmCapability", "createPythonLlmFragmentLoader", "createPythonLlmLoaderDiscovery", "createPythonLlmLoaderProvider", "createPythonLlmPackageManager", "createPythonLlmTemplateLoader", "createPythonLlmToolLoader", "createPythonPackageCache", "createPythonPackageEnvironment", "createPythonPackageManifestStore", "createPythonShellCapability", "createPythonSourcePackageEnvironment", "createPythonSourceSnapshot", "inspectPythonCapabilities", "installPythonLlmDependencies", "installPythonLlmPackages", "publishPythonBuildWheel", "pythonCommands", "pythonDocumentPackages", "pythonExecutorCommands", "pythonHostFailureCode", "pythonLlmDependencies", "pythonLlmPackages" } from "../../../safe-bash-command-python/index.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -3,6 +3,6 @@ export { CommandRegistry, Shell, ShellLimitError, ShellSyntaxError, cloudflareWo
3
3
  export { baseAgentCommands, createBoundedRegexProvider } from "./registry-entry.browser.js";
4
4
  export { agentCommands, createAgentCommands } from "./plugins/index.browser.js";
5
5
  export { EreLedger, EreProfileLimitError, EreSyntaxError, EreUnsupportedError, EreUsageUnknownError, RegexExecutionError, RegexExecutor, RegexSession, compileEre, matchEre } from "./commands/regex-execution/public.browser.js";
6
- export { PythonFailure, PythonPackageConflictError, createPythonExecutorCommands, createPythonExecutorPool, createPythonHostBridge, createPythonJspiAssets, createPythonJspiExecutor, createPythonJspiNativeCall, createPythonJspiStatResult, createPythonJspiTrampoline, createPythonLlmCapability, createPythonLlmToolLoader, createPythonPackageCache, createPythonPackageEnvironment, createPythonPackageManifestStore, createPythonShellCapability, inspectPythonCapabilities, installPythonLlmDependencies, installPythonLlmPackages, pythonDocumentPackages, pythonExecutorCommands, pythonHostFailureCode, pythonLlmDependencies, pythonLlmPackages } from "./commands/python/executor.browser.js";
6
+ export { PythonFailure, PythonPackageConflictError, createPythonBuildBackend, createPythonBuildDependencies, createPythonBuildEnvironment, createPythonExecutorCommands, createPythonExecutorPool, createPythonHostBridge, createPythonJspiAssets, createPythonJspiExecutor, createPythonJspiNativeCall, createPythonJspiStatResult, createPythonJspiTrampoline, createPythonLlmCapability, createPythonLlmFragmentLoader, createPythonLlmLoaderDiscovery, createPythonLlmLoaderProvider, createPythonLlmPackageManager, createPythonLlmTemplateLoader, createPythonLlmToolLoader, createPythonPackageCache, createPythonPackageEnvironment, createPythonPackageManifestStore, createPythonShellCapability, createPythonSourcePackageEnvironment, createPythonSourceSnapshot, inspectPythonCapabilities, installPythonLlmDependencies, installPythonLlmPackages, publishPythonBuildWheel, pythonDocumentPackages, pythonExecutorCommands, pythonHostFailureCode, pythonLlmDependencies, pythonLlmPackages } from "./commands/python/executor.browser.js";
7
7
  export { createPythonCommands, pythonCommands } from "./commands/python/index.browser.js";
8
- export { LlmCancelToolCall, createElevenLabsProvider, createLlmCommand, createLlmCommands, createLlmConfiguration, createLlmFragmentLoaders, createLlmFragmentSource, createLlmInputBudget, createLlmService, createLlmSpool, createLlmTemplateStore, createLlmToolRegistry, createLlmUrlFragmentSource, createLlmUrlSource, createOpenAiProvider, encodeLlmBase64, evaluateLlmTemplate, executeLlmToolCalls, findExtractedRange, getLlmAttachmentUrlId, getLlmFragmentPrefix, getLlmModelAliases, llmCommands, llmReferenceVersion, llmTemplateUsesInput, loadLlmPluginFragments, openAiChatOptions, parseLlmSchemaDsl, resolveLlmSchemaInput, resolveLlmUrlAttachment, selectLlmModelByQuery, selectLlmTools, serializeLlmJsonString, serializeLlmJsonValue, serializeLlmTokenUsage, serializeOpenAiChatRequest, streamLlmToolChain, templateYaml, validateLlmTemplateParameters, validateModelOptions } from "./commands/llm/index.browser.js";
8
+ export { LlmCancelToolCall, LlmLoaderLookupError, createElevenLabsProvider, createLlmCommand, createLlmCommands, createLlmConfiguration, createLlmFragmentLoaders, createLlmFragmentSource, createLlmInputBudget, createLlmService, createLlmSpool, createLlmTemplateStore, createLlmToolRegistry, createLlmUrlFragmentSource, createLlmUrlSource, createOpenAiProvider, encodeLlmBase64, evaluateLlmTemplate, executeLlmToolCalls, findExtractedRange, getLlmAttachmentUrlId, getLlmFragmentPrefix, getLlmModelAliases, llmCommands, llmReferenceVersion, llmTemplateUsesInput, loadLlmPluginFragments, openAiChatOptions, parseLlmSchemaDsl, resolveLlmSchemaInput, resolveLlmUrlAttachment, selectLlmModelByQuery, selectLlmTools, serializeLlmJsonString, serializeLlmJsonValue, serializeLlmTokenUsage, serializeOpenAiChatRequest, streamLlmToolChain, templateYaml, validateLlmTemplateParameters, validateModelOptions } from "./commands/llm/index.browser.js";
@@ -33,7 +33,7 @@ import {
33
33
  htmlqCommands,
34
34
  mmdcCommands,
35
35
  unrtfCommands
36
- } from "./chunks/chunk-NAETSXBW.js";
36
+ } from "./chunks/chunk-ZJAXMB5M.js";
37
37
  import {
38
38
  createMikeYqCommand,
39
39
  createMikeYqCommands,
@@ -61,6 +61,7 @@ import {
61
61
  } from "./chunks/chunk-5ZS237LB.js";
62
62
  import {
63
63
  LlmCancelToolCall,
64
+ LlmLoaderLookupError,
64
65
  createElevenLabsProvider,
65
66
  createLlmCommand,
66
67
  createLlmCommands,
@@ -100,12 +101,12 @@ import {
100
101
  templateYaml,
101
102
  validateLlmTemplateParameters,
102
103
  validateModelOptions
103
- } from "./chunks/chunk-HNT2MR4W.js";
104
+ } from "./chunks/chunk-363QOIDR.js";
104
105
  import {
105
106
  cloudflareWorkerLimits,
106
107
  mapfileExtension,
107
108
  readExtension
108
- } from "./chunks/chunk-67QE3JLU.js";
109
+ } from "./chunks/chunk-TZRVK3NU.js";
109
110
  import "./chunks/chunk-GI7OALXO.js";
110
111
  import {
111
112
  base32Commands,
@@ -235,7 +236,7 @@ import {
235
236
  xanCommands,
236
237
  xxdCommands,
237
238
  yesCommands
238
- } from "./chunks/chunk-VF3Q2V3E.js";
239
+ } from "./chunks/chunk-RAFD5ZAH.js";
239
240
  import {
240
241
  createDos2unixCommand,
241
242
  createDos2unixCommands,
@@ -334,6 +335,9 @@ import {
334
335
  import {
335
336
  PythonFailure,
336
337
  PythonPackageConflictError,
338
+ createPythonBuildBackend,
339
+ createPythonBuildDependencies,
340
+ createPythonBuildEnvironment,
337
341
  createPythonCommands,
338
342
  createPythonExecutorCommands,
339
343
  createPythonExecutorPool,
@@ -344,21 +348,29 @@ import {
344
348
  createPythonJspiStatResult,
345
349
  createPythonJspiTrampoline,
346
350
  createPythonLlmCapability,
351
+ createPythonLlmFragmentLoader,
352
+ createPythonLlmLoaderDiscovery,
353
+ createPythonLlmLoaderProvider,
354
+ createPythonLlmPackageManager,
355
+ createPythonLlmTemplateLoader,
347
356
  createPythonLlmToolLoader,
348
357
  createPythonPackageCache,
349
358
  createPythonPackageEnvironment,
350
359
  createPythonPackageManifestStore,
351
360
  createPythonShellCapability,
361
+ createPythonSourcePackageEnvironment,
362
+ createPythonSourceSnapshot,
352
363
  inspectPythonCapabilities,
353
364
  installPythonLlmDependencies,
354
365
  installPythonLlmPackages,
366
+ publishPythonBuildWheel,
355
367
  pythonCommands,
356
368
  pythonDocumentPackages,
357
369
  pythonExecutorCommands,
358
370
  pythonHostFailureCode,
359
371
  pythonLlmDependencies,
360
372
  pythonLlmPackages
361
- } from "./chunks/chunk-PSD2RSOS.js";
373
+ } from "./chunks/chunk-AGHV53VF.js";
362
374
  import {
363
375
  captureEnvironment,
364
376
  createDocumentHandlers,
@@ -603,7 +615,7 @@ import {
603
615
  readlinkCommands,
604
616
  realpathCommands,
605
617
  touchCommands
606
- } from "./chunks/chunk-IRJS54AA.js";
618
+ } from "./chunks/chunk-VWLQDZFF.js";
607
619
  import "./chunks/chunk-N4CQ5E3G.js";
608
620
  import "./chunks/chunk-EDJBO2HZ.js";
609
621
  import {
@@ -998,6 +1010,7 @@ export {
998
1010
  FsError,
999
1011
  InputByteBudget,
1000
1012
  LlmCancelToolCall,
1013
+ LlmLoaderLookupError,
1001
1014
  MdqError,
1002
1015
  MemoryFileSystem,
1003
1016
  MockS3Client,
@@ -1296,6 +1309,9 @@ export {
1296
1309
  createPrCommands,
1297
1310
  createPrintenvCommand,
1298
1311
  createPrintenvCommands,
1312
+ createPythonBuildBackend,
1313
+ createPythonBuildDependencies,
1314
+ createPythonBuildEnvironment,
1299
1315
  createPythonCommands,
1300
1316
  createPythonExecutorCommands,
1301
1317
  createPythonExecutorPool,
@@ -1306,11 +1322,18 @@ export {
1306
1322
  createPythonJspiStatResult,
1307
1323
  createPythonJspiTrampoline,
1308
1324
  createPythonLlmCapability,
1325
+ createPythonLlmFragmentLoader,
1326
+ createPythonLlmLoaderDiscovery,
1327
+ createPythonLlmLoaderProvider,
1328
+ createPythonLlmPackageManager,
1329
+ createPythonLlmTemplateLoader,
1309
1330
  createPythonLlmToolLoader,
1310
1331
  createPythonPackageCache,
1311
1332
  createPythonPackageEnvironment,
1312
1333
  createPythonPackageManifestStore,
1313
1334
  createPythonShellCapability,
1335
+ createPythonSourcePackageEnvironment,
1336
+ createPythonSourceSnapshot,
1314
1337
  createQpdfCommand,
1315
1338
  createQpdfCommands,
1316
1339
  createQrencodeCommand,
@@ -1614,6 +1637,7 @@ export {
1614
1637
  pptxCommands,
1615
1638
  prCommands,
1616
1639
  printenvCommands,
1640
+ publishPythonBuildWheel,
1617
1641
  pythonCommands,
1618
1642
  pythonDocumentPackages,
1619
1643
  pythonExecutorCommands,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  agentCommands,
3
3
  createAgentCommands
4
- } from "../chunks/chunk-NAETSXBW.js";
4
+ } from "../chunks/chunk-ZJAXMB5M.js";
5
5
  import "../chunks/chunk-XDDXXCBG.js";
6
6
  import {
7
7
  baseAgentCommands
8
- } from "../chunks/chunk-VF3Q2V3E.js";
8
+ } from "../chunks/chunk-RAFD5ZAH.js";
9
9
  import "../chunks/chunk-Z6R76REA.js";
10
10
  import "../chunks/chunk-5ICB3H25.js";
11
11
  import "../chunks/chunk-GXEFNZGD.js";
@@ -32,7 +32,7 @@ import "../chunks/chunk-ESH5MDQR.js";
32
32
  import "../chunks/chunk-4KYUJ3GC.js";
33
33
  import "../chunks/chunk-6E4SGHLU.js";
34
34
  import "../chunks/chunk-LFKUWFZT.js";
35
- import "../chunks/chunk-IRJS54AA.js";
35
+ import "../chunks/chunk-VWLQDZFF.js";
36
36
  import "../chunks/chunk-N4CQ5E3G.js";
37
37
  import "../chunks/chunk-EDJBO2HZ.js";
38
38
  import "../chunks/chunk-IMOFLK26.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  baseAgentCommands
3
- } from "./chunks/chunk-VF3Q2V3E.js";
3
+ } from "./chunks/chunk-RAFD5ZAH.js";
4
4
  import "./chunks/chunk-Z6R76REA.js";
5
5
  import "./chunks/chunk-5ICB3H25.js";
6
6
  import "./chunks/chunk-GXEFNZGD.js";
@@ -26,7 +26,7 @@ import "./chunks/chunk-F76MF5GT.js";
26
26
  import {
27
27
  createBoundedRegexProvider
28
28
  } from "./chunks/chunk-LFKUWFZT.js";
29
- import "./chunks/chunk-IRJS54AA.js";
29
+ import "./chunks/chunk-VWLQDZFF.js";
30
30
  import "./chunks/chunk-N4CQ5E3G.js";
31
31
  import "./chunks/chunk-EDJBO2HZ.js";
32
32
  import "./chunks/chunk-IMOFLK26.js";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunks/chunk-LFKUWFZT.js";
7
7
  import {
8
8
  Shell
9
- } from "./chunks/chunk-IRJS54AA.js";
9
+ } from "./chunks/chunk-VWLQDZFF.js";
10
10
  import "./chunks/chunk-N4CQ5E3G.js";
11
11
  import "./chunks/chunk-EDJBO2HZ.js";
12
12
  import "./chunks/chunk-IMOFLK26.js";
@@ -445,7 +445,7 @@ export declare class MemoryRedirectSink implements ByteSink {
445
445
  write(chunk: Uint8Array): Promise<void>;
446
446
  }
447
447
  export declare class BudgetedPipeStageSink implements ByteSink {
448
- canWriteSync: () => boolean;
448
+ canWriteSync: (byteLength?: number) => boolean;
449
449
  readonly isPipeStage = true;
450
450
  readonly self: ByteSink;
451
451
  readonly budget: Budget;
@@ -466,7 +466,7 @@ export declare class BudgetedPipeStageSink implements ByteSink {
466
466
  get ownedOutput(): NonNullable<ByteSink["ownedOutput"]>;
467
467
  [outputFailure](reason: unknown): Promise<void>;
468
468
  writeOwned(chunk: Uint8Array): Promise<void>;
469
- writeSync(chunk: Uint8Array): void;
469
+ writeSync(chunk: Uint8Array): boolean;
470
470
  write(chunk: Uint8Array): Promise<void>;
471
471
  }
472
472
  export declare function signalSink(sink: ByteSink, signal: AbortSignal): ByteSink;
@@ -1421,11 +1421,20 @@ export class BudgetedPipeStageSink {
1421
1421
  }
1422
1422
  }
1423
1423
  writeSync(chunk) {
1424
- this.budget.assertPipelineInput(chunk.byteLength);
1425
- this.budget.bytes += chunk.byteLength;
1424
+ if (!this.canWriteSync(chunk.byteLength))
1425
+ return false;
1426
+ this.signal.throwIfAborted();
1427
+ if (!(chunk instanceof Uint8Array))
1428
+ throw new TypeError("Shell output must be Uint8Array");
1429
+ const budget = this.budget;
1430
+ if (chunk.byteLength > budget.limits.maxOutputBytes - budget.bytes)
1431
+ budget.fail("maxOutputBytes");
1432
+ budget.assertPipelineInput(chunk.byteLength);
1433
+ budget.bytes += chunk.byteLength;
1426
1434
  this.writable.write(chunk);
1427
1435
  if (chunk.byteLength && this.written)
1428
1436
  this.written.add(this.index);
1437
+ return true;
1429
1438
  }
1430
1439
  write(chunk) {
1431
1440
  try {
@@ -318,6 +318,9 @@ import { text as awkValueText, compare as awkCompare, inputValue as awkInputValu
318
318
  import { shellValueByteLength } from "../contracts/value.js";
319
319
  import { stateMonitor } from "./arrays/state.js";
320
320
  import { Budget, Runtime } from "./runtime.js";
321
+ function canWriteBuiltinOutput(budget, pipe, byteLength) {
322
+ return (!pipe || pipe.canWriteSync(byteLength)) && (budget.bytes + byteLength <= budget.maxOutputBytesSmi || byteLength <= budget.limits.maxOutputBytes - budget.bytes);
323
+ }
321
324
  const createFmtEngine = (...args) => syncCommandEvaluators.createFmtEngine(...args);
322
325
  const parseFmtArguments = (...args) => syncCommandEvaluators.parseFmtArguments(...args);
323
326
  const evalSyncCal = (...args) => syncCommandEvaluators.evalSyncCal?.(...args);
@@ -489,12 +492,14 @@ function initializeSyncPrototypes() {
489
492
  },
490
493
  });
491
494
  Object.assign(BudgetedPipeStageSink.prototype, {
492
- canWriteSync() {
495
+ canWriteSync(byteLength = 0) {
493
496
  if (this.signal.aborted)
494
497
  return false;
495
498
  const w = this.writable;
496
499
  const pipe = w._pipe;
497
- return Boolean(w.open && pipe && !pipe.failed && !pipe.signal?.aborted && pipe.readerReferences && (!pipe.writes || pipe.writes.size === 0) && (pipe.availableBytes ?? 0) < (pipe.highWaterMark ?? 0));
500
+ const avail = pipe?.availableBytes ?? 0;
501
+ const hwm = pipe?.highWaterMark ?? 0;
502
+ return Boolean(w.open && pipe && !pipe.failed && !pipe.signal?.aborted && pipe.readerReferences && (!pipe.writes || pipe.writes.size === 0) && (byteLength > 0 ? avail + byteLength <= hwm : avail < hwm));
498
503
  },
499
504
  });
500
505
  }
@@ -12159,7 +12164,7 @@ const syncExtraRuntimeMethods = {
12159
12164
  if (disc.status !== 0 || fastSyncSink || fastPipeSink || syncOut) {
12160
12165
  const encoded = disc.status === 0 ? (encodeRedirectTextWithNewlineToScratch(disc.text) ?? fastSharedTextEncoder.encode(`${disc.text}\n`)) : undefined;
12161
12166
  const byteLength = encoded ? encoded.byteLength : 0;
12162
- if (byteLength === 0 || this.budget.bytes + byteLength <= this.budget.maxOutputBytesSmi || byteLength <= this.budget.limits.maxOutputBytes - this.budget.bytes) {
12167
+ if (byteLength === 0 || (canWriteBuiltinOutput(this.budget, fastPipeSink, byteLength))) {
12163
12168
  if (rawState.extensions && !rawState.extensions.eventDepth)
12164
12169
  publishCommandSpelling(rawState, commandSpelling(command));
12165
12170
  const restEpoch = monitor.chargeInternal(syncRestorationCharge, syncRestorationTickets).epoch;
@@ -12200,7 +12205,7 @@ const syncExtraRuntimeMethods = {
12200
12205
  if (fastSyncSink || fastPipeSink || syncOut) {
12201
12206
  const encoded = encodeRedirectTextWithNewlineToScratch(rawState.cwd) ?? fastSharedTextEncoder.encode(`${rawState.cwd}\n`);
12202
12207
  const byteLength = encoded.byteLength;
12203
- if (this.budget.bytes + byteLength <= this.budget.maxOutputBytesSmi || byteLength <= this.budget.limits.maxOutputBytes - this.budget.bytes) {
12208
+ if (canWriteBuiltinOutput(this.budget, fastPipeSink, byteLength)) {
12204
12209
  if (rawState.extensions && !rawState.extensions.eventDepth)
12205
12210
  publishCommandSpelling(rawState, commandSpelling(command));
12206
12211
  const restEpoch = monitor.chargeInternal(syncRestorationCharge, syncRestorationTickets).epoch;
@@ -12282,7 +12287,7 @@ const syncExtraRuntimeMethods = {
12282
12287
  if (outText !== undefined) {
12283
12288
  const encoded = encodeRedirectTextWithNewlineToScratch(outText) ?? fastSharedTextEncoder.encode(`${outText}\n`);
12284
12289
  const byteLength = encoded.byteLength;
12285
- if (this.budget.bytes + byteLength <= this.budget.maxOutputBytesSmi || byteLength <= this.budget.limits.maxOutputBytes - this.budget.bytes) {
12290
+ if (canWriteBuiltinOutput(this.budget, fastPipeSink, byteLength)) {
12286
12291
  if (rawState.extensions && !rawState.extensions.eventDepth)
12287
12292
  publishCommandSpelling(rawState, commandSpelling(command));
12288
12293
  const restEpoch = monitor.chargeInternal(syncRestorationCharge, syncRestorationTickets).epoch;
@@ -12401,7 +12406,7 @@ const syncExtraRuntimeMethods = {
12401
12406
  if (preEncoded !== undefined || formatted !== undefined) {
12402
12407
  const encoded = preEncoded ?? encodeRedirectTextToScratch(formatted);
12403
12408
  const byteLength = encoded.byteLength;
12404
- if (this.budget.bytes + byteLength <= this.budget.maxOutputBytesSmi || byteLength <= this.budget.limits.maxOutputBytes - this.budget.bytes) {
12409
+ if (canWriteBuiltinOutput(this.budget, fastPipeSink, byteLength)) {
12405
12410
  const restEpoch = monitor.chargeInternal(syncRestorationCharge, syncRestorationTickets).epoch;
12406
12411
  this.budget.tick();
12407
12412
  if (fastSyncSink) {
@@ -19272,7 +19277,7 @@ const syncExtraRuntimeMethods = {
19272
19277
  }
19273
19278
  const chunk = fastSharedTextEncoder.encode(this._syncStdoutBatch);
19274
19279
  this._syncStdoutBatch = "";
19275
- if ((io.stdout instanceof BudgetedSyncSink && io.stdout.write === BudgetedSyncSink.prototype.write) || (io.stdout instanceof Capture && io.stdout.write === Capture.prototype.write)) {
19280
+ if ((io.stdout instanceof BudgetedSyncSink && io.stdout.write === BudgetedSyncSink.prototype.write) || (io.stdout instanceof Capture && io.stdout.write === Capture.prototype.write) || (io.stdout instanceof BudgetedPipeStageSink && io.stdout.write === BudgetedPipeStageSink.prototype.write && io.stdout.canWriteSync(chunk.byteLength))) {
19276
19281
  if (io.stdout.budget !== this.budget) {
19277
19282
  if (chunk.byteLength > this.budget.limits.maxOutputBytes - this.budget.bytes)
19278
19283
  this.budget.fail("maxOutputBytes");
@@ -19280,11 +19285,6 @@ const syncExtraRuntimeMethods = {
19280
19285
  }
19281
19286
  io.stdout.writeSync(chunk);
19282
19287
  }
19283
- else if (io.stdout instanceof BudgetedPipeStageSink && io.stdout.canWriteSync()) {
19284
- if (chunk.byteLength > this.budget.limits.maxOutputBytes - this.budget.bytes)
19285
- this.budget.fail("maxOutputBytes");
19286
- io.stdout.writeSync(chunk);
19287
- }
19288
19288
  else {
19289
19289
  if (budgetedSinks.get(io.stdout)?.budget !== this.budget) {
19290
19290
  if (chunk.byteLength > this.budget.limits.maxOutputBytes - this.budget.bytes)
@@ -2,14 +2,14 @@ import {
2
2
  cloudflareWorkerLimits,
3
3
  mapfileExtension,
4
4
  readExtension
5
- } from "./chunks/chunk-67QE3JLU.js";
5
+ } from "./chunks/chunk-TZRVK3NU.js";
6
6
  import "./chunks/chunk-GI7OALXO.js";
7
7
  import {
8
8
  Shell,
9
9
  ShellLimitError,
10
10
  ShellSyntaxError,
11
11
  parseShell
12
- } from "./chunks/chunk-IRJS54AA.js";
12
+ } from "./chunks/chunk-VWLQDZFF.js";
13
13
  import "./chunks/chunk-N4CQ5E3G.js";
14
14
  import "./chunks/chunk-EDJBO2HZ.js";
15
15
  import "./chunks/chunk-IMOFLK26.js";
@@ -2,27 +2,30 @@ import {
2
2
  decodeLlmText,
3
3
  indentLlmText,
4
4
  withEmbeddingJsonDocument
5
- } from "../safe-bash/command-chunks/chunk-I7MEH76L.js";
5
+ } from "../safe-bash/command-chunks/chunk-UYNJF5QN.js";
6
6
  import {
7
7
  acquireEmbeddingInput,
8
+ commandArguments,
8
9
  createLlmConfiguration,
9
10
  embeddingCommand,
10
- embeddingText
11
- } from "../safe-bash/command-chunks/chunk-WOT2YXBT.js";
11
+ embeddingText,
12
+ hasUnpairedSurrogate,
13
+ pythonSurrogateId
14
+ } from "../safe-bash/command-chunks/chunk-7ZQVMPSB.js";
12
15
  import {
13
16
  createLlmSpool,
14
17
  fileSource,
15
18
  floatText,
16
19
  isPythonPrintable
17
- } from "../safe-bash/command-chunks/chunk-BZLLQWRK.js";
20
+ } from "../safe-bash/command-chunks/chunk-E5CDHXFA.js";
18
21
  import {
19
22
  tokenInteger
20
23
  } from "../safe-bash/command-chunks/chunk-GDH7OVYK.js";
21
- import "../safe-bash/command-chunks/chunk-GQV5RWMN.js";
24
+ import "../safe-bash/command-chunks/chunk-ZFXHSFTU.js";
22
25
  import {
23
26
  sourceBytes,
24
27
  waitForSource
25
- } from "../safe-bash/command-chunks/chunk-QX3WKBLI.js";
28
+ } from "../safe-bash/command-chunks/chunk-36FV6BAG.js";
26
29
  import {
27
30
  jsonValue
28
31
  } from "../safe-bash/command-chunks/chunk-GNPPPYDF.js";
@@ -164,16 +167,6 @@ import { FsError } from "../safe-bash-contracts/index.js";
164
167
  import { md5 as md52 } from "../safe-bash-checksum-engine/md5.js";
165
168
  import { withSqliteStatement as withSqliteStatement3 } from "../safe-bash-sqlite-engine/storage.js";
166
169
 
167
- // packages/safe-bash-command-llm/src/python-unicode.ts
168
- function hasUnpairedSurrogate(value) {
169
- for (const char of value) {
170
- const point = char.codePointAt(0);
171
- if (point >= 55296 && point <= 57343) return true;
172
- }
173
- return false;
174
- }
175
- var pythonSurrogateId = /* @__PURE__ */ Symbol("pythonSurrogateId");
176
-
177
170
  // packages/safe-bash-command-llm/src/collections-write.ts
178
171
  import { sqliteRecord as sqliteRecord2, withSqliteStatement as withSqliteStatement2 } from "../safe-bash-sqlite-engine/storage.js";
179
172
  var blob2 = (size, bytes) => ({ type: "blob", size, bytes });
@@ -1303,7 +1296,7 @@ async function withEmbeddingFileGlob(options, source, operation) {
1303
1296
 
1304
1297
  // packages/safe-bash-command-llm/src/import-files.ts
1305
1298
  import { FsError as FsError9 } from "../safe-bash-contracts/index.js";
1306
- import { PythonTextDecoder, PythonTextDecodeError } from "../safe-bash-csv-engine/text-decoder.js";
1299
+ import { PythonTextDecoder, PythonTextDecodeError, PythonIso2022PendingError, PythonUtf7EncodingError } from "../safe-bash-csv-engine/text-decoder.js";
1307
1300
  async function withFileEmbeddingEntries(options, files, operation) {
1308
1301
  const { fs, directory, signal } = options, maxBytes = options.maxInputBytes ?? Infinity;
1309
1302
  if (maxBytes !== Infinity && (!Number.isSafeInteger(maxBytes) || maxBytes < 0)) throw new RangeError("Invalid embedding input byte limit");
@@ -1315,6 +1308,7 @@ async function withFileEmbeddingEntries(options, files, operation) {
1315
1308
  const stat = await fs.stat(file.path, { signal });
1316
1309
  if (stat.type === "directory") continue;
1317
1310
  const input = await fileSource({ fs, path: file.path, signal, maxBytes, expectedStat: stat });
1311
+ let selectedEncodingError;
1318
1312
  let raw, selected, failed2 = false, retire;
1319
1313
  try {
1320
1314
  raw = await createLlmSpool(fs, directory, signal, "input");
@@ -1328,7 +1322,7 @@ async function withFileEmbeddingEntries(options, files, operation) {
1328
1322
  else if (options.binary) selected = await createLlmSpool(fs, directory, signal, "input");
1329
1323
  else for (const encoding of options.encodings?.length ? options.encodings : ["utf-8", "latin-1"]) {
1330
1324
  const decoder = new PythonTextDecoder(encoding), candidate = await createLlmSpool(fs, directory, signal, "input");
1331
- let accepted = false, failedAttempt = false;
1325
+ let accepted = false, failedAttempt = false, encodingError;
1332
1326
  try {
1333
1327
  const decoded = { async *[Symbol.asyncIterator]() {
1334
1328
  for await (const bytes of raw.replay()) for (let offset = 0; offset < bytes.length; offset += 4096) {
@@ -1347,7 +1341,10 @@ async function withFileEmbeddingEntries(options, files, operation) {
1347
1341
  } catch (error) {
1348
1342
  failedAttempt = true;
1349
1343
  signal.throwIfAborted();
1350
- if (!(error instanceof PythonTextDecodeError)) throw error;
1344
+ if (error instanceof PythonUtf7EncodingError) {
1345
+ accepted = true;
1346
+ encodingError = error;
1347
+ } else if (!(error instanceof PythonTextDecodeError) && !(error instanceof PythonIso2022PendingError)) throw error;
1351
1348
  failedAttempt = false;
1352
1349
  } finally {
1353
1350
  if (!accepted) try {
@@ -1357,6 +1354,7 @@ async function withFileEmbeddingEntries(options, files, operation) {
1357
1354
  }
1358
1355
  }
1359
1356
  if (accepted) {
1357
+ selectedEncodingError = encodingError;
1360
1358
  const previous = selected;
1361
1359
  selected = candidate;
1362
1360
  await previous?.close();
@@ -1366,6 +1364,7 @@ async function withFileEmbeddingEntries(options, files, operation) {
1366
1364
  await options.undecodable?.(file.displayPath ?? file.path);
1367
1365
  continue;
1368
1366
  }
1367
+ if (selectedEncodingError) throw selectedEncodingError;
1369
1368
  const retained = selected;
1370
1369
  let closed = false, consumed = false;
1371
1370
  retire = () => {
@@ -1776,58 +1775,18 @@ function createLlmCollectionCommands(options) {
1776
1775
  throw error;
1777
1776
  }
1778
1777
  });
1779
- if (tokens[0] === "--help" || tokens[0] === "-h") {
1780
- await emit(groupHelp);
1781
- return 0;
1782
- }
1783
- let command = "list", start = tokens[0] === "--" ? 1 : 0;
1784
- if (tokens[start] && Object.hasOwn(usages, tokens[start])) {
1785
- command = tokens[start];
1786
- start++;
1787
- }
1778
+ const parsed = await commandArguments("collections", tokens, ["list", "delete", "path"], emit, diagnostic, step, void 0, (name) => name === "collections" ? groupHelp : help2[name.slice(12)]);
1779
+ if (typeof parsed === "number") return parsed;
1780
+ const { command, operands, values } = parsed;
1781
+ const database = values.get("--database")?.at(-1), json = values.has("--json");
1788
1782
  const fail = async (message, code = 1, usage3 = false) => {
1789
- await diagnostic((usage3 ? usages[command] + `Try 'llm collections ${command} -h' for help.
1783
+ await diagnostic((usage3 ? `Usage: llm collections ${command} [OPTIONS]${command === "delete" ? " COLLECTION" : ""}
1784
+ Try 'llm collections ${command} -h' for help.
1790
1785
 
1791
1786
  ` : "") + `Error: ${message}
1792
1787
  `);
1793
1788
  return code;
1794
1789
  };
1795
- let database, json = false, ended = false, wantsHelp = false;
1796
- const operands = [];
1797
- for (let index = start; index < tokens.length; index++) {
1798
- await step();
1799
- const token = tokens[index];
1800
- if (!ended && token === "--") {
1801
- ended = true;
1802
- continue;
1803
- }
1804
- if (ended || !token.startsWith("-") || token === "-") {
1805
- operands.push(token);
1806
- continue;
1807
- }
1808
- const equals = token.indexOf("="), long = token.startsWith("--");
1809
- for (let cursor = long ? 0 : 1; cursor < token.length; cursor++) {
1810
- const flag = long ? token.slice(0, equals < 0 ? void 0 : equals) : "-" + token[cursor];
1811
- if (flag === "--help" || flag === "-h" || flag === "--json" && command === "list") {
1812
- if (long && equals >= 0) return fail(`Option '${flag}' does not take a value.`, 2);
1813
- if (flag === "--json") json = true;
1814
- else wantsHelp = true;
1815
- if (long) break;
1816
- continue;
1817
- }
1818
- if (command === "path" || flag !== "-d" && flag !== "--database") return fail(`No such option: ${flag}`, 2, true);
1819
- database = (long ? equals < 0 ? void 0 : token.slice(equals + 1) : token.slice(cursor + 1) || void 0) ?? tokens[++index];
1820
- if (database === void 0) return fail(`Option '${flag}' requires an argument.`, 2);
1821
- break;
1822
- }
1823
- }
1824
- if (wantsHelp) {
1825
- await emit(help2[command]);
1826
- return 0;
1827
- }
1828
- if (command === "delete" && !operands.length) return fail("Missing argument 'COLLECTION'.", 2, true);
1829
- const extra = operands.slice(command === "delete" ? 1 : 0);
1830
- if (extra.length) return fail(`Got unexpected extra argument${extra.length === 1 ? "" : "s"} (${extra.join(" ")})`, 2, true);
1831
1790
  const config = createLlmConfiguration(context, maxConfigurationBytes);
1832
1791
  if (command === "path") {
1833
1792
  await emit(config.directory + "/embeddings.db\n");