@hasna/machines 0.0.48 → 0.0.49
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.
- package/README.md +19 -0
- package/dist/agent/index.js +34 -12
- package/dist/cli/index.js +504 -387
- package/dist/commands/mutation-approval.d.ts +11 -0
- package/dist/commands/runtime.d.ts +1 -0
- package/dist/consumer.js +0 -81
- package/dist/index.d.ts +57 -29
- package/dist/index.js +9202 -25314
- package/dist/mcp/index.js +120 -22
- package/dist/remote-storage.d.ts +5 -1
- package/dist/sdk-mutations.d.ts +54 -0
- package/dist/storage.d.ts +18 -3
- package/dist/storage.js +392 -92
- package/dist/types.d.ts +7 -0
- package/package.json +1 -1
package/dist/mcp/index.js
CHANGED
|
@@ -4637,6 +4637,15 @@ var TOKEN_PREFIX = "machines-mut-v1";
|
|
|
4637
4637
|
var DEFAULT_TOKEN_TTL_MS = 5 * 60 * 1000;
|
|
4638
4638
|
var MAX_TOKEN_TTL_MS = 5 * 60 * 1000;
|
|
4639
4639
|
var MAX_CLOCK_SKEW_MS = 30000;
|
|
4640
|
+
var trustedSdkMutationApprovals = new WeakSet;
|
|
4641
|
+
function createTrustedSdkMutationApproval() {
|
|
4642
|
+
const approval = {};
|
|
4643
|
+
trustedSdkMutationApprovals.add(approval);
|
|
4644
|
+
return approval;
|
|
4645
|
+
}
|
|
4646
|
+
function isTrustedSdkMutationApproval(approval) {
|
|
4647
|
+
return typeof approval === "object" && approval !== null && trustedSdkMutationApprovals.has(approval);
|
|
4648
|
+
}
|
|
4640
4649
|
function isTruthy(value) {
|
|
4641
4650
|
return value === "1" || value?.toLowerCase() === "true" || value?.toLowerCase() === "yes";
|
|
4642
4651
|
}
|
|
@@ -4881,6 +4890,26 @@ function assertMutationApproved(options) {
|
|
|
4881
4890
|
const approvalHint = options.surface === "mcp" ? `pass a scoped approval_token signed with ${MUTATION_APPROVAL_TOKEN_ENV}` : tokenConfigured ? `pass a scoped approval_token signed with ${MUTATION_APPROVAL_TOKEN_ENV} or set ${MUTATION_APPROVAL_FLAG_ENV}=1 for a trusted local session` : `set ${MUTATION_APPROVAL_FLAG_ENV}=1 for a trusted local session or configure ${MUTATION_APPROVAL_TOKEN_ENV}`;
|
|
4882
4891
|
throw new Error(`Fleet mutation blocked: ${options.surface}.${options.operation} requires operator approval; ${approvalHint}.`);
|
|
4883
4892
|
}
|
|
4893
|
+
function assertSdkMutationApproved(scope, options = {}) {
|
|
4894
|
+
if (isTrustedSdkMutationApproval(options.trustedLocalMutation))
|
|
4895
|
+
return;
|
|
4896
|
+
const decision = verifyMutationApprovalToken({
|
|
4897
|
+
surface: "sdk",
|
|
4898
|
+
operation: scope.operation,
|
|
4899
|
+
machineId: scope.machineId,
|
|
4900
|
+
resourceId: scope.resourceId,
|
|
4901
|
+
callerId: options.callerId,
|
|
4902
|
+
runId: options.runId,
|
|
4903
|
+
transport: "sdk",
|
|
4904
|
+
args: scope.args,
|
|
4905
|
+
argsSha256: scope.argsSha256,
|
|
4906
|
+
approvalToken: options.approvalToken,
|
|
4907
|
+
env: process.env
|
|
4908
|
+
});
|
|
4909
|
+
if (decision.approved)
|
|
4910
|
+
return;
|
|
4911
|
+
throw new Error(`Fleet mutation blocked: sdk.${scope.operation} requires a scoped SDK approval token.`);
|
|
4912
|
+
}
|
|
4884
4913
|
|
|
4885
4914
|
// src/remote.ts
|
|
4886
4915
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
@@ -7554,6 +7583,8 @@ var PG_MIGRATIONS = [
|
|
|
7554
7583
|
|
|
7555
7584
|
// src/remote-storage.ts
|
|
7556
7585
|
import pg from "pg";
|
|
7586
|
+
var MACHINES_DATABASE_ALLOW_INSECURE_TLS_ENV = "HASNA_MACHINES_ALLOW_INSECURE_DATABASE_TLS";
|
|
7587
|
+
var MACHINES_DATABASE_SSL_REJECT_UNAUTHORIZED_ENV = "HASNA_MACHINES_DATABASE_SSL_REJECT_UNAUTHORIZED";
|
|
7557
7588
|
function translatePlaceholders(sql) {
|
|
7558
7589
|
let index = 0;
|
|
7559
7590
|
return sql.replace(/\?/g, () => `$${++index}`);
|
|
@@ -7562,7 +7593,18 @@ function normalizeParams(params) {
|
|
|
7562
7593
|
const flat = params.length === 1 && Array.isArray(params[0]) ? params[0] : params;
|
|
7563
7594
|
return flat.map((value) => value === undefined ? null : value);
|
|
7564
7595
|
}
|
|
7565
|
-
function
|
|
7596
|
+
function envFlag(env, name) {
|
|
7597
|
+
const value = env[name]?.trim().toLowerCase();
|
|
7598
|
+
return value === "1" || value === "true" || value === "yes" || value === "on";
|
|
7599
|
+
}
|
|
7600
|
+
function isLoopbackHost(hostname6) {
|
|
7601
|
+
const normalized = hostname6.replace(/^\[|\]$/g, "").toLowerCase();
|
|
7602
|
+
return normalized === "localhost" || normalized === "::1" || normalized === "0:0:0:0:0:0:0:1" || /^127(?:\.\d{1,3}){3}$/.test(normalized);
|
|
7603
|
+
}
|
|
7604
|
+
function allowsLocalInsecureTls(url, env) {
|
|
7605
|
+
return isLoopbackHost(url.hostname) && envFlag(env, MACHINES_DATABASE_ALLOW_INSECURE_TLS_ENV);
|
|
7606
|
+
}
|
|
7607
|
+
function sslConfigFor(connectionString, env = process.env) {
|
|
7566
7608
|
let url;
|
|
7567
7609
|
try {
|
|
7568
7610
|
url = new URL(connectionString);
|
|
@@ -7571,12 +7613,21 @@ function sslConfigFor(connectionString) {
|
|
|
7571
7613
|
}
|
|
7572
7614
|
const sslMode = url.searchParams.get("sslmode")?.toLowerCase();
|
|
7573
7615
|
const ssl = url.searchParams.get("ssl")?.toLowerCase();
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7616
|
+
const rejectUnauthorizedOverride = env[MACHINES_DATABASE_SSL_REJECT_UNAUTHORIZED_ENV]?.trim() === "0";
|
|
7617
|
+
if (sslMode === "disable" || ssl === "false") {
|
|
7618
|
+
if (allowsLocalInsecureTls(url, env))
|
|
7619
|
+
return;
|
|
7620
|
+
throw new Error(`Insecure PostgreSQL TLS mode is rejected for remote storage; use sslmode=require or set ${MACHINES_DATABASE_ALLOW_INSECURE_TLS_ENV}=1 only for loopback development databases.`);
|
|
7621
|
+
}
|
|
7622
|
+
if (sslMode === "no-verify" || rejectUnauthorizedOverride) {
|
|
7623
|
+
if (!allowsLocalInsecureTls(url, env)) {
|
|
7624
|
+
throw new Error(`PostgreSQL TLS certificate verification cannot be disabled for remote storage; set ${MACHINES_DATABASE_ALLOW_INSECURE_TLS_ENV}=1 only for loopback development databases.`);
|
|
7625
|
+
}
|
|
7577
7626
|
return { rejectUnauthorized: false };
|
|
7578
7627
|
}
|
|
7579
|
-
|
|
7628
|
+
if (sslMode || ssl === "true")
|
|
7629
|
+
return { rejectUnauthorized: true };
|
|
7630
|
+
return isLoopbackHost(url.hostname) ? undefined : { rejectUnauthorized: true };
|
|
7580
7631
|
}
|
|
7581
7632
|
|
|
7582
7633
|
class PgAdapterAsync {
|
|
@@ -8016,6 +8067,16 @@ function getStatus(options = {}) {
|
|
|
8016
8067
|
function check(id, status, summary, detail) {
|
|
8017
8068
|
return { id, status, summary, detail };
|
|
8018
8069
|
}
|
|
8070
|
+
function summarize(checks) {
|
|
8071
|
+
const counts = checks.reduce((acc, entry) => {
|
|
8072
|
+
acc[entry.status] += 1;
|
|
8073
|
+
return acc;
|
|
8074
|
+
}, { ok: 0, warn: 0, fail: 0 });
|
|
8075
|
+
return {
|
|
8076
|
+
overall: counts.fail > 0 ? "fail" : counts.warn > 0 ? "warn" : "ok",
|
|
8077
|
+
counts
|
|
8078
|
+
};
|
|
8079
|
+
}
|
|
8019
8080
|
function runSelfTest() {
|
|
8020
8081
|
const version = getPackageVersion();
|
|
8021
8082
|
const status = getStatus();
|
|
@@ -8027,19 +8088,21 @@ function runSelfTest() {
|
|
|
8027
8088
|
const apps = listApps(machineId);
|
|
8028
8089
|
const appsDiff = diffApps(machineId);
|
|
8029
8090
|
const cliPlan = buildClaudeInstallPlan(machineId);
|
|
8091
|
+
const checks = [
|
|
8092
|
+
check("package-version", version === "0.0.0" ? "fail" : "ok", "Package version resolves", version),
|
|
8093
|
+
check("status", "ok", "Status loads", JSON.stringify({ machines: status.manifestMachineCount, heartbeats: status.heartbeatCount })),
|
|
8094
|
+
check("doctor", doctor.checks.some((entry) => entry.status === "fail") ? "warn" : "ok", "Doctor completed", `${doctor.checks.length} checks`),
|
|
8095
|
+
check("serve-info", "ok", "Dashboard info renders", `${serveInfo.url} routes=${serveInfo.routes.length}`),
|
|
8096
|
+
check("dashboard-html", html.includes("Machines Dashboard") ? "ok" : "fail", "Dashboard HTML renders", html.slice(0, 80)),
|
|
8097
|
+
check("notifications", "ok", "Notifications config loads", `${notifications.channels.length} channels`),
|
|
8098
|
+
check("apps", "ok", "Apps manifest loads", `${apps.apps.length} apps`),
|
|
8099
|
+
check("apps-diff", appsDiff.missing.length === 0 ? "ok" : "warn", "Apps diff computed", `missing=${appsDiff.missing.length} installed=${appsDiff.installed.length}`),
|
|
8100
|
+
check("install-claude-plan", cliPlan.steps.length > 0 ? "ok" : "warn", "Install plan renders", `${cliPlan.steps.length} steps`)
|
|
8101
|
+
];
|
|
8030
8102
|
return {
|
|
8031
8103
|
machineId,
|
|
8032
|
-
checks
|
|
8033
|
-
|
|
8034
|
-
check("status", "ok", "Status loads", JSON.stringify({ machines: status.manifestMachineCount, heartbeats: status.heartbeatCount })),
|
|
8035
|
-
check("doctor", doctor.checks.some((entry) => entry.status === "fail") ? "warn" : "ok", "Doctor completed", `${doctor.checks.length} checks`),
|
|
8036
|
-
check("serve-info", "ok", "Dashboard info renders", `${serveInfo.url} routes=${serveInfo.routes.length}`),
|
|
8037
|
-
check("dashboard-html", html.includes("Machines Dashboard") ? "ok" : "fail", "Dashboard HTML renders", html.slice(0, 80)),
|
|
8038
|
-
check("notifications", "ok", "Notifications config loads", `${notifications.channels.length} channels`),
|
|
8039
|
-
check("apps", "ok", "Apps manifest loads", `${apps.apps.length} apps`),
|
|
8040
|
-
check("apps-diff", appsDiff.missing.length === 0 ? "ok" : "warn", "Apps diff computed", `missing=${appsDiff.missing.length} installed=${appsDiff.installed.length}`),
|
|
8041
|
-
check("install-claude-plan", cliPlan.steps.length > 0 ? "ok" : "warn", "Install plan renders", `${cliPlan.steps.length} steps`)
|
|
8042
|
-
]
|
|
8104
|
+
...summarize(checks),
|
|
8105
|
+
checks
|
|
8043
8106
|
};
|
|
8044
8107
|
}
|
|
8045
8108
|
|
|
@@ -8785,6 +8848,41 @@ function checkMachineCompatibility(options = {}) {
|
|
|
8785
8848
|
summary
|
|
8786
8849
|
};
|
|
8787
8850
|
}
|
|
8851
|
+
|
|
8852
|
+
// src/storage.ts
|
|
8853
|
+
function storageArgs(options = {}) {
|
|
8854
|
+
return {
|
|
8855
|
+
tables: options.tables?.length ? [...options.tables] : null
|
|
8856
|
+
};
|
|
8857
|
+
}
|
|
8858
|
+
function storageResourceId(operation, options = {}) {
|
|
8859
|
+
return `storage:${operation}:${mutationArgsSha256(storageArgs(options))}`;
|
|
8860
|
+
}
|
|
8861
|
+
async function storagePush2(options = {}) {
|
|
8862
|
+
assertSdkMutationApproved({
|
|
8863
|
+
operation: "machines_storage_push",
|
|
8864
|
+
resourceId: storageResourceId("push", options),
|
|
8865
|
+
args: storageArgs(options)
|
|
8866
|
+
}, options);
|
|
8867
|
+
return storagePush({ tables: options.tables });
|
|
8868
|
+
}
|
|
8869
|
+
async function storagePull2(options = {}) {
|
|
8870
|
+
assertSdkMutationApproved({
|
|
8871
|
+
operation: "machines_storage_pull",
|
|
8872
|
+
resourceId: storageResourceId("pull", options),
|
|
8873
|
+
args: storageArgs(options)
|
|
8874
|
+
}, options);
|
|
8875
|
+
return storagePull({ tables: options.tables });
|
|
8876
|
+
}
|
|
8877
|
+
async function storageSync2(options = {}) {
|
|
8878
|
+
assertSdkMutationApproved({
|
|
8879
|
+
operation: "machines_storage_sync",
|
|
8880
|
+
resourceId: storageResourceId("sync", options),
|
|
8881
|
+
args: storageArgs(options)
|
|
8882
|
+
}, options);
|
|
8883
|
+
return storageSync({ tables: options.tables });
|
|
8884
|
+
}
|
|
8885
|
+
|
|
8788
8886
|
// src/mcp/server.ts
|
|
8789
8887
|
function buildServer(version = getPackageVersion(), options = {}) {
|
|
8790
8888
|
return createMcpServer(version, options);
|
|
@@ -9236,17 +9334,17 @@ function createMcpServer(version, options = {}) {
|
|
|
9236
9334
|
server.tool("storage_push", "Push local machine runtime data to storage PostgreSQL.", { tables: exports_external.array(exports_external.string()).optional().describe("Optional table list to push"), approval_token: approvalTokenSchema }, async ({ tables, approval_token }) => {
|
|
9237
9335
|
const resolvedTables = resolveTables(tables);
|
|
9238
9336
|
requireMcpMutation("storage_push", approval_token, { resourceId: mutationResourceId("storage-push", resolvedTables.join(",")), args: { tables: resolvedTables } });
|
|
9239
|
-
return { content: [{ type: "text", text: JSON.stringify(await
|
|
9337
|
+
return { content: [{ type: "text", text: JSON.stringify(await storagePush2({ tables: resolvedTables, trustedLocalMutation: createTrustedSdkMutationApproval() }), null, 2) }] };
|
|
9240
9338
|
});
|
|
9241
9339
|
server.tool("storage_pull", "Pull machine runtime data from storage PostgreSQL to local SQLite.", { tables: exports_external.array(exports_external.string()).optional().describe("Optional table list to pull"), approval_token: approvalTokenSchema }, async ({ tables, approval_token }) => {
|
|
9242
9340
|
const resolvedTables = resolveTables(tables);
|
|
9243
9341
|
requireMcpMutation("storage_pull", approval_token, { resourceId: mutationResourceId("storage-pull", resolvedTables.join(",")), args: { tables: resolvedTables } });
|
|
9244
|
-
return { content: [{ type: "text", text: JSON.stringify(await
|
|
9342
|
+
return { content: [{ type: "text", text: JSON.stringify(await storagePull2({ tables: resolvedTables, trustedLocalMutation: createTrustedSdkMutationApproval() }), null, 2) }] };
|
|
9245
9343
|
});
|
|
9246
9344
|
server.tool("storage_sync", "Bidirectional machines storage sync: pull then push.", { tables: exports_external.array(exports_external.string()).optional().describe("Optional table list to sync"), approval_token: approvalTokenSchema }, async ({ tables, approval_token }) => {
|
|
9247
9345
|
const resolvedTables = resolveTables(tables);
|
|
9248
9346
|
requireMcpMutation("storage_sync", approval_token, { resourceId: mutationResourceId("storage-sync", resolvedTables.join(",")), args: { tables: resolvedTables } });
|
|
9249
|
-
return { content: [{ type: "text", text: JSON.stringify(await
|
|
9347
|
+
return { content: [{ type: "text", text: JSON.stringify(await storageSync2({ tables: resolvedTables, trustedLocalMutation: createTrustedSdkMutationApproval() }), null, 2) }] };
|
|
9250
9348
|
});
|
|
9251
9349
|
return server;
|
|
9252
9350
|
}
|
|
@@ -9284,12 +9382,12 @@ function parsePort(raw) {
|
|
|
9284
9382
|
function pathnameFromRequest(req) {
|
|
9285
9383
|
return new URL(req.url ?? "/", "http://127.0.0.1").pathname;
|
|
9286
9384
|
}
|
|
9287
|
-
function
|
|
9385
|
+
function isLoopbackHost2(host) {
|
|
9288
9386
|
const normalized = host.toLowerCase().replace(/^\[|\]$/g, "");
|
|
9289
9387
|
return normalized === "localhost" || normalized === "127.0.0.1" || normalized === "::1";
|
|
9290
9388
|
}
|
|
9291
9389
|
function resolveHttpSecurityConfig(env = process.env, host = "127.0.0.1") {
|
|
9292
|
-
const allowUnauthenticated = env.MACHINES_ALLOW_UNAUTHENTICATED === "1" &&
|
|
9390
|
+
const allowUnauthenticated = env.MACHINES_ALLOW_UNAUTHENTICATED === "1" && isLoopbackHost2(host);
|
|
9293
9391
|
const allowedOrigins = (env.MACHINES_HTTP_ALLOWED_ORIGINS ?? "").split(",").map((origin) => origin.trim()).filter(Boolean);
|
|
9294
9392
|
const maxBodyBytes = parsePositiveInteger(env.MACHINES_HTTP_MAX_BODY_BYTES, DEFAULT_MAX_BODY_BYTES);
|
|
9295
9393
|
return {
|
|
@@ -9327,7 +9425,7 @@ function isTrustedHttpOrigin(origin, host, allowedOrigins = []) {
|
|
|
9327
9425
|
} catch {
|
|
9328
9426
|
return false;
|
|
9329
9427
|
}
|
|
9330
|
-
return
|
|
9428
|
+
return isLoopbackHost2(host) && isLoopbackHost2(parsed.hostname);
|
|
9331
9429
|
}
|
|
9332
9430
|
function authorizeHttpOrigin(req, host, security) {
|
|
9333
9431
|
const origin = originValue(req);
|
package/dist/remote-storage.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare const MACHINES_DATABASE_ALLOW_INSECURE_TLS_ENV = "HASNA_MACHINES_ALLOW_INSECURE_DATABASE_TLS";
|
|
2
|
+
export declare const MACHINES_DATABASE_SSL_REJECT_UNAUTHORIZED_ENV = "HASNA_MACHINES_DATABASE_SSL_REJECT_UNAUTHORIZED";
|
|
3
|
+
type Env = Record<string, string | undefined>;
|
|
4
|
+
export declare function sslConfigFor(connectionString: string, env?: Env): {
|
|
2
5
|
rejectUnauthorized: boolean;
|
|
3
6
|
} | undefined;
|
|
4
7
|
export declare class PgAdapterAsync {
|
|
@@ -10,3 +13,4 @@ export declare class PgAdapterAsync {
|
|
|
10
13
|
all(sql: string, ...params: unknown[]): Promise<unknown[]>;
|
|
11
14
|
close(): Promise<void>;
|
|
12
15
|
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { MachineCommandRunner } from "./remote.js";
|
|
2
|
+
import type { DaemonServicePlan, DaemonServiceRunOptions, DaemonServiceRunResult } from "./commands/daemon.js";
|
|
3
|
+
import type { NotificationChannel, NotificationConfig, NotificationDispatchSummary, NotificationTestResult, SetupResult, SyncResult } from "./types.js";
|
|
4
|
+
import type { DomainMapping } from "./commands/dns.js";
|
|
5
|
+
import { type RunAppsInstallOptions } from "./commands/apps.js";
|
|
6
|
+
import { type RunClaudeInstallOptions } from "./commands/install-claude.js";
|
|
7
|
+
import { type RunSetupOptions } from "./commands/setup.js";
|
|
8
|
+
import { type RunSyncOptions } from "./commands/sync.js";
|
|
9
|
+
import { type RunTailscaleInstallOptions } from "./commands/install-tailscale.js";
|
|
10
|
+
import { type TrustedNotificationApproval } from "./commands/notifications.js";
|
|
11
|
+
import { type SdkMutationApprovalOptions } from "./commands/mutation-approval.js";
|
|
12
|
+
import type { FleetManifest, MachineManifest } from "./types.js";
|
|
13
|
+
type ApplyOptions = {
|
|
14
|
+
apply?: boolean;
|
|
15
|
+
yes?: boolean;
|
|
16
|
+
};
|
|
17
|
+
type SdkApplyOptions<T extends ApplyOptions> = T & SdkMutationApprovalOptions;
|
|
18
|
+
type NotificationSdkOptions = SdkMutationApprovalOptions & {
|
|
19
|
+
approvalToken?: string;
|
|
20
|
+
trustedApproval?: TrustedNotificationApproval;
|
|
21
|
+
};
|
|
22
|
+
type NotificationTestSdkOptions = NotificationSdkOptions & ApplyOptions;
|
|
23
|
+
export declare function manifestInit(options?: SdkMutationApprovalOptions): string;
|
|
24
|
+
export declare function manifestAdd(machine: MachineManifest, options?: SdkMutationApprovalOptions): FleetManifest;
|
|
25
|
+
export declare function manifestBootstrapCurrentMachine(options?: SdkMutationApprovalOptions): FleetManifest;
|
|
26
|
+
export declare function manifestRemove(machineId: string, options?: SdkMutationApprovalOptions): FleetManifest;
|
|
27
|
+
export declare function runSetup(machineId?: string, options?: SdkApplyOptions<RunSetupOptions>, runner?: MachineCommandRunner): SetupResult;
|
|
28
|
+
export declare function runSetupPlan(plan: SetupResult, options?: SdkApplyOptions<RunSetupOptions>, runner?: MachineCommandRunner): SetupResult;
|
|
29
|
+
export declare function runSync(machineId?: string, options?: SdkApplyOptions<RunSyncOptions>, runner?: MachineCommandRunner): SyncResult;
|
|
30
|
+
export declare function runSyncPlan(plan: SyncResult, options?: SdkApplyOptions<RunSyncOptions>, runner?: MachineCommandRunner): SyncResult;
|
|
31
|
+
export declare function runAppsInstall(machineId?: string, options?: SdkApplyOptions<RunAppsInstallOptions>, runner?: MachineCommandRunner): SetupResult;
|
|
32
|
+
export declare function runAppsPlan(plan: SetupResult, options?: SdkApplyOptions<RunAppsInstallOptions>, runner?: MachineCommandRunner): SetupResult;
|
|
33
|
+
export declare function runClaudeInstall(machineId?: string, tools?: string[], options?: SdkApplyOptions<RunClaudeInstallOptions>, runner?: MachineCommandRunner): SetupResult;
|
|
34
|
+
export declare function runClaudeInstallPlan(plan: SetupResult, options?: SdkApplyOptions<RunClaudeInstallOptions>, runner?: MachineCommandRunner): SetupResult;
|
|
35
|
+
export declare function runTailscaleInstall(machineId?: string, options?: SdkApplyOptions<RunTailscaleInstallOptions>, runner?: MachineCommandRunner): SetupResult;
|
|
36
|
+
export declare function runTailscaleInstallPlan(plan: SetupResult, options?: SdkApplyOptions<RunTailscaleInstallOptions>, runner?: MachineCommandRunner): SetupResult;
|
|
37
|
+
export declare function addDomainMapping(domain: string, port: number, targetHost?: string, options?: SdkMutationApprovalOptions): DomainMapping[];
|
|
38
|
+
export declare function runCertPlan(domains: string[], options?: SdkApplyOptions<{
|
|
39
|
+
apply?: boolean;
|
|
40
|
+
yes?: boolean;
|
|
41
|
+
}>): SetupResult;
|
|
42
|
+
export declare function runBackup(bucket?: string, prefix?: string, options?: SdkApplyOptions<{
|
|
43
|
+
apply?: boolean;
|
|
44
|
+
yes?: boolean;
|
|
45
|
+
}>): SetupResult;
|
|
46
|
+
export declare function runDaemonServicePlan(plan: DaemonServicePlan, options?: SdkApplyOptions<DaemonServiceRunOptions>): DaemonServiceRunResult;
|
|
47
|
+
export declare function writeNotificationConfig(config: NotificationConfig, pathOrOptions?: string | SdkMutationApprovalOptions, maybeOptions?: SdkMutationApprovalOptions): NotificationConfig;
|
|
48
|
+
export declare function addNotificationChannel(channel: NotificationChannel, options?: NotificationSdkOptions): NotificationConfig;
|
|
49
|
+
export declare function removeNotificationChannel(channelId: string, options?: SdkMutationApprovalOptions): NotificationConfig;
|
|
50
|
+
export declare function dispatchNotificationEvent(event: string, message: string, options?: NotificationSdkOptions & {
|
|
51
|
+
channelId?: string;
|
|
52
|
+
}): Promise<NotificationDispatchSummary>;
|
|
53
|
+
export declare function testNotificationChannel(channelId: string, event?: string, message?: string, options?: NotificationTestSdkOptions): Promise<NotificationTestResult>;
|
|
54
|
+
export {};
|
package/dist/storage.d.ts
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { MACHINES_STORAGE_ENV, MACHINES_STORAGE_FALLBACK_ENV, MACHINES_STORAGE_MODE_ENV, MACHINES_STORAGE_MODE_FALLBACK_ENV, MACHINES_STORAGE_TABLES, STORAGE_DATABASE_ENV, STORAGE_MODE_ENV, STORAGE_TABLES, getStorageDatabaseEnv, getStorageDatabaseEnvName, getStorageDatabaseUrl, getStorageMode, getStorageStatus, getSyncMetaAll, parseStorageTables, resolveTables } from "./storage-sync.js";
|
|
2
|
+
import { type SdkMutationApprovalOptions } from "./commands/mutation-approval.js";
|
|
3
|
+
import type { StorageEnv, StorageMode, StorageStatus, SyncMeta, SyncResult } from "./storage-sync.js";
|
|
4
|
+
export type StorageMutationOptions = SdkMutationApprovalOptions & {
|
|
5
|
+
tables?: string[];
|
|
6
|
+
};
|
|
7
|
+
export type StorageMigrationAdapter = {
|
|
8
|
+
run(sql: string, ...params: unknown[]): Promise<unknown>;
|
|
9
|
+
};
|
|
10
|
+
export declare function runStorageMigrations(remote: StorageMigrationAdapter, options?: SdkMutationApprovalOptions): Promise<void>;
|
|
11
|
+
export declare function storagePush(options?: StorageMutationOptions): Promise<SyncResult[]>;
|
|
12
|
+
export declare function storagePull(options?: StorageMutationOptions): Promise<SyncResult[]>;
|
|
13
|
+
export declare function storageSync(options?: StorageMutationOptions): Promise<{
|
|
14
|
+
pull: SyncResult[];
|
|
15
|
+
push: SyncResult[];
|
|
16
|
+
}>;
|
|
17
|
+
export { MACHINES_STORAGE_ENV, MACHINES_STORAGE_FALLBACK_ENV, MACHINES_STORAGE_MODE_ENV, MACHINES_STORAGE_MODE_FALLBACK_ENV, MACHINES_STORAGE_TABLES, STORAGE_DATABASE_ENV, STORAGE_MODE_ENV, STORAGE_TABLES, getStorageDatabaseEnv, getStorageDatabaseEnvName, getStorageDatabaseUrl, getStorageMode, getStorageStatus, getSyncMetaAll, parseStorageTables, resolveTables, };
|
|
18
|
+
export type { StorageEnv, StorageMode, StorageStatus, SyncMeta, SyncResult };
|
|
3
19
|
export { PG_MIGRATIONS } from "./pg-migrations.js";
|
|
4
|
-
export { PgAdapterAsync } from "./remote-storage.js";
|