@sweny-ai/core 0.1.180 → 0.1.182

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.
@@ -35,7 +35,9 @@
35
35
  * socat for step 1: install it with `npm i -g @anthropic-ai/sandbox-runtime`, or
36
36
  * point `SWENY_SRT_PATH` at the binary. Linux also needs bubblewrap, socat and
37
37
  * ripgrep, and unprivileged user namespaces (Ubuntu 23.10+:
38
- * `sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0`).
38
+ * `sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0`; Ubuntu 26.04
39
+ * also `sudo apparmor_parser -R /etc/apparmor.d/bwrap-userns-restrict`, see
40
+ * {@link usernsHint}).
39
41
  *
40
42
  * Modes are the step 1 modes, unchanged (`SWENY_SANDBOX`, default `auto` in CI
41
43
  * and `off` locally): `off` never wraps; `auto` wraps when a wrapper is
@@ -47,7 +49,7 @@ import { existsSync, realpathSync } from "node:fs";
47
49
  import { lstat, mkdir, mkdtemp, realpath, rm, writeFile } from "node:fs/promises";
48
50
  import { homedir, tmpdir } from "node:os";
49
51
  import * as path from "node:path";
50
- import { DEFAULT_SANDBOX_DOMAINS, parseList, resolveSandboxMode } from "../agent-env.js";
52
+ import { DEFAULT_SANDBOX_DOMAINS, parseList, probeLine, resolveSandboxMode, usernsHint, } from "../agent-env.js";
51
53
  import { runStateRoot } from "../journal.js";
52
54
  import { policyGate } from "./policy.js";
53
55
  // ─── srt settings ────────────────────────────────────────────────
@@ -256,14 +258,8 @@ async function srtWorks(srtPath, env) {
256
258
  execFile(srtPath, ["--settings", settings, "--", "true"], { env: { PATH: env.PATH ?? "", HOME: dir }, timeout: 30_000 }, (err, _stdout, stderr) => {
257
259
  if (!err)
258
260
  return resolve(undefined);
259
- const first = String(stderr || err.message)
260
- .trim()
261
- .split("\n")[0] || "unknown error";
262
- const userns = /user namespace|uid map|setting up uid|Operation not permitted|Permission denied/i.test(String(stderr));
263
- resolve(`srt cannot sandbox on this host (${first})` +
264
- (userns
265
- ? "; unprivileged user namespaces look restricted (Ubuntu 23.10+: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0)"
266
- : ""));
261
+ const first = probeLine(String(stderr || err.message));
262
+ resolve(`srt cannot sandbox on this host (${first})${usernsHint(String(stderr))}`);
267
263
  });
268
264
  });
269
265
  }
package/dist/inputs.d.ts CHANGED
@@ -69,37 +69,18 @@ export interface WorkflowInputField {
69
69
  }
70
70
  /** Declared input contract for a workflow. Keys are field names. */
71
71
  export type WorkflowInputs = Record<string, WorkflowInputField>;
72
- export declare const workflowInputsZ: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
73
- type: z.ZodEnum<["string", "number", "boolean", "string[]"]>;
72
+ export declare const workflowInputsZ: z.ZodRecord<z.ZodString, z.ZodObject<{
73
+ type: z.ZodEnum<{
74
+ string: "string";
75
+ number: "number";
76
+ boolean: "boolean";
77
+ "string[]": "string[]";
78
+ }>;
74
79
  description: z.ZodOptional<z.ZodString>;
75
80
  required: z.ZodOptional<z.ZodBoolean>;
76
81
  default: z.ZodOptional<z.ZodUnknown>;
77
- enum: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
78
- }, "strict", z.ZodTypeAny, {
79
- type: "string" | "number" | "boolean" | "string[]";
80
- description?: string | undefined;
81
- required?: boolean | undefined;
82
- default?: unknown;
83
- enum?: unknown[] | undefined;
84
- }, {
85
- type: "string" | "number" | "boolean" | "string[]";
86
- description?: string | undefined;
87
- required?: boolean | undefined;
88
- default?: unknown;
89
- enum?: unknown[] | undefined;
90
- }>, {
91
- type: "string" | "number" | "boolean" | "string[]";
92
- description?: string | undefined;
93
- required?: boolean | undefined;
94
- default?: unknown;
95
- enum?: unknown[] | undefined;
96
- }, {
97
- type: "string" | "number" | "boolean" | "string[]";
98
- description?: string | undefined;
99
- required?: boolean | undefined;
100
- default?: unknown;
101
- enum?: unknown[] | undefined;
102
- }>>;
82
+ enum: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
83
+ }, z.core.$strict>>;
103
84
  /** A single validation error against the declared input contract. */
104
85
  export interface InputValidationError {
105
86
  field: string;
package/dist/inputs.js CHANGED
@@ -101,7 +101,7 @@ const workflowInputFieldZ = z
101
101
  }
102
102
  }
103
103
  });
104
- export const workflowInputsZ = z.record(workflowInputFieldZ);
104
+ export const workflowInputsZ = z.record(z.string(), workflowInputFieldZ);
105
105
  /**
106
106
  * Validate the caller's raw input object against the workflow's declared
107
107
  * `inputs` block. Applies defaults for omitted optional fields. Surfaces