openpond 0.0.30 → 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 (30) hide show
  1. package/dist/chunks/{app-layer-FIGCNZJX.js → app-layer-53U5JVE7.js} +20 -3
  2. package/dist/chunks/{apps-4RMNCKXS.js → apps-MJ47WJNC.js} +3 -3
  3. package/dist/chunks/{chunk-MFS3SYUH.js → chunk-4GLUNJLZ.js} +1 -1
  4. package/dist/chunks/{chunk-RJXX6TJA.js → chunk-5X47XJC4.js} +2 -2
  5. package/dist/chunks/{chunk-KMSMK7PI.js → chunk-7HZBKUUB.js} +33 -33
  6. package/dist/chunks/{chunk-DANRS43D.js → chunk-7KYOO25A.js} +1 -1
  7. package/dist/chunks/{chunk-57P2GCW5.js → chunk-DZUJ6XJC.js} +1 -1
  8. package/dist/chunks/{chunk-OV3KAFWB.js → chunk-ETBF62DB.js} +1 -1
  9. package/dist/chunks/{chunk-KEDXE4BA.js → chunk-JWL5HCO5.js} +3 -3
  10. package/dist/chunks/{chunk-BNPFMGZD.js → chunk-NC2GQQOT.js} +2 -2
  11. package/dist/chunks/{chunk-GGKA4HLQ.js → chunk-TQRWG54R.js} +2 -2
  12. package/dist/chunks/{chunk-4S3XGFGL.js → chunk-WQ2GF7XT.js} +1 -1
  13. package/dist/chunks/{chunk-BBEVMP6O.js → chunk-XMW3PSI5.js} +2 -2
  14. package/dist/chunks/{chunk-BNVHGSI7.js → chunk-ZIKHE5AY.js} +3 -3
  15. package/dist/chunks/{cli-2L4NB7HD.js → cli-EP473A53.js} +1 -1
  16. package/dist/chunks/{cli-5RL7B2Z3.js → cli-H7PQLPKG.js} +5 -5
  17. package/dist/chunks/{core-commands-AZJZGTZS.js → core-commands-KI53GSJF.js} +4 -4
  18. package/dist/chunks/{extend-6IWYZI37.js → extend-F4R3AI2G.js} +8 -8
  19. package/dist/chunks/{harness-SSNXDSKM.js → harness-WADDUNGU.js} +3 -3
  20. package/dist/chunks/{help-MUJJMI3Q.js → help-TIEOIVOA.js} +1 -1
  21. package/dist/chunks/{opchat-RW4CFAQB.js → opchat-VYKKXDBO.js} +5 -5
  22. package/dist/chunks/{organizations-V7DTNLSI.js → organizations-LAACUOYE.js} +3 -3
  23. package/dist/chunks/{profile-WDBKJ7YW.js → profile-A75O7EZ4.js} +6 -6
  24. package/dist/chunks/{project-agent-3TZ3BPYN.js → project-agent-JOZ6NRTW.js} +5 -5
  25. package/dist/chunks/{sandbox-command-HOYHF4NC.js → sandbox-command-Q72CAVQ7.js} +4 -4
  26. package/dist/chunks/{sandbox-template-IYGB4CZU.js → sandbox-template-KWCE3OJV.js} +5 -5
  27. package/dist/chunks/{src-ZRQKSQTD.js → src-J4262EAE.js} +109 -6
  28. package/dist/chunks/{teams-bot-UWGCFL6C.js → teams-bot-KNY5OEXB.js} +3 -3
  29. package/dist/cli.js +9 -9
  30. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
2
  import {
3
3
  runProcessCommand
4
- } from "./chunk-BNPFMGZD.js";
4
+ } from "./chunk-NC2GQQOT.js";
5
5
  import {
6
6
  CliUsageError
7
- } from "./chunk-MFS3SYUH.js";
8
- import "./chunk-KMSMK7PI.js";
7
+ } from "./chunk-4GLUNJLZ.js";
8
+ import "./chunk-7HZBKUUB.js";
9
9
  import "./chunk-UACZUFIA.js";
10
10
 
11
11
  // src/cli/app-layer.ts
@@ -17,6 +17,21 @@ import { fileURLToPath } from "node:url";
17
17
  // src/cli/build-mode.ts
18
18
  var IS_COMPILED_CLI = false;
19
19
 
20
+ // src/cli/node-runtime.ts
21
+ var OPENPOND_NODE_MAJOR = 24;
22
+ var OPENPOND_NODE_MIN_MINOR = 18;
23
+ var OPENPOND_NODE_MIN_VERSION = `${OPENPOND_NODE_MAJOR}.${OPENPOND_NODE_MIN_MINOR}.0`;
24
+ function openPondTuiNodeRuntimeMessage(version = process.versions.node) {
25
+ const match = /^(\d+)\.(\d+)\.(\d+)/.exec(version);
26
+ const major = match ? Number(match[1]) : Number.NaN;
27
+ const minor = match ? Number(match[2]) : Number.NaN;
28
+ if (major === OPENPOND_NODE_MAJOR && minor >= OPENPOND_NODE_MIN_MINOR) return null;
29
+ return [
30
+ `OpenPond TUI requires Node.js ${OPENPOND_NODE_MIN_VERSION} or newer in the Node ${OPENPOND_NODE_MAJOR} release line; detected Node.js ${version}.`,
31
+ `Switch Node versions and retry (with nvm: \`nvm install ${OPENPOND_NODE_MIN_VERSION} && nvm use ${OPENPOND_NODE_MIN_VERSION}\`).`
32
+ ].join("\n");
33
+ }
34
+
20
35
  // src/cli/app-layer.ts
21
36
  var __dirname = path.dirname(fileURLToPath(import.meta.url));
22
37
  var OpenPondChildProcessExitError = class extends Error {
@@ -39,6 +54,8 @@ async function runOpenPondServerCommand(mode, options, rest) {
39
54
  }
40
55
  async function runOpenPondTerminalCommand(options, rest) {
41
56
  validateTerminalForwardingOptions(options);
57
+ const runtimeMessage = openPondTuiNodeRuntimeMessage();
58
+ if (runtimeMessage) throw new CliUsageError(runtimeMessage);
42
59
  const terminal = resolveAppEntrypoint("terminal");
43
60
  const server = resolveAppEntrypoint("server");
44
61
  const args = [...terminal.args, "chat", ...forwardedOptions(normalizeTerminalPaths(options)), ...rest];
@@ -23,17 +23,17 @@ import {
23
23
  submitPositionsTx,
24
24
  updateAppCodeVisibility,
25
25
  updateAppEnvironment
26
- } from "./chunk-BNPFMGZD.js";
26
+ } from "./chunk-NC2GQQOT.js";
27
27
  import {
28
28
  resolveBaseUrl,
29
29
  resolvePublicApiBaseUrl
30
- } from "./chunk-MFS3SYUH.js";
30
+ } from "./chunk-4GLUNJLZ.js";
31
31
  import {
32
32
  parseBooleanOption,
33
33
  parseJsonOption,
34
34
  parseTimeOption,
35
35
  resolveTemplateEnvironment
36
- } from "./chunk-KMSMK7PI.js";
36
+ } from "./chunk-7HZBKUUB.js";
37
37
  import "./chunk-UACZUFIA.js";
