@moxxy/plugin-self-update 0.26.0
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/LICENSE +21 -0
- package/dist/classify.d.ts +33 -0
- package/dist/classify.d.ts.map +1 -0
- package/dist/classify.js +177 -0
- package/dist/classify.js.map +1 -0
- package/dist/core-tools/apply.d.ts +4 -0
- package/dist/core-tools/apply.d.ts.map +1 -0
- package/dist/core-tools/apply.js +43 -0
- package/dist/core-tools/apply.js.map +1 -0
- package/dist/core-tools/begin.d.ts +4 -0
- package/dist/core-tools/begin.d.ts.map +1 -0
- package/dist/core-tools/begin.js +76 -0
- package/dist/core-tools/begin.js.map +1 -0
- package/dist/core-tools/edit.d.ts +4 -0
- package/dist/core-tools/edit.d.ts.map +1 -0
- package/dist/core-tools/edit.js +33 -0
- package/dist/core-tools/edit.js.map +1 -0
- package/dist/core-tools/index.d.ts +11 -0
- package/dist/core-tools/index.d.ts.map +1 -0
- package/dist/core-tools/index.js +28 -0
- package/dist/core-tools/index.js.map +1 -0
- package/dist/core-tools/preflight.d.ts +4 -0
- package/dist/core-tools/preflight.d.ts.map +1 -0
- package/dist/core-tools/preflight.js +14 -0
- package/dist/core-tools/preflight.js.map +1 -0
- package/dist/core-tools/rollback.d.ts +4 -0
- package/dist/core-tools/rollback.d.ts.map +1 -0
- package/dist/core-tools/rollback.js +30 -0
- package/dist/core-tools/rollback.js.map +1 -0
- package/dist/core-tools/shared.d.ts +16 -0
- package/dist/core-tools/shared.d.ts.map +1 -0
- package/dist/core-tools/shared.js +12 -0
- package/dist/core-tools/shared.js.map +1 -0
- package/dist/core-tools/status.d.ts +4 -0
- package/dist/core-tools/status.d.ts.map +1 -0
- package/dist/core-tools/status.js +25 -0
- package/dist/core-tools/status.js.map +1 -0
- package/dist/core-tools/verify.d.ts +4 -0
- package/dist/core-tools/verify.d.ts.map +1 -0
- package/dist/core-tools/verify.js +39 -0
- package/dist/core-tools/verify.js.map +1 -0
- package/dist/core-tools/write.d.ts +4 -0
- package/dist/core-tools/write.d.ts.map +1 -0
- package/dist/core-tools/write.js +28 -0
- package/dist/core-tools/write.js.map +1 -0
- package/dist/core-update.d.ts +173 -0
- package/dist/core-update.d.ts.map +1 -0
- package/dist/core-update.js +626 -0
- package/dist/core-update.js.map +1 -0
- package/dist/deps.d.ts +49 -0
- package/dist/deps.d.ts.map +1 -0
- package/dist/deps.js +30 -0
- package/dist/deps.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +349 -0
- package/dist/index.js.map +1 -0
- package/dist/transaction.d.ts +80 -0
- package/dist/transaction.d.ts.map +1 -0
- package/dist/transaction.js +188 -0
- package/dist/transaction.js.map +1 -0
- package/dist/verify.d.ts +23 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +164 -0
- package/dist/verify.js.map +1 -0
- package/package.json +61 -0
- package/src/classify.test.ts +176 -0
- package/src/classify.ts +221 -0
- package/src/core-tools/apply.ts +44 -0
- package/src/core-tools/begin.ts +94 -0
- package/src/core-tools/edit.ts +33 -0
- package/src/core-tools/index.ts +33 -0
- package/src/core-tools/preflight.ts +15 -0
- package/src/core-tools/rollback.ts +30 -0
- package/src/core-tools/shared.test.ts +16 -0
- package/src/core-tools/shared.ts +24 -0
- package/src/core-tools/status.ts +26 -0
- package/src/core-tools/verify.ts +39 -0
- package/src/core-tools/write.ts +30 -0
- package/src/core-update.test.ts +542 -0
- package/src/core-update.ts +744 -0
- package/src/deps.ts +84 -0
- package/src/discovery.test.ts +40 -0
- package/src/index.test.ts +299 -0
- package/src/index.ts +441 -0
- package/src/transaction.test.ts +143 -0
- package/src/transaction.ts +254 -0
- package/src/verify.test.ts +82 -0
- package/src/verify.ts +200 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Moxxy (moxxy.ai)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { EventLogReader } from '@moxxy/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Request classification for self-update. The *signals* are gathered
|
|
4
|
+
* deterministically here; the *decision* is advisory — the orchestrating
|
|
5
|
+
* skill makes the final call. This keeps mechanical inspection in code and
|
|
6
|
+
* judgement in the prompt (mirroring how self-improver splits the two).
|
|
7
|
+
*/
|
|
8
|
+
export type Tier = 'skill' | 'plugin' | 'core';
|
|
9
|
+
export interface ClassifyInput {
|
|
10
|
+
readonly trigger: 'error' | 'request';
|
|
11
|
+
readonly text?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ClassifySignals {
|
|
14
|
+
readonly failedTools: ReadonlyArray<string>;
|
|
15
|
+
readonly errorMessages: ReadonlyArray<string>;
|
|
16
|
+
readonly registeredTools: ReadonlyArray<string>;
|
|
17
|
+
}
|
|
18
|
+
export interface ClassifyResult {
|
|
19
|
+
readonly tier: Tier;
|
|
20
|
+
readonly candidateName?: string;
|
|
21
|
+
readonly evidence: ReadonlyArray<string>;
|
|
22
|
+
readonly rationale: string;
|
|
23
|
+
}
|
|
24
|
+
/** Gather deterministic signals from the session event log. */
|
|
25
|
+
export declare function gatherSignals(log: EventLogReader, registeredTools: ReadonlyArray<string>, lookback?: number): ClassifySignals;
|
|
26
|
+
/** Suggest a kebab-case artifact name from free text. */
|
|
27
|
+
export declare function suggestName(text: string | undefined): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Decide the lowest-risk tier that can satisfy the request, plus the evidence
|
|
30
|
+
* behind that suggestion. Always advisory.
|
|
31
|
+
*/
|
|
32
|
+
export declare function classify(input: ClassifyInput, signals: ClassifySignals): ClassifyResult;
|
|
33
|
+
//# sourceMappingURL=classify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../src/classify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;GAKG;AAEH,MAAM,MAAM,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE/C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9C,QAAQ,CAAC,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACjD;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAsCD,+DAA+D;AAC/D,wBAAgB,aAAa,CAC3B,GAAG,EAAE,cAAc,EACnB,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,EACtC,QAAQ,SAAK,GACZ,eAAe,CAsBjB;AAUD,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CASxE;AAqBD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,GAAG,cAAc,CAmFvF"}
|
package/dist/classify.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
const CORE_HINTS = [
|
|
2
|
+
'@moxxy/core',
|
|
3
|
+
'packages/core',
|
|
4
|
+
'core/src',
|
|
5
|
+
'run-turn',
|
|
6
|
+
'session.ts',
|
|
7
|
+
'event log',
|
|
8
|
+
'new event type',
|
|
9
|
+
'loop strategy internals',
|
|
10
|
+
'registry internals',
|
|
11
|
+
];
|
|
12
|
+
const SKILL_HINTS = [
|
|
13
|
+
'always',
|
|
14
|
+
'whenever',
|
|
15
|
+
'every time',
|
|
16
|
+
'remember to',
|
|
17
|
+
'before you',
|
|
18
|
+
'workflow',
|
|
19
|
+
'procedure',
|
|
20
|
+
'instruction',
|
|
21
|
+
];
|
|
22
|
+
const PLUGIN_HINTS = [
|
|
23
|
+
'add a tool',
|
|
24
|
+
'new tool',
|
|
25
|
+
'integrate',
|
|
26
|
+
'integration',
|
|
27
|
+
'connect to',
|
|
28
|
+
'call the',
|
|
29
|
+
' api',
|
|
30
|
+
'command that',
|
|
31
|
+
'wrap',
|
|
32
|
+
'override',
|
|
33
|
+
];
|
|
34
|
+
/** Gather deterministic signals from the session event log. */
|
|
35
|
+
export function gatherSignals(log, registeredTools, lookback = 40) {
|
|
36
|
+
const callNames = new Map();
|
|
37
|
+
for (const e of log.ofType('tool_call_requested')) {
|
|
38
|
+
callNames.set(String(e.callId), e.name);
|
|
39
|
+
}
|
|
40
|
+
const recent = log.slice(Math.max(0, log.length - lookback));
|
|
41
|
+
const failedTools = new Set();
|
|
42
|
+
const errorMessages = [];
|
|
43
|
+
for (const e of recent) {
|
|
44
|
+
if (e.type === 'tool_result' && !e.ok) {
|
|
45
|
+
const name = callNames.get(String(e.callId));
|
|
46
|
+
if (name)
|
|
47
|
+
failedTools.add(name);
|
|
48
|
+
if (e.error?.message)
|
|
49
|
+
errorMessages.push(e.error.message);
|
|
50
|
+
}
|
|
51
|
+
else if (e.type === 'error') {
|
|
52
|
+
errorMessages.push(e.message);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
failedTools: [...failedTools],
|
|
57
|
+
errorMessages,
|
|
58
|
+
registeredTools,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function includesAny(haystack, needles) {
|
|
62
|
+
const lower = haystack.toLowerCase();
|
|
63
|
+
for (const n of needles) {
|
|
64
|
+
if (lower.includes(n))
|
|
65
|
+
return n;
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
/** Suggest a kebab-case artifact name from free text. */
|
|
70
|
+
export function suggestName(text) {
|
|
71
|
+
if (!text)
|
|
72
|
+
return undefined;
|
|
73
|
+
const words = text
|
|
74
|
+
.toLowerCase()
|
|
75
|
+
.replace(/[^a-z0-9\s-]/g, ' ')
|
|
76
|
+
.split(/\s+/)
|
|
77
|
+
.filter((w) => w.length > 2 && !STOP_WORDS.has(w))
|
|
78
|
+
.slice(0, 4);
|
|
79
|
+
return words.length > 0 ? words.join('-') : undefined;
|
|
80
|
+
}
|
|
81
|
+
const STOP_WORDS = new Set([
|
|
82
|
+
'the',
|
|
83
|
+
'and',
|
|
84
|
+
'for',
|
|
85
|
+
'add',
|
|
86
|
+
'can',
|
|
87
|
+
'you',
|
|
88
|
+
'please',
|
|
89
|
+
'that',
|
|
90
|
+
'this',
|
|
91
|
+
'with',
|
|
92
|
+
'make',
|
|
93
|
+
'create',
|
|
94
|
+
'want',
|
|
95
|
+
'would',
|
|
96
|
+
'like',
|
|
97
|
+
'your',
|
|
98
|
+
]);
|
|
99
|
+
/**
|
|
100
|
+
* Decide the lowest-risk tier that can satisfy the request, plus the evidence
|
|
101
|
+
* behind that suggestion. Always advisory.
|
|
102
|
+
*/
|
|
103
|
+
export function classify(input, signals) {
|
|
104
|
+
const evidence = [];
|
|
105
|
+
const blob = `${input.text ?? ''} ${signals.errorMessages.join(' ')}`;
|
|
106
|
+
const coreHit = includesAny(blob, CORE_HINTS);
|
|
107
|
+
if (coreHit) {
|
|
108
|
+
evidence.push(`mentions core internals ("${coreHit}")`);
|
|
109
|
+
return {
|
|
110
|
+
tier: 'core',
|
|
111
|
+
evidence,
|
|
112
|
+
rationale: 'The change appears to touch @moxxy/core internals — escalate to a Tier-2 core patch (build + overlay + restart). Confirm a plugin override cannot express it first.',
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// A referenced-but-unregistered capability ⇒ a new plugin/tool is needed.
|
|
116
|
+
const missing = signals.failedTools.filter((t) => !signals.registeredTools.includes(t));
|
|
117
|
+
if (missing.length > 0) {
|
|
118
|
+
evidence.push(`failed call to unregistered tool(s): ${missing.join(', ')}`);
|
|
119
|
+
return {
|
|
120
|
+
tier: 'plugin',
|
|
121
|
+
candidateName: suggestName(input.text) ?? missing[0],
|
|
122
|
+
evidence,
|
|
123
|
+
rationale: 'A capability is missing. Author a new plugin (or install a published one) that provides the tool, then hot-reload.',
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
// An existing tool misbehaved ⇒ usually instructions (skill) or a hook wrapper.
|
|
127
|
+
if (signals.failedTools.length > 0) {
|
|
128
|
+
evidence.push(`registered tool(s) misbehaved: ${signals.failedTools.join(', ')}`);
|
|
129
|
+
const pluginHit = includesAny(blob, PLUGIN_HINTS);
|
|
130
|
+
if (pluginHit) {
|
|
131
|
+
evidence.push(`request implies a behavior override ("${pluginHit}")`);
|
|
132
|
+
return {
|
|
133
|
+
tier: 'plugin',
|
|
134
|
+
candidateName: suggestName(input.text),
|
|
135
|
+
evidence,
|
|
136
|
+
rationale: 'An existing tool misbehaves and the fix is a behavior change — wrap it in a plugin (onToolResult / onToolCall) rather than editing core.',
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
tier: 'skill',
|
|
141
|
+
candidateName: suggestName(input.text),
|
|
142
|
+
evidence,
|
|
143
|
+
rationale: 'The tool exists but was used wrongly — a skill that encodes the correct procedure is the lowest-risk fix.',
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
// No error signal: classify the free-text request.
|
|
147
|
+
const skillHit = includesAny(blob, SKILL_HINTS);
|
|
148
|
+
const pluginHit = includesAny(blob, PLUGIN_HINTS);
|
|
149
|
+
if (pluginHit && !skillHit) {
|
|
150
|
+
evidence.push(`request implies a new capability ("${pluginHit}")`);
|
|
151
|
+
return {
|
|
152
|
+
tier: 'plugin',
|
|
153
|
+
candidateName: suggestName(input.text),
|
|
154
|
+
evidence,
|
|
155
|
+
rationale: 'The request asks for a new action/capability — author a plugin tool and hot-reload.',
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
if (skillHit) {
|
|
159
|
+
evidence.push(`request describes a procedure ("${skillHit}")`);
|
|
160
|
+
return {
|
|
161
|
+
tier: 'skill',
|
|
162
|
+
candidateName: suggestName(input.text),
|
|
163
|
+
evidence,
|
|
164
|
+
rationale: 'The request is a recurring procedure expressible with existing tools — author a skill.',
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
// Default for an unqualified "add XYZ": prefer a plugin (capability), the
|
|
168
|
+
// common case, but the skill should reconsider a skill if no code is needed.
|
|
169
|
+
evidence.push('no strong signal; defaulting to the plugin tier');
|
|
170
|
+
return {
|
|
171
|
+
tier: 'plugin',
|
|
172
|
+
candidateName: suggestName(input.text),
|
|
173
|
+
evidence,
|
|
174
|
+
rationale: 'Ambiguous request. Default to authoring a plugin; if the change needs no new code (only instructions), drop to the skill tier instead.',
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=classify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../src/classify.ts"],"names":[],"mappings":"AA6BA,MAAM,UAAU,GAAG;IACjB,aAAa;IACb,eAAe;IACf,UAAU;IACV,UAAU;IACV,YAAY;IACZ,WAAW;IACX,gBAAgB;IAChB,yBAAyB;IACzB,oBAAoB;CACrB,CAAC;AAEF,MAAM,WAAW,GAAG;IAClB,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,UAAU;IACV,WAAW;IACX,aAAa;CACd,CAAC;AAEF,MAAM,YAAY,GAAG;IACnB,YAAY;IACZ,UAAU;IACV,WAAW;IACX,aAAa;IACb,YAAY;IACZ,UAAU;IACV,MAAM;IACN,cAAc;IACd,MAAM;IACN,UAAU;CACX,CAAC;AAEF,+DAA+D;AAC/D,MAAM,UAAU,aAAa,CAC3B,GAAmB,EACnB,eAAsC,EACtC,QAAQ,GAAG,EAAE;IAEb,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE,CAAC;QAClD,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IACD,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAA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3B,QAAQ,CAAC,IAAI,CAAC,sCAAsC,SAAS,IAAI,CAAC,CAAC;QACnE,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;YACtC,QAAQ;YACR,SAAS,EAAE,qFAAqF;SACjG,CAAC;IACJ,CAAC;IACD,IAAI,QAAQ,EAAE,CAAC;QACb,QAAQ,CAAC,IAAI,CAAC,mCAAmC,QAAQ,IAAI,CAAC,CAAC;QAC/D,OAAO;YACL,IAAI,EAAE,OAAO;YACb,aAAa,EAAE,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;YACtC,QAAQ;YACR,SAAS,EAAE,wFAAwF;SACpG,CAAC;IACJ,CAAC;IAED,0EAA0E;IAC1E,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;IACjE,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,aAAa,EAAE,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;QACtC,QAAQ;QACR,SAAS,EACP,wIAAwI;KAC3I,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/core-tools/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAG3E,OAAO,EAA4B,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAG1E,wBAAgB,aAAa,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAqCvD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineTool, z } from '@moxxy/sdk';
|
|
2
|
+
import { overlayPackages, readCoreJournal, restoreOverlay, writeCoreJournal } from '../core-update.js';
|
|
3
|
+
import { emitSafe } from '../deps.js';
|
|
4
|
+
import { resolveCore, snapshotDir } from './shared.js';
|
|
5
|
+
// ── self_update_core_apply ──────────────────────────────────────────────────
|
|
6
|
+
export function coreApplyTool(cd) {
|
|
7
|
+
const { deps } = cd;
|
|
8
|
+
return defineTool({
|
|
9
|
+
name: 'self_update_core_apply',
|
|
10
|
+
description: 'Overlay the verified build into the live global install (snapshotting the previous dist for rollback) and stage a restart. The new core code only activates after moxxy restarts. Requires a prior successful self_update_core_verify.',
|
|
11
|
+
inputSchema: z.object({ coreTxnId: z.string().min(1) }),
|
|
12
|
+
permission: { action: 'prompt' },
|
|
13
|
+
handler: async (input, ctx) => {
|
|
14
|
+
const journal = await readCoreJournal(deps.moxxyDir, input.coreTxnId);
|
|
15
|
+
if (journal.state !== 'verified') {
|
|
16
|
+
throw new Error(`core txn ${input.coreTxnId} is "${journal.state}", not "verified" — run self_update_core_verify first`);
|
|
17
|
+
}
|
|
18
|
+
const install = resolveCore(cd);
|
|
19
|
+
if (!install)
|
|
20
|
+
throw new Error('could not resolve @moxxy/core');
|
|
21
|
+
const res = await overlayPackages({
|
|
22
|
+
repo: journal.repoDir,
|
|
23
|
+
install,
|
|
24
|
+
pkgNames: journal.packages,
|
|
25
|
+
snapshotDir: snapshotDir(deps.moxxyDir, input.coreTxnId),
|
|
26
|
+
});
|
|
27
|
+
if (!res.ok) {
|
|
28
|
+
await restoreOverlay({ install, pkgNames: journal.packages, snapshotDir: snapshotDir(deps.moxxyDir, input.coreTxnId) }).catch(() => undefined);
|
|
29
|
+
throw new Error(`overlay failed and was rolled back: ${res.message}`);
|
|
30
|
+
}
|
|
31
|
+
journal.state = 'staged_restart';
|
|
32
|
+
await writeCoreJournal(deps.moxxyDir, journal);
|
|
33
|
+
await emitSafe(deps, ctx, 'core_apply', { txnId: input.coreTxnId, applied: res.applied });
|
|
34
|
+
return {
|
|
35
|
+
ok: true,
|
|
36
|
+
applied: res.applied,
|
|
37
|
+
restartRequired: true,
|
|
38
|
+
message: 'Core patch overlaid. RESTART moxxy to activate it (re-run `moxxy`, or it restarts on the next launch under a supervisor). It will be committed automatically on a clean boot; use self_update_core_rollback if needed.',
|
|
39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3E,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAG7D,wBAAgB,aAAa,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CA+EvD"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { defineTool, z } from '@moxxy/sdk';
|
|
2
|
+
import { corePreflight, countCorruptCoreTxns, listCoreTxns, newCoreTxnId, provisionWorkspace, writeCoreJournal, } from '../core-update.js';
|
|
3
|
+
import { emitSafe } from '../deps.js';
|
|
4
|
+
import { resolveCore } from './shared.js';
|
|
5
|
+
// ── self_update_core_begin ──────────────────────────────────────────────────
|
|
6
|
+
export function coreBeginTool(cd) {
|
|
7
|
+
const { deps } = cd;
|
|
8
|
+
return defineTool({
|
|
9
|
+
name: 'self_update_core_begin',
|
|
10
|
+
description: 'Start a Tier-2 core patch: provision a source clone pinned to the EXACT installed commit (git clone/fetch + checkout gitHead + pnpm install — this can take minutes) and open a transaction. Returns a coreTxnId and the repo path. Edit files ONLY via self_update_core_write / self_update_core_edit, then self_update_core_verify. Prefer a Tier-1 plugin override first — only patch core when truly unavoidable.',
|
|
11
|
+
inputSchema: z.object({
|
|
12
|
+
packages: z
|
|
13
|
+
.array(z.string().min(1))
|
|
14
|
+
.min(1)
|
|
15
|
+
.describe('Affected @moxxy/* package names, e.g. ["@moxxy/core"].'),
|
|
16
|
+
}),
|
|
17
|
+
permission: { action: 'prompt' },
|
|
18
|
+
handler: async (input, ctx) => {
|
|
19
|
+
const install = resolveCore(cd);
|
|
20
|
+
if (!install)
|
|
21
|
+
throw new Error('could not resolve the installed @moxxy/core — cannot self-update core');
|
|
22
|
+
// Fail CLOSED on a corrupt journal: an unparseable in-flight journal would
|
|
23
|
+
// otherwise vanish from listCoreTxns and let this begin clobber the shared
|
|
24
|
+
// repoDir. Refuse rather than risk concurrent overlay corruption.
|
|
25
|
+
const corrupt = await countCorruptCoreTxns(deps.moxxyDir);
|
|
26
|
+
if (corrupt > 0) {
|
|
27
|
+
throw new Error(`${corrupt} core-update transaction journal(s) are corrupt/unreadable — refusing to start a ` +
|
|
28
|
+
`new core update (the serialization guard can't see them). Inspect ` +
|
|
29
|
+
`~/.moxxy/self-update/core-txns and resolve them before retrying.`);
|
|
30
|
+
}
|
|
31
|
+
// Serialize core transactions: only ONE may be in flight at a time. Every
|
|
32
|
+
// txn shares the single provisioned workspace (repoDir), so a second
|
|
33
|
+
// concurrent txn would clobber the first's edits + build. Refuse rather
|
|
34
|
+
// than corrupt — the active txn must be finished (verify → commit) or
|
|
35
|
+
// released (self_update_core_rollback, which is a no-op overlay restore +
|
|
36
|
+
// marks it rolled_back even when nothing was applied yet).
|
|
37
|
+
const active = (await listCoreTxns(deps.moxxyDir)).find((j) => j.state !== 'committed' && j.state !== 'rolled_back');
|
|
38
|
+
if (active) {
|
|
39
|
+
throw new Error(`a core update is already in progress (txn ${active.txnId}, state "${active.state}"). ` +
|
|
40
|
+
`Finish it (self_update_core_verify → self_update_commit) or release it with ` +
|
|
41
|
+
`self_update_core_rollback({ coreTxnId: "${active.txnId}" }) before starting another.`);
|
|
42
|
+
}
|
|
43
|
+
const pf = await corePreflight(install);
|
|
44
|
+
if (!pf.ok) {
|
|
45
|
+
throw new Error(`core update preflight failed: ${pf.checks.filter((c) => !c.ok).map((c) => `${c.id} (${c.detail})`).join('; ')}`);
|
|
46
|
+
}
|
|
47
|
+
const prov = await provisionWorkspace({
|
|
48
|
+
moxxyDir: deps.moxxyDir,
|
|
49
|
+
install,
|
|
50
|
+
...(deps.coreUpdate?.repoUrlOverride ? { repoUrlOverride: deps.coreUpdate.repoUrlOverride } : {}),
|
|
51
|
+
});
|
|
52
|
+
if (!prov.ok)
|
|
53
|
+
throw new Error(`provisioning failed (escalate to the user): ${prov.message}`);
|
|
54
|
+
const txnId = newCoreTxnId();
|
|
55
|
+
const journal = {
|
|
56
|
+
txnId,
|
|
57
|
+
createdAt: new Date().toISOString(),
|
|
58
|
+
updatedAt: new Date().toISOString(),
|
|
59
|
+
packages: [...input.packages],
|
|
60
|
+
version: install.version,
|
|
61
|
+
...(install.gitHead ? { gitHead: install.gitHead } : {}),
|
|
62
|
+
repoDir: prov.repoDir,
|
|
63
|
+
state: 'provisioned',
|
|
64
|
+
attempts: [],
|
|
65
|
+
};
|
|
66
|
+
await writeCoreJournal(deps.moxxyDir, journal);
|
|
67
|
+
await emitSafe(deps, ctx, 'core_begin', { txnId, packages: journal.packages, version: install.version });
|
|
68
|
+
return {
|
|
69
|
+
coreTxnId: txnId,
|
|
70
|
+
repoDir: prov.repoDir,
|
|
71
|
+
next: 'Edit files under the repo with self_update_core_write / self_update_core_edit (paths relative to the repo), then call self_update_core_verify.',
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=begin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"begin.js","sourceRoot":"","sources":["../../src/core-tools/begin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,CAAC,EAAkC,MAAM,YAAY,CAAC;AAC3E,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,GAEjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAqB,MAAM,aAAa,CAAC;AAE7D,+EAA+E;AAC/E,MAAM,UAAU,aAAa,CAAC,EAAgB;IAC5C,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IACpB,OAAO,UAAU,CAAC;QAChB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EACT,uZAAuZ;QACzZ,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,QAAQ,EAAE,CAAC;iBACR,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;iBACxB,GAAG,CAAC,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I,EAAE,GAAG,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;YACzG,OAAO;gBACL,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,IAAI,EAAE,gJAAgJ;aACvJ,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/core-tools/edit.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAG3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,wBAAgB,YAAY,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAyBtD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { promises as fs } from 'node:fs';
|
|
2
|
+
import { defineTool, z } from '@moxxy/sdk';
|
|
3
|
+
import { readCoreJournal, safeRepoPath } from '../core-update.js';
|
|
4
|
+
import { emitSafe } from '../deps.js';
|
|
5
|
+
// ── self_update_core_edit ───────────────────────────────────────────────────
|
|
6
|
+
export function coreEditTool(cd) {
|
|
7
|
+
const { deps } = cd;
|
|
8
|
+
return defineTool({
|
|
9
|
+
name: 'self_update_core_edit',
|
|
10
|
+
description: 'Find-and-replace a unique string in a file inside the provisioned core clone (path relative to the repo root). Approval-gated.',
|
|
11
|
+
inputSchema: z.object({
|
|
12
|
+
coreTxnId: z.string().min(1),
|
|
13
|
+
file: z.string().min(1),
|
|
14
|
+
oldString: z.string().min(1),
|
|
15
|
+
newString: z.string(),
|
|
16
|
+
}),
|
|
17
|
+
permission: { action: 'prompt' },
|
|
18
|
+
handler: async (input, ctx) => {
|
|
19
|
+
const journal = await readCoreJournal(deps.moxxyDir, input.coreTxnId);
|
|
20
|
+
const abs = safeRepoPath(journal.repoDir, input.file);
|
|
21
|
+
const cur = await fs.readFile(abs, 'utf8');
|
|
22
|
+
const count = cur.split(input.oldString).length - 1;
|
|
23
|
+
if (count === 0)
|
|
24
|
+
throw new Error(`oldString not found in ${input.file}`);
|
|
25
|
+
if (count > 1)
|
|
26
|
+
throw new Error(`oldString is not unique in ${input.file} (${count} matches)`);
|
|
27
|
+
await fs.writeFile(abs, cur.replace(input.oldString, input.newString), 'utf8');
|
|
28
|
+
await emitSafe(deps, ctx, 'core_edit', { txnId: input.coreTxnId, file: input.file });
|
|
29
|
+
return { ok: true, edited: input.file };
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=edit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.js","sourceRoot":"","sources":["../../src/core-tools/edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,CAAC,EAAkC,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,+EAA+E;AAC/E,MAAM,UAAU,YAAY,CAAC,EAAgB;IAC3C,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IACpB,OAAO,UAAU,CAAC;QAChB,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EACT,gIAAgI;QAClI,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC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
|
1
|
+
import type { ToolDef } from '@moxxy/sdk';
|
|
2
|
+
import type { SelfUpdateDeps } from '../deps.js';
|
|
3
|
+
export type { CoreToolDeps } from './shared.js';
|
|
4
|
+
/**
|
|
5
|
+
* Composes the Tier-2 core-update tools from per-tool factories (mirroring the
|
|
6
|
+
* Tier-1 layout). `fromUrl` is the module URL used to resolve the live
|
|
7
|
+
* `@moxxy/core` install (the plugin entry's `import.meta.url`). Order preserved
|
|
8
|
+
* exactly as before extraction.
|
|
9
|
+
*/
|
|
10
|
+
export declare function coreTools(deps: SelfUpdateDeps, fromUrl: string): ToolDef[];
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core-tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAWjD,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,CAY1E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { coreApplyTool } from './apply.js';
|
|
2
|
+
import { coreBeginTool } from './begin.js';
|
|
3
|
+
import { coreEditTool } from './edit.js';
|
|
4
|
+
import { corePreflightTool } from './preflight.js';
|
|
5
|
+
import { coreRollbackTool } from './rollback.js';
|
|
6
|
+
import { coreStatusTool } from './status.js';
|
|
7
|
+
import { coreVerifyTool } from './verify.js';
|
|
8
|
+
import { coreWriteTool } from './write.js';
|
|
9
|
+
/**
|
|
10
|
+
* Composes the Tier-2 core-update tools from per-tool factories (mirroring the
|
|
11
|
+
* Tier-1 layout). `fromUrl` is the module URL used to resolve the live
|
|
12
|
+
* `@moxxy/core` install (the plugin entry's `import.meta.url`). Order preserved
|
|
13
|
+
* exactly as before extraction.
|
|
14
|
+
*/
|
|
15
|
+
export function coreTools(deps, fromUrl) {
|
|
16
|
+
const cd = { deps, fromUrl };
|
|
17
|
+
return [
|
|
18
|
+
corePreflightTool(cd),
|
|
19
|
+
coreBeginTool(cd),
|
|
20
|
+
coreWriteTool(cd),
|
|
21
|
+
coreEditTool(cd),
|
|
22
|
+
coreVerifyTool(cd),
|
|
23
|
+
coreApplyTool(cd),
|
|
24
|
+
coreRollbackTool(cd),
|
|
25
|
+
coreStatusTool(cd),
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core-tools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAI3C;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,IAAoB,EAAE,OAAe;IAC7D,MAAM,EAAE,GAAiB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3C,OAAO;QACL,iBAAiB,CAAC,EAAE,CAAC;QACrB,aAAa,CAAC,EAAE,CAAC;QACjB,aAAa,CAAC,EAAE,CAAC;QACjB,YAAY,CAAC,EAAE,CAAC;QAChB,cAAc,CAAC,EAAE,CAAC;QAClB,aAAa,CAAC,EAAE,CAAC;QACjB,gBAAgB,CAAC,EAAE,CAAC;QACpB,cAAc,CAAC,EAAE,CAAC;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../src/core-tools/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAEzD,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAG7D,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAS3D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineTool, z } from '@moxxy/sdk';
|
|
2
|
+
import { corePreflight } from '../core-update.js';
|
|
3
|
+
import { resolveCore } from './shared.js';
|
|
4
|
+
// ── self_update_core_preflight ──────────────────────────────────────────────
|
|
5
|
+
export function corePreflightTool(cd) {
|
|
6
|
+
return defineTool({
|
|
7
|
+
name: 'self_update_core_preflight',
|
|
8
|
+
description: 'Read-only. Check whether a Tier-2 core patch is even possible: git + pnpm present, @moxxy/core resolvable, a pinned source commit (gitHead) and repo URL in its published metadata. Run this BEFORE attempting to patch @moxxy/core; if any check fails, do not start — tell the user.',
|
|
9
|
+
inputSchema: z.object({}),
|
|
10
|
+
permission: { action: 'allow' },
|
|
11
|
+
handler: async () => corePreflight(resolveCore(cd)),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../src/core-tools/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,CAAC,EAAgB,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAqB,MAAM,aAAa,CAAC;AAE7D,+EAA+E;AAC/E,MAAM,UAAU,iBAAiB,CAAC,EAAgB;IAChD,OAAO,UAAU,CAAC;QAChB,IAAI,EAAE,4BAA4B;QAClC,WAAW,EACT,wRAAwR;QAC1R,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,UAAU,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE;QAC/B,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;KACpD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollback.d.ts","sourceRoot":"","sources":["../../src/core-tools/rollback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAG3E,OAAO,EAA4B,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAG1E,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAuB1D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineTool, z } from '@moxxy/sdk';
|
|
2
|
+
import { gcCoreTxns, readCoreJournal, restoreOverlay, writeCoreJournal } from '../core-update.js';
|
|
3
|
+
import { emitSafe } from '../deps.js';
|
|
4
|
+
import { resolveCore, snapshotDir } from './shared.js';
|
|
5
|
+
// ── self_update_core_rollback ───────────────────────────────────────────────
|
|
6
|
+
export function coreRollbackTool(cd) {
|
|
7
|
+
const { deps } = cd;
|
|
8
|
+
return defineTool({
|
|
9
|
+
name: 'self_update_core_rollback',
|
|
10
|
+
description: 'Undo a core overlay: restore the previous dist from the snapshot. A restart is required to drop the patched code. Use if a core patch built+loaded but misbehaves.',
|
|
11
|
+
inputSchema: z.object({ coreTxnId: z.string().min(1), reason: z.string().optional() }),
|
|
12
|
+
permission: { action: 'allow' },
|
|
13
|
+
handler: async (input, ctx) => {
|
|
14
|
+
const journal = await readCoreJournal(deps.moxxyDir, input.coreTxnId);
|
|
15
|
+
const install = resolveCore(cd);
|
|
16
|
+
if (!install)
|
|
17
|
+
throw new Error('could not resolve @moxxy/core');
|
|
18
|
+
await restoreOverlay({ install, pkgNames: journal.packages, snapshotDir: snapshotDir(deps.moxxyDir, input.coreTxnId) });
|
|
19
|
+
journal.state = 'rolled_back';
|
|
20
|
+
await writeCoreJournal(deps.moxxyDir, journal);
|
|
21
|
+
await emitSafe(deps, ctx, 'core_rollback', { txnId: input.coreTxnId, reason: input.reason ?? null });
|
|
22
|
+
// Reclaim disk now: this txn is terminal, and its (large) dist snapshot is
|
|
23
|
+
// no longer needed. Prune older terminal core txns too. Best-effort — keep
|
|
24
|
+
// the freshly-rolled-back one + recent history. Mirrors maxTxnRetained.
|
|
25
|
+
await gcCoreTxns(deps.moxxyDir, deps.maxTxnRetained ?? 5).catch(() => undefined);
|
|
26
|
+
return { ok: true, restored: journal.packages, restartRequired: true };
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=rollback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollback.js","sourceRoot":"","sources":["../../src/core-tools/rollback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,CAAC,EAAkC,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAqB,MAAM,aAAa,CAAC;AAE1E,+EAA+E;AAC/E,MAAM,UAAU,gBAAgB,CAAC,EAAgB;IAC/C,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IACpB,OAAO,UAAU,CAAC;QAChB,IAAI,EAAE,2BAA2B;QACjC,WAAW,EACT,oKAAoK;QACtK,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,S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AC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type SelfUpdateDeps } from '../deps.js';
|
|
2
|
+
import type { CoreInstallInfo } from '../core-update.js';
|
|
3
|
+
/**
|
|
4
|
+
* Context threaded into every Tier-2 core-tool factory. `fromUrl` is the
|
|
5
|
+
* module URL used to resolve the live `@moxxy/core` install (defaults to the
|
|
6
|
+
* plugin entry's `import.meta.url`, overridable via deps.coreUpdate.fromUrl).
|
|
7
|
+
*/
|
|
8
|
+
export interface CoreToolDeps {
|
|
9
|
+
readonly deps: SelfUpdateDeps;
|
|
10
|
+
readonly fromUrl: string;
|
|
11
|
+
}
|
|
12
|
+
/** Where a given core transaction parks its pre-overlay dist snapshot. */
|
|
13
|
+
export declare function snapshotDir(moxxyDir: string, txnId: string): string;
|
|
14
|
+
/** Resolve the live `@moxxy/core` install for this plugin's deps. */
|
|
15
|
+
export declare function resolveCore(c: CoreToolDeps): CoreInstallInfo | null;
|
|
16
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/core-tools/shared.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,CAAC,EAAE,YAAY,GAAG,eAAe,GAAG,IAAI,CAEnE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import { coreTxnDir } from '../core-update.js';
|
|
3
|
+
import { resolveCoreInstall } from '../deps.js';
|
|
4
|
+
/** Where a given core transaction parks its pre-overlay dist snapshot. */
|
|
5
|
+
export function snapshotDir(moxxyDir, txnId) {
|
|
6
|
+
return path.join(coreTxnDir(moxxyDir, txnId), 'snapshot');
|
|
7
|
+
}
|
|
8
|
+
/** Resolve the live `@moxxy/core` install for this plugin's deps. */
|
|
9
|
+
export function resolveCore(c) {
|
|
10
|
+
return resolveCoreInstall(c.deps, c.fromUrl);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/core-tools/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAuB,MAAM,YAAY,CAAC;AAarE,0EAA0E;AAC1E,MAAM,UAAU,WAAW,CAAC,QAAgB,EAAE,KAAa;IACzD,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAC5D,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,WAAW,CAAC,CAAe;IACzC,OAAO,kBAAkB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/core-tools/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,wBAAgB,cAAc,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAoBxD"}
|