opencrowd 0.10.1 → 0.11.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.
- package/bundle/opencrowd.js +16 -6
- package/package.json +1 -1
package/bundle/opencrowd.js
CHANGED
|
@@ -16717,12 +16717,19 @@ var init_session_defaults = __esm({
|
|
|
16717
16717
|
// ../../packages/core/dist/shell.js
|
|
16718
16718
|
import { spawn } from "node:child_process";
|
|
16719
16719
|
import { isAbsolute as isAbsolute2, join as join7, resolve as resolve3 } from "node:path";
|
|
16720
|
+
function maxShellTimeoutMs(env = process.env) {
|
|
16721
|
+
const requested = Number(env.OPENCROWD_MAX_SHELL_TIMEOUT_MS);
|
|
16722
|
+
if (!Number.isInteger(requested) || requested <= DEFAULT_MAX_SHELL_TIMEOUT_MS) {
|
|
16723
|
+
return DEFAULT_MAX_SHELL_TIMEOUT_MS;
|
|
16724
|
+
}
|
|
16725
|
+
return Math.min(SHELL_TIMEOUT_CEILING_MS, requested);
|
|
16726
|
+
}
|
|
16720
16727
|
async function runShell(state, command, cwd = state.workspaceRoot, timeoutMs = 1e4, options = {}) {
|
|
16721
16728
|
if (!state.shellEnabled) {
|
|
16722
16729
|
throw new Error("shell tool is disabled for this session");
|
|
16723
16730
|
}
|
|
16724
16731
|
options.signal?.throwIfAborted();
|
|
16725
|
-
const maxTimeout = options.maxTimeoutMs ??
|
|
16732
|
+
const maxTimeout = options.maxTimeoutMs ?? maxShellTimeoutMs();
|
|
16726
16733
|
if (!Number.isInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > maxTimeout) {
|
|
16727
16734
|
throw new Error(`timeout_ms must be between 1 and ${maxTimeout}`);
|
|
16728
16735
|
}
|
|
@@ -16853,10 +16860,13 @@ function capOutput(output3, maxBytes) {
|
|
|
16853
16860
|
}
|
|
16854
16861
|
return output3.slice(0, maxBytes) + "\n[output truncated]\n";
|
|
16855
16862
|
}
|
|
16863
|
+
var DEFAULT_MAX_SHELL_TIMEOUT_MS, SHELL_TIMEOUT_CEILING_MS;
|
|
16856
16864
|
var init_shell = __esm({
|
|
16857
16865
|
"../../packages/core/dist/shell.js"() {
|
|
16858
16866
|
"use strict";
|
|
16859
16867
|
init_ledger();
|
|
16868
|
+
DEFAULT_MAX_SHELL_TIMEOUT_MS = 3e5;
|
|
16869
|
+
SHELL_TIMEOUT_CEILING_MS = 27e5;
|
|
16860
16870
|
}
|
|
16861
16871
|
});
|
|
16862
16872
|
|
|
@@ -16907,7 +16917,7 @@ function toolParameters(name) {
|
|
|
16907
16917
|
return objectSchema({
|
|
16908
16918
|
command: stringSchema("Shell command."),
|
|
16909
16919
|
cwd: stringSchema("Working directory inside the workspace. Use artifacts/<dir> to run where save_file writes (cd inside the command does not reach it)."),
|
|
16910
|
-
timeout_ms: integerSchema(
|
|
16920
|
+
timeout_ms: integerSchema(`Timeout in milliseconds (default 10000, maximum ${maxShellTimeoutMs()}). Pass the real time a long build or download needs; the command is killed at the timeout.`)
|
|
16911
16921
|
}, ["command"]);
|
|
16912
16922
|
case "spawn_subagent":
|
|
16913
16923
|
return objectSchema({
|
|
@@ -17039,6 +17049,7 @@ var TOOL_NAMES, HOSTED_ONLY_TOOL_NAMES, SUBAGENT_TOOL_NAMES, OPEN_CROWD_TOOLS;
|
|
|
17039
17049
|
var init_tool_definitions = __esm({
|
|
17040
17050
|
"../../packages/core/dist/tool-definitions.js"() {
|
|
17041
17051
|
"use strict";
|
|
17052
|
+
init_shell();
|
|
17042
17053
|
TOOL_NAMES = [
|
|
17043
17054
|
"get_budget_status",
|
|
17044
17055
|
"save_file",
|
|
@@ -17167,7 +17178,7 @@ function shellTimeoutMs(value) {
|
|
|
17167
17178
|
if (typeof value !== "number" || !Number.isInteger(value)) {
|
|
17168
17179
|
return DEFAULT_SHELL_TIMEOUT_MS;
|
|
17169
17180
|
}
|
|
17170
|
-
return Math.min(
|
|
17181
|
+
return Math.min(maxShellTimeoutMs(), Math.max(1, value));
|
|
17171
17182
|
}
|
|
17172
17183
|
function objectValue(value) {
|
|
17173
17184
|
if (value === void 0 || value === null) {
|
|
@@ -17184,7 +17195,7 @@ function sumCents(rows) {
|
|
|
17184
17195
|
return total + (Number.isFinite(value) ? Math.round(value) : 0);
|
|
17185
17196
|
}, 0);
|
|
17186
17197
|
}
|
|
17187
|
-
var DEFAULT_SHELL_TIMEOUT_MS
|
|
17198
|
+
var DEFAULT_SHELL_TIMEOUT_MS;
|
|
17188
17199
|
var init_tools = __esm({
|
|
17189
17200
|
"../../packages/core/dist/tools.js"() {
|
|
17190
17201
|
"use strict";
|
|
@@ -17193,7 +17204,6 @@ var init_tools = __esm({
|
|
|
17193
17204
|
init_ledger();
|
|
17194
17205
|
init_shell();
|
|
17195
17206
|
DEFAULT_SHELL_TIMEOUT_MS = 1e4;
|
|
17196
|
-
MAX_SHELL_TIMEOUT_MS = 3e5;
|
|
17197
17207
|
}
|
|
17198
17208
|
});
|
|
17199
17209
|
|
|
@@ -82496,7 +82506,7 @@ async function runAgentTaskDetailed(session, task, options = {}) {
|
|
|
82496
82506
|
systemPromptParts.push("Using secrets from chat: call vault_request to send one HTTPS request with a vault secret injected, writing {{SECRET_NAME}} where the value belongs (for example an authorization header). The platform substitutes the real value only for hosts the user approved for that secret, refreshes OAuth tokens automatically, and never returns the value to you. If it reports that a host needs approval, tell the user to allow it in the Vault tab and stop; never look for paid third-party services to do what an approved secret already lets you do. To upload a file (an image or video you rendered with run_shell, where ffmpeg is installed), pass body_artifact with its path under artifacts/ and, for multipart APIs, body_field plus form_fields; files over an API's chunk limit can be split with run_shell first.");
|
|
82497
82507
|
}
|
|
82498
82508
|
if (options.hosted && hostedTools.includes("run_shell")) {
|
|
82499
|
-
systemPromptParts.push("Tooling: ffmpeg, python3 with pip and venv, node and npm are installed; the system image is read-only, but `pip install --user <package>` and `npm install` persist on this machine's volume between runs, so install once and reuse.", "Resource recovery: before installing large ML dependencies, check available memory, disk space and Python version. A killed install or OOM is a failed approach, not the end of the task. Inspect partial installs and preserve user files, then choose a materially lighter backend or an external service within the user's budget. Verify package metadata: optional extras add dependencies and do not remove default ones; never invent an extra such as basic-pitch[tflite]. For audio-to-MIDI, prefer a verified TFLite or ONNX inference setup in an isolated venv over full TensorFlow; test on a short audio segment before processing the whole file. If no viable path remains, report the concrete blocker and useful artifacts. Do not claim success until the output has been checked.");
|
|
82509
|
+
systemPromptParts.push("Tooling: ffmpeg, python3 with pip and venv, node and npm are installed; the system image is read-only, but `pip install --user <package>` and `npm install` persist on this machine's volume between runs, so install once and reuse.", "Heavy toolchains: this machine's CPU, memory and disk come from the agent's compute tier, and a multi-gigabyte toolchain needs the heavy tier. Measure before installing one (`df -h \"$HOME\"`, `free -m`, `nproc`) and compare the numbers with what it needs. Install it under `$HOME`: that is the persistent volume and is excluded from the per-run workspace backup, while the session workspace is archived after every run with a 25 MB cap. Give a long download or compile the time it really needs through run_shell `timeout_ms` instead of accepting the 10 s default, redirect build logs to a file under `$HOME` and tail it rather than printing everything, and re-check free space between steps. `No space left on device` or an OOM kill twice means the tier is too small, not that the command was wrong: stop retrying, and tell the owner exactly which limit you hit, how much you need, and that they can switch this agent to the heavy compute tier from Machine in the agent menu (which also raises the shell timeout).", 'Lean 4 and Mathlib, when a task asks for machine-checked proofs: install elan into `$HOME` (`ELAN_HOME="$HOME/.elan" curl -fsSL https://elan.lean-lang.org/elan-init.sh | sh -s -- -y --default-toolchain none`, then source `$HOME/.elan/env`), create or clone the project under `$HOME` so `lake-manifest.json` pins the toolchain, and always run `lake exe cache get` to fetch prebuilt `.olean` files before `lake build` \u2014 compiling Mathlib from source is not viable here. Expect roughly 2 GB for the toolchain, 10 GB for the Mathlib cache, several minutes for `cache get`, and a few GB of memory to elaborate one file that imports Mathlib. Report the compiler\'s real output; a file containing `sorry` is not a proof.', "Resource recovery: before installing large ML dependencies, check available memory, disk space and Python version. A killed install or OOM is a failed approach, not the end of the task. Inspect partial installs and preserve user files, then choose a materially lighter backend or an external service within the user's budget. Verify package metadata: optional extras add dependencies and do not remove default ones; never invent an extra such as basic-pitch[tflite]. For audio-to-MIDI, prefer a verified TFLite or ONNX inference setup in an isolated venv over full TensorFlow; test on a short audio segment before processing the whole file. If no viable path remains, report the concrete blocker and useful artifacts. Do not claim success until the output has been checked.");
|
|
82500
82510
|
}
|
|
82501
82511
|
systemPromptParts.push("End by calling complete_session with a concise final message.");
|
|
82502
82512
|
if (options.subagent) {
|
package/package.json
CHANGED