@overaihq/cli 0.14.3 → 0.14.5

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 +230 -114
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -27166,6 +27166,29 @@ import { hostname } from "os";
27166
27166
 
27167
27167
  // src/args.ts
27168
27168
  import { readFileSync as readFileSync2 } from "fs";
27169
+ var usageFor = (help, command2) => {
27170
+ const out = [];
27171
+ let inSection = false;
27172
+ for (const line of help.split("\n")) {
27173
+ const body = line.trimStart();
27174
+ if (body.startsWith("overai "))
27175
+ inSection = body === `overai ${command2}` || body.startsWith(`overai ${command2} `);
27176
+ else if (line === body) inSection = false;
27177
+ if (inSection) out.push(line);
27178
+ }
27179
+ return out.length === 0 ? "" : `${out.join("\n")}
27180
+ `;
27181
+ };
27182
+ var unknownFlags = (args, known, valueFlags = []) => {
27183
+ const out = [];
27184
+ for (let i = 0; i < args.length; i++) {
27185
+ const arg = args[i];
27186
+ if (arg == null || !arg.startsWith("-")) continue;
27187
+ if (!known.includes(arg)) out.push(arg);
27188
+ else if (valueFlags.includes(arg)) i++;
27189
+ }
27190
+ return out;
27191
+ };
27169
27192
  var flagValue = (args, ...names) => {
27170
27193
  for (const name2 of names) {
27171
27194
  const i = args.indexOf(name2);
@@ -27812,6 +27835,112 @@ var runAutomation = async (args) => {
27812
27835
  process.exitCode = 1;
27813
27836
  };
27814
27837
 
27838
+ // ../common/src/agent.ts
27839
+ var agentVersionConfigSchema = external_exports.object({
27840
+ systemPrompt: external_exports.string(),
27841
+ model: external_exports.string(),
27842
+ temperature: external_exports.number(),
27843
+ maxTokens: external_exports.number(),
27844
+ rateLimitRequestsPerMinute: external_exports.number(),
27845
+ rateLimitTokensPerMinute: external_exports.number()
27846
+ });
27847
+ var defaultAgentVersionConfig = {
27848
+ systemPrompt: "You are a helpful assistant.",
27849
+ model: "claude-sonnet-4-6",
27850
+ temperature: 0.7,
27851
+ maxTokens: 4096,
27852
+ rateLimitRequestsPerMinute: 20,
27853
+ rateLimitTokensPerMinute: 2e5
27854
+ };
27855
+ var agentTableSpaceAccessModeSchema = external_exports.enum(["read", "read_write"]);
27856
+ var BUILTIN_TOOL_SETS = {
27857
+ web: {
27858
+ label: "Web search",
27859
+ description: "Search the web. Runs on the model provider's infrastructure; not every model offers it."
27860
+ },
27861
+ documents: {
27862
+ label: "Read documents",
27863
+ description: "Read PDFs, Word documents, spreadsheets and text files from this organization's storage."
27864
+ },
27865
+ storage: {
27866
+ label: "Save files",
27867
+ description: "Write text files to this organization's storage for other tools and people to use."
27868
+ }
27869
+ };
27870
+ var isBuiltinToolSetName = (name2) => Object.hasOwn(BUILTIN_TOOL_SETS, name2);
27871
+ var agentEditableConfigSchema = agentVersionConfigSchema.extend({
27872
+ agentVersionFunctionsByAgentIdAndVersionNumber: external_exports.object({
27873
+ nodes: external_exports.array(
27874
+ external_exports.object({
27875
+ functionId: external_exports.string()
27876
+ })
27877
+ )
27878
+ }),
27879
+ agentVersionTableSpacesByAgentIdAndVersionNumber: external_exports.object({
27880
+ nodes: external_exports.array(
27881
+ external_exports.object({
27882
+ tableSpaceId: external_exports.string(),
27883
+ accessMode: agentTableSpaceAccessModeSchema
27884
+ })
27885
+ )
27886
+ }),
27887
+ agentVersionAgentsByAgentIdAndVersionNumber: external_exports.object({
27888
+ nodes: external_exports.array(
27889
+ external_exports.object({
27890
+ attachedAgentId: external_exports.string()
27891
+ })
27892
+ )
27893
+ }),
27894
+ agentVersionKnowledgeBasesByAgentIdAndVersionNumber: external_exports.object({
27895
+ nodes: external_exports.array(
27896
+ external_exports.object({
27897
+ knowledgeBaseId: external_exports.string()
27898
+ })
27899
+ )
27900
+ }),
27901
+ // Prefaulted: configs from before built-ins (stale clients, saved drafts)
27902
+ // still parse.
27903
+ agentVersionBuiltinToolSetsByAgentIdAndVersionNumber: external_exports.object({
27904
+ nodes: external_exports.array(
27905
+ external_exports.object({
27906
+ toolSet: external_exports.string()
27907
+ })
27908
+ )
27909
+ }).prefault({ nodes: [] })
27910
+ });
27911
+ var agentToolHttpMethodSchema = external_exports.enum([
27912
+ "GET",
27913
+ "POST",
27914
+ "PUT",
27915
+ "PATCH",
27916
+ "DELETE"
27917
+ ]);
27918
+ var agentToolRequestSchema = external_exports.object({
27919
+ method: agentToolHttpMethodSchema,
27920
+ // Sub-path under the function base URL; functions route on it
27921
+ path: external_exports.string().prefault("/").transform((p) => p.startsWith("/") ? p : `/${p}`),
27922
+ headers: external_exports.record(external_exports.string(), external_exports.string()).prefault({}),
27923
+ queryParams: external_exports.record(external_exports.string(), external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])).prefault({}),
27924
+ body: external_exports.unknown()
27925
+ });
27926
+ var agentToolRequestJsonSchemaSchema = external_exports.object({
27927
+ type: external_exports.literal("object"),
27928
+ properties: external_exports.object({
27929
+ method: external_exports.object({ type: external_exports.literal("string") }).loose(),
27930
+ headers: external_exports.object({ type: external_exports.literal("object") }).loose(),
27931
+ queryParams: external_exports.object({ type: external_exports.literal("object") }).loose(),
27932
+ body: external_exports.object({}).loose()
27933
+ }).loose(),
27934
+ required: external_exports.array(external_exports.string()).refine(
27935
+ (arr) => ["method", "headers", "queryParams", "body"].every(
27936
+ (key) => arr.includes(key)
27937
+ ),
27938
+ {
27939
+ message: "required array must include: method, headers, queryParams, body"
27940
+ }
27941
+ )
27942
+ }).loose();
27943
+
27815
27944
  // src/workspace/validateElements.ts
