@senpi-ai/runtime 1.0.76 → 1.0.78
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 +32 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -2
- package/dist/index.js.map +1 -1
- package/dist/runtime/auto-update/command-runner.d.ts +20 -0
- package/dist/runtime/auto-update/command-runner.d.ts.map +1 -0
- package/dist/runtime/auto-update/command-runner.js +54 -0
- package/dist/runtime/auto-update/command-runner.js.map +1 -0
- package/dist/runtime/auto-update/coordinator.d.ts +80 -0
- package/dist/runtime/auto-update/coordinator.d.ts.map +1 -0
- package/dist/runtime/auto-update/coordinator.js +290 -0
- package/dist/runtime/auto-update/coordinator.js.map +1 -0
- package/dist/runtime/auto-update/gateway-restart.d.ts +49 -0
- package/dist/runtime/auto-update/gateway-restart.d.ts.map +1 -0
- package/dist/runtime/auto-update/gateway-restart.js +105 -0
- package/dist/runtime/auto-update/gateway-restart.js.map +1 -0
- package/dist/runtime/auto-update/policy.d.ts +24 -0
- package/dist/runtime/auto-update/policy.d.ts.map +1 -0
- package/dist/runtime/auto-update/policy.js +42 -0
- package/dist/runtime/auto-update/policy.js.map +1 -0
- package/dist/runtime/auto-update/preflight.d.ts +16 -0
- package/dist/runtime/auto-update/preflight.d.ts.map +1 -0
- package/dist/runtime/auto-update/preflight.js +20 -0
- package/dist/runtime/auto-update/preflight.js.map +1 -0
- package/dist/runtime/auto-update/state-store.d.ts +20 -0
- package/dist/runtime/auto-update/state-store.d.ts.map +1 -0
- package/dist/runtime/auto-update/state-store.js +42 -0
- package/dist/runtime/auto-update/state-store.js.map +1 -0
- package/dist/runtime/auto-update/types.d.ts +108 -0
- package/dist/runtime/auto-update/types.d.ts.map +1 -0
- package/dist/runtime/auto-update/types.js +57 -0
- package/dist/runtime/auto-update/types.js.map +1 -0
- package/dist/runtime/auto-update/version-source.d.ts +18 -0
- package/dist/runtime/auto-update/version-source.d.ts.map +1 -0
- package/dist/runtime/auto-update/version-source.js +22 -0
- package/dist/runtime/auto-update/version-source.js.map +1 -0
- package/openclaw.plugin.json +47 -1
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { AUTO_UPDATE_STATE_FILE, createDefaultAutoUpdateState, } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Reads and writes {@link AutoUpdateState} to a JSON file in the plugin
|
|
6
|
+
* state directory so that deduplication counters and notification history
|
|
7
|
+
* survive gateway restarts.
|
|
8
|
+
*/
|
|
9
|
+
export class AutoUpdateStateStore {
|
|
10
|
+
stateDir;
|
|
11
|
+
filePath;
|
|
12
|
+
constructor(stateDir) {
|
|
13
|
+
this.stateDir = stateDir;
|
|
14
|
+
this.filePath = join(stateDir, AUTO_UPDATE_STATE_FILE);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Load persisted state, merging it with fresh defaults for the running
|
|
18
|
+
* version and effective mode. Returns defaults when the file is missing
|
|
19
|
+
* or cannot be parsed.
|
|
20
|
+
*/
|
|
21
|
+
async load(currentVersion, effectiveMode) {
|
|
22
|
+
try {
|
|
23
|
+
const raw = await readFile(this.filePath, "utf8");
|
|
24
|
+
const parsed = JSON.parse(raw);
|
|
25
|
+
return {
|
|
26
|
+
...createDefaultAutoUpdateState(currentVersion, effectiveMode),
|
|
27
|
+
...parsed,
|
|
28
|
+
currentVersionLastSeen: currentVersion,
|
|
29
|
+
effectiveMode,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return createDefaultAutoUpdateState(currentVersion, effectiveMode);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** Atomically write the state to disk, creating the directory if needed. */
|
|
37
|
+
async save(state) {
|
|
38
|
+
await mkdir(dirname(this.filePath), { recursive: true });
|
|
39
|
+
await writeFile(this.filePath, JSON.stringify(state, null, 2), "utf8");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=state-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-store.js","sourceRoot":"","sources":["../../../src/runtime/auto-update/state-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,sBAAsB,EACtB,4BAA4B,GAG7B,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,MAAM,OAAO,oBAAoB;IAGF;IAFZ,QAAQ,CAAS;IAElC,YAA6B,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;QAC3C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAI,CAAC,cAAsB,EAAE,aAA6B;QAC9D,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAClD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAA6B,CAAC;YAC3D,OAAO;gBACL,GAAG,4BAA4B,CAAC,cAAc,EAAE,aAAa,CAAC;gBAC9D,GAAG,MAAM;gBACT,sBAAsB,EAAE,cAAc;gBACtC,aAAa;aACd,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,4BAA4B,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;IAED,4EAA4E;IAC5E,KAAK,CAAC,IAAI,CAAC,KAAsB;QAC/B,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzD,MAAM,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACzE,CAAC;CACF"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/** Whether the updater installs updates automatically or only sends notifications. */
|
|
2
|
+
export type AutoUpdateMode = "notify-only" | "auto-apply";
|
|
3
|
+
/** Strategy for restarting the process after an update (currently unused -- restart is via config bump). */
|
|
4
|
+
export type AutoUpdateRestartStrategy = "manual" | "process-exit";
|
|
5
|
+
/** Classification of the semver distance between the current and latest version. */
|
|
6
|
+
export type AutoUpdateKind = "none" | "patch" | "minor" | "major";
|
|
7
|
+
/** Whether the gateway can be restarted automatically after an update. */
|
|
8
|
+
export type RestartCapability = "unknown" | "capable" | "not-capable";
|
|
9
|
+
/**
|
|
10
|
+
* Resolved auto-update configuration.
|
|
11
|
+
*
|
|
12
|
+
* Produced by {@link resolveAutoUpdateConfig} from the raw plugin config block.
|
|
13
|
+
* All fields have safe defaults so the block can be omitted entirely.
|
|
14
|
+
*/
|
|
15
|
+
export interface AutoUpdateConfig {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
mode: AutoUpdateMode;
|
|
18
|
+
pollIntervalMinutes: number;
|
|
19
|
+
startupDelaySeconds: number;
|
|
20
|
+
allowPatch: boolean;
|
|
21
|
+
allowMinor: boolean;
|
|
22
|
+
/** Hard policy: always `false`. Major versions require manual update. */
|
|
23
|
+
allowMajor: boolean;
|
|
24
|
+
restartStrategy: AutoUpdateRestartStrategy;
|
|
25
|
+
failureBackoffMinutes: number;
|
|
26
|
+
maxBackoffMinutes: number;
|
|
27
|
+
/** Internal key written by the auto-updater to trigger gateway restart via config reload. */
|
|
28
|
+
lastRestartTrigger?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Persistent state tracked across auto-update poll cycles.
|
|
32
|
+
*
|
|
33
|
+
* Serialised to {@link AUTO_UPDATE_STATE_FILE} in the plugin state directory
|
|
34
|
+
* so that deduplication (e.g. "already notified for this major") survives restarts.
|
|
35
|
+
*/
|
|
36
|
+
export interface AutoUpdateState {
|
|
37
|
+
currentVersionLastSeen: string;
|
|
38
|
+
latestVersionLastSeen: string;
|
|
39
|
+
lastAppliedVersion?: string;
|
|
40
|
+
lastCheckedAt: string;
|
|
41
|
+
lastAttemptAt?: string;
|
|
42
|
+
lastSuccessAt?: string;
|
|
43
|
+
lastFailureAt?: string;
|
|
44
|
+
lastFailureReason?: string;
|
|
45
|
+
lastNotifiedMajorVersion?: string;
|
|
46
|
+
lastNotifiedUpdateVersion?: string;
|
|
47
|
+
consecutiveFailures: number;
|
|
48
|
+
effectiveMode: AutoUpdateMode;
|
|
49
|
+
restartCapability: RestartCapability;
|
|
50
|
+
restartCapabilityReasons: string[];
|
|
51
|
+
restartCapabilityMode?: string;
|
|
52
|
+
lastRestartTriggerAt?: string;
|
|
53
|
+
lastRestartTriggerMode?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Result of the preflight environment check performed before the first poll.
|
|
57
|
+
*
|
|
58
|
+
* The preflight may downgrade {@link AutoUpdateConfig.mode} if the runtime
|
|
59
|
+
* environment cannot execute plugin updates (e.g. missing CLI).
|
|
60
|
+
*/
|
|
61
|
+
export interface AutoUpdatePreflightResult {
|
|
62
|
+
ok: boolean;
|
|
63
|
+
effectiveMode: AutoUpdateMode;
|
|
64
|
+
reasons: string[];
|
|
65
|
+
}
|
|
66
|
+
/** Aggregate health of the auto-update subsystem, surfaced via gateway RPCs. */
|
|
67
|
+
export type AutoUpdateHealth = "healthy" | "degraded" | "unhealthy" | "disabled";
|
|
68
|
+
/**
|
|
69
|
+
* Point-in-time snapshot of the auto-update subsystem exposed through
|
|
70
|
+
* the `senpi.getHealthStatus` and `senpi.getSystemState` gateway RPCs.
|
|
71
|
+
*/
|
|
72
|
+
export interface AutoUpdateSnapshot {
|
|
73
|
+
enabled: boolean;
|
|
74
|
+
configuredMode: AutoUpdateMode;
|
|
75
|
+
effectiveMode: AutoUpdateMode;
|
|
76
|
+
health: AutoUpdateHealth;
|
|
77
|
+
currentVersion: string;
|
|
78
|
+
latestVersion: string;
|
|
79
|
+
lastCheckedAt: string | null;
|
|
80
|
+
lastAction: string;
|
|
81
|
+
lastError: string | null;
|
|
82
|
+
consecutiveFailures: number;
|
|
83
|
+
nextCheckAt: string | null;
|
|
84
|
+
preflightReasons: string[];
|
|
85
|
+
restartCapability: RestartCapability;
|
|
86
|
+
restartCapabilityReasons: string[];
|
|
87
|
+
lastRestartTriggerAt: string | null;
|
|
88
|
+
lastRestartTriggerMode: string | null;
|
|
89
|
+
}
|
|
90
|
+
/** Filename used by {@link AutoUpdateStateStore} for persistent state. */
|
|
91
|
+
export declare const AUTO_UPDATE_STATE_FILE = "auto-update-state.json";
|
|
92
|
+
/**
|
|
93
|
+
* Parse and normalise the raw `autoUpdate` config block from the plugin config.
|
|
94
|
+
*
|
|
95
|
+
* When the block is `undefined` (user omitted it), all defaults apply:
|
|
96
|
+
* enabled, auto-apply mode, 6-hour poll interval, 90-second startup delay.
|
|
97
|
+
* Numeric values are clamped to safe ranges. `allowMajor` is always forced to `false`.
|
|
98
|
+
*
|
|
99
|
+
* @param value - Raw `autoUpdate` value from the plugin config (may be undefined).
|
|
100
|
+
* @returns Fully resolved {@link AutoUpdateConfig} with safe defaults.
|
|
101
|
+
*/
|
|
102
|
+
export declare function resolveAutoUpdateConfig(value: unknown): AutoUpdateConfig;
|
|
103
|
+
/**
|
|
104
|
+
* Create a blank {@link AutoUpdateState} for a fresh install or when
|
|
105
|
+
* the persisted state file cannot be loaded.
|
|
106
|
+
*/
|
|
107
|
+
export declare function createDefaultAutoUpdateState(currentVersion: string, effectiveMode: AutoUpdateMode): AutoUpdateState;
|
|
108
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
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B,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAoBxE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,cAAc,GAC5B,eAAe,CAUjB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** Filename used by {@link AutoUpdateStateStore} for persistent state. */
|
|
2
|
+
export const AUTO_UPDATE_STATE_FILE = "auto-update-state.json";
|
|
3
|
+
function toBool(value, fallback) {
|
|
4
|
+
return typeof value === "boolean" ? value : fallback;
|
|
5
|
+
}
|
|
6
|
+
function toFinite(value, fallback) {
|
|
7
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
8
|
+
}
|
|
9
|
+
function clamp(value, min, max) {
|
|
10
|
+
return Math.min(max, Math.max(min, value));
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parse and normalise the raw `autoUpdate` config block from the plugin config.
|
|
14
|
+
*
|
|
15
|
+
* When the block is `undefined` (user omitted it), all defaults apply:
|
|
16
|
+
* enabled, auto-apply mode, 6-hour poll interval, 90-second startup delay.
|
|
17
|
+
* Numeric values are clamped to safe ranges. `allowMajor` is always forced to `false`.
|
|
18
|
+
*
|
|
19
|
+
* @param value - Raw `autoUpdate` value from the plugin config (may be undefined).
|
|
20
|
+
* @returns Fully resolved {@link AutoUpdateConfig} with safe defaults.
|
|
21
|
+
*/
|
|
22
|
+
export function resolveAutoUpdateConfig(value) {
|
|
23
|
+
const raw = value && typeof value === "object" && !Array.isArray(value)
|
|
24
|
+
? value
|
|
25
|
+
: {};
|
|
26
|
+
const mode = raw.mode === "notify-only" ? "notify-only" : "auto-apply";
|
|
27
|
+
return {
|
|
28
|
+
enabled: toBool(raw.enabled, true),
|
|
29
|
+
mode,
|
|
30
|
+
pollIntervalMinutes: clamp(toFinite(raw.pollIntervalMinutes, 360), 60, 24 * 60),
|
|
31
|
+
startupDelaySeconds: clamp(toFinite(raw.startupDelaySeconds, 90), 5, 15 * 60),
|
|
32
|
+
allowPatch: toBool(raw.allowPatch, true),
|
|
33
|
+
allowMinor: toBool(raw.allowMinor, true),
|
|
34
|
+
// Hard policy requirement.
|
|
35
|
+
allowMajor: false,
|
|
36
|
+
restartStrategy: raw.restartStrategy === "process-exit" ? "process-exit" : "manual",
|
|
37
|
+
failureBackoffMinutes: clamp(toFinite(raw.failureBackoffMinutes, 30), 1, 24 * 60),
|
|
38
|
+
maxBackoffMinutes: clamp(toFinite(raw.maxBackoffMinutes, 12 * 60), 5, 7 * 24 * 60),
|
|
39
|
+
lastRestartTrigger: typeof raw.lastRestartTrigger === "string" ? raw.lastRestartTrigger : undefined,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a blank {@link AutoUpdateState} for a fresh install or when
|
|
44
|
+
* the persisted state file cannot be loaded.
|
|
45
|
+
*/
|
|
46
|
+
export function createDefaultAutoUpdateState(currentVersion, effectiveMode) {
|
|
47
|
+
return {
|
|
48
|
+
currentVersionLastSeen: currentVersion,
|
|
49
|
+
latestVersionLastSeen: currentVersion,
|
|
50
|
+
lastCheckedAt: "",
|
|
51
|
+
consecutiveFailures: 0,
|
|
52
|
+
effectiveMode,
|
|
53
|
+
restartCapability: "unknown",
|
|
54
|
+
restartCapabilityReasons: [],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime/auto-update/types.ts"],"names":[],"mappings":"AAkGA,0EAA0E;AAC1E,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAE/D,SAAS,MAAM,CAAC,KAAc,EAAE,QAAiB;IAC/C,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AACvD,CAAC;AAED,SAAS,QAAQ,CAA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cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ;QACnF,qBAAqB,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,qBAAqB,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC;QACjF,iBAAiB,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;QAClF,kBAAkB,EAAE,OAAO,GAAG,CAAC,kBAAkB,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS;KACpG,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAC1C,cAAsB,EACtB,aAA6B;IAE7B,OAAO;QACL,sBAAsB,EAAE,cAAc;QACtC,qBAAqB,EAAE,cAAc;QACrC,aAAa,EAAE,EAAE;QACjB,mBAAmB,EAAE,CAAC;QACtB,aAAa;QACb,iBAAiB,EAAE,SAAS;QAC5B,wBAAwB,EAAE,EAAE;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstraction for fetching the latest published version of a package.
|
|
3
|
+
*
|
|
4
|
+
* The default implementation uses `npm view`; tests can substitute a
|
|
5
|
+
* stub that returns a fixed version string.
|
|
6
|
+
*/
|
|
7
|
+
export interface VersionSource {
|
|
8
|
+
getLatestVersion(packageName: string): Promise<string>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Fetches the latest version of a package from the npm registry
|
|
12
|
+
* by shelling out to `npm view <package> version`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class NpmVersionSource implements VersionSource {
|
|
15
|
+
/** @throws When the npm CLI exits non-zero or returns an empty string. */
|
|
16
|
+
getLatestVersion(packageName: string): Promise<string>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=version-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-source.d.ts","sourceRoot":"","sources":["../../../src/runtime/auto-update/version-source.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACxD;AAED;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,aAAa;IACpD,0EAA0E;IACpE,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAa7D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { runCommand } from "./command-runner.js";
|
|
2
|
+
/**
|
|
3
|
+
* Fetches the latest version of a package from the npm registry
|
|
4
|
+
* by shelling out to `npm view <package> version`.
|
|
5
|
+
*/
|
|
6
|
+
export class NpmVersionSource {
|
|
7
|
+
/** @throws When the npm CLI exits non-zero or returns an empty string. */
|
|
8
|
+
async getLatestVersion(packageName) {
|
|
9
|
+
const result = await runCommand("npm", ["view", packageName, "version"], {
|
|
10
|
+
timeoutMs: 20_000,
|
|
11
|
+
});
|
|
12
|
+
if (result.code !== 0) {
|
|
13
|
+
throw new Error(result.stderr || `npm view failed with code ${result.code}`);
|
|
14
|
+
}
|
|
15
|
+
const version = result.stdout.trim();
|
|
16
|
+
if (!version) {
|
|
17
|
+
throw new Error("npm view returned empty version");
|
|
18
|
+
}
|
|
19
|
+
return version;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=version-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-source.js","sourceRoot":"","sources":["../../../src/runtime/auto-update/version-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAYjD;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAC3B,0EAA0E;IAC1E,KAAK,CAAC,gBAAgB,CAAC,WAAmB;QACxC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE;YACvE,SAAS,EAAE,MAAM;SAClB,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,6BAA6B,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAC/E,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "runtime",
|
|
3
3
|
"name": "Senpi Runtime",
|
|
4
4
|
"description": "Senpi runtime plugin for OpenClaw",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.78",
|
|
6
6
|
"configSchema": {
|
|
7
7
|
"type": "object",
|
|
8
8
|
"additionalProperties": false,
|
|
@@ -14,6 +14,52 @@
|
|
|
14
14
|
"apiKey": {
|
|
15
15
|
"type": "string",
|
|
16
16
|
"description": "API key when mcpTransport is not provided by the gateway"
|
|
17
|
+
},
|
|
18
|
+
"autoUpdate": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"description": "Auto-update configuration. Enabled with auto-apply by default (opt-out). Omit this block entirely to use defaults.",
|
|
21
|
+
"properties": {
|
|
22
|
+
"enabled": {
|
|
23
|
+
"type": "boolean",
|
|
24
|
+
"description": "Enable or disable auto-update polling (default: true)"
|
|
25
|
+
},
|
|
26
|
+
"mode": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"enum": [
|
|
29
|
+
"auto-apply",
|
|
30
|
+
"notify-only"
|
|
31
|
+
],
|
|
32
|
+
"description": "auto-apply installs updates automatically; notify-only sends a Telegram notification (default: auto-apply)"
|
|
33
|
+
},
|
|
34
|
+
"pollIntervalMinutes": {
|
|
35
|
+
"type": "number",
|
|
36
|
+
"description": "Minutes between version checks (default: 360, range: 60-1440)"
|
|
37
|
+
},
|
|
38
|
+
"startupDelaySeconds": {
|
|
39
|
+
"type": "number",
|
|
40
|
+
"description": "Seconds to wait after plugin start before the first version check (default: 90, range: 5-900)"
|
|
41
|
+
},
|
|
42
|
+
"allowPatch": {
|
|
43
|
+
"type": "boolean",
|
|
44
|
+
"description": "Allow automatic patch version updates (default: true)"
|
|
45
|
+
},
|
|
46
|
+
"allowMinor": {
|
|
47
|
+
"type": "boolean",
|
|
48
|
+
"description": "Allow automatic minor version updates (default: true)"
|
|
49
|
+
},
|
|
50
|
+
"failureBackoffMinutes": {
|
|
51
|
+
"type": "number",
|
|
52
|
+
"description": "Minutes to wait after a failed check before retrying (default: 30, range: 1-1440)"
|
|
53
|
+
},
|
|
54
|
+
"maxBackoffMinutes": {
|
|
55
|
+
"type": "number",
|
|
56
|
+
"description": "Maximum backoff ceiling in minutes (default: 720, range: 5-10080)"
|
|
57
|
+
},
|
|
58
|
+
"lastRestartTrigger": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"description": "Internal: timestamp written by the auto-updater to trigger gateway restart via config reload. Do not set manually."
|
|
61
|
+
}
|
|
62
|
+
}
|
|
17
63
|
}
|
|
18
64
|
}
|
|
19
65
|
},
|