38
38
 
39
39
  // src/cli/apps.ts
@@ -5,7 +5,7 @@ import {
5
5
  getCliCommandDefinition,
6
6
  getCliOptionKind,
7
7
  parseJsonOption
8
- } from "./chunk-KMSMK7PI.js";
8
+ } from "./chunk-7HZBKUUB.js";
9
9
 
10
10
  // ../../packages/cloud/src/urls.ts
11
11
  var DEFAULT_OPENPOND_WEB_BASE_URL = "https://openpond.ai";
@@ -4,14 +4,14 @@ import {
4
4
  parseSandboxRuntimeProfileIdOption,
5
5
  parseSandboxRuntimePromotionPolicyOption,
6
6
  parseSandboxWorkflowModeOption
7
- } from "./chunk-BNPFMGZD.js";
7
+ } from "./chunk-NC2GQQOT.js";
8
8
  import {
9
9
  parseBooleanOption,
10
10
  parseCsvOption,
11
11
  parseIntegerOption,
12
12
  parseJsonOption,
13
13
  parseNumberOption
14
- } from "./chunk-KMSMK7PI.js";
14
+ } from "./chunk-7HZBKUUB.js";
15
15
 
16
16
  // src/cli/sandbox-helpers.ts
17
17
  import { Buffer } from "node:buffer";
@@ -468,7 +468,7 @@ var CLI_COMMAND_REGISTRY = [
468
468
  name: "help",
469
469
  usage: "openpond help",
470
470
  optionSchema: {},
471
- handler: async () => (await import("./help-MUJJMI3Q.js")).printHelp()
471
+ handler: async () => (await import("./help-TIEOIVOA.js")).printHelp()
472
472
  },
