@overaihq/cli 0.14.14 → 0.14.15

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 +74 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -38209,7 +38209,7 @@ var agentToolRequestSchema = external_exports.object({
38209
38209
  path: external_exports.string().prefault("/").transform((p) => p.startsWith("/") ? p : `/${p}`),
38210
38210
  headers: external_exports.record(external_exports.string(), external_exports.string()).prefault({}),
38211
38211
  queryParams: external_exports.record(external_exports.string(), external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])).prefault({}),
38212
- body: external_exports.unknown()
38212
+ body: external_exports.unknown().optional()
38213
38213
  });
38214
38214
  var agentToolRequestJsonSchemaSchema = external_exports.object({
38215
38215
  type: external_exports.literal("object"),
@@ -45112,6 +45112,8 @@ var NodeEnum = /* @__PURE__ */ ((NodeEnum2) => {
45112
45112
  NodeEnum2["readFoldersFromLocalFolder"] = "READ_FOLDERS_FROM_LOCAL_FOLDER";
45113
45113
  NodeEnum2["redisAction"] = "REDIS_ACTION";
45114
45114
  NodeEnum2["renameLocalFile"] = "RENAME_LOCAL_FILE";
45115
+ NodeEnum2["ringcentralAction"] = "RINGCENTRAL_ACTION";
45116
+ NodeEnum2["ringcentralQuery"] = "RINGCENTRAL_QUERY";
45115
45117
  NodeEnum2["runContainerScript"] = "RUN_CONTAINER_SCRIPT";
45116
45118
  NodeEnum2["runFunction"] = "RUN_FUNCTION";
45117
45119
  NodeEnum2["runTableSpaceQuery"] = "RUN_TABLE_SPACE_QUERY";
@@ -45319,7 +45321,7 @@ var automationNodeSchema = external_exports.lazy(
45319
45321
  var automationNodesSchema = external_exports.array(automationNodeSchema);
45320
45322
  var iterationStateSchema = external_exports.object({
45321
45323
  iteration: external_exports.number().int(),
45322
- iteratee: external_exports.any(),
45324
+ iteratee: external_exports.any().nonoptional(),
45323
45325
  state: external_exports.lazy(() => automationStateSchema),
45324
45326
  /**
45325
45327
  * Set when a completed iteration's `state` is compacted to `{}` to keep the
@@ -60773,6 +60775,7 @@ var ID_PREFIXES = {
60773
60775
  knowledge_base: { prefix: "kb", body: 10 },
60774
60776
  knowledge_base_chunk: { prefix: "kbc", body: 20 },
60775
60777
  knowledge_base_document: { prefix: "kbd", body: 20 },
60778
+ library: { prefix: "lib", body: 10 },
60776
60779
  mailbox: { prefix: "mbx", body: 10 },
60777
60780
  mailbox_address: { prefix: "mba", body: 10 },
60778
60781
  mailbox_message: { prefix: "mbm", body: 10 },
@@ -65132,7 +65135,7 @@ When a parent executes, it resolves to one of these handles. Child nodes only be
65132
65135
  To run an event node, call \`runAutomationNode\` with a \`eventPayload\` object whose fields match the event node's declared outputs:
65133
65136
 
65134
65137
  - **TIMER**: \`{ firedAt: "<ISO8601>", scheduledAt: "<ISO8601>" }\` \u2014 use current time for both when testing ad-hoc
65135
- - **WEBHOOK**: \`{ payload: "<JSON string>", queryParams: {}, method: "POST", headers: { "Content-Type": "application/json" }, firedAt: "<ISO8601>" }\`
65138
+ - **WEBHOOK**: \`{ payload: { ... }, queryParams: {}, firedAt: "<ISO8601>" }\` \u2014 \`payload\` is the parsed request body (a JSON object, not a JSON string), matching a live run; use a raw string only to simulate an XML body
65136
65139
  - **EMAIL_RECEIVED**: \`{ from: "<email>", subject?: "<string>", text?: "<string>", html?: "<string>", headers?: {}, attachments?: [], firedAt: "<ISO8601>" }\`
65137
65140
  - **FILE_UPLOAD**: You **cannot** provide a file URL programmatically. Tell the user: "Please click the debug run button on the file upload event node and select a file. Once you've done that, I'll continue." Then wait for them to confirm before proceeding.
65138
65141
 
@@ -65730,6 +65733,45 @@ A function can email recipients when it breaks: the handler throws, times out, o
65730
65733
  `
65731
65734
  };
65732
65735
 
65736
+ // ../common/src/architectDocs/libraries.ts
65737
+ var librariesDoc = {
65738
+ id: "libraries",
65739
+ summary: "Libraries: reusable components and functions that v2 pages import as overai:<libraryId>, with a Preview export, versions and sharing.",
65740
+ body: `
65741
+ ## Libraries
65742
+
65743
+ A Library is a workspace resource holding one TypeScript/TSX module. Pages on the v2 runtime import its named exports:
65744
+
65745
+ \`\`\`tsx
65746
+ import { StatusBadge, formatMoney } from "overai:libxxxxxxxxxx";
65747
+ import { StatusBadge } from "overai:libxxxxxxxxxx@12"; // pinned to version 12
65748
+ \`\`\`
65749
+
65750
+ An unpinned import gets the library's deployed version. Lint flags an import of a library this workspace can't import, an archived library, or a pin to a version that doesn't exist; such an import leaves the page showing "Couldn't load the page's imports". A page can load at most 50 libraries, counting the libraries they import. Deploying a new version reaches open pages through their "new version available" refresh prompt. Library ids are lowercase; write them that way in imports. Only v2 pages can import libraries.
65751
+
65752
+ ## Writing a library
65753
+
65754
+ - Export what pages need by name. A default export is not importable.
65755
+ - \`Preview\` is reserved: export a component named \`Preview\` and it renders in the library's editor. Show each state and a usage example there. Pages never load it, so it costs them nothing.
65756
+ - A library is a real module, so import what it uses: \`import { useState } from "react";\`. The page globals (hooks, \`env\`, SDK helpers) are not in scope.
65757
+ - Imports may be \`react\`, \`react/jsx-runtime\`, \`react-dom\`, \`react-dom/client\`, \`superjson\`, \`@zumer/snapdom\`, other libraries (\`overai:<libraryId>\`) and https URLs (esm.sh). Anything else fails the build.
65758
+ - Take data as props and leave fetching to the page. The preview runs with no page data, and a component that fetches for itself is harder to reuse.
65759
+ - A build error is served as a module that throws it, so it appears in the console of any page importing the library.
65760
+ - To reuse a component a page already has, create a library, move the component into it with a \`Preview\`, deploy it, then replace the page's copy with an import.
65761
+ - A version that does not build is never deployed, by a save or by Deploy; fix the reported error and save again.
65762
+
65763
+ ## Versions and sharing
65764
+
65765
+ Saving creates a version and Deploy points pages at it. A library's own \`overai:\` imports also resolve to deployed versions, so an unsaved or undeployed change in one library never reaches a deployed page through another.
65766
+
65767
+ In the page editor's preview, the page's own library imports update on every edit, but the libraries those import keep the versions loaded when the preview opened. Reload the preview to pick up a newer deploy.
65768
+
65769
+ A library is shared into child workspaces like a function. Builders there read its source and preview but cannot edit it. A shared library brings its own imports along: pages in the child load whatever the library imports from its owning workspace, without that being shared too. To import one of those directly, share it. Library code is visible to anyone who can import it: keep secrets in a function, never in a library.
65770
+
65771
+ Archiving a library stops every deployed page and library that imports it from loading. \`setResourceArchived\` refuses at first and returns those importers; name them to the user, and call again with \`archiveDespiteImporters: true\` only if they still want it archived. Moving a library to another workspace warns the user about the same importers, since pages load a library only from the workspace that owns it or one it is shared into.
65772
+ `
65773
+ };
65774
+
65733
65775
  // ../common/src/architectDocs/liquidTemplates.ts
65734
65776
  var liquidTemplatesDoc = {
65735
65777
  id: "liquidTemplates",
@@ -66600,7 +66642,7 @@ These populate the \`data\`/\`items\` globals once, at render start, from the ol
66600
66642
  2. **DO NOT import React or hooks.** React, useState, useEffect, useRef, useMemo, useCallback, and useReducer are all globally available. Importing them will cause errors.
66601
66643
  3. **The main component MUST be named \`App\` and MUST NOT be exported.** Write \`function App() { ... }\` \u2014 no \`export\`.
66602
66644
  4. **Use Tailwind CSS for styling.** It's built in.
66603
- 5. **Import external libraries from esm.sh.** Example: \`import confetti from "https://esm.sh/canvas-confetti@1.9.3"\`. Imports must be absolute https URLs \u2014 the sandbox cannot resolve bare or relative specifiers.
66645
+ 5. **Import external libraries from esm.sh.** Example: \`import confetti from "https://esm.sh/canvas-confetti@1.9.3"\`. Imports must be absolute https URLs \u2014 bare and relative specifiers do not resolve. On the v2 runtime, also import your organization's libraries as \`overai:<libraryId>\` (read the \`libraries\` topic).
66604
66646
  6. **Sandbox restrictions (v1 runtime).** By default the page runs in a sandboxed iframe (allow-scripts only). Raw \`localStorage\`, \`sessionStorage\`, cookies, alert/confirm/prompt, and form submissions are blocked. Use \`useLocalStorageState\` / \`useSessionStorageState\` for storage (both require disabling the sandbox \u2014 see Rule 1). Set \`noSandbox: true\` to lift the sandbox, or \`runtime: "v2"\` (see Web Page Configuration) when the page also needs its own origin or browser devices.
66605
66647
  7. **Read code before editing.** Reading a large page's config returns its outline instead of the code \u2014 then read only the blocks or line ranges you are about to change. Edits return the changed lines, numbered, so don't re-read to verify. Prefer small, targeted edits \u2014 insert or search-replace \u2014 over rewriting a whole block.
66606
66648
  8. **Decompose large pages.** When a page exceeds ~200 lines, break it into multiple top-level function components (e.g., \`function DataTable() { ... }\` used inside \`function App() { ... }\`), so each can be read and edited on its own.
@@ -66667,7 +66709,7 @@ These libraries are tested and work from \`https://esm.sh/...\`. Do NOT import R
66667
66709
 
66668
66710
  ### Do NOT use libraries that depend on React
66669
66711
 
66670
- An esm.sh build of a React library imports its own React (\`import "/react@>=16.8"\`), a second copy beside the page's global one, so every hook inside it fails with "Invalid hook call". The page has no import map to redirect that specifier, so there is no workaround. This rules out, among others:
66712
+ An esm.sh build of a React library imports its own React (\`import "/react@>=16.8"\`), a second copy beside the page's global one, so every hook inside it fails with "Invalid hook call". The page's import map does not cover that specifier, so there is no workaround. This rules out, among others:
66671
66713
 
66672
66714
  - **react-resize-detector** \u2014 Use a \`ResizeObserver\` hook instead (see pattern below).
66673
66715
  - **@tanstack/react-table** \u2014 Build tables with plain \`<table>\` + Tailwind + \`useState\` for sorting/filtering/pagination.
@@ -66752,13 +66794,13 @@ var workspacesDoc = {
66752
66794
 
66753
66795
  Workspaces serve as permission boundaries. By design, a builder (viewer, editor, manager) in one workspace is able to see ALL child workspaces. It is NOT guaranteed that a builder in one workspace has permissions to see the parents though.
66754
66796
 
66755
- Resources (functions, tablespaces, integrations, agents, action runners) can be shared from one workspace to another, but ONLY from a parent to a direct child. This is done such that any builder is guaranteed to be able to see all usages of a resource in their workspace. This prevents issues where a builder makes a change and unintentionally breaks something.
66797
+ Resources (functions, tablespaces, integrations, agents, action runners, libraries) can be shared from one workspace to another, but ONLY from a parent to a direct child. This is done such that any builder is guaranteed to be able to see all usages of a resource in their workspace. This prevents issues where a builder makes a change and unintentionally breaks something.
66756
66798
 
66757
66799
  To share a resource, go to the Workspace Overview page, and then click "Resource sharing" (Managers only) in the top bar.
66758
66800
 
66759
- Resources shared into a workspace appear in its Workspace Overview resource table alongside its own, each marked "Shared from <parent workspace>" ("Shared from another workspace" when the viewer can't see the parent), and the "Shared" filter chip narrows the table to them. They are read-only there: no action menu, no activity stats. A shared resource's name links to its page only when the viewer holds a builder role in the workspace that owns it; otherwise the row is listed but not clickable. To change or unshare it, a manager of the parent workspace uses "Resource sharing" there.
66801
+ Resources shared into a workspace appear in its Workspace Overview resource table alongside its own, each marked "Shared from <parent workspace>" ("Shared from another workspace" when the viewer can't see the parent), and the "Shared" filter chip narrows the table to them. They are read-only there: no action menu, no activity stats. A shared resource's name links to its page only when the viewer holds a builder role in the workspace that owns it; otherwise the row is listed but not clickable. A shared library is the exception: it always opens, read-only, viewed from the child workspace. To change or unshare it, a manager of the parent workspace uses "Resource sharing" there.
66760
66802
 
66761
- An agent's tools (functions, tablespaces, sub-agents, knowledge bases) resolve from the agent's own workspace, never the caller's. Sharing an agent therefore lets the recipient use its tools through it without those tools being shared. Moving an agent to a workspace that can't reach a tool silently drops that tool at runtime; the agent page header shows "N tools unavailable" when this has happened. Fix it by sharing the tool into the agent's workspace or moving the tool, not by detaching it.
66803
+ An agent's tools (functions, tablespaces, sub-agents, knowledge bases) resolve from the agent's own workspace, never the caller's. Sharing an agent therefore lets the recipient use its tools through it without those tools being shared. A library's own imports work the same way: sharing a library brings what it imports along. Moving an agent to a workspace that can't reach a tool silently drops that tool at runtime; the agent page header shows "N tools unavailable" when this has happened. Fix it by sharing the tool into the agent's workspace or moving the tool, not by detaching it.
66762
66804
 
66763
66805
  Archived workspaces are hidden from the workspace tree but are not deleted. Archiving a workspace also archives its integrations, which deletes their credentials; restoring the workspace leaves them archived. Account admins can inventory every archived workspace from **All Workspaces \u2192 Show archived**. To restore one they manage, tell the user to right-click the workspace tree's root item, choose **View archived workspaces**, and then choose **Unarchive**.
66764
66806
 
@@ -66794,6 +66836,7 @@ var ARCHITECT_DOC_TOPICS = [
66794
66836
  automationExecutionRulesDoc,
66795
66837
  liquidTemplatesDoc,
66796
66838
  webPagesDoc,
66839
+ librariesDoc,
66797
66840
  printablePagesDoc,
66798
66841
  functionsDoc,
66799
66842
  functionDebuggingDoc,
@@ -66918,12 +66961,34 @@ var runReview = async () => {
66918
66961
  );
66919
66962
  }
66920
66963
  if (resource.type === "webPage" && relPath.endsWith(".tsx")) {
66964
+ const metaPath = resource.files.find(
66965
+ (file2) => file2.endsWith(".meta.json")
66966
+ );
66967
+ const isV2 = iife(() => {
66968
+ const meta3 = metaPath ? readWorkingFile(root, metaPath) : null;
66969
+ const [parsed] = resultOfSync(
66970
+ () => JSON.parse(meta3 ?? "{}")
66971
+ );
66972
+ return typeof parsed === "object" && parsed !== null && "runtime" in parsed && parsed.runtime === "v2";
66973
+ });
66921
66974
  const importRe = /^\s*import\s+(?:[^'"\n]*?\bfrom\s+)?["']([^"']+)["']/gm;
66922
66975
  for (const match of content.matchAll(importRe)) {
66923
66976
  const specifier = match[1];
66924
66977
  if (specifier == null || specifier.startsWith("https://")) continue;
66978
+ const library = /^overai:([^@]*)(?:@([0-9]+))?$/i.exec(specifier);
66979
+ if (library) {
66980
+ if (!isIdOf("library", library[1]))
66981
+ findings2.push(
66982
+ `${relPath}: imports "${specifier}" \u2014 not a library id; copy the import line from the library's page (overai:lib followed by 10 characters).`
66983
+ );
66984
+ else if (!isV2)
66985
+ findings2.push(
66986
+ `${relPath}: imports "${specifier}" \u2014 libraries load only on the v2 runtime; set "runtime": "v2" in ${metaPath ?? "the page's meta.json"}.`
66987
+ );
66988
+ continue;
66989
+ }
66925
66990
  findings2.push(
66926
- /^react(-dom)?(\/|$)/.test(specifier) ? `${relPath}: imports "${specifier}" \u2014 React and its hooks are already in scope; remove the import or the page renders blank.` : `${relPath}: imports "${specifier}" \u2014 the page sandbox can only import https URLs (use https://esm.sh/...).`
66991
+ /^react(-dom)?(\/|$)/.test(specifier) ? `${relPath}: imports "${specifier}" \u2014 React and its hooks are already in scope; remove the import or the page renders blank.` : `${relPath}: imports "${specifier}" \u2014 pages import https URLs (use https://esm.sh/...) or, on the v2 runtime, libraries as overai:<libraryId>.`
66927
66992
  );
66928
66993
  }
66929
66994
  if (/^\s*export\s+default\b/m.test(content)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overaihq/cli",
3
- "version": "0.14.14",
3
+ "version": "0.14.15",
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",