27816
27945
  var findings = (parsed) => parsed.success ? [] : parsed.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`);
27817
27946
  var validateAutomationElements = async (elements) => {
@@ -27824,40 +27953,46 @@ var validateWebPageConfig = async (config) => {
27824
27953
  };
27825
27954
 
27826
27955
  // ../common/src/function.ts
27827
- var defaultAgentFunctionInputSchema = `{
27828
- "type": "object",
27829
- "properties": {
27830
- "method": {
27831
- "type": "string",
27832
- "enum": ["GET", "POST", "PUT", "PATCH", "DELETE"],
27833
- "default": "POST",
27834
- "description": "HTTP method for this function call."
27956
+ var agentToolPathJsonSchema = {
27957
+ type: "string",
27958
+ default: "/",
27959
+ description: 'Sub-path under the function URL, e.g. "/notes". Use "/" for the base.'
27960
+ };
27961
+ var defaultAgentFunctionInputSchema = JSON.stringify(
27962
+ {
27963
+ type: "object",
27964
+ properties: {
27965
+ method: {
27966
+ type: "string",
27967
+ enum: ["GET", "POST", "PUT", "PATCH", "DELETE"],
27968
+ default: "POST",
27969
+ description: "HTTP method for this function call."
27835
27970
  },
27836
- "headers": {
27837
- "type": "object",
27838
- "description": "Request headers. Use {} when none are needed.",
27839
- "default": {},
27840
- "additionalProperties": {
27841
- "type": "string"
27842
- }
27971
+ path: agentToolPathJsonSchema,
27972
+ headers: {
27973
+ type: "object",
27974
+ description: "Request headers. Use {} when none are needed.",
27975
+ default: {},
27976
+ additionalProperties: { type: "string" }
27843
27977
  },
27844
- "queryParams": {
27845
- "type": "object",
27846
- "description": "URL query params. Use {} when none are needed.",
27847
- "default": {},
27848
- "additionalProperties": {
27849
- "type": ["string", "number", "boolean"]
27850
- }
27978
+ queryParams: {
27979
+ type: "object",
27980
+ description: "URL query params. Use {} when none are needed.",
27981
+ default: {},
27982
+ additionalProperties: { type: ["string", "number", "boolean"] }
27851
27983
  },
27852
- "body": {
27853
- "type": "object",
27854
- "description": "Request body payload. Use {} when none is needed.",
27855
- "default": {},
27856
- "additionalProperties": true
27984
+ body: {
27985
+ type: "object",
27986
+ description: "Request body payload. Use {} when none is needed.",
27987
+ default: {},
27988
+ additionalProperties: true
27857
27989
  }
27858
27990
  },
27859
- "required": ["method", "headers", "queryParams", "body"]
27860
- }`;
27991
+ required: ["method", "headers", "queryParams", "body"]
27992
+ },
27993
+ null,
27994
+ 2
27995
+ );
27861
27996
  var DEFAULT_FUNCTION_EXECUTION_TIMEOUT_MS = 3e4;
27862
27997
  var DEFAULT_FUNCTION_EXECUTION_MEMORY_MB = 512;
27863
27998
 
@@ -28259,6 +28394,9 @@ var agentFiles = (id, name2, version) => ({
28259
28394
  ),
28260
28395
  knowledgeBaseIds: version.agentVersionKnowledgeBasesByAgentIdAndVersionNumber.nodes.map(
28261
28396
  (link) => link.knowledgeBaseId
28397
+ ),
28398
+ builtinToolSets: version.agentVersionBuiltinToolSetsByAgentIdAndVersionNumber.nodes.map(
28399
+ (link) => link.toolSet
28262
28400
  )
28263
28401
  })
28264
28402
  });
@@ -28277,6 +28415,9 @@ var agentVersionFields = `
28277
28415
  agentVersionKnowledgeBasesByAgentIdAndVersionNumber(orderBy: [KNOWLEDGE_BASE_ID_ASC]) {
28278
28416
  nodes { knowledgeBaseId }
28279
28417
  }
28418
+ agentVersionBuiltinToolSetsByAgentIdAndVersionNumber(orderBy: [TOOL_SET_ASC]) {
28419
+ nodes { toolSet }
28420
+ }
28280
28421
  `;
28281
28422
  var agentAdapter = {
28282
28423
  type: "agent",
@@ -28342,13 +28483,21 @@ var agentAdapter = {
28342
28483
  },
28343
28484
  push: async (id, files, message, expectedLatestVersion) => {
28344
28485
  const config = JSON.parse(fileBySuffix(files, ".json"));
28486
+ const unknownToolSets = (config.builtinToolSets ?? []).filter(
28487
+ (name2) => !isBuiltinToolSetName(name2)
28488
+ );
28489
+ if (unknownToolSets.length > 0) {
28490
+ throw new Error(
28491
+ `Unknown builtinToolSets: ${unknownToolSets.join(", ")}. Known: ${Object.keys(BUILTIN_TOOL_SETS).join(", ")}. If the name is new, upgrade the CLI.`
28492
+ );
28493
+ }
28345
28494
  const data = await gqlRequest(
28346
28495
  `mutation CliCreateAgentVersion($expectedLatestVersion: Int,
28347
28496
  $agentId: String!, $message: String!, $systemPrompt: String!,
28348
28497
  $model: String!, $temperature: Float!, $maxTokens: Int!,
28349
28498
  $rateLimitRequestsPerMinute: Int!, $rateLimitTokensPerMinute: Int!,
28350
28499
  $functionIds: [String], $tableSpaceBindings: JSON, $agentIds: [String],
28351
- $knowledgeBaseIds: [String]
28500
+ $knowledgeBaseIds: [String], $builtinToolSets: [String]
28352
28501
  ) {
28353
28502
  createAgentVersionWithAttachments(input: { expectedLatestVersion: $expectedLatestVersion,
28354
28503
  agentId: $agentId, message: $message, systemPrompt: $systemPrompt,
@@ -28356,7 +28505,8 @@ var agentAdapter = {
28356
28505
  rateLimitRequestsPerMinute: $rateLimitRequestsPerMinute,
28357
28506
  rateLimitTokensPerMinute: $rateLimitTokensPerMinute,
28358
28507
  functionIds: $functionIds, tableSpaceBindings: $tableSpaceBindings,
28359
- agentIds: $agentIds, knowledgeBaseIds: $knowledgeBaseIds
28508
+ agentIds: $agentIds, knowledgeBaseIds: $knowledgeBaseIds,
28509
+ builtinToolSets: $builtinToolSets
28360
28510
  }) { result { versionNumber } }
28361
28511
  }`,
28362
28512
  {
@@ -28366,6 +28516,7 @@ var agentAdapter = {
28366
28516
  tableSpaceBindings: config.tableSpaceBindings ?? [],
28367
28517
  agentIds: config.agentIds ?? [],
28368
28518
  knowledgeBaseIds: config.knowledgeBaseIds ?? [],
28519
+ builtinToolSets: config.builtinToolSets ?? null,
28369
28520
  expectedLatestVersion
28370
28521
  }
28371
28522
  );
@@ -28554,86 +28705,6 @@ var runRunner = async (args) => {
28554
28705
  process.exitCode = 1;
28555
28706
  };
28556
28707
 
28557
- // ../common/src/agent.ts
28558
- var agentVersionConfigSchema = external_exports.object({
28559
- systemPrompt: external_exports.string(),
28560
- model: external_exports.string(),
28561
- temperature: external_exports.number(),
28562
- maxTokens: external_exports.number(),
28563
- rateLimitRequestsPerMinute: external_exports.number(),
28564
- rateLimitTokensPerMinute: external_exports.number()
28565
- });
28566
- var defaultAgentVersionConfig = {
28567
- systemPrompt: "You are a helpful assistant.",
28568
- model: "claude-sonnet-4-6",
28569
- temperature: 0.7,
28570
- maxTokens: 4096,
28571
- rateLimitRequestsPerMinute: 20,
28572
- rateLimitTokensPerMinute: 2e5
28573
- };
28574
- var agentTableSpaceAccessModeSchema = external_exports.enum(["read", "read_write"]);
28575
- var agentEditableConfigSchema = agentVersionConfigSchema.extend({
28576
- agentVersionFunctionsByAgentIdAndVersionNumber: external_exports.object({
28577
- nodes: external_exports.array(
28578
- external_exports.object({
28579
- functionId: external_exports.string()
28580
- })
28581
- )
28582
- }),
28583
- agentVersionTableSpacesByAgentIdAndVersionNumber: external_exports.object({
28584
- nodes: external_exports.array(
28585
- external_exports.object({
28586
- tableSpaceId: external_exports.string(),
28587
- accessMode: agentTableSpaceAccessModeSchema
28588
- })
28589
- )
28590
- }),
28591
- agentVersionAgentsByAgentIdAndVersionNumber: external_exports.object({
28592
- nodes: external_exports.array(
28593
- external_exports.object({
28594
- attachedAgentId: external_exports.string()
28595
- })
28596
- )
28597
- }),
28598
- agentVersionKnowledgeBasesByAgentIdAndVersionNumber: external_exports.object({
28599
- nodes: external_exports.array(
28600
- external_exports.object({
28601
- knowledgeBaseId: external_exports.string()
28602
- })
28603
- )
28604
- })
28605
- });
28606
- var agentToolHttpMethodSchema = external_exports.enum([
28607
- "GET",
28608
- "POST",
28609
- "PUT",
28610
- "PATCH",
28611
- "DELETE"
28612
- ]);
28613
- var agentToolRequestSchema = external_exports.object({
28614
- method: agentToolHttpMethodSchema,
28615
- headers: external_exports.record(external_exports.string(), external_exports.string()).prefault({}),
28616
- queryParams: external_exports.record(external_exports.string(), external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])).prefault({}),
28617
- body: external_exports.unknown()
28618
- });
28619
- var agentToolRequestJsonSchemaSchema = external_exports.object({
28620
- type: external_exports.literal("object"),
28621
- properties: external_exports.object({
28622
- method: external_exports.object({ type: external_exports.literal("string") }).loose(),
28623
- headers: external_exports.object({ type: external_exports.literal("object") }).loose(),
28624
- queryParams: external_exports.object({ type: external_exports.literal("object") }).loose(),
28625
- body: external_exports.object({}).loose()
28626
- }).loose(),
28627
- required: external_exports.array(external_exports.string()).refine(
28628
- (arr) => ["method", "headers", "queryParams", "body"].every(
28629
- (key) => arr.includes(key)
28630
- ),
28631
- {
28632
- message: "required array must include: method, headers, queryParams, body"
28633
- }
28634
- )
28635
- }).loose();
28636
-
28637
28708
  // ../common/src/liquidjs/liquidjs.ts
28638
28709
  var import_jmespath = __toESM(require_jmespath(), 1);
28639
28710
 
@@ -34773,14 +34844,20 @@ var positionals = (args) => {
34773
34844
  }
34774
34845
  return out;
34775
34846
  };
34847
+ var pushMessage = (args) => {
34848
+ const message = flagValue(args, "-m", "--message");
34849
+ if (message == null || message.startsWith("-"))
34850
+ throw new Error("Usage: overai push [filter] -m <message>. -m names the version this push creates.");
34851
+ return message;
34852
+ };
34776
34853
  var runPush = async (args, clone) => {
34777
34854
  if (clone != null && args.includes("--deploy")) throw new Error("Recursive push cannot deploy.");
34855
+ const message = pushMessage(args);
34778
34856
  const { root, manifest } = clone ?? openClone();
34779
34857
  let incomplete = false;
34780
34858
  const currentIds = clone == null ? null : new Set((await Promise.all(
34781
34859
  allAdapters.map((adapter) => adapter.fetchAll(manifest.workspaceId))
34782
34860
  )).flat().map((resource) => resource.id));
34783
- const message = flagValue(args, "-m", "--message") ?? "Pushed via overai CLI";
34784
34861
  const deploy = args.includes("--deploy");
34785
34862
  const force = args.includes("--force");
34786
34863
  const allowBreaking = args.includes("--allow-breaking");
@@ -35373,6 +35450,9 @@ var ID_PREFIXES = {
35373
35450
  agent: { prefix: "agt", body: 10 },
35374
35451
  agent_conversation: { prefix: "agcv", body: 20 },
35375
35452
  agent_message: { prefix: "agmsg", body: 20 },
35453
+ agent_message_part: { prefix: "amp", body: 16 },
35454
+ agent_tool_invocation: { prefix: "ati", body: 16 },
35455
+ agent_turn: { prefix: "atn", body: 16 },
35376
35456
  architect_chat: {
35377
35457
  prefix: "ac",
35378
35458
  body: 12,
@@ -36262,6 +36342,7 @@ var runDiff = async (args, clone) => {
36262
36342
  var runRecursiveSync = async (command2, args) => {
36263
36343
  if (command2 === "push" && args.includes("--deploy"))
36264
36344
  throw new Error("Recursive push saves versions only. Deploy from an individual workspace.");
36345
+ if (command2 === "push") pushMessage(args);
36265
36346
  const origin = openClone();
36266
36347
  const local = /* @__PURE__ */ new Map([[origin.manifest.workspaceId, origin]]);
36267
36348
  const folders = [origin];
@@ -36680,7 +36761,9 @@ Rules that keep graphs healthy:
36680
36761
  - Keep TYPESCRIPT_CODE nodes small and focused \u2014 split logic across nodes and
36681
36762
  let the graph orchestrate, rather than one big code block.
36682
36763
  - Write TYPESCRIPT_CODE as a module:
36683
- \`export default async function step(state: StepState, ctx, env) { const s1 = await state.get("S1"); return s1.rows; }\`.
36764
+ \`export default async function step(state: StepState, ctx: StepContext, env: Env) { const s1 = await state.get("S1"); return s1.rows; }\`.
36765
+ Annotate every parameter you declare \u2014 module code is checked with
36766
+ noImplicitAny, so an unannotated one is an error.
36684
36767
  \`state.get\` fetches one step's output on first read (cached for that node's execution),
36685
36768
  resolves undefined for a skipped step, and rejects for an id not visible
36686
36769
  from the node. Bare snippets (STATE/OUTPUT globals) are legacy, being retired.
@@ -37843,13 +37926,44 @@ var withoutLeadingFlags = (argv) => {
37843
37926
  }
37844
37927
  return argv.slice(index);
37845
37928
  };
37929
+ var COMMAND_ALIASES = {
37930
+ login: "signin",
37931
+ logout: "signout",
37932
+ ws: "workspace",
37933
+ upgrade: "update"
37934
+ };
37935
+ var WRITE_COMMAND_FLAGS = /* @__PURE__ */ new Map([
37936
+ ["pull", { flags: ["--recursive"] }],
37937
+ [
37938
+ "push",
37939
+ {
37940
+ flags: ["-m", "--message", "--deploy", "--force", "--allow-breaking", "--recursive"],
37941
+ valueFlags: ["-m", "--message"]
37942
+ }
37943
+ ],
37944
+ // --recursive stays listed for deploy and restore so the --recursive branch
37945
+ // below can explain that they are single-workspace, instead of "unknown flag".
37946
+ ["deploy", { flags: ["--all", "--allow-breaking", "--recursive"] }],
37947
+ ["restore", { flags: ["--all", "--recursive"] }]
37948
+ ]);
37949
+ var usageOrHelp = (command2) => usageFor(HELP, COMMAND_ALIASES[command2] ?? command2) || HELP;
37846
37950
  var run = async () => {
37847
37951
  const [command2, ...rest] = withoutLeadingFlags(process.argv.slice(2));
37952
+ if (command2 != null && (rest.includes("--help") || rest.includes("-h"))) {
37953
+ process.stdout.write(usageOrHelp(command2));
37954
+ return;
37955
+ }
37848
37956
  const misplaced = rest.find((arg) => LEADING_FLAGS.includes(arg));
37849
37957
  if (misplaced != null)
37850
37958
  throw new Error(
37851
37959
  `${misplaced} goes before the command: overai ${misplaced} <ref> ${command2 ?? "<command>"} ...`
37852
37960
  );
37961
+ const writeFlags = command2 == null ? void 0 : WRITE_COMMAND_FLAGS.get(command2);
37962
+ const unknown = writeFlags == null ? [] : unknownFlags(rest, writeFlags.flags, writeFlags.valueFlags);
37963
+ if (unknown.length > 0)
37964
+ throw new Error(
37965
+ `Unknown flag ${unknown.join(", ")} for ${command2 ?? ""}. See: overai ${command2 ?? ""} --help`
37966
+ );
37853
37967
  const orgFromFolder = command2 != null && !ORG_AGNOSTIC_COMMANDS.has(command2);
37854
37968
  if (orgFromFolder) pinOrgFromClone();
37855
37969
  if (requireExplicitOrg && command2 != null && !ORG_OPTIONAL_COMMANDS.has(command2) && orgScopeSource() === "saved default")
@@ -38006,8 +38120,10 @@ var run = async () => {
38006
38120
  process.stdout.write(`${cliVersion()}
38007
38121
  `);
38008
38122
  return;
38009
- case void 0:
38010
38123
  case "help":
38124
+ process.stdout.write(rest[0] == null ? HELP : usageOrHelp(rest[0]));
38125
+ return;
38126
+ case void 0:
38011
38127
  case "--help":
38012
38128
  case "-h":
38013
38129
  process.stdout.write(HELP);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overaihq/cli",
3
- "version": "0.14.3",
3
+ "version": "0.14.5",
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",