473
473
  {
474
474
  name: "version",
@@ -480,19 +480,19 @@ var CLI_COMMAND_REGISTRY = [
480
480
  name: "check-update",
481
481
  usage: "openpond check-update",
482
482
  optionSchema: {},
483
- handler: async () => (await import("./core-commands-AZJZGTZS.js")).runCheckUpdate()
483
+ handler: async () => (await import("./core-commands-KI53GSJF.js")).runCheckUpdate()
484
484
  },
485
485
  {
486
486
  name: "login",
487
487
  usage: "openpond login [--base-url <url>]",
488
488
  optionSchema: CLI_GLOBAL_OPTION_SCHEMA,
489
- handler: async ({ options }) => (await import("./core-commands-AZJZGTZS.js")).runLogin(options)
489
+ handler: async ({ options }) => (await import("./core-commands-KI53GSJF.js")).runLogin(options)
490
490
  },
491
491
  {
492
492
  name: "init",
493
493
  usage: "openpond init [--path <dir>]",
494
494
  optionSchema: { path: "string" },
495
- handler: async ({ options }) => (await import("./profile-WDBKJ7YW.js")).runOpenPondInitCommand(options)
495
+ handler: async ({ options }) => (await import("./profile-A75O7EZ4.js")).runOpenPondInitCommand(options)
496
496
  },
497
497
  {
498
498
  name: "profile",
@@ -521,44 +521,44 @@ var CLI_COMMAND_REGISTRY = [
521
521
  teamId: "string",
522
522
  workItemId: "string"
523
523
  },
524
- handler: async ({ options, rest }) => (await import("./profile-WDBKJ7YW.js")).runOpenPondProfileCommand(options, rest)
524
+ handler: async ({ options, rest }) => (await import("./profile-A75O7EZ4.js")).runOpenPondProfileCommand(options, rest)
525
525
  },
526
526
  {
527
527
  name: "agents",
528
528
  usage: "openpond agents [--json]",
529
529
  optionSchema: { json: "boolean" },
530
- handler: async ({ options, rest }) => (await import("./profile-WDBKJ7YW.js")).runOpenPondAgentsCommand(options, rest)
530
+ handler: async ({ options, rest }) => (await import("./profile-A75O7EZ4.js")).runOpenPondAgentsCommand(options, rest)
531
531
  },
532
532
  ...profileSdkAliasDefinitions(),
533
533
  {
534
534
  name: "extend",
535
535
  usage: "openpond extend <instructions>",
536
536
  optionSchema: { cwd: "string" },
537
- handler: async ({ options, rest }) => (await import("./extend-6IWYZI37.js")).runOpenPondExtendCommand(options, rest)
537
+ handler: async ({ options, rest }) => (await import("./extend-F4R3AI2G.js")).runOpenPondExtendCommand(options, rest)
538
538
  },
539
539
  {
540
540
  name: "edit",
541
541
  usage: "openpond edit <instructions>",
542
542
  optionSchema: { cwd: "string" },
543
- handler: async ({ options, rest }) => (await import("./extend-6IWYZI37.js")).runOpenPondEditCommand(options, rest)
543
+ handler: async ({ options, rest }) => (await import("./extend-F4R3AI2G.js")).runOpenPondEditCommand(options, rest)
544
544
  },
545
545
  {
546
546
  name: "profiles",
547
547
  usage: "openpond profiles [args]",
548
548
  optionSchema: { json: "boolean" },
549
- handler: async ({ options, rest }) => (await import("./core-commands-AZJZGTZS.js")).runProfiles(options, rest)
549
+ handler: async ({ options, rest }) => (await import("./core-commands-KI53GSJF.js")).runProfiles(options, rest)
550
550
  },
551
551
  {
552
552
  name: "account",
553
553
  usage: "openpond account",
554
554
  optionSchema: { json: "boolean" },
555
- handler: async () => (await import("./core-commands-AZJZGTZS.js")).runAccount()
555
+ handler: async () => (await import("./core-commands-KI53GSJF.js")).runAccount()
556
556
  },
557
557
  {
558
558
  name: "health",
559
559
  usage: "openpond health",
560
560
  optionSchema: { json: "boolean" },
561
- handler: async ({ options }) => (await import("./core-commands-AZJZGTZS.js")).runHealth(options)
561
+ handler: async ({ options }) => (await import("./core-commands-KI53GSJF.js")).runHealth(options)
562
562
  },
563
563
  {
564
564
  name: "serve",
@@ -569,7 +569,7 @@ var CLI_COMMAND_REGISTRY = [
569
569
  listen: "string",
570
570
  port: "integer"
571
571
  },
572
- handler: async ({ options, rest }) => (await import("./app-layer-FIGCNZJX.js")).runOpenPondServerCommand("serve", options, rest)
572
+ handler: async ({ options, rest }) => (await import("./app-layer-53U5JVE7.js")).runOpenPondServerCommand("serve", options, rest)
573
573
  },
574
574
  {
575
575
  name: "ui",
@@ -582,7 +582,7 @@ var CLI_COMMAND_REGISTRY = [
582
582
  port: "integer",
583
583
  webRoot: "string"
584
584
  },
585
- handler: async ({ options, rest }) => (await import("./app-layer-FIGCNZJX.js")).runOpenPondServerCommand("web", options, rest)
585
+ handler: async ({ options, rest }) => (await import("./app-layer-53U5JVE7.js")).runOpenPondServerCommand("web", options, rest)
586
586
  },
587
587
  {
588
588
  name: "tui",
@@ -596,13 +596,13 @@ var CLI_COMMAND_REGISTRY = [
596
596
  provider: "string",
597
597
  server: "string"
598
598
  },
599
- handler: async ({ options, rest }) => (await import("./app-layer-FIGCNZJX.js")).runOpenPondTerminalCommand(options, rest)
599
+ handler: async ({ options, rest }) => (await import("./app-layer-53U5JVE7.js")).runOpenPondTerminalCommand(options, rest)
600
600
  },
601
601
  {
602
602
  name: "chat",
603
603
  usage: "openpond chat (--message-file <path>|--message <text>|--stdin) --non-interactive [--provider <id>] [--model <id>] [--project <id>] [--yes] [--approval-policy <policy>] [--json] [--timeout-sec <n>] [--max-output-bytes <n>] [--sandbox <mode>]",
604
604
  optionSchema: CHAT_OPTION_SCHEMA,
605
- handler: async ({ options, rest }) => (await import("./app-layer-FIGCNZJX.js")).runOpenPondTerminalCommand(options, rest)
605
+ handler: async ({ options, rest }) => (await import("./app-layer-53U5JVE7.js")).runOpenPondTerminalCommand(options, rest)
606
606
  },
607
607
  {
608
608
  name: "tool",
@@ -638,7 +638,7 @@ var CLI_COMMAND_REGISTRY = [
638
638
  name: "sandbox-template",
639
639
  usage: "openpond sandbox-template <command> [args]",
640
640
  optionSchema: SANDBOX_TEMPLATE_OPTION_SCHEMA,
641
- handler: async ({ options, rest }) => (await import("./sandbox-template-IYGB4CZU.js")).runSandboxTemplateCommand(options, rest)
641
+ handler: async ({ options, rest }) => (await import("./sandbox-template-KWCE3OJV.js")).runSandboxTemplateCommand(options, rest)
642
642
  },
643
643
  {
644
644
  name: "repo",
@@ -660,13 +660,13 @@ var CLI_COMMAND_REGISTRY = [
660
660
  open: "boolean",
661
661
  timeoutSeconds: "integer"
662
662
  },
663
- handler: async ({ options, rest }) => (await import("./organizations-V7DTNLSI.js")).runOrganizationsCommand(options, rest)
663
+ handler: async ({ options, rest }) => (await import("./organizations-LAACUOYE.js")).runOrganizationsCommand(options, rest)
664
664
  },
665
665
  {
666
666
  name: "project",
667
667
  usage: "openpond project <list|create|upsert|get|update|sync|source-upload|archive> [args]",
668
668
  optionSchema: PROJECT_OPTION_SCHEMA,
669
- handler: async ({ options, rest }) => (await import("./project-agent-3TZ3BPYN.js")).runProjectCommand(options, rest)
669
+ handler: async ({ options, rest }) => (await import("./project-agent-JOZ6NRTW.js")).runProjectCommand(options, rest)
670
670
  },
671
671
  {
672
672
  name: "agent",
@@ -679,7 +679,7 @@ var CLI_COMMAND_REGISTRY = [
679
679
  "openpond agent edit checkpoint-result|commit-result|pr-result <workItemId> --team-id <id> --ref <artifact-ref>"
680
680
  ],
681
681
  optionSchema: AGENT_OPTION_SCHEMA,
682
- handler: async ({ options, rest }) => (await import("./project-agent-3TZ3BPYN.js")).runAgentCommand(options, rest)
682
+ handler: async ({ options, rest }) => (await import("./project-agent-JOZ6NRTW.js")).runAgentCommand(options, rest)
683
683
  },
684
684
  {
685
685
  name: "goal",
@@ -691,7 +691,7 @@ var CLI_COMMAND_REGISTRY = [
691
691
  json: "boolean",
692
692
  goalId: "string"
693
693
  },
694
- handler: async ({ options, rest }) => (await import("./cli-5RL7B2Z3.js")).runGoalCommand(options, rest)
694
+ handler: async ({ options, rest }) => (await import("./cli-H7PQLPKG.js")).runGoalCommand(options, rest)
695
695
  },
696
696
  {
697
697
  name: "harness",
@@ -712,13 +712,13 @@ var CLI_COMMAND_REGISTRY = [
712
712
  token: "string",
713
713
  tokenFile: "string"
714
714
  },
715
- handler: async ({ options, rest }) => (await import("./harness-SSNXDSKM.js")).runHarnessCommand(options, rest)
715
+ handler: async ({ options, rest }) => (await import("./harness-WADDUNGU.js")).runHarnessCommand(options, rest)
716
716
  },
717
717
  {
718
718
  name: "sandbox",
719
719
  usage: "openpond sandbox <command> [args]",
720
720
  optionSchema: SANDBOX_OPTION_SCHEMA,
721
- handler: async ({ options, rest }) => (await import("./sandbox-command-HOYHF4NC.js")).runSandboxCommand(options, rest)
721
+ handler: async ({ options, rest }) => (await import("./sandbox-command-Q72CAVQ7.js")).runSandboxCommand(options, rest)
722
722
  },
723
723
  {
724
724
  name: "opchat",
@@ -727,7 +727,7 @@ var CLI_COMMAND_REGISTRY = [
727
727
  json: "boolean",
728
728
  stream: "boolean"
729
729
  },
730
- handler: async ({ options, rest }) => (await import("./opchat-RW4CFAQB.js")).runOpChatCommand(options, rest)
730
+ handler: async ({ options, rest }) => (await import("./opchat-VYKKXDBO.js")).runOpChatCommand(options, rest)
731
731
  },
732
732
  {
733
733
  name: "teams-bot",
@@ -736,7 +736,7 @@ var CLI_COMMAND_REGISTRY = [
736
736
  json: "boolean",
737
737
  teamId: "string"
738
738
  },
739
- handler: async ({ options, rest }) => (await import("./teams-bot-UWGCFL6C.js")).runTeamsBotCommand(options, rest)
739
+ handler: async ({ options, rest }) => (await import("./teams-bot-KNY5OEXB.js")).runTeamsBotCommand(options, rest)
740
740
  },
741
741
  {
742
742
  name: "apps",
@@ -757,7 +757,7 @@ var CLI_COMMAND_REGISTRY = [
757
757
  name: "opentool",
758
758
  usage: "openpond opentool <init|validate|build> [args]",
759
759
  optionSchema: {},
760
- handler: async ({ rest }) => (await import("./core-commands-AZJZGTZS.js")).runOpentool(rest)
760
+ handler: async ({ rest }) => (await import("./core-commands-KI53GSJF.js")).runOpentool(rest)
761
761
  }
762
762
  ];
763
763
  var CLI_COMMAND_BY_NAME = /* @__PURE__ */ new Map();
@@ -829,11 +829,11 @@ function profileSdkAliasDefinitions() {
829
829
  name,
830
830
  usage: `openpond ${name} [args]`,
831
831
  optionSchema: PROFILE_SDK_OPTION_SCHEMA,
832
- handler: async ({ options, rest }) => (await import("./profile-WDBKJ7YW.js")).runOpenPondProfileSdkAlias(name, options, rest)
832
+ handler: async ({ options, rest }) => (await import("./profile-A75O7EZ4.js")).runOpenPondProfileSdkAlias(name, options, rest)
833
833
  }));
