@clawops/cli 1.7.9 → 2.0.1

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 (98) hide show
  1. package/README.md +504 -76
  2. package/dist/apply-KYFPWI5U.js +27 -0
  3. package/dist/automation-RMAIBNVC.js +44 -0
  4. package/dist/bedrock-XVASJX2K.js +61 -0
  5. package/dist/{bootstrap-HL4DNUNG.js → bootstrap-HNGKY6WW.js} +31 -19
  6. package/dist/bootstrap.sh.tmpl +51 -31
  7. package/dist/channels-KBUR42IU.js +53 -0
  8. package/dist/chunk-2I7KCMXZ.js +142 -0
  9. package/dist/{chunk-DQDAWNGB.js → chunk-2Z7J3ERQ.js} +1 -1
  10. package/dist/chunk-3OLUJPCB.js +36 -0
  11. package/dist/chunk-5XT5IAJK.js +69 -0
  12. package/dist/chunk-AEEMRFZV.js +24 -0
  13. package/dist/chunk-BSLIYB5Q.js +106 -0
  14. package/dist/{chunk-3XK66DKK.js → chunk-E4NJSJ54.js} +57 -93
  15. package/dist/chunk-FEK7VJAY.js +16 -0
  16. package/dist/{chunk-UKTP332Z.js → chunk-GAZPPSKU.js} +6 -7
  17. package/dist/chunk-GIEVAGEK.js +126 -0
  18. package/dist/chunk-HSPHXG6W.js +67 -0
  19. package/dist/chunk-IVWP4QUJ.js +901 -0
  20. package/dist/{chunk-PVUVI35Y.js → chunk-JW5A7E3X.js} +5 -1
  21. package/dist/{chunk-GZN7PKP4.js → chunk-KC3GC3PE.js} +328 -121
  22. package/dist/chunk-LBE6COC4.js +244 -0
  23. package/dist/chunk-LEVIW2PV.js +890 -0
  24. package/dist/chunk-LT4XMO5D.js +50 -0
  25. package/dist/chunk-MC5ATCXS.js +108 -0
  26. package/dist/chunk-N4WZLWJ4.js +16 -0
  27. package/dist/chunk-NUDIHZEH.js +55 -0
  28. package/dist/chunk-NUL5F6YV.js +56 -0
  29. package/dist/chunk-RHOWYIWT.js +52 -0
  30. package/dist/chunk-STLRHLLV.js +193 -0
  31. package/dist/chunk-V25QRZRB.js +45 -0
  32. package/dist/chunk-VOEJYRIK.js +33 -0
  33. package/dist/{providers-2OABPW2E.js → chunk-VUFMZEIM.js} +3 -2
  34. package/dist/chunk-W3OLNNJW.js +51 -0
  35. package/dist/cli-WLD3EBEM.js +11 -0
  36. package/dist/cli-auth-GD5SK7JU.js +13 -0
  37. package/dist/cli.js +1296 -695
  38. package/dist/config-validate-K2N6XLDX.js +76 -0
  39. package/dist/context-7EVC6W45.js +20 -0
  40. package/dist/docker-3PDO4TS7.js +12 -0
  41. package/dist/{firewall-XQGO7HWK.js → firewall-5VKZ4WBH.js} +32 -1
  42. package/dist/generate-I6YQ5V2T.js +29 -0
  43. package/dist/{harden-URPXLSVF.js → harden-72JMRT4E.js} +51 -11
  44. package/dist/health-5CCOXYGG.js +11 -0
  45. package/dist/index.d.ts +56 -0
  46. package/dist/known-hosts-file-I3Q3NBYQ.js +22 -0
  47. package/dist/logs-5A7YYA53.js +15 -0
  48. package/dist/{mcp-wire-7E5JQY47.js → mcp-wire-3SWBM7D6.js} +32 -16
  49. package/dist/models-AGTQWYDL.js +32 -0
  50. package/dist/network-args-PYJRJBYO.js +64 -0
  51. package/dist/{package-5AR4ZPK4.js → package-5BCMEBTE.js} +11 -4
  52. package/dist/passphrase-MJBE45N7.js +15 -0
  53. package/dist/plugins-DTST3OER.js +49 -0
  54. package/dist/{pool-QGFQRMGU.js → pool-PIIKJ4L2.js} +3 -2
  55. package/dist/preflight-EF52S3WW.js +162 -0
  56. package/dist/preflight-MWWM5JT3.js +181 -0
  57. package/dist/preflight-TFD4N5ZU.js +141 -0
  58. package/dist/privileged-JFA6LLTV.js +17 -0
  59. package/dist/providers-FW6H6OPF.js +11 -0
  60. package/dist/ready-KDNRBNSU.js +95 -0
  61. package/dist/{remote-config-QDLN4UMG.js → remote-config-3HZLUWEA.js} +4 -3
  62. package/dist/runtime-X3KW5TCP.js +44 -0
  63. package/dist/server-GBA7BJGK.js +46 -0
  64. package/dist/spec-path-KQOOIQCA.js +9 -0
  65. package/dist/ssh-VAI5DU5M.js +11 -0
  66. package/dist/ssh-key-DUO6OKOI.js +7 -0
  67. package/dist/stack-config-R4SPSUQZ.js +12 -0
  68. package/dist/upgrade-ULD4KFYC.js +88 -0
  69. package/dist/validate-YVI3BJ55.js +14 -0
  70. package/dist/{version-guard-VUCNZXQS.js → version-guard-XVYW5WFJ.js} +2 -2
  71. package/dist/{versions-2UVAT6PQ.js → versions-W5LRQCAJ.js} +2 -2
  72. package/dist/wait-WO72TRRQ.js +79 -0
  73. package/package.json +11 -4
  74. package/spec/deploy-plan.schema.json +114 -25
  75. package/spec/integrations.yaml +135 -28
  76. package/spec/mcp-tools.yaml +89 -37
  77. package/spec/models.yaml +23 -3
  78. package/spec/openclaw-2.0.config.schema.json +1 -0
  79. package/spec/openclaw-versions.yaml +116 -27
  80. package/spec/providers.schema.json +163 -28
  81. package/dist/apply-F3KY2HTB.js +0 -17
  82. package/dist/automation-RULUSJBW.js +0 -30
  83. package/dist/aws-L4RR2LSE.js +0 -254
  84. package/dist/azure-7OXQENQL.js +0 -262
  85. package/dist/chunk-35WVQY3X.js +0 -122
  86. package/dist/chunk-6X45DDGH.js +0 -42
  87. package/dist/chunk-A4QR4TXW.js +0 -120
  88. package/dist/chunk-C5X375RO.js +0 -85
  89. package/dist/chunk-FNS56UQY.js +0 -741
  90. package/dist/chunk-P5LKWRPL.js +0 -114
  91. package/dist/chunk-SEZMVVAS.js +0 -156
  92. package/dist/context-5LCUG2QR.js +0 -10
  93. package/dist/gcp-UG6AWPIZ.js +0 -193
  94. package/dist/generate-OAGYT3VH.js +0 -15
  95. package/dist/local-DXBEVZ5C.js +0 -47
  96. package/dist/server-FIZCOLHL.js +0 -32
  97. package/dist/ssh-CNJNLM3E.js +0 -8
  98. package/dist/validate-CFQ4FH2T.js +0 -10
