openpond 0.0.30-bootstrap.0 → 0.0.31

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 (35) hide show
  1. package/README.md +19 -5
  2. package/dist/chunks/{app-layer-YKXEQGOW.js → app-layer-53U5JVE7.js} +24 -4
  3. package/dist/chunks/{apps-GGSIN2ZF.js → apps-MJ47WJNC.js} +3 -3
  4. package/dist/chunks/{chunk-5G4E547X.js → chunk-4GLUNJLZ.js} +1 -1
  5. package/dist/chunks/{chunk-AUJLPKGI.js → chunk-5X47XJC4.js} +2 -2
  6. package/dist/chunks/{chunk-3Y4EL3P6.js → chunk-7HZBKUUB.js} +36 -35
  7. package/dist/chunks/{chunk-Y6G6WRTG.js → chunk-7KYOO25A.js} +57 -12
  8. package/dist/chunks/{chunk-Q57SVPEH.js → chunk-BX4XSB2J.js} +5619 -6654
  9. package/dist/chunks/{chunk-KRKGHVMQ.js → chunk-DZUJ6XJC.js} +1 -1
  10. package/dist/chunks/{chunk-NLBKZZEK.js → chunk-ETBF62DB.js} +1 -1
  11. package/dist/chunks/chunk-IUTUUNAX.js +1126 -0
  12. package/dist/chunks/{chunk-74O6FGVN.js → chunk-JWL5HCO5.js} +3 -3
  13. package/dist/chunks/{chunk-XSAXENQD.js → chunk-NC2GQQOT.js} +2 -2
  14. package/dist/chunks/{chunk-FUP7EGT7.js → chunk-TQRWG54R.js} +2 -2
  15. package/dist/chunks/{chunk-I6HN3ZGW.js → chunk-WQ2GF7XT.js} +1 -1
  16. package/dist/chunks/{chunk-4HYJG2JE.js → chunk-XMW3PSI5.js} +2 -2
  17. package/dist/chunks/{chunk-3CC6MH35.js → chunk-ZIKHE5AY.js} +3 -3
  18. package/dist/chunks/{cli-NVKNE4AZ.js → cli-EP473A53.js} +5 -2
  19. package/dist/chunks/{cli-X3HPLSOV.js → cli-H7PQLPKG.js} +5 -5
  20. package/dist/chunks/{core-commands-IM2UKLU4.js → core-commands-KI53GSJF.js} +4 -4
  21. package/dist/chunks/{extend-YXCBULPO.js → extend-F4R3AI2G.js} +8 -8
  22. package/dist/chunks/{harness-GMK6IY2U.js → harness-WADDUNGU.js} +3 -3
  23. package/dist/chunks/{help-LMH5FGT2.js → help-TIEOIVOA.js} +2 -1
  24. package/dist/chunks/{opchat-BWXZ32GX.js → opchat-VYKKXDBO.js} +5 -5
  25. package/dist/chunks/{organizations-4ISQRGMQ.js → organizations-LAACUOYE.js} +73 -15
  26. package/dist/chunks/{profile-NLDZDT3L.js → profile-A75O7EZ4.js} +6 -6
  27. package/dist/chunks/{project-agent-ZPVO25HA.js → project-agent-JOZ6NRTW.js} +5 -5
  28. package/dist/chunks/{sandbox-command-5GFJ2U3V.js → sandbox-command-Q72CAVQ7.js} +4 -4
  29. package/dist/chunks/{sandbox-template-LZN4F55Z.js → sandbox-template-KWCE3OJV.js} +5 -5
  30. package/dist/chunks/{src-3RBI4DNN.js → src-CBPRIWG5.js} +7 -15
  31. package/dist/chunks/{src-EYXQS6XD.js → src-J4262EAE.js} +122 -17
  32. package/dist/chunks/{teams-bot-WP3FHKGA.js → teams-bot-KNY5OEXB.js} +3 -3
  33. package/dist/cli.js +28 -17
  34. package/docs/command-reference.md +2 -1
  35. package/package.json +3 -1