834
834
  }
835
835
  async function runToolCommand({ options, rest }) {
836
- const { runToolList, runToolRun } = await import("./core-commands-AZJZGTZS.js");
836
+ const { runToolList, runToolRun } = await import("./core-commands-KI53GSJF.js");
837
837
  const subcommand = rest[0];
838
838
  if (subcommand === "list") {
839
839
  const target = rest[1];
@@ -857,8 +857,8 @@ async function runToolCommand({ options, rest }) {
857
857
  throw new Error("usage: tool <list|run> <handle>/<repo> [args]");
858
858
  }
859
859
  async function runBacktestCommand({ options, rest }) {
860
- const { runBacktestRun } = await import("./core-commands-AZJZGTZS.js");
861
- const { runBacktestEvents, runBacktestGet } = await import("./apps-4RMNCKXS.js");
860
+ const { runBacktestRun } = await import("./core-commands-KI53GSJF.js");
861
+ const { runBacktestEvents, runBacktestGet } = await import("./apps-MJ47WJNC.js");
862
862
  const subcommand = rest[0] || "run";
863
863
  if (subcommand === "run") {
864
864
  const target = rest[1];
@@ -892,7 +892,7 @@ async function runBacktestCommand({ options, rest }) {
892
892
  throw new Error("usage: backtest <run|events|get> <handle>/<repo> [args]");
893
893
  }
894
894
  async function runDeployCommand({ options, rest }) {
895
- const { runDeployWatch } = await import("./core-commands-AZJZGTZS.js");
895
+ const { runDeployWatch } = await import("./core-commands-KI53GSJF.js");
896
896
  const subcommand = rest[0] || "watch";
897
897
  if (subcommand !== "watch") {
898
898
  throw new Error(
@@ -908,7 +908,7 @@ async function runDeployCommand({ options, rest }) {
908
908
  await runDeployWatch(options, target);
909
909
  }
910
910
  async function runTemplateCommand({ options, rest }) {
911
- const { runTemplateBranches, runTemplateStatus, runTemplateUpdate } = await import("./core-commands-AZJZGTZS.js");
911
+ const { runTemplateBranches, runTemplateStatus, runTemplateUpdate } = await import("./core-commands-KI53GSJF.js");
912
912
  const subcommand = rest[0] || "status";
913
913
  const target = rest[1];
914
914
  if (!target) {
@@ -933,7 +933,7 @@ async function runTemplateCommand({ options, rest }) {
933
933
  );
934
934
  }
935
935
  async function runRepoCommand({ options, rest }) {
936
- const { runRepoCreate, runRepoPush } = await import("./core-commands-AZJZGTZS.js");
936
+ const { runRepoCreate, runRepoPush } = await import("./core-commands-KI53GSJF.js");
937
937
  const subcommand = rest[0] || "create";
938
938
  if (subcommand === "create") {
939
939
  await runRepoCreate(options, rest.slice(1));
@@ -963,7 +963,7 @@ async function runAppsCommand({ options, rest }) {
963
963
  runAppsTools,
964
964
  runAppsToolsExecute,
965
965
  runAppsTradeFacts
966
- } = await import("./apps-4RMNCKXS.js");
966
+ } = await import("./apps-MJ47WJNC.js");
967
967
  const subcommand = rest[0];
968
968
  if (subcommand === "list") {
969
969
  await runAppsList(options);
@@ -12,7 +12,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
12
12
  // ../server/src/constants.ts
13
13
  var DEFAULT_HOST = "127.0.0.1";
14
14
  var DEFAULT_PORT = 17874;
15
- var VERSION = "0.0.30";
15
+ var VERSION = "0.0.31";
16
16
  var HOSTED_CHAT_SYSTEM_PROMPT = "You are OpenPond Chat. Respond in the user's language. If the user's latest message is language-neutral, ambiguous, or only a short test, respond in English. Be concise and directly answer the latest request. Do not use emojis. Use Markdown when it improves scanability. If you emit reasoning or thinking content, keep it sparse and user-readable: at most one short sentence for major progress, decisions, or blockers. Omit reasoning for routine searches, reads, tool calls, and obvious next steps. Do not restate the user request, narrate every action, or include code blocks, code excerpts, diffs, raw tool payloads, or markdown examples in reasoning. Put necessary code or exact snippets only in the final assistant answer. When the user asks to show or preview an image that is available as a workspace path or signed image URL, use Markdown image syntax like ![description](path-or-url) instead of a bare path or raw HTML. For workspace-backed answers, use a Codex-style shape: brief outcome first, then Changed Files if files changed, then Verification if checks ran. End with a concise final answer that summarizes the result and verification when relevant. Do not mention raw tool JSON, internal repo paths, or origin/remote URLs unless the user explicitly asks for them or they are necessary to explain a git/deploy failure.";
17
17
  var APP_PREFERENCES_CACHE_TYPE = "app_preferences";
18
18
  var APP_PREFERENCES_CACHE_KEY = "global";
@@ -4,7 +4,7 @@ import {
4
4
  listOpChatModels,
5
5
  sendHostedChatTurn,
6
6
  streamHostedChatTurn
7
- } from "./chunk-OV3KAFWB.js";
7
+ } from "./chunk-ETBF62DB.js";
8
8
 
9
9
  // ../../packages/cloud/src/opchat-smoke.ts
10
10
  var DEFAULT_MODEL = "openpond-chat";
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
2
  import {
3
3
  DEFAULT_OPENPOND_OPCHAT_API_BASE_URL
4
- } from "./chunk-MFS3SYUH.js";
4
+ } from "./chunk-4GLUNJLZ.js";
5
5
 
6
6
  // ../../packages/cloud/src/hosted-chat.ts
7
7
  import { randomUUID } from "node:crypto";
@@ -30,7 +30,7 @@ import {
30
30
  setActiveProfile,
31
31
  submitBacktestRun,
32
32
  warnOnRepoHostMismatch
33
- } from "./chunk-BNPFMGZD.js";
33
+ } from "./chunk-NC2GQQOT.js";
34
34
  import {
35
35
  normalizeTemplateRepoUrl,
36
36
  resolveApiBaseUrlOption,
@@ -38,7 +38,7 @@ import {
38
38
  resolveBaseUrlOption,
39
39
  resolveChatApiBaseUrlOption,
40
40
  resolvePublicApiBaseUrl
41
- } from "./chunk-MFS3SYUH.js";
41
+ } from "./chunk-4GLUNJLZ.js";
42
42
  import {
43
43
  compareSemver,
44
44
  fetchLatestNpmVersion,
@@ -46,7 +46,7 @@ import {
46
46
  parseBooleanOption,
47
47
  parseJsonOption,
48
48
  resolveTemplateEnvironment
49
- } from "./chunk-KMSMK7PI.js";
49
+ } from "./chunk-7HZBKUUB.js";
50
50
 
51
51
  // src/cli/core-commands.ts
52
52
  import { promises as fs, existsSync } from "node:fs";
@@ -5,10 +5,10 @@ import {
5
5
  mapUiBaseToApiBase,
6
6
  resolveBaseUrl,
7
7
  resolveSandboxApiUrlOption
8
- } from "./chunk-MFS3SYUH.js";
8
+ } from "./chunk-4GLUNJLZ.js";
9
9
  import {
10
10
  parseBooleanOption
11
- } from "./chunk-KMSMK7PI.js";
11
+ } from "./chunk-7HZBKUUB.js";
12
12
 
13
13
  // ../../packages/cloud/src/api/core.ts
14
14
  var DEFAULT_API_TIMEOUT_MS = 3e4;
@@ -4,14 +4,14 @@ import {
4
4
  materializeSourceUploadFile,
5
5
  readSourceUploadCache,
6
6
  writeSourceUploadCache
7
- } from "./chunk-4S3XGFGL.js";
7
+ } from "./chunk-WQ2GF7XT.js";
8
8
  import {
9
9
  yaml
10
10
  } from "./chunk-WYDVQOBL.js";
11
11
  import {
12
12
  loadGlobalConfig,
13
13
  saveGlobalConfig
14
- } from "./chunk-BNPFMGZD.js";
14
+ } from "./chunk-NC2GQQOT.js";
15
15
 
16
16
  // ../../packages/cloud/src/profile/profile-setup-gate.ts
17
17
  var OpenPondProfileSetupRequiredError = class extends Error {
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
2
  import {
3
3
  writePrivateJsonFile
4
- } from "./chunk-BNPFMGZD.js";
4
+ } from "./chunk-NC2GQQOT.js";
5
5
 
6
6
  // ../../packages/cloud/src/profile/source-upload-cache.ts
7
7
  import { createHash } from "node:crypto";
@@ -2,7 +2,7 @@ import { createRequire as __openpondCreateRequire } from "node:module"; var requ
2
2
  import {
3
3
  resolveOpChatApiBaseUrl,
4
4
  sendHostedChatTurn
5
- } from "./chunk-OV3KAFWB.js";
5
+ } from "./chunk-ETBF62DB.js";
6
6
  import {
7
7
  CreatePipelinePlanSchema,
8
8
  CreatePipelineSnapshotSchema,
@@ -18,7 +18,7 @@ import {
18
18
  loadGlobalConfig,
19
19
  readApiJson,
20
20
  runShellCommand
21
- } from "./chunk-BNPFMGZD.js";
21
+ } from "./chunk-NC2GQQOT.js";
22
22
 
23
23
  // src/goal/cli.ts
24
24
  import { randomUUID as randomUUID9 } from "node:crypto";
@@ -3,7 +3,7 @@ import {
3
3
  materializeSourceUploadFile,
4
4
  readSourceUploadCache,
5
5
  writeSourceUploadCache
6
- } from "./chunk-4S3XGFGL.js";
6
+ } from "./chunk-WQ2GF7XT.js";
7
7
  import {
8
8
  CreatePipelineRequestSchema
9
9
  } from "./chunk-VQX33YAG.js";
@@ -18,7 +18,7 @@ import {
18
18
  parseSandboxRuntimePromotionPolicyOption,
19
19
  parseSandboxWorkflowModeOption,
20
20
  runCommand
21
- } from "./chunk-BNPFMGZD.js";
21
+ } from "./chunk-NC2GQQOT.js";
22
22
  import {
23
23
  optionString,
24
24
  optionalJsonObject,
@@ -26,7 +26,7 @@ import {
26
26
  parseCsvOption,
27
27
  parseIntegerOption,
28
28
  requiredTeamId
29
- } from "./chunk-KMSMK7PI.js";
29
+ } from "./chunk-7HZBKUUB.js";
30
30
 