@@ -1,114 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- readLocalState
4
- } from "./chunk-A2I76FTA.js";
5
- import {
6
- getConfigDir,
7
- requireConfig
8
- } from "./chunk-CX5SL5HP.js";
9
- import {
10
- UsageError
11
- } from "./chunk-KGXPLI7W.js";
12
-
13
- // src/cli/context.ts
14
- function buildContext(args) {
15
- const config = requireConfig();
16
- const stackName = typeof args.stack === "string" ? args.stack : config.defaults.stack;
17
- const providerName = typeof args.provider === "string" ? args.provider : config.stacks[stackName]?.provider ?? config.defaults.provider;
18
- const adapter = loadProvider(providerName);
19
- const localState = providerName === "local" ? readLocalState(stackName) : void 0;
20
- let stackCache = null;
21
- return {
22
- config,
23
- adapter,
24
- stackName,
25
- localState,
26
- async getStack() {
27
- if (providerName === "local") {
28
- throw new UsageError(
29
- "The local provider does not use Pulumi stacks. Use `clawops up` to bootstrap the host instead."
30
- );
31
- }
32
- if (stackCache) return stackCache;
33
- const stackConfig = config.stacks[stackName];
34
- if (!stackConfig) {
35
- throw new UsageError(
36
- `Stack "${stackName}" not found in config. Run \`clawops init\` or use \`--stack\` to specify a different stack.`
37
- );
38
- }
39
- const { getOrCreateStack } = await import("./automation-RULUSJBW.js");
40
- stackCache = await getOrCreateStack({
41
- stack: stackName,
42
- stateUrl: stackConfig.stateUrl,
43
- program: adapter.program,
44
- configDir: getConfigDir()
45
- });
46
- return stackCache;
47
- }
48
- };
49
- }
50
- function loadProvider(name) {
51
- return makeProviderProxy(name);
52
- }
53
- function makeProviderProxy(name) {
54
- let resolved = null;
55
- const resolve = async () => {
56
- if (resolved) return resolved;
57
- switch (name) {
58
- case "gcp": {
59
- const mod = await import("./gcp-UG6AWPIZ.js");
60
- resolved = mod.default;
61
- return resolved;
62
- }
63
- case "aws": {
64
- const mod = await import("./aws-L4RR2LSE.js");
65
- resolved = mod.default;
66
- return resolved;
67
- }
68
- case "azure": {
69
- const mod = await import("./azure-7OXQENQL.js");
70
- resolved = mod.default;
71
- return resolved;
72
- }
73
- case "local": {
74
- const mod = await import("./local-DXBEVZ5C.js");
75
- resolved = mod.default;
76
- return resolved;
77
- }
78
- default:
79
- throw new UsageError(
80
- `Provider "${name}" is not yet supported. Supported providers: gcp, aws, azure, local`
81
- );
82
- }
83
- };
84
- return {
85
- name,
86
- get program() {
87
- return async () => {
88
- const adapter = await resolve();
89
- return adapter.program();
90
- };
91
- },
92
- getConnectionInfo: (outputs) => {
93
- if (!resolved) throw new UsageError("Provider not yet loaded. Call getStack() first.");
94
- return resolved.getConnectionInfo(outputs);
95
- },
96
- normalizeInstanceType: (alias) => {
97
- if (!resolved) throw new UsageError("Provider not yet loaded. Call getStack() first.");
98
- return resolved.normalizeInstanceType(alias);
99
- },
100
- defaultRegion: () => {
101
- if (!resolved) throw new UsageError("Provider not yet loaded. Call getStack() first.");
102
- return resolved.defaultRegion();
103
- },
104
- stateBackendUrl: (bucket) => {
105
- if (!resolved) throw new UsageError("Provider not yet loaded. Call getStack() first.");
106
- return resolved.stateBackendUrl(bucket);
107
- },
108
- validateConfig: () => resolve().then((a) => a.validateConfig())
109
- };
110
- }
111
-
112
- export {
113
- buildContext
114
- };
@@ -1,156 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- err,
4
- ok
5
- } from "./chunk-EI7CQQ7D.js";
6
-
7
- // src/openclaw/run-flags.ts
8
- var CONFIG_MOUNT_PATH = "/app/config.json";
9
- var GATEWAY_PORT = 18789;
10
- var CONFIG_PATH_ENV = `-e OPENCLAW_CONFIG_PATH=${CONFIG_MOUNT_PATH}`;
11
- var ADD_HOST_FLAG = "--add-host=host.docker.internal:host-gateway";
12
- var PORT_PIN = `--port ${GATEWAY_PORT}`;
13
- var COMMON_RUN_FLAGS = `${CONFIG_PATH_ENV} ${ADD_HOST_FLAG}`;
14
- var ENV_FILE_PATH = "/home/clawops/openclaw.env";
15
- var IMAGE_INSPECT_CMD = `docker inspect openclaw --format '{{.Config.Image}}'`;
16
- function imageForRestart(inspectStdout) {
17
- const image = inspectStdout.trim();
18
- if (!image || image.includes("Error") || !image.includes(":")) {
19
- return err(
20
- "No running OpenClaw container found, so there is no image version to reuse. Deploy one with `clawops up --openclaw-version <version>`. clawops does not fall back to `latest` or `stable` here: both now point at OpenClaw 2.0, which this release line does not support."
21
- );
22
- }
23
- return ok(image);
24
- }
25
- function versionOf(image) {
26
- return image.split(":")[1] ?? "unknown";
27
- }
28
- function gatewayRunCommand(opts) {
29
- const { image, configPath, envFilePath = ENV_FILE_PATH, pathPrefix = "" } = opts;
30
- const envFileArg = `$([ -s ${envFilePath} ] && echo --env-file ${envFilePath})`;
31
- return pathPrefix + [
32
- "docker stop openclaw 2>/dev/null || true",
33
- "docker rm openclaw 2>/dev/null || true",
34
- `docker run -d --name openclaw --restart unless-stopped -p ${GATEWAY_PORT}:${GATEWAY_PORT} ${COMMON_RUN_FLAGS} ${envFileArg} -v ${configPath}:${CONFIG_MOUNT_PATH}:ro ${image} node openclaw.mjs gateway run --allow-unconfigured ${PORT_PIN}`
35
- ].join(" && ");
36
- }
37
-
38
- // src/plan/remote-config.ts
39
- var OPENCLAW_CONFIG_LINUX = "/home/clawops/openclaw.json";
40
- var OPENCLAW_CONFIG_MACOS = "~/.config/openclaw/config.json";
41
- var OPENCLAW_CONFIG = OPENCLAW_CONFIG_LINUX;
42
- var OPENCLAW_TMP = "/tmp/clawops-config.json.tmp";
43
- async function detectOS(session, signal) {
44
- const result = await session.exec("uname -s", signal);
45
- return result.stdout.trim() === "Darwin" ? "Darwin" : "Linux";
46
- }
47
- function configPathForOS(os) {
48
- return os === "Darwin" ? OPENCLAW_CONFIG_MACOS : OPENCLAW_CONFIG_LINUX;
49
- }
50
- async function execWithFallbackSudo(session, cmd, signal) {
51
- const result = await session.exec(cmd, signal);
52
- if (result.code === 0) return result;
53
- return session.exec(`sudo -n bash -c "${cmd}"`, signal);
54
- }
55
- async function readRemoteConfig(session, signal) {
56
- const os = await detectOS(session, signal);
57
- const configPath = configPathForOS(os);
58
- const result = os === "Darwin" ? await session.exec(`cat ${configPath}`, signal) : await execWithFallbackSudo(session, `cat ${configPath}`, signal);
59
- if (result.code !== 0) {
60
- throw new Error(`Cannot read ${configPath}: ${result.stderr}`);
61
- }
62
- try {
63
- return JSON.parse(result.stdout);
64
- } catch {
65
- throw new Error(`Cannot parse ${configPath}: invalid JSON`);
66
- }
67
- }
68
- function normaliseGatewayPort(cfg) {
69
- const gateway = cfg["gateway"];
70
- if (!gateway || typeof gateway !== "object" || Array.isArray(gateway)) return void 0;
71
- const g = gateway;
72
- const current = g["port"];
73
- if (typeof current === "number" && current !== GATEWAY_PORT) {
74
- g["port"] = GATEWAY_PORT;
75
- return current;
76
- }
77
- if (current === void 0) g["port"] = GATEWAY_PORT;
78
- return void 0;
79
- }
80
- async function atomicWriteConfig(session, cfg, signal) {
81
- const os = await detectOS(session, signal);
82
- const configPath = configPathForOS(os);
83
- const json = JSON.stringify(cfg, null, 2);
84
- const b64 = Buffer.from(json, "utf-8").toString("base64");
85
- const chown = os === "Linux" ? ` && chown clawops:clawops ${configPath}` : "";
86
- const cmd = `echo '${b64}' | base64 -d > ${OPENCLAW_TMP} && mv ${OPENCLAW_TMP} ${configPath}` + chown;
87
- const result = os === "Darwin" ? await session.exec(cmd, signal) : await execWithFallbackSudo(session, cmd, signal);
88
- if (result.code !== 0) {
89
- throw new Error(`Failed to write config: ${result.stderr}`);
90
- }
91
- }
92
- async function restartGateway(session, signal) {
93
- const os = await detectOS(session, signal);
94
- const configPath = configPathForOS(os);
95
- const pathPrefix = os === "Darwin" ? 'export PATH="/usr/local/bin:/opt/homebrew/bin:/Applications/Docker.app/Contents/Resources/bin:$PATH" && ' : "";
96
- const imgCmd = `${pathPrefix}${IMAGE_INSPECT_CMD}`;
97
- const imgResult = os === "Darwin" ? await session.exec(imgCmd, signal) : await execWithFallbackSudo(session, imgCmd, signal);
98
- const resolved = imageForRestart(imgResult.stdout);
99
- if (!resolved.ok) throw new Error(resolved.error);
100
- const image = resolved.value;
101
- const restartCmd = gatewayRunCommand({
102
- image,
103
- configPath,
104
- pathPrefix
105
- });
106
- const result = os === "Darwin" ? await session.exec(restartCmd, signal) : await execWithFallbackSudo(session, restartCmd, signal);
107
- if (result.code !== 0) {
108
- throw new Error(`Gateway restart failed: ${result.stderr}`);
109
- }
110
- const healthy = await waitForGateway(session, pathPrefix, signal);
111
- if (!healthy) {
112
- throw new Error(
113
- `Gateway restarted but did not become healthy on port ${GATEWAY_PORT}. The previous container has already been replaced; inspect it with \`docker logs openclaw\`. If the newly-applied config is at fault, revert it and restart \u2014 before v1.7.2 this config was never applied, so a value that has sat unused may now be taking effect.`
114
- );
115
- }
116
- }
117
- async function waitForGateway(session, pathPrefix, signal, attempts = 15) {
118
- const probe = `${pathPrefix}curl -fsS -m 3 http://127.0.0.1:${GATEWAY_PORT}/healthz >/dev/null 2>&1 && echo ok || echo waiting`;
119
- for (let i = 0; i < attempts; i++) {
120
- if (signal?.aborted) return false;
121
- const r = await session.exec(probe, signal);
122
- if (r.stdout.trim().endsWith("ok")) return true;
123
- await new Promise((resolve) => setTimeout(resolve, 2e3));
124
- }
125
- return false;
126
- }
127
- function deepMerge(base, overlay) {
128
- const result = { ...base };
129
- for (const [key, val] of Object.entries(overlay)) {
130
- if (val !== null && typeof val === "object" && !Array.isArray(val) && typeof result[key] === "object" && result[key] !== null && !Array.isArray(result[key])) {
131
- result[key] = deepMerge(
132
- result[key],
133
- val
134
- );
135
- } else {
136
- result[key] = val;
137
- }
138
- }
139
- return result;
140
- }
141
-
142
- export {
143
- IMAGE_INSPECT_CMD,
144
- imageForRestart,
145
- versionOf,
146
- gatewayRunCommand,
147
- OPENCLAW_CONFIG_LINUX,
148
- OPENCLAW_CONFIG_MACOS,
149
- OPENCLAW_CONFIG,
150
- OPENCLAW_TMP,
151
- readRemoteConfig,
152
- normaliseGatewayPort,
153
- atomicWriteConfig,
154
- restartGateway,
155
- deepMerge
156
- };
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- buildContext
4
- } from "./chunk-P5LKWRPL.js";
5
- import "./chunk-A2I76FTA.js";
6
- import "./chunk-CX5SL5HP.js";
7
- import "./chunk-KGXPLI7W.js";
8
- export {
9
- buildContext
10
- };
@@ -1,193 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- makeStartupScript
4
- } from "./chunk-C5X375RO.js";
5
-
6
- // src/providers/gcp/index.ts
7
- import process2 from "process";
8
-
9
- // src/providers/gcp/program.ts
10
- var GATEWAY_PORT = 18789;
11
- var SSH_PORT = 22;
12
- var gcpProgram = async () => {
13
- const [pulumi, gcp, { resolveIngressCidrs, detectEgressIp }] = await Promise.all([
14
- import("@pulumi/pulumi"),
15
- import("@pulumi/gcp"),
16
- import("./firewall-XQGO7HWK.js")
17
- ]);
18
- const cfg = new pulumi.Config();
19
- const instanceType = cfg.get("instanceType") ?? "e2-standard-2";
20
- const region = cfg.get("region") ?? "us-central1";
21
- const openclawVersion = cfg.get("openclawVersion") ?? "latest";
22
- const zone = cfg.get("zone") ?? `${region}-a`;
23
- const accessMode = cfg.get("accessMode") ?? "restricted";
24
- const allowedCidrs = cfg.get("allowedCidrs") ?? "";
25
- const sshCidrs = cfg.get("sshCidrs") ?? "";
26
- const gatewayCidrs = cfg.get("gatewayCidrs") ?? "";
27
- const sshPublicKey = cfg.get("sshPublicKey");
28
- if (!sshPublicKey) {
29
- throw new Error(
30
- 'Stack config "sshPublicKey" is required for the GCP adapter. Set it with: pulumi config set --stack <name> sshPublicKey "ssh-ed25519 ..."'
31
- );
32
- }
33
- const egressResult = accessMode === "auto" ? await detectEgressIp("https://ifconfig.me") : { ok: true, ip: "" };
34
- if (accessMode === "open") {
35
- process.stderr.write(
36
- "[clawops] WARNING: accessMode=open allows 0.0.0.0/0 on SSH and gateway ports. Only use this for development/sandbox stacks.\n"
37
- );
38
- }
39
- const sshIngressCidrs = resolveIngressCidrs(accessMode, allowedCidrs, sshCidrs, egressResult);
40
- const gatewayIngressCidrs = resolveIngressCidrs(accessMode, allowedCidrs, gatewayCidrs, egressResult);
41
- const network = new gcp.compute.Network("clawops-network", {
42
- autoCreateSubnetworks: false,
43
- description: "clawops managed network"
44
- });
45
- const subnet = new gcp.compute.Subnetwork("clawops-subnet", {
46
- ipCidrRange: "10.0.0.0/24",
47
- region,
48
- network: network.selfLink
49
- });
50
- if (sshIngressCidrs.length > 0) {
51
- new gcp.compute.Firewall("clawops-firewall-ssh", {
52
- network: network.selfLink,
53
- allows: [{ protocol: "tcp", ports: [String(SSH_PORT)] }],
54
- sourceRanges: sshIngressCidrs,
55
- targetTags: ["clawops"]
56
- });
57
- }
58
- if (gatewayIngressCidrs.length > 0) {
59
- new gcp.compute.Firewall("clawops-firewall-gateway", {
60
- network: network.selfLink,
61
- allows: [{ protocol: "tcp", ports: [String(GATEWAY_PORT)] }],
62
- sourceRanges: gatewayIngressCidrs,
63
- targetTags: ["clawops"]
64
- });
65
- }
66
- const address = new gcp.compute.Address("clawops-address", { region });
67
- const instance = new gcp.compute.Instance("clawops-instance", {
68
- machineType: instanceType,
69
- zone,
70
- tags: ["clawops"],
71
- bootDisk: {
72
- initializeParams: {
73
- image: "debian-cloud/debian-12",
74
- size: 20
75
- }
76
- },
77
- networkInterfaces: [
78
- {
79
- network: network.selfLink,
80
- subnetwork: subnet.selfLink,
81
- accessConfigs: [
82
- {
83
- natIp: address.address,
84
- networkTier: "PREMIUM"
85
- }
86
- ]
87
- }
88
- ],
89
- metadata: {
90
- // GCP guest agent reads 'ssh-keys' and populates /home/<user>/.ssh/authorized_keys
91
- "ssh-keys": `clawops:${sshPublicKey}`,
92
- "startup-script": makeStartupScript({ openclawVersion, os: "debian" })
93
- },
94
- serviceAccount: {
95
- scopes: ["https://www.googleapis.com/auth/cloud-platform"]
96
- }
97
- });
98
- return {
99
- instanceId: instance.id,
100
- publicIp: address.address,
101
- gatewayUrl: pulumi.interpolate`https://${address.address}:${GATEWAY_PORT}`,
102
- sshHost: address.address,
103
- sshPort: SSH_PORT,
104
- sshUser: "clawops",
105
- region,
106
- provisionedAt: (/* @__PURE__ */ new Date()).toISOString()
107
- };
108
- };
109
-
110
- // src/providers/gcp/index.ts
111
- var INSTANCE_TYPE_MAP = {
112
- micro: "e2-micro",
113
- small: "e2-standard-2",
114
- medium: "e2-standard-4",
115
- large: "e2-standard-8",
116
- gpu: "n1-standard-4"
117
- // TODO M3: add accelerator config for GPU instances
118
- };
119
- var gcpAdapter = {
120
- name: "gcp",
121
- get program() {
122
- return gcpProgram;
123
- },
124
- getConnectionInfo(outputs) {
125
- return {
126
- host: String(outputs["sshHost"] ?? ""),
127
- port: Number(outputs["sshPort"] ?? 22),
128
- user: String(outputs["sshUser"] ?? "clawops"),
129
- privateKeyPath: String(outputs["privateKeyPath"] ?? ""),
130
- knownHostsPath: String(outputs["knownHostsPath"] ?? "")
131
- };
132
- },
133
- normalizeInstanceType(alias) {
134
- if (alias === "gpu") {
135
- throw new Error(
136
- "GPU instances are not yet supported on GCP. Use --provider aws (g4dn.xlarge) or --provider azure (Standard_NC6s_v3) for GPU workloads."
137
- );
138
- }
139
- const mapped = INSTANCE_TYPE_MAP[alias];
140
- if (!mapped) throw new Error(`Unknown instance alias: ${alias}`);
141
- return mapped;
142
- },
143
- defaultRegion() {
144
- return "us-central1";
145
- },
146
- stateBackendUrl(bucket) {
147
- return `gs://${bucket}`;
148
- },
149
- async validateConfig() {
150
- const errors = [];
151
- const hasKeyFile = Boolean(process2.env["GOOGLE_APPLICATION_CREDENTIALS"]);
152
- const hasToken = Boolean(process2.env["GOOGLE_OAUTH_ACCESS_TOKEN"]);
153
- const hasAdcFile = await checkAdcFile();
154
- if (!hasKeyFile && !hasToken && !hasAdcFile) {
155
- const onGcp = await checkInstanceMetadata();
156
- if (!onGcp) {
157
- errors.push(
158
- "No GCP credentials found. Set GOOGLE_APPLICATION_CREDENTIALS to a service account key file, or run `gcloud auth application-default login`."
159
- );
160
- }
161
- }
162
- return { ok: errors.length === 0, errors };
163
- }
164
- };
165
- async function checkAdcFile() {
166
- try {
167
- const { accessSync } = await import("fs");
168
- const { join } = await import("path");
169
- const home = process2.env["HOME"] ?? process2.env["USERPROFILE"] ?? "";
170
- accessSync(join(home, ".config", "gcloud", "application_default_credentials.json"));
171
- return true;
172
- } catch {
173
- return false;
174
- }
175
- }
176
- async function checkInstanceMetadata() {
177
- try {
178
- const res = await fetch(
179
- "http://metadata.google.internal/computeMetadata/v1/instance/id",
180
- {
181
- headers: { "Metadata-Flavor": "Google" },
182
- signal: AbortSignal.timeout(1e3)
183
- }
184
- );
185
- return res.ok;
186
- } catch {
187
- return false;
188
- }
189
- }
190
- var gcp_default = gcpAdapter;
191
- export {
192
- gcp_default as default
193
- };
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- generatePlan,
4
- planId
5
- } from "./chunk-A4QR4TXW.js";
6
- import "./chunk-6X45DDGH.js";
7
- import "./chunk-P5LKWRPL.js";
8
- import "./chunk-PVUVI35Y.js";
9
- import "./chunk-A2I76FTA.js";
10
- import "./chunk-CX5SL5HP.js";
11
- import "./chunk-KGXPLI7W.js";
12
- export {
13
- generatePlan,
14
- planId
15
- };
@@ -1,47 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/providers/local/index.ts
4
- import { accessSync } from "fs";
5
- var localAdapter = {
6
- name: "local",
7
- /** Never called — local stacks bypass Pulumi entirely. */
8
- get program() {
9
- return async () => ({});
10
- },
11
- getConnectionInfo(outputs) {
12
- return {
13
- host: String(outputs["sshHost"] ?? ""),
14
- port: Number(outputs["sshPort"] ?? 22),
15
- user: String(outputs["sshUser"] ?? "root"),
16
- privateKeyPath: String(outputs["privateKeyPath"] ?? ""),
17
- knownHostsPath: String(outputs["knownHostsPath"] ?? "")
18
- };
19
- },
20
- normalizeInstanceType(_alias) {
21
- return "local";
22
- },
23
- defaultRegion() {
24
- return "local";
25
- },
26
- stateBackendUrl(_bucket) {
27
- return "file://~/.clawops/state";
28
- },
29
- async validateConfig() {
30
- const keyPath = process.env["CLAWOPS_SSH_KEY_PATH"];
31
- if (keyPath) {
32
- try {
33
- accessSync(keyPath);
34
- } catch {
35
- return {
36
- ok: false,
37
- errors: [`SSH key not readable: ${keyPath}`]
38
- };
39
- }
40
- }
41
- return { ok: true, errors: [] };
42
- }
43
- };
44
- var local_default = localAdapter;
45
- export {
46
- local_default as default
47
- };
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- MCP_HTTP_PORT,
4
- authRequirement,
5
- bearerFrom,
6
- isLoopbackBind,
7
- serveMcp
8
- } from "./chunk-GZN7PKP4.js";
9
- import "./chunk-35WVQY3X.js";
10
- import "./chunk-6ZFIFDBJ.js";
11
- import "./chunk-BOPSG2LI.js";
12
- import "./chunk-3QJBNAHW.js";
13
- import "./chunk-A4QR4TXW.js";
14
- import "./chunk-6X45DDGH.js";
15
- import "./chunk-FNS56UQY.js";
16
- import "./chunk-DQDAWNGB.js";
17
- import "./chunk-SEZMVVAS.js";
18
- import "./chunk-P5LKWRPL.js";
19
- import "./chunk-EI7CQQ7D.js";
20
- import "./chunk-PVUVI35Y.js";
21
- import "./chunk-3XK66DKK.js";
22
- import "./chunk-Q7NQY5HV.js";
23
- import "./chunk-A2I76FTA.js";
24
- import "./chunk-CX5SL5HP.js";
25
- import "./chunk-KGXPLI7W.js";
26
- export {
27
- MCP_HTTP_PORT,
28
- authRequirement,
29
- bearerFrom,
30
- isLoopbackBind,
31
- serveMcp
32
- };
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- connect
4
- } from "./chunk-3XK66DKK.js";
5
- import "./chunk-KGXPLI7W.js";
6
- export {
7
- connect
8
- };
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- assertValidPlan,
4
- validatePlan
5
- } from "./chunk-6X45DDGH.js";
6
- import "./chunk-PVUVI35Y.js";
7
- export {
8
- assertValidPlan,
9
- validatePlan
10
- };