@mettlelabs/mettle 0.0.0-beta.2-linux-arm64 → 0.0.0-beta.2

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 (62) hide show
  1. package/bin/mettle.js +53 -0
  2. package/bin/postinstall.js +28 -0
  3. package/package.json +19 -13
  4. package/THIRD_PARTY_NOTICES.md +0 -11974
  5. package/bin/mettle +0 -4
  6. package/harness/audit-investigation.mjs +0 -203
  7. package/harness/chunk-1sygmp11.mjs +0 -18142
  8. package/harness/chunk-1ykxpmaz.mjs +0 -7887
  9. package/harness/chunk-2pm2sayw.mjs +0 -248
  10. package/harness/chunk-3m7jn5ac.mjs +0 -16242
  11. package/harness/chunk-3wt8a8fq.mjs +0 -1716
  12. package/harness/chunk-3wvjs93w.mjs +0 -538
  13. package/harness/chunk-49ytr8d5.mjs +0 -33761
  14. package/harness/chunk-4bepyxmq.mjs +0 -113
  15. package/harness/chunk-4vx34w5h.mjs +0 -2357
  16. package/harness/chunk-50sbrf09.mjs +0 -18972
  17. package/harness/chunk-56csr8sw.mjs +0 -322
  18. package/harness/chunk-5wgmv4np.mjs +0 -585
  19. package/harness/chunk-65eyq32y.mjs +0 -225
  20. package/harness/chunk-6fnh6qhk.mjs +0 -195
  21. package/harness/chunk-6kgqw9ny.mjs +0 -32303
  22. package/harness/chunk-7b242j0n.mjs +0 -14
  23. package/harness/chunk-9dg1btk1.mjs +0 -2818
  24. package/harness/chunk-ageqxj9v.mjs +0 -63008
  25. package/harness/chunk-b0qbt5jd.mjs +0 -14
  26. package/harness/chunk-b5g1r3fz.mjs +0 -4785
  27. package/harness/chunk-b71gpkxg.mjs +0 -1514
  28. package/harness/chunk-bdv1rx4a.mjs +0 -20364
  29. package/harness/chunk-c1631s2x.mjs +0 -12241
  30. package/harness/chunk-c7dx5mdd.mjs +0 -10807
  31. package/harness/chunk-d5xgxsnp.mjs +0 -74
  32. package/harness/chunk-erg1fbh0.mjs +0 -0
  33. package/harness/chunk-fh78v9vn.mjs +0 -19366
  34. package/harness/chunk-fjx29qvp.mjs +0 -50
  35. package/harness/chunk-gryka6kg.mjs +0 -39
  36. package/harness/chunk-h1td5kq9.mjs +0 -422
  37. package/harness/chunk-jb0r19et.mjs +0 -180
  38. package/harness/chunk-jp69h6sj.mjs +0 -95
  39. package/harness/chunk-mfn574ss.mjs +0 -179
  40. package/harness/chunk-nz5sv9as.mjs +0 -1642
  41. package/harness/chunk-p9d3cgvq.mjs +0 -452
  42. package/harness/chunk-pq6wvwxr.mjs +0 -12
  43. package/harness/chunk-qcm9arf8.mjs +0 -7736
  44. package/harness/chunk-qr8zfqjd.mjs +0 -24
  45. package/harness/chunk-rd80vvc5.mjs +0 -22047
  46. package/harness/chunk-rz2tz6jp.mjs +0 -26
  47. package/harness/chunk-sbkgc3kn.mjs +0 -8
  48. package/harness/chunk-v66qvpnb.mjs +0 -169
  49. package/harness/chunk-vjaxzab3.mjs +0 -136
  50. package/harness/chunk-vr1n5nza.mjs +0 -1045
  51. package/harness/chunk-vsf2zajv.mjs +0 -3867
  52. package/harness/chunk-w0qwc5z2.mjs +0 -41
  53. package/harness/chunk-wq253fj4.mjs +0 -19041
  54. package/harness/chunk-wyv7ceq4.mjs +0 -0
  55. package/harness/chunk-xnqknk2r.mjs +0 -198
  56. package/harness/chunk-z6n9thea.mjs +0 -45146
  57. package/harness/chunk-zty0d3bw.mjs +0 -0
  58. package/harness/chunk-zvkxtj82.mjs +0 -42
  59. package/harness/issue-api-token.mjs +0 -35
  60. package/harness/launcher.mjs +0 -459
  61. package/harness/sandbox.mjs +0 -133
  62. package/harness/server.mjs +0 -87314