31
31
  // src/cli/agent-sdk-command.ts
32
32
  import { existsSync, readFileSync } from "node:fs";
@@ -2,7 +2,7 @@ import { createRequire as __openpondCreateRequire } from "node:module"; var requ
2
2
  import {
3
3
  resolveWebLaunchMessages,
4
4
  runOpenPondServerCli
5
- } from "./chunk-DANRS43D.js";
5
+ } from "./chunk-7KYOO25A.js";
6
6
  import "./chunk-IUTUUNAX.js";
7
7
  import "./chunk-BX4XSB2J.js";
8
8
  import "./chunk-LHYK6QO2.js";
@@ -3,14 +3,14 @@ import {
3
3
  createLocalGoal,
4
4
  printGoalHelp,
5
5
  runGoalCommand
6
- } from "./chunk-BBEVMP6O.js";
7
- import "./chunk-OV3KAFWB.js";
6
+ } from "./chunk-XMW3PSI5.js";
7
+ import "./chunk-ETBF62DB.js";
8
8
  import "./chunk-VQX33YAG.js";
9
9
  import "./chunk-LHYK6QO2.js";
10
10
  import "./chunk-WYDVQOBL.js";
11
- import "./chunk-BNPFMGZD.js";
12
- import "./chunk-MFS3SYUH.js";
13
- import "./chunk-KMSMK7PI.js";
11
+ import "./chunk-NC2GQQOT.js";
12
+ import "./chunk-4GLUNJLZ.js";
13
+ import "./chunk-7HZBKUUB.js";
14
14
  import "./chunk-UACZUFIA.js";
