openpond 0.0.30-bootstrap.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 (193) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/LICENSE +21 -0
  3. package/README.md +162 -0
  4. package/RELEASE.md +20 -0
  5. package/dist/api/core.d.ts +22 -0
  6. package/dist/api/deployments.d.ts +30 -0
  7. package/dist/api/types.d.ts +624 -0
  8. package/dist/api.d.ts +90 -0
  9. package/dist/cache.d.ts +22 -0
  10. package/dist/chunks/app-layer-YKXEQGOW.js +163 -0
  11. package/dist/chunks/apps-GGSIN2ZF.js +539 -0
  12. package/dist/chunks/chunk-3CC6MH35.js +1663 -0
  13. package/dist/chunks/chunk-3Y4EL3P6.js +1090 -0
  14. package/dist/chunks/chunk-4HYJG2JE.js +3875 -0
  15. package/dist/chunks/chunk-5G4E547X.js +294 -0
  16. package/dist/chunks/chunk-74O6FGVN.js +598 -0
  17. package/dist/chunks/chunk-AUJLPKGI.js +632 -0
  18. package/dist/chunks/chunk-BYAPLT37.js +744 -0
  19. package/dist/chunks/chunk-FUP7EGT7.js +1845 -0
  20. package/dist/chunks/chunk-I6HN3ZGW.js +88 -0
  21. package/dist/chunks/chunk-KRKGHVMQ.js +294 -0
  22. package/dist/chunks/chunk-LHYK6QO2.js +1300 -0
  23. package/dist/chunks/chunk-NLBKZZEK.js +224 -0
  24. package/dist/chunks/chunk-OG75GMVO.js +1 -0
  25. package/dist/chunks/chunk-Q57SVPEH.js +11663 -0
  26. package/dist/chunks/chunk-UACZUFIA.js +47 -0
  27. package/dist/chunks/chunk-VQX33YAG.js +5135 -0
  28. package/dist/chunks/chunk-W5GKHH77.js +168 -0
  29. package/dist/chunks/chunk-WYDVQOBL.js +17581 -0
  30. package/dist/chunks/chunk-XSAXENQD.js +4167 -0
  31. package/dist/chunks/chunk-Y6G6WRTG.js +210 -0
  32. package/dist/chunks/cli-NVKNE4AZ.js +11 -0
  33. package/dist/chunks/cli-X3HPLSOV.js +19 -0
  34. package/dist/chunks/core-commands-IM2UKLU4.js +41 -0
  35. package/dist/chunks/extend-YXCBULPO.js +84 -0
  36. package/dist/chunks/harness-GMK6IY2U.js +140 -0
  37. package/dist/chunks/help-LMH5FGT2.js +65 -0
  38. package/dist/chunks/opchat-BWXZ32GX.js +169 -0
  39. package/dist/chunks/organizations-4ISQRGMQ.js +738 -0
  40. package/dist/chunks/profile-NLDZDT3L.js +1110 -0
  41. package/dist/chunks/project-agent-ZPVO25HA.js +892 -0
  42. package/dist/chunks/sandbox-command-5GFJ2U3V.js +1652 -0
  43. package/dist/chunks/sandbox-template-LZN4F55Z.js +1646 -0
  44. package/dist/chunks/src-3RBI4DNN.js +3595 -0
  45. package/dist/chunks/src-EYXQS6XD.js +73427 -0
  46. package/dist/chunks/teams-bot-WP3FHKGA.js +137 -0
  47. package/dist/cli.js +77 -0
  48. package/dist/client-types.d.ts +222 -0
  49. package/dist/client.d.ts +19 -0
  50. package/dist/config.d.ts +184 -0
  51. package/dist/hosted-chat.d.ts +162 -0
  52. package/dist/index.d.ts +5 -0
  53. package/dist/index.js +25481 -0
  54. package/dist/indicators.d.ts +38 -0
  55. package/dist/opchat-smoke.d.ts +47 -0
  56. package/dist/private-json-file.d.ts +3 -0
  57. package/dist/profile/local-profile-types.d.ts +160 -0
  58. package/dist/profile/local-profile.d.ts +69 -0
  59. package/dist/profile/profile-catalog.d.ts +14 -0
  60. package/dist/profile/profile-git.d.ts +17 -0
  61. package/dist/profile/profile-promotion.d.ts +21 -0
  62. package/dist/profile/profile-setup-gate.d.ts +22 -0
  63. package/dist/profile/profile-skills.d.ts +30 -0
  64. package/dist/profile/profile-source-upload.d.ts +29 -0
  65. package/dist/profile/source-upload-cache.d.ts +29 -0
  66. package/dist/sandbox/async-request-options.d.ts +2 -0
  67. package/dist/sandbox/client-handles.d.ts +113 -0
  68. package/dist/sandbox/client.d.ts +348 -0
  69. package/dist/sandbox/runtime-handle.d.ts +36 -0
  70. package/dist/sandbox/sandbox-instance-client.d.ts +72 -0
  71. package/dist/sandbox/smoke.d.ts +3 -0
  72. package/dist/sandbox/stream.d.ts +7 -0
  73. package/dist/sandbox/types/billing.d.ts +176 -0
  74. package/dist/sandbox/types/client.d.ts +103 -0
  75. package/dist/sandbox/types/core.d.ts +140 -0
  76. package/dist/sandbox/types/index.d.ts +14 -0
  77. package/dist/sandbox/types/io.d.ts +240 -0
  78. package/dist/sandbox/types/microsoft-teams-bot.d.ts +51 -0
  79. package/dist/sandbox/types/org-project-agent.d.ts +610 -0
  80. package/dist/sandbox/types/record.d.ts +53 -0
  81. package/dist/sandbox/types/responses.d.ts +295 -0
  82. package/dist/sandbox/types/runtime-profiles.d.ts +15 -0
  83. package/dist/sandbox/types/runtime.d.ts +152 -0
  84. package/dist/sandbox/types/schedules.d.ts +141 -0
  85. package/dist/sandbox/types/snapshots.d.ts +205 -0
  86. package/dist/sandbox/types/workflow-modes.d.ts +1 -0
  87. package/dist/sandbox/types/workload-sources.d.ts +20 -0
  88. package/dist/sandbox/url.d.ts +2 -0
  89. package/dist/sandbox-template/manifest.d.ts +304 -0
  90. package/dist/sandbox-template/manifest.js +18381 -0
  91. package/dist/skills/openpond-cli/SKILL.md +49 -0
  92. package/dist/skills/openpond-desktop-harness/SKILL.md +113 -0
  93. package/dist/skills/openpond-desktop-harness/agents/openai.yaml +4 -0
  94. package/dist/skills/openpond-taskset-authoring/SKILL.md +38 -0
  95. package/dist/skills/openpond-taskset-authoring/references/graders-and-rewards.md +11 -0
  96. package/dist/skills/openpond-taskset-authoring/references/method-selection.md +12 -0
  97. package/dist/skills/openpond-taskset-authoring/references/privacy-and-provenance.md +8 -0
  98. package/dist/skills/openpond-taskset-authoring/references/task-design.md +13 -0
  99. package/dist/stream.d.ts +20 -0
  100. package/dist/types.d.ts +57 -0
  101. package/dist/urls.d.ts +4 -0
  102. package/dist/web/assets/AppsView-Bu-Nc3Ew.js +1 -0
  103. package/dist/web/assets/AppsView-DIhprTIC.css +1 -0
  104. package/dist/web/assets/BrowserSidebar-CCguQ-DR.js +1 -0
  105. package/dist/web/assets/BrowserSidebar-D9i7gQzw.css +1 -0
  106. package/dist/web/assets/CloudWorkView-DNoPIlMj.css +1 -0
  107. package/dist/web/assets/CloudWorkView-Dr3xqLE5.js +1 -0
  108. package/dist/web/assets/CommandMenu-CnodJFHD.js +1 -0
  109. package/dist/web/assets/CommandMenu-hNQCm8mw.css +1 -0
  110. package/dist/web/assets/CommunityView-CIbjNUZr.js +1 -0
  111. package/dist/web/assets/CommunityView-DSik4sd2.css +1 -0
  112. package/dist/web/assets/GetStartedView-C3ZrnEz5.css +1 -0
  113. package/dist/web/assets/GetStartedView-C8nyH_PT.js +1 -0
  114. package/dist/web/assets/LabsExtensions-GtJzxDnK.js +1 -0
  115. package/dist/web/assets/LabsProfile-DG7rWYur.js +1 -0
  116. package/dist/web/assets/LabsRoute-D6MDHBzq.js +2 -0
  117. package/dist/web/assets/LabsRoute-TEt9j1vB.css +1 -0
  118. package/dist/web/assets/LabsSignals-BfsDN86w.js +1 -0
  119. package/dist/web/assets/LabsSignals-D6iA6Ryl.css +1 -0
  120. package/dist/web/assets/NewProjectDialog-CaKiCoVS.js +1 -0
  121. package/dist/web/assets/ProfileSettingsSection-DTQS2DVL.css +1 -0
  122. package/dist/web/assets/ProfileSettingsSection-DxEzoF3K.js +1 -0
  123. package/dist/web/assets/ProfileView-CEscW7Ru.js +1 -0
  124. package/dist/web/assets/SettingsView-DwbGu8Kj.css +1 -0
  125. package/dist/web/assets/SettingsView-JIRR_FO4.js +63 -0
  126. package/dist/web/assets/TeamChatView-B5M1ThhJ.js +3 -0
  127. package/dist/web/assets/TeamChatView-Bx44q3WV.css +1 -0
  128. package/dist/web/assets/TerminalOverlay-C1iP4OS1.js +19 -0
  129. package/dist/web/assets/TerminalOverlay-DwBiZLwk.css +1 -0
  130. package/dist/web/assets/TrainingSettingsSection-BDYvI2te.js +1 -0
  131. package/dist/web/assets/TrainingView-CoCFK6W3.js +5 -0
  132. package/dist/web/assets/WorkspaceDiffPanel-CMxKQeo7.js +14 -0
  133. package/dist/web/assets/WorkspaceEnvironmentMenu-B8JJbwIz.js +32 -0
  134. package/dist/web/assets/WorkspaceEnvironmentMenu-DGIFdG3o.css +1 -0
  135. package/dist/web/assets/WorkspaceGitDialogs-B4sp9BGn.js +1 -0
  136. package/dist/web/assets/WorkspaceMonacoEditor-BBqimG5X.js +845 -0
  137. package/dist/web/assets/WorkspaceMonacoEditor-BwKcXIZw.css +1 -0
  138. package/dist/web/assets/boxes-DAaDUabq.js +1 -0
  139. package/dist/web/assets/codicon-ngg6Pgfi.ttf +0 -0
  140. package/dist/web/assets/css.worker-DBVD8oXr.js +93 -0
  141. package/dist/web/assets/cssMode-CBF1mieJ.js +1 -0
  142. package/dist/web/assets/dockerfile-BG73LgW2.js +1 -0
  143. package/dist/web/assets/editor.worker-CdQrwHl8.js +26 -0
  144. package/dist/web/assets/git-commit-horizontal-CAickXpN.js +1 -0
  145. package/dist/web/assets/git-dialogs-BZDqS1eT.css +1 -0
  146. package/dist/web/assets/html.worker-CwpTb9lJ.js +470 -0
  147. package/dist/web/assets/htmlMode-2u8OHtWO.js +1 -0
  148. package/dist/web/assets/index-BdY6A-YN.css +1 -0
  149. package/dist/web/assets/index-CU2qhUYV.js +195 -0
  150. package/dist/web/assets/index-Dz2B3-4C.js +1 -0
  151. package/dist/web/assets/info-CQNTh78o.js +1 -0
  152. package/dist/web/assets/json.worker-BoL8UZqY.js +58 -0
  153. package/dist/web/assets/jsonMode-C4CWXViX.js +7 -0
  154. package/dist/web/assets/lspLanguageFeatures-CBs_BOlB.js +4 -0
  155. package/dist/web/assets/markdown-BFxVWTOG.js +1 -0
  156. package/dist/web/assets/monaco.contribution-C1LUxAKf.js +2 -0
  157. package/dist/web/assets/monaco.contribution-Cpf6dWsh.js +2 -0
  158. package/dist/web/assets/monaco.contribution-lOXpG2xQ.js +2 -0
  159. package/dist/web/assets/monaco.contribution-sd3cFkcN.js +2 -0
  160. package/dist/web/assets/monitor-DsIswrMV.js +1 -0
  161. package/dist/web/assets/play-CeRw21NV.js +1 -0
  162. package/dist/web/assets/python-CXYq3BUl.js +1 -0
  163. package/dist/web/assets/refresh-cw-N5b_6AP5.js +1 -0
  164. package/dist/web/assets/reply-BSKjZrJg.js +1 -0
  165. package/dist/web/assets/save-D0oHH1a3.js +1 -0
  166. package/dist/web/assets/settings-lists-BEg6LMcy.css +1 -0
  167. package/dist/web/assets/shell-DiJ1NA_G.js +1 -0
  168. package/dist/web/assets/toggleHighContrast-B7NOMXDY.css +1 -0
  169. package/dist/web/assets/toggleHighContrast-DRjlcwes.js +62 -0
  170. package/dist/web/assets/training-model-data-BPrc68VG.js +1 -0
  171. package/dist/web/assets/ts.worker-BH9nVgjN.js +67718 -0
  172. package/dist/web/assets/tsMode-x-1A7ZcB.js +11 -0
  173. package/dist/web/assets/wifi-off-Dt52ofzh.js +1 -0
  174. package/dist/web/assets/workers-Ciff6Dzi.js +1 -0
  175. package/dist/web/assets/yaml-CB67Kxnz.js +1 -0
  176. package/dist/web/connected-apps/github.svg +3 -0
  177. package/dist/web/connected-apps/google.svg +6 -0
  178. package/dist/web/connected-apps/linear.svg +3 -0
  179. package/dist/web/connected-apps/microsoft.svg +6 -0
  180. package/dist/web/connected-apps/notion.svg +3 -0
  181. package/dist/web/connected-apps/openpond-mcp.svg +4 -0
  182. package/dist/web/connected-apps/slack.svg +6 -0
  183. package/dist/web/connected-apps/x.svg +3 -0
  184. package/dist/web/favicon-16x16.png +0 -0
  185. package/dist/web/favicon-32x32.png +0 -0
  186. package/dist/web/index.html +16 -0
  187. package/dist/web/openpond-icon.png +0 -0
  188. package/dist/web/openpond-wordlogo-white.png +0 -0
  189. package/dist/web/tokens/eth.svg +1 -0
  190. package/dist/web/tokens/usdc.svg +1 -0
  191. package/docs/agent-edit-check-status-json.md +132 -0
  192. package/docs/command-reference.md +695 -0
  193. package/package.json +84 -0