@@ -1,133 +0,0 @@
1
- import {
2
- HarnessError,
3
- publicError,
4
- FIXTURE_TARGET,
5
- fixtureConfig
6
- } from "./chunk-rd80vvc5.mjs";
7
- import {
8
- ToolExecutor,
9
- SandboxProbeJournal,
10
- SandboxJournal,
11
- reapSandboxes
12
- } from "./chunk-h1td5kq9.mjs";
13
- import {
14
- sandboxRuntime,
15
- PROBE_TOOL
16
- } from "./chunk-c7dx5mdd.mjs";
17
- import"./chunk-zvkxtj82.mjs";
18
- import {
19
- ToolRegistry,
20
- DockerEngine,
21
- sandboxConfig,
22
- checkSandbox,
23
- SandboxWorker
24
- } from "./chunk-9dg1btk1.mjs";
25
- import {
26
- databaseConfig
27
- } from "./chunk-w0qwc5z2.mjs";
28
- import {
29
- uuid
30
- } from "./chunk-1sygmp11.mjs";
31
-
32
- // apps/harness/src/sandbox/probe.ts
33
- import { randomUUID } from "node:crypto";
34
- async function sandboxProbe(args) {
35
- const [command, argument] = args;
36
- if (!["check", "run", "cleanup", "reap"].includes(command ?? "") || args.length !== (command === "cleanup" ? 2 : 1) || command === "cleanup" && !uuid().safeParse(argument).success)
37
- throw new HarnessError("sandbox_command", "Use sandbox check, run, reap, or cleanup <runId>.");
38
- const config = sandboxConfig();
39
- const engine = new DockerEngine(config.socket);
40
- if (command === "check") {
41
- const workerId = await checkSandbox(config, engine);
42
- console.log(JSON.stringify({
43
- configured: true,
44
- runtime: sandboxRuntime(config),
45
- workerId,
46
- image: config.image,
47
- executed: false,
48
- productionApproved: false
49
- }));
50
- return;
51
- }
52
- const journal = new SandboxProbeJournal(databaseConfig());
53
- const controller = new AbortController;
54
- let lease;
55
- let heartbeat;
56
- let heartbeatTask;
57
- const stop = () => controller.abort();
58
- process.on("SIGINT", stop);
59
- process.on("SIGTERM", stop);
60
- try {
61
- if (command === "reap") {
62
- const report = await reapSandboxes(config, engine, journal, controller.signal);
63
- console.log(JSON.stringify(report));
64
- if (report.interrupted || report.outcomes.some((outcome) => outcome.status === "blocked"))
65
- process.exitCode = 1;
66
- return;
67
- }
68
- if (command === "run")
69
- await checkSandbox(config, engine);
70
- const runId = argument ?? randomUUID();
71
- if (command === "run")
72
- await journal.createRun(runId, FIXTURE_TARGET, fixtureConfig());
73
- lease = await journal.acquire(runId);
74
- const owned = lease;
75
- heartbeat = setInterval(() => {
76
- if (heartbeatTask)
77
- return;
78
- heartbeatTask = journal.heartbeat(owned).then(async () => {
79
- if ((await journal.read(runId)).stopRequested)
80
- controller.abort();
81
- }).catch(() => controller.abort()).finally(() => {
82
- heartbeatTask = undefined;
83
- });
84
- }, 1000);
85
- const worker = new SandboxWorker(config, engine, new SandboxJournal(journal, lease));
86
- if (command === "cleanup") {
87
- const removed = await worker.reap();
88
- console.log(JSON.stringify({
89
- runId,
90
- removed,
91
- actionReplayed: false,
92
- actionReconciled: false
93
- }));
94
- return;
95
- }
96
- console.log(JSON.stringify({
97
- runId,
98
- diagnostic: "offline-sandbox-probe",
99
- providerCalls: 0
100
- }));
101
- const callId = "sandbox-probe-1";
102
- await journal.beginModel(lease, "sandbox-diagnostic", {
103
- diagnostic: "offline-sandbox-probe"
104
- });
105
- await journal.completeModel(lease, "sandbox-diagnostic", {
106
- tool_calls: [{ id: callId, name: PROBE_TOOL, args: {} }]
107
- });
108
- const executor = new ToolExecutor(journal, lease, controller.signal, new ToolRegistry([worker.tool()]));
109
- const result = JSON.parse(await executor.execute(callId, PROBE_TOOL, {}));
110
- await journal.finish(lease, "completed");
111
- console.log(JSON.stringify({ runId, ...result, productionApproved: false }));
112
- } finally {
113
- controller.abort();
114
- if (heartbeat)
115
- clearInterval(heartbeat);
116
- await heartbeatTask;
117
- if (lease)
118
- await journal.release(lease).catch(() => {
119
- return;
120
- });
121
- await journal.close();
122
- process.off("SIGINT", stop);
123
- process.off("SIGTERM", stop);
124
- }
125
- }
126
-
127
- // apps/harness/scripts/sandbox.ts
128
- try {
129
- await sandboxProbe(process.argv.slice(2));
130
- } catch (error) {
131
- console.error(publicError(error));
132
- process.exitCode = 1;
133
- }