15
15
  export {
16
16
  createLocalGoal,
@@ -16,10 +16,10 @@ import {
16
16
  runTemplateUpdate,
17
17
  runToolList,
18
18
  runToolRun
19
- } from "./chunk-KEDXE4BA.js";
20
- import "./chunk-BNPFMGZD.js";
21
- import "./chunk-MFS3SYUH.js";
22
- import "./chunk-KMSMK7PI.js";
19
+ } from "./chunk-JWL5HCO5.js";
20
+ import "./chunk-NC2GQQOT.js";
21
+ import "./chunk-4GLUNJLZ.js";
22
+ import "./chunk-7HZBKUUB.js";
23
23
  import "./chunk-UACZUFIA.js";
24
24
  export {
25
25
  resolveGitBranch,
@@ -1,22 +1,22 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import "./chunk-57P2GCW5.js";
2
+ import "./chunk-DZUJ6XJC.js";
3
3
  import "./chunk-W5GKHH77.js";
4
4
  import {
5
5
  loadOpenPondProfileState
6
- } from "./chunk-GGKA4HLQ.js";
7
- import "./chunk-4S3XGFGL.js";
6
+ } from "./chunk-TQRWG54R.js";
7
+ import "./chunk-WQ2GF7XT.js";
8
8
  import {
9
9
  createLocalGoal,
10
10
  runGoalCommand
11
- } from "./chunk-BBEVMP6O.js";
12
- import "./chunk-OV3KAFWB.js";
11
+ } from "./chunk-XMW3PSI5.js";
12
+ import "./chunk-ETBF62DB.js";
13
13
  import "./chunk-VQX33YAG.js";
14
14
  import "./chunk-LHYK6QO2.js";
15
15
  import "./chunk-BYAPLT37.js";
16
16
  import "./chunk-WYDVQOBL.js";
17
- import "./chunk-BNPFMGZD.js";
18
- import "./chunk-MFS3SYUH.js";
19
- import "./chunk-KMSMK7PI.js";
17
+ import "./chunk-NC2GQQOT.js";
18
+ import "./chunk-4GLUNJLZ.js";
19
+ import "./chunk-7HZBKUUB.js";
20
20
  import "./chunk-UACZUFIA.js";
21
21
 
22
22
  // src/cli/extend.ts
@@ -1,14 +1,14 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
2
  import {
3
3
  runProcessCommand
4
- } from "./chunk-BNPFMGZD.js";
4
+ } from "./chunk-NC2GQQOT.js";
5
5
  import {
6
6
  CliUsageError
7
- } from "./chunk-MFS3SYUH.js";
7
+ } from "./chunk-4GLUNJLZ.js";
8
8
  import {
9
9
  optionString,
10
10
  parseBooleanOption
11
- } from "./chunk-KMSMK7PI.js";
11
+ } from "./chunk-7HZBKUUB.js";
12
12
  import "./chunk-UACZUFIA.js";
13
13
 
14
14
  // src/cli/harness.ts
@@ -3,7 +3,7 @@ import {
3
3
  CLI_GLOBAL_OPTION_SCHEMA,
4
4
  formatCliCommandUsage,
5
5
  listCliCommandDefinitions
6
- } from "./chunk-KMSMK7PI.js";
6
+ } from "./chunk-7HZBKUUB.js";
7
7
  import "./chunk-UACZUFIA.js";
8
8
 
9
9
  // src/cli/help.ts
@@ -1,26 +1,26 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
2
  import {
3
3
  runOpChatSmoke
4
- } from "./chunk-57P2GCW5.js";
4
+ } from "./chunk-DZUJ6XJC.js";
5
5
  import {
6
6
  getOpChatModel,
7
7
  listOpChatModels,
8
8
  resolveOpChatApiBaseUrl,
9
9
  sendHostedChatTurn,
10
10
  streamHostedChatTurn
11
- } from "./chunk-OV3KAFWB.js";
11
+ } from "./chunk-ETBF62DB.js";
12
12
  import {
13
13
  ensureApiKey,
14
14
  loadConfig
15
- } from "./chunk-BNPFMGZD.js";
15
+ } from "./chunk-NC2GQQOT.js";
16
16
  import {
17
17
  resolveApiBaseUrlOption,
18
18
  resolveBaseUrl,
19
19
  resolveChatApiBaseUrlOption
20
- } from "./chunk-MFS3SYUH.js";
20
+ } from "./chunk-4GLUNJLZ.js";
21
21
  import {
22
22
  parseBooleanOption
23
- } from "./chunk-KMSMK7PI.js";
23
+ } from "./chunk-7HZBKUUB.js";
24
24
  import "./chunk-UACZUFIA.js";
25
25
 
26
26
  // src/cli/opchat.ts
@@ -7,14 +7,14 @@ import "./chunk-LHYK6QO2.js";
7
7
  import "./chunk-WYDVQOBL.js";
8
8
  import {
9
9
  resolveSandboxClient
10
- } from "./chunk-BNPFMGZD.js";
11
- import "./chunk-MFS3SYUH.js";
10
+ } from "./chunk-NC2GQQOT.js";
11
+ import "./chunk-4GLUNJLZ.js";
12
12
  import {
13
13
  parseBooleanOption,
14
14
  parseCsvOption,
15
15
  parseIntegerOption,
16
16
  parseJsonOption
17
- } from "./chunk-KMSMK7PI.js";
17
+ } from "./chunk-7HZBKUUB.js";
18
18
  import "./chunk-UACZUFIA.js";
19
19
 
20
20
  // src/cli/organizations.ts
@@ -5,7 +5,7 @@ import {
5
5
  mergeProjectSourceUploadEntries,
6
6
  parseAgentSourceCheckDispatch,
7
7
  parseAgentSourceCheckKind
8
- } from "./chunk-BNVHGSI7.js";
8
+ } from "./chunk-ZIKHE5AY.js";
9
9
  import {
10
10
  buildHostedRunIdempotencyKey,
11
11
  collectProfileSourceUploadEntries,
@@ -22,8 +22,8 @@ import {
22
22
  runProfileCheck,
23
23
  runProfileSdkCommand,
24
24
  saveProfilePushStatus
25
- } from "./chunk-GGKA4HLQ.js";
26
- import "./chunk-4S3XGFGL.js";
25
+ } from "./chunk-TQRWG54R.js";
26
+ import "./chunk-WQ2GF7XT.js";
27
27
  import "./chunk-VQX33YAG.js";
28
28
  import "./chunk-LHYK6QO2.js";
29
29
  import "./chunk-OG75GMVO.js";
@@ -31,13 +31,13 @@ import "./chunk-BYAPLT37.js";
31
31
  import "./chunk-WYDVQOBL.js";
32
32
  import {
33
33
  resolveSandboxClient
34
- } from "./chunk-BNPFMGZD.js";
35
- import "./chunk-MFS3SYUH.js";
34
+ } from "./chunk-NC2GQQOT.js";
35
+ import "./chunk-4GLUNJLZ.js";
36
36
  import {
37
37
  optionString,
38
38
  parseBooleanOption,
39
39
  requiredTeamId
40
- } from "./chunk-KMSMK7PI.js";
40
+ } from "./chunk-7HZBKUUB.js";
41
41
  import "./chunk-UACZUFIA.js";
