@opengeni/runtime 6.37.3 → 6.37.4-canary.45279257475001

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 (34) hide show
  1. package/dist/assets/codemode-client.json +1 -1
  2. package/dist/{chunk-MENQJCIH.js → chunk-EDYIVFM6.js} +66 -12
  3. package/dist/chunk-EDYIVFM6.js.map +1 -0
  4. package/dist/{chunk-AY4BJB56.js → chunk-JJ5TY6IC.js} +21 -16
  5. package/dist/chunk-JJ5TY6IC.js.map +1 -0
  6. package/dist/{chunk-YK5XI5WO.js → chunk-OKSEXUCX.js} +2 -2
  7. package/dist/{chunk-KIC3L4DL.js → chunk-POPSWKJG.js} +2 -2
  8. package/dist/{chunk-T4O5GMZZ.js → chunk-QR62UQWX.js} +3 -3
  9. package/dist/{chunk-43LQ4DVH.js → chunk-RPCDZNPG.js} +2 -2
  10. package/dist/{chunk-AEWNWZA6.js → chunk-SPAAKBWU.js} +3 -3
  11. package/dist/gmail-rest-mcp.js +3 -3
  12. package/dist/google-calendar-rest-mcp.js +2 -2
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +13 -7
  15. package/dist/{lazy-manifest-NZQENVHZ.js → lazy-manifest-C3TKNLDG.js} +2 -2
  16. package/dist/sandbox/index.js +2 -2
  17. package/dist/sandbox/routing/routing-session.d.ts +4 -1
  18. package/dist/sandbox/turn-tool-cancellation.d.ts +37 -1
  19. package/dist/slack-rest-mcp.js +3 -3
  20. package/dist/workspace-tool-gateway.js +7 -7
  21. package/package.json +18 -17
  22. package/src/bundled_site_skills/sites/SKILL.md +6 -6
  23. package/src/bundled_site_skills/sites/references/dashboards.md +53 -0
  24. package/src/index.ts +3 -0
  25. package/src/sandbox/routing/routing-session.ts +12 -0
  26. package/src/sandbox/turn-tool-cancellation.ts +103 -8
  27. package/dist/chunk-AY4BJB56.js.map +0 -1
  28. package/dist/chunk-MENQJCIH.js.map +0 -1
  29. /package/dist/{chunk-YK5XI5WO.js.map → chunk-OKSEXUCX.js.map} +0 -0
  30. /package/dist/{chunk-KIC3L4DL.js.map → chunk-POPSWKJG.js.map} +0 -0
  31. /package/dist/{chunk-T4O5GMZZ.js.map → chunk-QR62UQWX.js.map} +0 -0
  32. /package/dist/{chunk-43LQ4DVH.js.map → chunk-RPCDZNPG.js.map} +0 -0
  33. /package/dist/{chunk-AEWNWZA6.js.map → chunk-SPAAKBWU.js.map} +0 -0
  34. /package/dist/{lazy-manifest-NZQENVHZ.js.map → lazy-manifest-C3TKNLDG.js.map} +0 -0