@@ -13,7 +13,19 @@ import {
13
13
  now,
14
14
  runOpenPondServerCli,
15
15
  textFromUnknown
16
- } from "./chunk-Y6G6WRTG.js";
16
+ } from "./chunk-7KYOO25A.js";
17
+ import {
18
+ createOpenPondRepoApp,
19
+ getBundledRuntimeVersion,
20
+ getOpenPondAppEnvironment,
21
+ loadOpenPondAccountContext,
22
+ loadOpenPondApps,
23
+ loadOpenPondProviderCatalog,
24
+ saveOpenPondAccount,
25
+ streamOpenPondHostedChatTurn,
26
+ switchOpenPondAccount,
27
+ updateOpenPondAccountConfig
28
+ } from "./chunk-IUTUUNAX.js";
17
29
  import {
18
30
  AccountStateSchema,
19
31
  AppPreferencesSchema,
@@ -222,7 +234,6 @@ import {
222
234
  buildOpenPondProfileSetupGate,
223
235
  collectProfileSourceUploadEntries,
224
236
  commitActiveProfileChanges,
225
- createOpenPondRepoApp,
226
237
  createOpenPondSandboxClient,
227
238
  createPlaceholderPanes,
228
239
  crossSystemLocalToolSystemPrompt,
@@ -231,8 +242,6 @@ import {
231
242
  executeConnectedAppToolCall,
232
243
  executeProfileSkillGoalRequest,
233
244
  formatOpenPondProfileSetupRequirement,
234
- getBundledRuntimeVersion,
235
- getOpenPondAppEnvironment,
236
245
  hostedPublishStatusFromPayload,
237
246
  hostedRunStatusFromRunSummary,
238
247
  hostedRunSummaryFromPayload,
@@ -240,10 +249,7 @@ import {
240
249
  initLocalProfileRepo,
241
250
  loadGlobalConfig,
242
251
  loadLocalProfileRepo,
243
- loadOpenPondAccountContext,
244
- loadOpenPondApps,
245
252
  loadOpenPondProfileState,
246
- loadOpenPondProviderCatalog,
247
253
  localPathWorkspaceId,
248
254
  normalizeOpenPondGoalStatus,
249
255
  normalizeSandboxApiUrl,
@@ -254,13 +260,9 @@ import {
254
260
  runProfileSkillCommandFromPrompt,
255
261
  runProfileSkillGoalCommand,
256
262
  saveGlobalConfig,
257
- saveOpenPondAccount,
258
263
  saveProfilePushStatus,
259
- streamOpenPondHostedChatTurn,
260
- switchOpenPondAccount,
261
- updateOpenPondAccountConfig,
262
264
  workspacePathFromLocalPathWorkspaceId
263
- } from "./chunk-Q57SVPEH.js";
265
+ } from "./chunk-BX4XSB2J.js";
264
266
  import {
265
267
  CONNECTED_APP_PROVIDER_TOOL_NAMES,
266
268
  CONNECTED_APP_TOOL_CALL_ENDPOINT,
@@ -65568,15 +65570,38 @@ function scanAndRedactEvidence(text2) {
65568
65570
  import { Buffer as Buffer11 } from "node:buffer";
65569
65571
 
65570
65572
  // ../server/src/training/cross-system-operations/python-sandbox.ts
65571
- import { spawn as spawn7 } from "node:child_process";
65573
+ import { execFile as execFile4, spawn as spawn7 } from "node:child_process";
65572
65574
  import { tmpdir } from "node:os";
65573
65575
  import readline from "node:readline";
65574
65576
  import { randomUUID as randomUUID22 } from "node:crypto";
65577
+ import { promisify as promisify2 } from "node:util";
65578
+ var execFileAsync2 = promisify2(execFile4);
65579
+ var DEFAULT_MAX_MEMORY_BYTES = 256 * 1024 * 1024;
65580
+ var DEFAULT_MEMORY_POLL_INTERVAL_MS = 100;
65581
+ var MAX_STDERR_BYTES = 4096;
65575
65582
  var WORKER_SOURCE = String.raw`
65576
- import contextlib, io, json, math, statistics, decimal, datetime, collections, itertools, functools, resource, sys
65583
+ import contextlib, io, json, math, statistics, decimal, datetime, collections, itertools, functools, sys
65584
+
65585
+ try:
65586
+ import resource
65587
+ except ImportError:
65588
+ resource = None
65589
+
65590
+ def apply_resource_limit(kind, value):
65591
+ if resource is None:
65592
+ return
65593
+ try:
65594
+ _, current_hard = resource.getrlimit(kind)
65595
+ hard = value if current_hard == resource.RLIM_INFINITY else min(value, current_hard)
65596
+ resource.setrlimit(kind, (min(value, hard), hard))
65597
+ except (OSError, ValueError):
65598
+ # Some platforms expose a limit without accepting finite values. The
65599
+ # parent process independently enforces the memory ceiling.
65600
+ pass
65577
65601
 
65578
- resource.setrlimit(resource.RLIMIT_CPU, (5, 5))
65579
- resource.setrlimit(resource.RLIMIT_AS, (268435456, 268435456))
65602
+ if resource is not None:
65603
+ apply_resource_limit(resource.RLIMIT_CPU, 5)
65604
+ apply_resource_limit(resource.RLIMIT_AS, 268435456)
65580
65605
  ALLOWED_MODULES = {"math", "statistics", "decimal", "datetime", "collections", "itertools", "functools", "json"}
65581
65606
  real_import = __import__
65582
65607
  def safe_import(name, globals=None, locals=None, fromlist=(), level=0):
@@ -65616,20 +65641,39 @@ for line in sys.stdin:
65616
65641
  var PersistentPythonSandbox = class {
65617
65642
  constructor(options = {}) {
65618
65643
  this.options = options;
65644
+ this.maxMemoryBytes = Math.max(1, Math.trunc(options.maxMemoryBytes ?? DEFAULT_MAX_MEMORY_BYTES));
65645
+ this.memoryPollIntervalMs = Math.max(10, Math.trunc(options.memoryPollIntervalMs ?? DEFAULT_MEMORY_POLL_INTERVAL_MS));
65646
+ this.memoryUsage = options.memoryUsage ?? readResidentMemoryBytes;
65619
65647
  this.child = spawn7(options.pythonBin ?? process.env.OPENPOND_PYTHON_BIN ?? "python3", ["-I", "-S", "-u", "-c", WORKER_SOURCE], {
65620
65648
  cwd: tmpdir(),
65621
65649
  env: { PATH: process.env.PATH ?? "/usr/bin:/bin", PYTHONIOENCODING: "utf-8", PYTHONUNBUFFERED: "1" },
65622
65650
  stdio: ["pipe", "pipe", "pipe"]
65623
65651
  });
65624
65652
  readline.createInterface({ input: this.child.stdout }).on("line", (line) => this.handleLine(line));
65653
+ this.child.stderr.setEncoding("utf8");
65654
+ this.child.stderr.on("data", (chunk2) => {
65655
+ this.stderr = `${this.stderr}${chunk2}`.slice(-MAX_STDERR_BYTES);
65656
+ });
65625
65657
  this.child.once("error", (error) => this.failAll(error));
65626
65658
  this.child.once("exit", (code, signal) => {
65627
- if (!this.closed) this.failAll(new Error(`Python sandbox exited with ${code ?? signal}.`));
65659
+ this.stopMemoryMonitor();
65660
+ if (!this.closed) {
65661
+ const stderr = this.stderr.trim();
65662
+ const detail = stderr ? `: ${stderr}` : ".";
65663
+ this.failAll(this.terminationError ?? new Error(`Python sandbox exited with ${code ?? signal}${detail}`));
65664
+ }
65628
65665
  });
65629
65666
  }
65630
65667
  options;
65631
65668
  child;
65632
65669
  pending = /* @__PURE__ */ new Map();
65670
+ maxMemoryBytes;
65671
+ memoryPollIntervalMs;
65672
+ memoryUsage;
65673
+ memoryTimer = null;
65674
+ memoryProbeInFlight = false;
65675
+ terminationError = null;
65676
+ stderr = "";
65633
65677
  closed = false;
65634
65678
  async run(code, signal) {
65635
65679
  if (this.closed) throw new Error("Python sandbox is closed.");
@@ -65639,6 +65683,7 @@ var PersistentPythonSandbox = class {
65639
65683
  const result = new Promise((resolve, reject) => {
65640
65684
  const timer = setTimeout(() => {
65641
65685
  this.pending.delete(id);
65686
+ if (this.pending.size === 0) this.stopMemoryMonitor();
65642
65687
  reject(new Error("Python sandbox execution timed out."));
65643
65688
  void this.close();
65644
65689
  }, this.options.timeoutMs ?? 1500);
@@ -65650,10 +65695,12 @@ var PersistentPythonSandbox = class {
65650
65695
  if (!pending) return;
65651
65696
  clearTimeout(pending.timer);
65652
65697
  this.pending.delete(id);
65698
+ if (this.pending.size === 0) this.stopMemoryMonitor();
65653
65699
  pending.reject(abortError(signal));
65654
65700
  void this.close();
65655
65701
  };
65656
65702
  signal?.addEventListener("abort", abort, { once: true });
65703
+ this.startMemoryMonitor();
65657
65704
  this.child.stdin.write(`${JSON.stringify({ id, code })}
65658
65705
  `);
65659
65706
  try {
@@ -65665,6 +65712,7 @@ var PersistentPythonSandbox = class {
65665
65712
  async close() {
65666
65713
  if (this.closed) return;
65667
65714
  this.closed = true;
65715
+ this.stopMemoryMonitor();
65668
65716
  this.failAll(new Error("Python sandbox closed."));
65669
65717
  if (this.child.exitCode !== null || this.child.signalCode !== null) return;
65670
65718
  this.child.stdin.end();
@@ -65686,6 +65734,7 @@ var PersistentPythonSandbox = class {
65686
65734
  if (!pending) return;
65687
65735
  clearTimeout(pending.timer);
65688
65736
  this.pending.delete(id);
65737
+ if (this.pending.size === 0) this.stopMemoryMonitor();
65689
65738
  const stdout = typeof value.stdout === "string" ? value.stdout : "";
65690
65739
  const serialized = JSON.stringify(value.result ?? null);
65691
65740
  if (Buffer.byteLength(stdout + serialized, "utf8") > (this.options.maxOutputBytes ?? 16384)) {
@@ -65695,13 +65744,69 @@ var PersistentPythonSandbox = class {
65695
65744
  pending.resolve(value.ok === true ? { ok: true, stdout, result: value.result ?? null, error: null } : { ok: false, stdout: "", result: null, error: typeof value.error === "string" ? value.error : "Python execution failed." });
65696
65745
  }
65697
65746
  failAll(error) {
65747
+ this.stopMemoryMonitor();
65698
65748
  for (const pending of this.pending.values()) {
65699
65749
  clearTimeout(pending.timer);
65700
65750
  pending.reject(error);
65701
65751
  }
65702
65752
  this.pending.clear();
65703
65753
  }
65754
+ startMemoryMonitor() {
65755
+ if (this.memoryTimer || !this.child.pid) return;
65756
+ void this.probeMemory();
65757
+ this.memoryTimer = setInterval(() => void this.probeMemory(), this.memoryPollIntervalMs);
65758
+ this.memoryTimer.unref?.();
65759
+ }
65760
+ stopMemoryMonitor() {
65761
+ if (this.memoryTimer) clearInterval(this.memoryTimer);
65762
+ this.memoryTimer = null;
65763
+ }
65764
+ async probeMemory() {
65765
+ const pid = this.child.pid;
65766
+ if (!pid || this.memoryProbeInFlight || this.terminationError || this.pending.size === 0) return;
65767
+ this.memoryProbeInFlight = true;
65768
+ try {
65769
+ const residentBytes = await this.memoryUsage(pid);
65770
+ if (residentBytes !== null && residentBytes > this.maxMemoryBytes && !this.terminationError) {
65771
+ this.terminationError = new Error(
65772
+ `Python sandbox exceeded the ${this.maxMemoryBytes}-byte memory limit.`
65773
+ );
65774
+ this.stopMemoryMonitor();
65775
+ this.child.kill("SIGKILL");
65776
+ }
65777
+ } finally {
65778
+ this.memoryProbeInFlight = false;
65779
+ }
65780
+ }
65704
65781
  };
65782
+ async function readResidentMemoryBytes(pid) {
65783
+ if (!Number.isInteger(pid) || pid <= 0) return null;
65784
+ try {
65785
+ if (process.platform === "win32") {
65786
+ const { stdout: stdout2 } = await execFileAsync2(
65787
+ "powershell.exe",
65788
+ [
65789
+ "-NoProfile",
65790
+ "-NonInteractive",
65791
+ "-Command",
65792
+ `(Get-Process -Id ${pid} -ErrorAction Stop).WorkingSet64`
65793
+ ],
65794
+ { encoding: "utf8", timeout: 1e3, windowsHide: true }
65795
+ );
65796
+ const bytes = Number(String(stdout2).trim());
65797
+ return Number.isFinite(bytes) && bytes >= 0 ? bytes : null;
65798
+ }
65799
+ const { stdout } = await execFileAsync2(
65800
+ "ps",
65801
+ ["-o", "rss=", "-p", String(pid)],
65802
+ { encoding: "utf8", timeout: 1e3, windowsHide: true }
65803
+ );
65804
+ const kibibytes = Number(String(stdout).trim());
65805
+ return Number.isFinite(kibibytes) && kibibytes >= 0 ? kibibytes * 1024 : null;
65806
+ } catch {
65807
+ return null;
65808
+ }
65809
+ }
65705
65810
  function abortError(signal) {
65706
65811
  const error = signal?.reason instanceof Error ? signal.reason : new Error("Python sandbox execution was cancelled.");
65707
65812
  error.name = "AbortError";
@@ -1,13 +1,13 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
2
  import {
3
3
  resolveSandboxClient
4
- } from "./chunk-XSAXENQD.js";
5
- import "./chunk-5G4E547X.js";
4
+ } from "./chunk-NC2GQQOT.js";
5
+ import "./chunk-4GLUNJLZ.js";
6
6
  import {
7
7
  optionString,
8
8
  parseJsonOption,
9
9
  requiredTeamId
10
- } from "./chunk-3Y4EL3P6.js";
10
+ } from "./chunk-7HZBKUUB.js";
11
11
  import "./chunk-UACZUFIA.js";
12
12
 
13
13
  // src/cli/teams-bot.ts
package/dist/cli.js CHANGED
@@ -4,24 +4,39 @@ import {
4
4
  parseArgs,
5
5
  resolveAccountOption,
6
6
  resolveBaseUrlOption
7
- } from "./chunks/chunk-5G4E547X.js";
7
+ } from "./chunks/chunk-4GLUNJLZ.js";
8
8
  import {
9
9
  getInstalledCliVersion,
10
10
  parseBooleanOption,
11
11
  runCliCommand
12
- } from "./chunks/chunk-3Y4EL3P6.js";
12
+ } from "./chunks/chunk-7HZBKUUB.js";
13
13
  import "./chunks/chunk-UACZUFIA.js";
14
14
 
15
+ // src/cli/top-level-action.ts
16
+ function resolveCliTopLevelAction(input) {
17
+ if (!input.command && parseBooleanOption(input.options.version)) return "version";
18
+ if (parseBooleanOption(input.options.checkUpdate)) return "check-update";
19
+ if (!input.command && parseBooleanOption(input.options.help)) return "help";
20
+ if (!input.command && parseBooleanOption(input.options.tui)) return "tui";
21
+ if (!input.command) return "ui";
22
+ return "command";
23
+ }
24
+
15
25
  // src/cli/main.ts
16
26
  async function runOpenPondCli(argv = process.argv.slice(2)) {
17
27
  if (await runEmbeddedCompanion(argv)) return;
18
28
  const { command, options, rest } = parseArgs(argv);
19
- if (options.version !== void 0 && !command) {
29
+ const action = resolveCliTopLevelAction({ command, options });
30
+ if (action === "version") {
20
31
  console.log(getInstalledCliVersion());
21
32
  return;
22
33
  }
23
- if (options.checkUpdate !== void 0) {
24
- await (await import("./chunks/core-commands-IM2UKLU4.js")).runCheckUpdate();
34
+ if (action === "check-update") {
35
+ await (await import("./chunks/core-commands-KI53GSJF.js")).runCheckUpdate();
36
+ return;
37
+ }
38
+ if (action === "help") {
39
+ (await import("./chunks/help-TIEOIVOA.js")).printHelp();
25
40
  return;
26
41
  }
27
42
  const selectedAccount = resolveAccountOption(options);
@@ -32,36 +47,32 @@ async function runOpenPondCli(argv = process.argv.slice(2)) {
32
47
  if (selectedBaseUrl) {
33
48
  process.env.OPENPOND_BASE_URL = selectedBaseUrl;
34
49
  }
35
- if (parseBooleanOption(options.tui)) {
36
- await (await import("./chunks/app-layer-YKXEQGOW.js")).runOpenPondTerminalCommand(options, rest);
37
- return;
38
- }
39
- if (!command && process.stdin.isTTY && process.stdout.isTTY) {
40
- await (await import("./chunks/app-layer-YKXEQGOW.js")).runOpenPondTerminalCommand(options, rest);
50
+ if (action === "tui") {
51
+ await (await import("./chunks/app-layer-53U5JVE7.js")).runOpenPondTerminalCommand(options, rest);
41
52
  return;
42
53
  }
43
- if (!command) {
44
- (await import("./chunks/help-LMH5FGT2.js")).printHelp();
54
+ if (action === "ui") {
55
+ await (await import("./chunks/app-layer-53U5JVE7.js")).runOpenPondServerCommand("web", options, rest);
45
56
  return;
46
57
  }
47
58
  if (await runCliCommand({ command, options, rest })) {
48
59
  return;
49
60
  }
50
- (await import("./chunks/help-LMH5FGT2.js")).printHelp();
61
+ (await import("./chunks/help-TIEOIVOA.js")).printHelp();
51
62
  process.exit(1);
52
63
  }
53
64
  async function runEmbeddedCompanion(argv) {
54
65
  if (argv[0] === "__server") {
55
66
  process.argv = [process.execPath, "openpond-server", ...argv.slice(1)];
56
67
  const [{ createOpenPondServer }, { runOpenPondServerCli }] = await Promise.all([
57
- import("./chunks/src-EYXQS6XD.js"),
58
- import("./chunks/cli-NVKNE4AZ.js")
68
+ import("./chunks/src-J4262EAE.js"),
69
+ import("./chunks/cli-EP473A53.js")
59
70
  ]);
60
71
  await runOpenPondServerCli(createOpenPondServer);
61
72
  return true;
62
73
  }
63
74
  if (argv[0] === "__terminal") {
64
- await (await import("./chunks/src-3RBI4DNN.js")).runOpenPondTerminalCli(argv.slice(1));
75
+ await (await import("./chunks/src-CBPRIWG5.js")).runOpenPondTerminalCli(argv.slice(1));
65
76
  return true;
66
77
  }
67
78
  return false;
@@ -220,12 +220,13 @@ Options:
220
220
 
221
221
  ```text
222
222
  Usage:
223
- openpond ui [args]
223
+ openpond ui [--no-open] [--hostname HOST] [--port PORT]
224
224
 
225
225
  Options:
226
226
  --host <string>
227
227
  --hostname <string>
228
228
  --listen <string>
229
+ --no-open
229
230
  --port <integer>
230
231
  --web-root <string>
231
232
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openpond",
3
- "version": "0.0.30-bootstrap.0",
3
+ "version": "0.0.31",
4
4
  "openpondReleaseVersioned": true,
5
5
  "license": "MIT",
6
6
  "description": "OpenPond CLI and local harness",
@@ -71,6 +71,7 @@
71
71
  "@openpond/cloud": "workspace:*",
72
72
  "@openpond/contracts": "workspace:*",
73
73
  "@openpond/local-server": "workspace:*",
74
+ "@openpond/runtime": "workspace:*",
74
75
  "@openpond/terminal": "workspace:*",
75
76
  "@types/js-yaml": "^4.0.9",
76
77
  "@types/node": "24.13.3"
@@ -79,6 +80,7 @@
79
80
  "@openpond/cloud",
80
81
  "@openpond/contracts",
81
82
  "@openpond/local-server",
83
+ "@openpond/runtime",
82
84
  "@openpond/terminal"
83
85
  ]
84
86
  }