42
42
 
43
43
  // src/cli/profile.ts
@@ -30,8 +30,8 @@ import {
30
30
  parseProjectSourceType,
31
31
  resolveLocalAgentSdkCommand,
32
32
  resolveProjectSourceUploadBranch
33
- } from "./chunk-BNVHGSI7.js";
34
- import "./chunk-4S3XGFGL.js";
33
+ } from "./chunk-ZIKHE5AY.js";
34
+ import "./chunk-WQ2GF7XT.js";
35
35
  import "./chunk-VQX33YAG.js";
36
36
  import "./chunk-LHYK6QO2.js";
37
37
  import "./chunk-OG75GMVO.js";
@@ -41,14 +41,14 @@ import {
41
41
  parseSandboxWorkflowModeOption,
42
42
  resolveSandboxClient,
43
43
  runCommand
44
- } from "./chunk-BNPFMGZD.js";
45
- import "./chunk-MFS3SYUH.js";
44
+ } from "./chunk-NC2GQQOT.js";
45
+ import "./chunk-4GLUNJLZ.js";
46
46
  import {
47
47
  optionString,
48
48
  optionalJsonObject,
49
49
  parseBooleanOption,
50
50
  requiredTeamId
51
- } from "./chunk-KMSMK7PI.js";
51
+ } from "./chunk-7HZBKUUB.js";
52
52
  import "./chunk-UACZUFIA.js";
53
53
 
54
54
  // src/cli/project-agent-formatters.ts
@@ -15,19 +15,19 @@ import {
15
15
  summarizeReplayArtifact,
16
16
  summarizeSandbox,
17
17
  waitForSandboxCreateReady
18
- } from "./chunk-RJXX6TJA.js";
18
+ } from "./chunk-5X47XJC4.js";
19
19
  import {
20
20
  readSandboxSecretValue,
21
21
  resolveSandboxClient,
22
22
  summarizeSandboxSecret
23
- } from "./chunk-BNPFMGZD.js";
24
- import "./chunk-MFS3SYUH.js";
23
+ } from "./chunk-NC2GQQOT.js";
24
+ import "./chunk-4GLUNJLZ.js";
25
25
  import {
26
26
  parseBooleanOption,
27
27
  parseIntegerOption,
28
28
  parseJsonObjectOption,
29
29
  parseNumberOption
30
- } from "./chunk-KMSMK7PI.js";
30
+ } from "./chunk-7HZBKUUB.js";
31
31
  import "./chunk-UACZUFIA.js";
32
32
 
33
33
  // src/cli/sandbox-files-command.ts
@@ -2,10 +2,10 @@ import { createRequire as __openpondCreateRequire } from "node:module"; var requ
2
2
  import {
3
3
  createSandboxFromPlan,
4
4
  summarizeSandbox
5
- } from "./chunk-RJXX6TJA.js";
5
+ } from "./chunk-5X47XJC4.js";
6
6
  import {
7
7
  resolveGitBranch
8
- } from "./chunk-KEDXE4BA.js";
8
+ } from "./chunk-JWL5HCO5.js";
9
9
  import "./chunk-OG75GMVO.js";
10
10
  import {
11
11
  OPENPOND_MANIFEST_FILE_NAME,
@@ -36,16 +36,16 @@ import {
36
36
  runCommand,
37
37
  runShellCommand,
38
38
  warnOnRepoHostMismatch
39
- } from "./chunk-BNPFMGZD.js";
39
+ } from "./chunk-NC2GQQOT.js";
40
40
  import {
41
41
  resolveBaseUrl,
42
42
  resolvePublicApiBaseUrl
43
- } from "./chunk-MFS3SYUH.js";
43
+ } from "./chunk-4GLUNJLZ.js";
44
44
  import {
45
45
  parseBooleanOption,
46
46
  parseIntegerOption,
47
47
  parseJsonOption
48
- } from "./chunk-KMSMK7PI.js";
48
+ } from "./chunk-7HZBKUUB.js";
49
49
  import "./chunk-UACZUFIA.js";
50
50
 
51
51
  // src/cli/sandbox-template.ts
