@overaihq/cli 0.13.0 → 0.13.1

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 (2) hide show
  1. package/dist/index.js +31 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26821,7 +26821,10 @@ var gqlRequest = async (query, variables) => {
26821
26821
  }
26822
26822
  })();
26823
26823
  if (body?.errors != null && body.errors.length > 0) {
26824
- throw new Error(body.errors.map((e) => e.message).join("; "));
26824
+ throw Object.assign(
26825
+ new Error(body.errors.map((e) => e.message).join("; ")),
26826
+ { errors: body.errors }
26827
+ );
26825
26828
  }
26826
26829
  if (!res.ok) throw v2Error("graphql", res, raw2);
26827
26830
  if (body?.data == null) {
@@ -27116,7 +27119,7 @@ var functionAdapter = {
27116
27119
  functions(condition: { workspaceId: $workspaceId }, includeArchived: NO) {
27117
27120
  nodes {
27118
27121
  id name
27119
- functionVersions(orderBy: [CREATED_AT_DESC], first: 1) {
27122
+ functionVersions(orderBy: [VERSION_NUMBER_DESC], first: 1) {
27120
27123
  nodes { versionNumber code inputSchema outputSchema executionTimeout executionCpu executionMemory }
27121
27124
  }
27122
27125
  functionDeployedVersion { versionNumber }
@@ -27143,7 +27146,7 @@ var functionAdapter = {
27143
27146
  const data = await gqlRequest(
27144
27147
  `query CliFunctionHead($id: String!) {
27145
27148
  function(id: $id) {
27146
- functionVersions(orderBy: [CREATED_AT_DESC], first: 1) { nodes { versionNumber } }
27149
+ functionVersions(orderBy: [VERSION_NUMBER_DESC], first: 1) { nodes { versionNumber } }
27147
27150
  functionDeployedVersion { versionNumber }
27148
27151
  }
27149
27152
  }`,
@@ -27171,11 +27174,11 @@ var functionAdapter = {
27171
27174
  }
27172
27175
  return functionFiles(id, name2, data.functionVersion);
27173
27176
  },
27174
- push: async (id, files, message) => {
27177
+ push: async (id, files, message, expectedLatestVersion) => {
27175
27178
  const meta = JSON.parse(fileBySuffix(files, ".meta.json"));
27176
27179
  const data = await gqlRequest(
27177
- `mutation CliCreateFunctionVersion($functionId: String!, $code: String!, $message: String, $inputSchema: String, $outputSchema: String, $executionTimeout: Int, $executionCpu: Int, $executionMemory: Int) {
27178
- createFunctionVersion(input: { functionVersion: {
27180
+ `mutation CliCreateFunctionVersion($expectedLatestVersion: Int, $functionId: String!, $code: String!, $message: String, $inputSchema: String, $outputSchema: String, $executionTimeout: Int, $executionCpu: Int, $executionMemory: Int) {
27181
+ createFunctionVersion(input: { expectedLatestVersion: $expectedLatestVersion, functionVersion: {
27179
27182
  functionId: $functionId, code: $code, message: $message,
27180
27183
  inputSchema: $inputSchema, outputSchema: $outputSchema,
27181
27184
  executionTimeout: $executionTimeout, executionCpu: $executionCpu,
@@ -27183,6 +27186,7 @@ var functionAdapter = {
27183
27186
  }}) { functionVersion { versionNumber } }
27184
27187
  }`,
27185
27188
  {
27189
+ expectedLatestVersion,
27186
27190
  functionId: id,
27187
27191
  code: fileBySuffix(files, ".ts"),
27188
27192
  message,
@@ -27301,7 +27305,7 @@ var pageAdapter = (opts) => {
27301
27305
  }
27302
27306
  return pageFiles(opts.dir, id, name2, version.config);
27303
27307
  },
27304
- push: async (id, files, message) => {
27308
+ push: async (id, files, message, expectedLatestVersion) => {
27305
27309
  const config = pageConfigFromFiles(files);
27306
27310
  const findings2 = await opts.validateConfig?.(config) ?? [];
27307
27311
  if (findings2.length > 0) {
@@ -27311,12 +27315,12 @@ ${findings2.map((f) => ` ${f}`).join("\n")}`
27311
27315
  );
27312
27316
  }
27313
27317
  const data = await gqlRequest(
27314
- `mutation CliCreatePageVersion($id: String!, $message: String, $config: JSON!) {
27315
- create${capitalized}Version(input: { ${gqlName}Version: { ${idArg}: $id, message: $message, config: $config } }) {
27318
+ `mutation CliCreatePageVersion($expectedLatestVersion: Int, $id: String!, $message: String, $config: JSON!) {
27319
+ create${capitalized}Version(input: { expectedLatestVersion: $expectedLatestVersion, ${gqlName}Version: { ${idArg}: $id, message: $message, config: $config } }) {
27316
27320
  ${gqlName}Version { versionNumber }
27317
27321
  }
27318
27322
  }`,
27319
- { id, message, config }
27323
+ { id, message, config, expectedLatestVersion }
27320
27324
  );
27321
27325
  const versionNumber = data[`create${capitalized}Version`]?.[`${gqlName}Version`]?.versionNumber;
27322
27326
  if (versionNumber == null) {
@@ -27411,7 +27415,7 @@ var automationAdapter = {
27411
27415
  })
27412
27416
  };
27413
27417
  },
27414
- push: async (id, files, message) => {
27418
+ push: async (id, files, message, expectedLatestVersion) => {
27415
27419
  const doc = JSON.parse(fileBySuffix(files, ".json"));
27416
27420
  const findings2 = await validateAutomationElements(doc.elements);
27417
27421
  if (findings2.length > 0) {
@@ -27421,12 +27425,13 @@ ${findings2.map((f) => ` ${f}`).join("\n")}`
27421
27425
  );
27422
27426
  }
27423
27427
  const data = await gqlRequest(
27424
- `mutation CliCreateAutomationVersion($automationId: String!, $elements: JSON!, $message: String, $maxConcurrentRuns: Int) {
27425
- createAutomationVersion(input: { automationVersion: {
27428
+ `mutation CliCreateAutomationVersion($expectedLatestVersion: Int, $automationId: String!, $elements: JSON!, $message: String, $maxConcurrentRuns: Int) {
27429
+ createAutomationVersion(input: { expectedLatestVersion: $expectedLatestVersion, automationVersion: {
27426
27430
  automationId: $automationId, elements: $elements, message: $message, maxConcurrentRuns: $maxConcurrentRuns
27427
27431
  }}) { automationVersion { num } }
27428
27432
  }`,
27429
27433
  {
27434
+ expectedLatestVersion,
27430
27435
  automationId: id,
27431
27436
  elements: doc.elements,
27432
27437
  message,
@@ -27536,22 +27541,20 @@ var agentAdapter = {
27536
27541
  { agentId: id, versionNumber }
27537
27542
  );
27538
27543
  if (data.agentVersion == null) {
27539
- throw new Error(
27540
- `Agent ${id} has no version ${String(versionNumber)}.`
27541
- );
27544
+ throw new Error(`Agent ${id} has no version ${String(versionNumber)}.`);
27542
27545
  }
27543
27546
  return agentFiles(id, name2, data.agentVersion);
27544
27547
  },
27545
- push: async (id, files, message) => {
27548
+ push: async (id, files, message, expectedLatestVersion) => {
27546
27549
  const config = JSON.parse(fileBySuffix(files, ".json"));
27547
27550
  const data = await gqlRequest(
27548
- `mutation CliCreateAgentVersion(
27551
+ `mutation CliCreateAgentVersion($expectedLatestVersion: Int,
27549
27552
  $agentId: String!, $message: String!, $systemPrompt: String!,
27550
27553
  $model: String!, $temperature: Float!, $maxTokens: Int!,
27551
27554
  $rateLimitRequestsPerMinute: Int!, $rateLimitTokensPerMinute: Int!,
27552
27555
  $functionIds: [String]
27553
27556
  ) {
27554
- createAgentVersionWithFunctions(input: {
27557
+ createAgentVersionWithFunctions(input: { expectedLatestVersion: $expectedLatestVersion,
27555
27558
  agentId: $agentId, message: $message, systemPrompt: $systemPrompt,
27556
27559
  model: $model, temperature: $temperature, maxTokens: $maxTokens,
27557
27560
  rateLimitRequestsPerMinute: $rateLimitRequestsPerMinute,
@@ -27559,7 +27562,7 @@ var agentAdapter = {
27559
27562
  functionIds: $functionIds
27560
27563
  }) { result { versionNumber } }
27561
27564
  }`,
27562
- { agentId: id, message, ...config }
27565
+ { agentId: id, message, ...config, expectedLatestVersion }
27563
27566
  );
27564
27567
  const versionNumber = data.createAgentVersionWithFunctions?.result?.versionNumber;
27565
27568
  if (versionNumber == null) {
@@ -27931,7 +27934,12 @@ var runPush = async (args, clone) => {
27931
27934
  if (content == null) throw new Error(`${relPath} is missing locally.`);
27932
27935
  files[relPath] = content;
27933
27936
  }
27934
- const versionNumber = await adapter.push(id, files, message);
27937
+ const versionNumber = await adapter.push(
27938
+ id,
27939
+ files,
27940
+ message,
27941
+ force ? void 0 : resource.baseVersion
27942
+ );
27935
27943
  for (const relPath of changedFiles) {
27936
27944
  const content = files[relPath];
27937
27945
  if (content == null) continue;
@@ -35597,6 +35605,8 @@ var runResource = async (args) => {
35597
35605
  // src/docs/bestPractices.ts
35598
35606
  var platform2 = `# OverAI platform primer
35599
35607
 
35608
+ Saves reject a stale editing base without discarding your draft. Incorporate the latest saved changes before retrying; never retry with a newer base unless those changes have been reconciled. A save conflict does not deploy anything. Normal push sends the manifest base to an atomic server check. Only explicit --force omits it; never use --force as automatic conflict recovery.
35609
+
35600
35610
  Organization context: Commands in a clone select its org automatically. Outside a clone,
35601
35611
  use OVERAI_ORG_ID=<orgId>. Each backend/org has an independent saved session; org switch
35602
35612
  changes only the machine-global default. Use whoami to inspect the effective scope.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overaihq/cli",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "Create, edit, deploy, and run OverAI workspace resources from the command line",
5
5
  "type": "module",
6
6
  "homepage": "https://overai.com",