@@ -0,0 +1,294 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import {
3
+ CLI_SHORT_OPTION_ALIASES,
4
+ getAnyCliOptionKind,
5
+ getCliCommandDefinition,
6
+ getCliOptionKind,
7
+ parseJsonOption
8
+ } from "./chunk-3Y4EL3P6.js";
9
+
10
+ // ../../packages/cloud/src/urls.ts
11
+ var DEFAULT_OPENPOND_WEB_BASE_URL = "https://openpond.ai";
12
+ var DEFAULT_OPENPOND_API_BASE_URL = "https://api.openpond.ai";
13
+ var DEFAULT_OPENPOND_OPCHAT_API_BASE_URL = "https://api.openpond.ai/opchat/v1";
14
+
15
+ // src/cli/common/urls.ts
16
+ var DEFAULT_OPENPOND_API_HOST = new URL(DEFAULT_OPENPOND_API_BASE_URL).hostname;
17
+ var DEFAULT_OPENPOND_WEB_HOST = new URL(DEFAULT_OPENPOND_WEB_BASE_URL).hostname;
18
+ function resolveAccountOption(options) {
19
+ const raw = typeof options.account === "string" ? options.account : typeof options.profile === "string" ? options.profile : null;
20
+ if (!raw) return null;
21
+ const trimmed = raw.trim();
22
+ if (!trimmed || trimmed === "true") {
23
+ throw new Error("account must be a non-empty value");
24
+ }
25
+ return trimmed;
26
+ }
27
+ function resolveBaseUrlOption(options) {
28
+ const raw = typeof options.baseUrl === "string" ? options.baseUrl : typeof options.baseurl === "string" ? options.baseurl : null;
29
+ if (!raw) return null;
30
+ const trimmed = raw.trim();
31
+ if (!trimmed || trimmed === "true") {
32
+ throw new Error("baseurl must be a non-empty value");
33
+ }
34
+ return trimmed.replace(/\/$/, "");
35
+ }
36
+ function resolveApiBaseUrlOption(options) {
37
+ const raw = typeof options.apiBaseUrl === "string" ? options.apiBaseUrl : typeof options.apiBaseurl === "string" ? options.apiBaseurl : null;
38
+ if (!raw) return null;
39
+ const trimmed = raw.trim();
40
+ if (!trimmed || trimmed === "true") {
41
+ throw new Error("api-base-url must be a non-empty value");
42
+ }
43
+ return trimmed.replace(/\/$/, "");
44
+ }
45
+ function resolveChatApiBaseUrlOption(options) {
46
+ const raw = typeof options.chatApiBaseUrl === "string" ? options.chatApiBaseUrl : typeof options.chatApiBaseurl === "string" ? options.chatApiBaseurl : typeof options.chatApiUrl === "string" ? options.chatApiUrl : null;
47
+ if (!raw) return null;
48
+ const trimmed = raw.trim();
49
+ if (!trimmed || trimmed === "true") {
50
+ throw new Error("chat-api-base-url must be a non-empty value");
51
+ }
52
+ return trimmed.replace(/\/$/, "");
53
+ }
54
+ function resolveSandboxApiUrlOption(options) {
55
+ const raw = typeof options.sandboxApiUrl === "string" ? options.sandboxApiUrl : typeof options.sandboxApiurl === "string" ? options.sandboxApiurl : null;
56
+ if (!raw) return null;
57
+ const trimmed = raw.trim();
58
+ if (!trimmed || trimmed === "true") {
59
+ throw new Error("sandbox-api-url must be a non-empty value");
60
+ }
61
+ return trimmed.replace(/\/$/, "");
62
+ }
63
+ function resolveBaseUrl(config) {
64
+ const envBase = process.env.OPENPOND_BASE_URL;
65
+ const base = envBase || config.baseUrl || DEFAULT_OPENPOND_WEB_BASE_URL;
66
+ return base.replace(/\/$/, "");
67
+ }
68
+ function mapUiBaseToApiBase(baseUrl) {
69
+ if (!baseUrl) return null;
70
+ const trimmed = baseUrl.replace(/\/$/, "");
71
+ try {
72
+ const url = new URL(trimmed);
73
+ const host = url.hostname.toLowerCase();
74
+ if (host === DEFAULT_OPENPOND_WEB_HOST || host === "openpond.live" || host === "www.openpond.live") {
75
+ return DEFAULT_OPENPOND_API_BASE_URL;
76
+ }
77
+ if (host === DEFAULT_OPENPOND_API_HOST || host.startsWith("api.")) {
78
+ return trimmed;
79
+ }
80
+ } catch {
81
+ return null;
82
+ }
83
+ return null;
84
+ }
85
+ function resolvePublicApiBaseUrl(config) {
86
+ const envBase = process.env.OPENPOND_API_URL;
87
+ const configuredApiBase = config?.apiBaseUrl?.trim();
88
+ const mapped = mapUiBaseToApiBase(
89
+ process.env.OPENPOND_BASE_URL || config?.baseUrl
90
+ );
91
+ const base = envBase || configuredApiBase || mapped || DEFAULT_OPENPOND_API_BASE_URL;
92
+ return base.replace(/\/$/, "");
93
+ }
94
+ function normalizeTemplateRepoUrl(input, baseUrl) {
95
+ const trimmed = input.trim();
96
+ if (!trimmed) {
97
+ throw new Error("template must be non-empty");
98
+ }
99
+ if (trimmed.startsWith("http://") || trimmed.startsWith("https://")) {
100
+ return trimmed.endsWith(".git") ? trimmed : `${trimmed}.git`;
101
+ }
102
+ const normalizedBase = baseUrl.replace(/\/$/, "");
103
+ const [owner, repoRaw] = trimmed.includes("/") ? trimmed.split("/", 2) : ["openpondai", trimmed];
104
+ const repo = repoRaw.endsWith(".git") ? repoRaw.slice(0, -4) : repoRaw;
105
+ if (!owner || !repo) {
106
+ throw new Error("template must be <owner>/<repo> or a full https URL");
107
+ }
108
+ return `${normalizedBase}/${owner}/${repo}.git`;
109
+ }
110
+
111
+ // src/cli/common/args.ts
112
+ var CLI_OPTION_VALUES = /* @__PURE__ */ Symbol("openpondCliOptionValues");
113
+ var CliUsageError = class extends Error {
114
+ exitCode = 2;
115
+ constructor(message) {
116
+ super(message);
117
+ this.name = "CliUsageError";
118
+ }
119
+ };
120
+ var CLI_POSITIVE_INTEGER_OPTIONS = /* @__PURE__ */ new Set(["maxOutputBytes", "timeoutSec"]);
121
+ function parseArgs(argv) {
122
+ const args = [...argv];
123
+ let command = "";
124
+ const options = {};
125
+ const optionValues = {};
126
+ const rest = [];
127
+ while (args.length > 0) {
128
+ const next = args.shift();
129
+ if (next === "--") {
130
+ rest.push(...args);
131
+ break;
132
+ }
133
+ if (next.startsWith("--")) {
134
+ const separatorIndex = next.indexOf("=");
135
+ const rawKey = separatorIndex >= 0 ? next.slice(2, separatorIndex) : next.slice(2);
136
+ const key = normalizeCliOptionKey(rawKey);
137
+ const value = separatorIndex >= 0 ? next.slice(separatorIndex + 1) : readOptionValue(args, key, command);
138
+ setParsedOption(options, optionValues, key, value, command);
139
+ } else if (isShortOptionToken(next)) {
140
+ parseShortOptionToken(next, args, options, optionValues);
141
+ } else {
142
+ if (!command) {
143
+ command = next;
144
+ } else {
145
+ rest.push(next);
146
+ }
147
+ }
148
+ }
149
+ Object.defineProperty(options, CLI_OPTION_VALUES, {
150
+ value: optionValues,
151
+ enumerable: false,
152
+ configurable: false,
153
+ writable: false
154
+ });
155
+ validateCommandOptions(command, options);
156
+ return { command, options, rest };
157
+ }
158
+ function normalizeCliOptionKey(rawKey) {
159
+ return rawKey.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
160
+ }
161
+ function isShortOptionToken(value) {
162
+ return /^-[^-].*/.test(value) && !isNegativeNumber(value);
163
+ }
164
+ function parseShortOptionToken(token, args, options, optionValues) {
165
+ const body = token.slice(1);
166
+ if (!body) return;
167
+ const equalsIndex = body.indexOf("=");
168
+ const aliasBody = equalsIndex >= 0 ? body.slice(0, equalsIndex) : body;
169
+ const inlineValue = equalsIndex >= 0 ? body.slice(equalsIndex + 1) : null;
170
+ if (aliasBody.length !== 1) {
171
+ for (const alias of aliasBody) {
172
+ const key2 = CLI_SHORT_OPTION_ALIASES[alias];
173
+ if (!key2) {
174
+ throw new CliUsageError(`unknown short option -${alias}`);
175
+ }
176
+ const kind = getAnyCliOptionKind(key2);
177
+ if (kind !== "boolean") {
178
+ throw new CliUsageError(`short option -${alias} requires its own value`);
179
+ }
180
+ setParsedOption(options, optionValues, key2, "true");
181
+ }
182
+ return;
183
+ }
184
+ const key = CLI_SHORT_OPTION_ALIASES[aliasBody];
185
+ if (!key) {
186
+ throw new CliUsageError(`unknown short option -${aliasBody}`);
187
+ }
188
+ const value = inlineValue ?? readOptionValue(args, key);
189
+ setParsedOption(options, optionValues, key, value);
190
+ }
191
+ function readOptionValue(args, key, command) {
192
+ const kind = typedOptionKind(key, command);
193
+ if (kind === "boolean") {
194
+ if (args[0] && isBooleanLiteral(args[0])) return args.shift();
195
+ return "true";
196
+ }
197
+ if (kind) {
198
+ const next = args.shift();
199
+ if (next === void 0 || isOptionLike(next) && !isNegativeNumber(next)) {
200
+ if (next !== void 0) args.unshift(next);
201
+ throw new CliUsageError(`${cliOptionLabel(key)} must be ${optionKindPhrase(kind)}`);
202
+ }
203
+ return next;
204
+ }
205
+ return args[0] && !args[0].startsWith("--") ? args.shift() : "true";
206
+ }
207
+ function setParsedOption(options, optionValues, key, value, command) {
208
+ validateParsedOptionValue(key, value, command);
209
+ options[key] = value;
210
+ (optionValues[key] ??= []).push(value);
211
+ }
212
+ function validateParsedOptionValue(key, value, command) {
213
+ const kind = typedOptionKind(key, command);
214
+ if (!kind) return;
215
+ if (kind === "boolean") {
216
+ if (!isBooleanLiteral(value)) {
217
+ throw new CliUsageError(`${cliOptionLabel(key)} must be a boolean`);
218
+ }
219
+ return;
220
+ }
221
+ if (value.trim().length === 0 || value === "true") {
222
+ throw new CliUsageError(`${cliOptionLabel(key)} must be ${optionKindPhrase(kind)}`);
223
+ }
224
+ if (kind === "number" || kind === "integer") {
225
+ const parsed = Number(value);
226
+ if (!Number.isFinite(parsed)) {
227
+ throw new CliUsageError(`${cliOptionLabel(key)} must be ${optionKindPhrase(kind)}`);
228
+ }
229
+ if (kind === "integer" && !Number.isInteger(parsed)) {
230
+ throw new CliUsageError(`${cliOptionLabel(key)} must be an integer`);
231
+ }
232
+ if (kind === "integer" && CLI_POSITIVE_INTEGER_OPTIONS.has(key) && parsed <= 0) {
233
+ throw new CliUsageError(`${cliOptionLabel(key)} must be a positive integer`);
234
+ }
235
+ return;
236
+ }
237
+ if (kind === "json") {
238
+ try {
239
+ parseJsonOption(value, cliOptionLabel(key));
240
+ } catch (error) {
241
+ throw new CliUsageError(error instanceof Error ? error.message : String(error));
242
+ }
243
+ }
244
+ }
245
+ function typedOptionKind(key, command) {
246
+ return command ? getCliOptionKind(command, key) : getAnyCliOptionKind(key);
247
+ }
248
+ function cliOptionLabel(key) {
249
+ return key.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);
250
+ }
251
+ function optionKindLabel(kind) {
252
+ if (kind === "json") return "JSON value";
253
+ return kind;
254
+ }
255
+ function optionKindPhrase(kind) {
256
+ const label = optionKindLabel(kind);
257
+ return /^[aeiou]/i.test(label) ? `an ${label}` : `a ${label}`;
258
+ }
259
+ function isBooleanLiteral(value) {
260
+ return /^(true|false|1|0|yes|no)$/i.test(value);
261
+ }
262
+ function isOptionLike(value) {
263
+ return value.startsWith("-") && value !== "-";
264
+ }
265
+ function isNegativeNumber(value) {
266
+ return /^-\d+(?:\.\d+)?$/.test(value);
267
+ }
268
+ function validateCommandOptions(command, options) {
269
+ const definition = command ? getCliCommandDefinition(command) : null;
270
+ for (const key of Object.keys(options)) {
271
+ if (!getCliOptionKind(command, key)) {
272
+ const label = cliOptionLabel(key);
273
+ const suffix = definition ? ` for ${definition.name}` : "";
274
+ throw new CliUsageError(`unknown option --${label}${suffix}`);
275
+ }
276
+ }
277
+ }
278
+
279
+ export {
280
+ DEFAULT_OPENPOND_WEB_BASE_URL,
281
+ DEFAULT_OPENPOND_API_BASE_URL,
282
+ DEFAULT_OPENPOND_OPCHAT_API_BASE_URL,
283
+ resolveAccountOption,
284
+ resolveBaseUrlOption,
285
+ resolveApiBaseUrlOption,
286
+ resolveChatApiBaseUrlOption,
287
+ resolveSandboxApiUrlOption,
288
+ resolveBaseUrl,
289
+ mapUiBaseToApiBase,
290
+ resolvePublicApiBaseUrl,
291
+ normalizeTemplateRepoUrl,
292
+ CliUsageError,
293
+ parseArgs
294
+ };