@@ -13,7 +13,7 @@ import {
13
13
  now,
14
14
  runOpenPondServerCli,
15
15
  textFromUnknown
16
- } from "./chunk-DANRS43D.js";
16
+ } from "./chunk-7KYOO25A.js";
17
17
  import {
18
18
  createOpenPondRepoApp,
19
19
  getBundledRuntimeVersion,
@@ -65570,15 +65570,38 @@ function scanAndRedactEvidence(text2) {
65570
65570
  import { Buffer as Buffer11 } from "node:buffer";
65571
65571
 
65572
65572
  // ../server/src/training/cross-system-operations/python-sandbox.ts
65573
- import { spawn as spawn7 } from "node:child_process";
65573
+ import { execFile as execFile4, spawn as spawn7 } from "node:child_process";
65574
65574
  import { tmpdir } from "node:os";
65575
65575
  import readline from "node:readline";
65576
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;
65577
65582
  var WORKER_SOURCE = String.raw`
65578
- 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
65579
65584
 
65580
- resource.setrlimit(resource.RLIMIT_CPU, (5, 5))
65581
- resource.setrlimit(resource.RLIMIT_AS, (268435456, 268435456))
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
65601
+
65602
+ if resource is not None:
65603
+ apply_resource_limit(resource.RLIMIT_CPU, 5)
65604
+ apply_resource_limit(resource.RLIMIT_AS, 268435456)
65582
65605
  ALLOWED_MODULES = {"math", "statistics", "decimal", "datetime", "collections", "itertools", "functools", "json"}
65583
65606
  real_import = __import__
65584
65607
  def safe_import(name, globals=None, locals=None, fromlist=(), level=0):
@@ -65618,20 +65641,39 @@ for line in sys.stdin:
65618
65641
  var PersistentPythonSandbox = class {
65619
65642
  constructor(options = {}) {
65620
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;
65621
65647
  this.child = spawn7(options.pythonBin ?? process.env.OPENPOND_PYTHON_BIN ?? "python3", ["-I", "-S", "-u", "-c", WORKER_SOURCE], {
65622
65648
  cwd: tmpdir(),
65623
65649
  env: { PATH: process.env.PATH ?? "/usr/bin:/bin", PYTHONIOENCODING: "utf-8", PYTHONUNBUFFERED: "1" },
65624
65650
  stdio: ["pipe", "pipe", "pipe"]
65625
65651
  });
65626
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
+ });
65627
65657
  this.child.once("error", (error) => this.failAll(error));
65628
65658
  this.child.once("exit", (code, signal) => {
65629
- 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
+ }
65630
65665
  });
65631
65666
  }
65632
65667
  options;
65633
65668
  child;
65634
65669
  pending = /* @__PURE__ */ new Map();
65670
+ maxMemoryBytes;
65671
+ memoryPollIntervalMs;
65672
+ memoryUsage;
65673
+ memoryTimer = null;
65674
+ memoryProbeInFlight = false;
65675
+ terminationError = null;
65676
+ stderr = "";
65635
65677
  closed = false;
65636
65678
  async run(code, signal) {
65637
65679
  if (this.closed) throw new Error("Python sandbox is closed.");
@@ -65641,6 +65683,7 @@ var PersistentPythonSandbox = class {
65641
65683
  const result = new Promise((resolve, reject) => {
65642
65684
  const timer = setTimeout(() => {
65643
65685
  this.pending.delete(id);
65686
+ if (this.pending.size === 0) this.stopMemoryMonitor();
65644
65687
  reject(new Error("Python sandbox execution timed out."));
65645
65688
  void this.close();
65646
65689
  }, this.options.timeoutMs ?? 1500);
@@ -65652,10 +65695,12 @@ var PersistentPythonSandbox = class {
65652
65695
  if (!pending) return;
65653
65696
  clearTimeout(pending.timer);
65654
65697
  this.pending.delete(id);
65698
+ if (this.pending.size === 0) this.stopMemoryMonitor();
65655
65699
  pending.reject(abortError(signal));
65656
65700
  void this.close();
65657
65701
  };
65658
65702
  signal?.addEventListener("abort", abort, { once: true });
65703
+ this.startMemoryMonitor();
65659
65704
  this.child.stdin.write(`${JSON.stringify({ id, code })}
65660
65705
  `);
65661
65706
  try {
@@ -65667,6 +65712,7 @@ var PersistentPythonSandbox = class {
65667
65712
  async close() {
65668
65713
  if (this.closed) return;
65669
65714
  this.closed = true;
65715
+ this.stopMemoryMonitor();
65670
65716
  this.failAll(new Error("Python sandbox closed."));
65671
65717
  if (this.child.exitCode !== null || this.child.signalCode !== null) return;
65672
65718
  this.child.stdin.end();
@@ -65688,6 +65734,7 @@ var PersistentPythonSandbox = class {
65688
65734
  if (!pending) return;
65689
65735
  clearTimeout(pending.timer);
65690
65736
  this.pending.delete(id);
65737
+ if (this.pending.size === 0) this.stopMemoryMonitor();
65691
65738
  const stdout = typeof value.stdout === "string" ? value.stdout : "";
65692
65739
  const serialized = JSON.stringify(value.result ?? null);
65693
65740
  if (Buffer.byteLength(stdout + serialized, "utf8") > (this.options.maxOutputBytes ?? 16384)) {
@@ -65697,13 +65744,69 @@ var PersistentPythonSandbox = class {
65697
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." });
65698
65745
  }
65699
65746
  failAll(error) {
65747
+ this.stopMemoryMonitor();
65700
65748
  for (const pending of this.pending.values()) {
65701
65749
  clearTimeout(pending.timer);
65702
65750
  pending.reject(error);
65703
65751
  }
65704
65752
  this.pending.clear();
65705
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
+ }
65706
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
+ }
65707
65810
  function abortError(signal) {
65708
65811
  const error = signal?.reason instanceof Error ? signal.reason : new Error("Python sandbox execution was cancelled.");
65709
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-BNPFMGZD.js";
5
- import "./chunk-MFS3SYUH.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-KMSMK7PI.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,12 +4,12 @@ import {
4
4
  parseArgs,
5
5
  resolveAccountOption,
6
6
  resolveBaseUrlOption
7
- } from "./chunks/chunk-MFS3SYUH.js";
7
+ } from "./chunks/chunk-4GLUNJLZ.js";
8
8
  import {
9
9
  getInstalledCliVersion,
10
10
  parseBooleanOption,
11
11
  runCliCommand
12
- } from "./chunks/chunk-KMSMK7PI.js";
12
+ } from "./chunks/chunk-7HZBKUUB.js";
13
13
  import "./chunks/chunk-UACZUFIA.js";
14
14
 
15
15
  // src/cli/top-level-action.ts
@@ -32,11 +32,11 @@ async function runOpenPondCli(argv = process.argv.slice(2)) {
32
32
  return;
33
33
  }
34
34
  if (action === "check-update") {
35
- await (await import("./chunks/core-commands-AZJZGTZS.js")).runCheckUpdate();
35
+ await (await import("./chunks/core-commands-KI53GSJF.js")).runCheckUpdate();
36
36
  return;
37
37
  }
38
38
  if (action === "help") {
39
- (await import("./chunks/help-MUJJMI3Q.js")).printHelp();
39
+ (await import("./chunks/help-TIEOIVOA.js")).printHelp();
40
40
  return;
41
41
  }
42
42
  const selectedAccount = resolveAccountOption(options);
@@ -48,25 +48,25 @@ async function runOpenPondCli(argv = process.argv.slice(2)) {
48
48
  process.env.OPENPOND_BASE_URL = selectedBaseUrl;
49
49
  }
50
50
  if (action === "tui") {
51
- await (await import("./chunks/app-layer-FIGCNZJX.js")).runOpenPondTerminalCommand(options, rest);
51
+ await (await import("./chunks/app-layer-53U5JVE7.js")).runOpenPondTerminalCommand(options, rest);
52
52
  return;
53
53
  }
54
54
  if (action === "ui") {
55
- await (await import("./chunks/app-layer-FIGCNZJX.js")).runOpenPondServerCommand("web", options, rest);
55
+ await (await import("./chunks/app-layer-53U5JVE7.js")).runOpenPondServerCommand("web", options, rest);
56
56
  return;
57
57
  }
58
58
  if (await runCliCommand({ command, options, rest })) {
59
59
  return;
60
60
  }
61
- (await import("./chunks/help-MUJJMI3Q.js")).printHelp();
61
+ (await import("./chunks/help-TIEOIVOA.js")).printHelp();
62
62
  process.exit(1);
63
63
  }
64
64
  async function runEmbeddedCompanion(argv) {
65
65
  if (argv[0] === "__server") {
66
66
  process.argv = [process.execPath, "openpond-server", ...argv.slice(1)];
67
67
  const [{ createOpenPondServer }, { runOpenPondServerCli }] = await Promise.all([
68
- import("./chunks/src-ZRQKSQTD.js"),
69
- import("./chunks/cli-2L4NB7HD.js")
68
+ import("./chunks/src-J4262EAE.js"),
69
+ import("./chunks/cli-EP473A53.js")
70
70
  ]);
71
71
  await runOpenPondServerCli(createOpenPondServer);
72
72
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openpond",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
4
4
  "openpondReleaseVersioned": true,
5
5
  "license": "MIT",
6
6
  "description": "OpenPond CLI and local harness",