@@ -30627,7 +30627,7 @@ var RoutingSandboxSession = class {
30627
30627
  /** Make a retained process session-owned before exposing its live locator.
30628
30628
  * Provider yield alone is not adoption: short commands can still finish and
30629
30629
  * return inline during the model-facing eager-wait window. */
30630
- async adoptRetainedProcessAsBackgroundCommand(providerSessionId, command) {
30630
+ async adoptRetainedProcessAsBackgroundCommand(providerSessionId, command, processGroupMarker) {
30631
30631
  const record = this.retainedProcess(providerSessionId);
30632
30632
  if (!this.canAdoptRetainedProcessAsBackgroundCommand(providerSessionId)) {
30633
30633
  throw new RoutingUnsupportedError("backgroundCommandAdoption", record.backend.kind);
@@ -30641,10 +30641,12 @@ var RoutingSandboxSession = class {
30641
30641
  );
30642
30642
  }
30643
30643
  await this.captureRetainedOutput(record);
30644
+ const supervised = record.process.providerCommand?.kind === "modal-router-v1" && Boolean(record.process.providerCommand.supervision);
30644
30645
  record.backgroundAdoption ??= this.deps.adoptProcessAsBackgroundCommand({
30645
30646
  backend: record.backend,
30646
30647
  process: record.process,
30647
- command
30648
+ command,
30649
+ ...processGroupMarker && !supervised ? { processGroupMarker } : {}
30648
30650
  });
30649
30651
  try {
30650
30652
  await record.backgroundAdoption;
@@ -31458,6 +31460,20 @@ function shellMarkerPath(token, directory = SHELL_MARKER_DIR) {
31458
31460
  function shellCancellationPath(markerPath) {
31459
31461
  return `${markerPath}.cancelled`;
31460
31462
  }
31463
+ function adoptableProcessGroupMarker(markerPath) {
31464
+ if (!markerPath) return void 0;
31465
+ const valid = isTurnShellMarkerPath(markerPath);
31466
+ if (valid) return markerPath;
31467
+ console.warn("turn shell process-group marker dropped at background adoption", {
31468
+ reason: "unrecognized_marker_path",
31469
+ length: String(markerPath).length
31470
+ });
31471
+ return void 0;
31472
+ }
31473
+ var TURN_SHELL_MARKER_PATH = /^\/[A-Za-z0-9._/-]{0,512}\/opengeni-turn-shell\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;
31474
+ function isTurnShellMarkerPath(value) {
31475
+ return typeof value === "string" && TURN_SHELL_MARKER_PATH.test(value) && !value.split("/").some((segment) => segment === "." || segment === "..");
31476
+ }
31461
31477
  function processInspectionCommandLines() {
31462
31478
  return [
31463
31479
  "__opengeni_process_group_id() {",
@@ -31701,15 +31717,48 @@ function pendingShellCancellationCommand(state) {
31701
31717
  ].join("\n");
31702
31718
  }
31703
31719
  function retainedShellCancellationCommand(state) {
31704
- const marker = singleQuote(state.markerPath);
31705
- const cancellation = singleQuote(shellCancellationPath(state.markerPath));
31706
- const markerDir = singleQuote(posix2.dirname(state.markerPath));
31707
- const token = singleQuote(state.token);
31720
+ return processGroupStopScript(state.markerPath, state.token, {
31721
+ termPolls: 4,
31722
+ pollSeconds: "0.025",
31723
+ tombstone: true
31724
+ });
31725
+ }
31726
+ var PROCESS_GROUP_STOP_EXIT = {
31727
+ /** The group is absent (stopped now or already gone). */
31728
+ stopped: 0,
31729
+ /** No marker: the wrapper never started user code or already exited. */
31730
+ markerAbsent: RETAINED_SHELL_MARKER_PENDING_EXIT_CODE,
31731
+ /** The group survived TERM and KILL. */
31732
+ groupLive: RETAINED_SHELL_GROUP_LIVE_EXIT_CODE,
31733
+ /** Identity could not be read or validated. */
31734
+ inconclusive: RETAINED_SHELL_PROOF_INCONCLUSIVE_EXIT_CODE
31735
+ };
31736
+ function processGroupStopCommand(markerPath, options) {
31737
+ if (!isTurnShellMarkerPath(markerPath)) {
31738
+ throw new Error("Process-group stop requires a turn shell marker path");
31739
+ }
31740
+ const termPolls = Math.max(1, Math.min(600, Math.ceil(options.termGraceMs / 100)));
31741
+ return processGroupStopScript(markerPath, posix2.basename(markerPath), {
31742
+ termPolls,
31743
+ pollSeconds: "0.1",
31744
+ tombstone: false
31745
+ });
31746
+ }
31747
+ function processGroupStopScript(markerPath, rawToken, grace) {
31748
+ const marker = singleQuote(markerPath);
31749
+ const cancellation = singleQuote(shellCancellationPath(markerPath));
31750
+ const markerDir = singleQuote(posix2.dirname(markerPath));
31751
+ const token = singleQuote(rawToken);
31752
+ const termPolls = Math.trunc(grace.termPolls);
31708
31753
  return [
31709
31754
  ...processInspectionCommandLines(),
31710
31755
  "umask 077",
31711
- `command mkdir -p ${markerDir} || exit ${RETAINED_SHELL_PROOF_INCONCLUSIVE_EXIT_CODE}`,
31712
- `: > ${cancellation} || exit ${RETAINED_SHELL_PROOF_INCONCLUSIVE_EXIT_CODE}`,
31756
+ // The tombstone blocks user code that has not started yet; only the
31757
+ // in-turn cancellation can race a start.
31758
+ ...grace.tombstone ? [
31759
+ `command mkdir -p ${markerDir} || exit ${RETAINED_SHELL_PROOF_INCONCLUSIVE_EXIT_CODE}`,
31760
+ `: > ${cancellation} || exit ${RETAINED_SHELL_PROOF_INCONCLUSIVE_EXIT_CODE}`
31761
+ ] : [],
31713
31762
  `__opengeni_marker=${marker}`,
31714
31763
  `__opengeni_token=${token}`,
31715
31764
  `[ -r "$__opengeni_marker" ] || exit ${RETAINED_SHELL_MARKER_PENDING_EXIT_CODE}`,
@@ -31726,8 +31775,8 @@ function retainedShellCancellationCommand(state) {
31726
31775
  `[ "$__opengeni_live_pgid" = "$__opengeni_pgid" ] || { command kill -0 "-$__opengeni_pgid" 2>/dev/null && exit ${RETAINED_SHELL_PROOF_INCONCLUSIVE_EXIT_CODE}; command rm -f "$__opengeni_marker"; exit 0; }`,
31727
31776
  'command kill -TERM "-$__opengeni_pgid" 2>/dev/null || true',
31728
31777
  "__opengeni_poll=0",
31729
- 'while command kill -0 "-$__opengeni_pgid" 2>/dev/null && [ "$__opengeni_poll" -lt 4 ]; do',
31730
- " command sleep 0.025 2>/dev/null || true",
31778
+ `while command kill -0 "-$__opengeni_pgid" 2>/dev/null && [ "$__opengeni_poll" -lt ${termPolls} ]; do`,
31779
+ ` command sleep ${grace.pollSeconds} 2>/dev/null || true`,
31731
31780
  " __opengeni_poll=$((__opengeni_poll + 1))",
31732
31781
  "done",
31733
31782
  'command kill -0 "-$__opengeni_pgid" 2>/dev/null || { command rm -f "$__opengeni_marker"; exit 0; }',
@@ -32913,9 +32962,11 @@ var TurnToolCancellationControllerImpl = class {
32913
32962
  }
32914
32963
  if (this.cancelled) throw cancellationError(this.reason);
32915
32964
  if (canAdoptInBackground && state.processSession?.adoptRetainedProcessAsBackgroundCommand) {
32965
+ const processGroupMarker = adoptableProcessGroupMarker(state.markerPath);
32916
32966
  await state.processSession.adoptRetainedProcessAsBackgroundCommand(
32917
32967
  state.sessionId,
32918
- state.command
32968
+ state.command,
32969
+ processGroupMarker
32919
32970
  );
32920
32971
  this.shellSessions.delete(state.sessionId);
32921
32972
  }
@@ -33749,6 +33800,9 @@ export {
33749
33800
  secretLeakMessage,
33750
33801
  SecretLeakGuard,
33751
33802
  TurnSandboxCommandCancelledError,
33803
+ isTurnShellMarkerPath,
33804
+ PROCESS_GROUP_STOP_EXIT,
33805
+ processGroupStopCommand,
33752
33806
  isRouteMoveRefusal,
33753
33807
  createTurnToolCancellationController,
33754
33808
  wrapCapabilityToolsForTurnCancellation,
@@ -33792,4 +33846,4 @@ export {
33792
33846
  renderRoutingMutationOutcomeUnknownToolResult,
33793
33847
  RoutingSandboxSession
33794
33848
  };
33795
- //# sourceMappingURL=chunk-MENQJCIH.js.map
33849
+ //# sourceMappingURL=chunk-EDYIVFM6.js.map