@joshuaswarren/openclaw-engram 8.3.18 → 8.3.20
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/dist/index.js +429 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13831,6 +13831,105 @@ import { Type } from "@sinclair/typebox";
|
|
|
13831
13831
|
function toolResult(text) {
|
|
13832
13832
|
return { content: [{ type: "text", text }], details: void 0 };
|
|
13833
13833
|
}
|
|
13834
|
+
var IDENTITY_ANCHOR_TITLE = "# Identity Continuity Anchor";
|
|
13835
|
+
var IDENTITY_ANCHOR_SECTION_ORDER = [
|
|
13836
|
+
"Identity Traits",
|
|
13837
|
+
"Communication Preferences",
|
|
13838
|
+
"Operating Principles",
|
|
13839
|
+
"Continuity Notes"
|
|
13840
|
+
];
|
|
13841
|
+
function parseMarkdownSections(raw) {
|
|
13842
|
+
const lines = raw.replace(/\r/g, "").split("\n");
|
|
13843
|
+
const headerLines = [];
|
|
13844
|
+
const sectionLines = /* @__PURE__ */ new Map();
|
|
13845
|
+
const order = [];
|
|
13846
|
+
let currentSection = null;
|
|
13847
|
+
for (const line of lines) {
|
|
13848
|
+
const sectionMatch = line.match(/^##\s+(.+?)\s*$/);
|
|
13849
|
+
if (sectionMatch) {
|
|
13850
|
+
currentSection = sectionMatch[1].trim();
|
|
13851
|
+
if (!sectionLines.has(currentSection)) {
|
|
13852
|
+
sectionLines.set(currentSection, []);
|
|
13853
|
+
order.push(currentSection);
|
|
13854
|
+
}
|
|
13855
|
+
continue;
|
|
13856
|
+
}
|
|
13857
|
+
if (!currentSection) {
|
|
13858
|
+
headerLines.push(line);
|
|
13859
|
+
continue;
|
|
13860
|
+
}
|
|
13861
|
+
sectionLines.get(currentSection)?.push(line);
|
|
13862
|
+
}
|
|
13863
|
+
const sections = /* @__PURE__ */ new Map();
|
|
13864
|
+
for (const [name, contentLines] of sectionLines.entries()) {
|
|
13865
|
+
sections.set(name, contentLines.join("\n").trim());
|
|
13866
|
+
}
|
|
13867
|
+
return {
|
|
13868
|
+
header: headerLines.join("\n").trim(),
|
|
13869
|
+
sections,
|
|
13870
|
+
order
|
|
13871
|
+
};
|
|
13872
|
+
}
|
|
13873
|
+
function mergeAnchorSection(existing, incoming) {
|
|
13874
|
+
const next = incoming?.trim();
|
|
13875
|
+
const prev = existing?.trim() === "- (empty)" ? "" : existing?.trim();
|
|
13876
|
+
if (!next) return prev ?? "";
|
|
13877
|
+
if (!prev) return next;
|
|
13878
|
+
if (prev.includes(next)) return prev;
|
|
13879
|
+
if (next.includes(prev)) return next;
|
|
13880
|
+
return `${prev}
|
|
13881
|
+
|
|
13882
|
+
${next}`;
|
|
13883
|
+
}
|
|
13884
|
+
function mergeIdentityAnchor(existingRaw, updates) {
|
|
13885
|
+
const parsed = parseMarkdownSections(existingRaw ?? "");
|
|
13886
|
+
const header = parsed.header.length > 0 ? parsed.header : IDENTITY_ANCHOR_TITLE;
|
|
13887
|
+
const sections = new Map(parsed.sections);
|
|
13888
|
+
for (const sectionName of IDENTITY_ANCHOR_SECTION_ORDER) {
|
|
13889
|
+
const merged = mergeAnchorSection(sections.get(sectionName), updates[sectionName]);
|
|
13890
|
+
if (merged) {
|
|
13891
|
+
sections.set(sectionName, merged);
|
|
13892
|
+
} else if (!sections.has(sectionName)) {
|
|
13893
|
+
sections.set(sectionName, "");
|
|
13894
|
+
}
|
|
13895
|
+
}
|
|
13896
|
+
const finalOrder = [];
|
|
13897
|
+
for (const sectionName of IDENTITY_ANCHOR_SECTION_ORDER) {
|
|
13898
|
+
if (sections.has(sectionName)) finalOrder.push(sectionName);
|
|
13899
|
+
}
|
|
13900
|
+
for (const sectionName of parsed.order) {
|
|
13901
|
+
if (!finalOrder.includes(sectionName) && sections.has(sectionName)) {
|
|
13902
|
+
finalOrder.push(sectionName);
|
|
13903
|
+
}
|
|
13904
|
+
}
|
|
13905
|
+
const lines = [header.trim(), ""];
|
|
13906
|
+
for (const sectionName of finalOrder) {
|
|
13907
|
+
lines.push(`## ${sectionName}`, "");
|
|
13908
|
+
const body = sections.get(sectionName)?.trim();
|
|
13909
|
+
if (body && body.length > 0) {
|
|
13910
|
+
lines.push(body, "");
|
|
13911
|
+
} else {
|
|
13912
|
+
lines.push("");
|
|
13913
|
+
}
|
|
13914
|
+
}
|
|
13915
|
+
return lines.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd() + "\n";
|
|
13916
|
+
}
|
|
13917
|
+
function formatContinuityIncidentSummary(incident, index) {
|
|
13918
|
+
const prefix = typeof index === "number" ? `### [${index + 1}] ` : "### ";
|
|
13919
|
+
const lines = [
|
|
13920
|
+
`${prefix}${incident.id} (${incident.state})`,
|
|
13921
|
+
`Opened: ${incident.openedAt}`
|
|
13922
|
+
];
|
|
13923
|
+
if (incident.closedAt) lines.push(`Closed: ${incident.closedAt}`);
|
|
13924
|
+
if (incident.triggerWindow) lines.push(`Window: ${incident.triggerWindow}`);
|
|
13925
|
+
lines.push("", `Symptom: ${incident.symptom}`);
|
|
13926
|
+
if (incident.suspectedCause) lines.push(`Suspected Cause: ${incident.suspectedCause}`);
|
|
13927
|
+
if (incident.fixApplied) lines.push(`Fix Applied: ${incident.fixApplied}`);
|
|
13928
|
+
if (incident.verificationResult) lines.push(`Verification: ${incident.verificationResult}`);
|
|
13929
|
+
if (incident.preventiveRule) lines.push(`Preventive Rule: ${incident.preventiveRule}`);
|
|
13930
|
+
if (incident.filePath) lines.push(`Path: ${incident.filePath}`);
|
|
13931
|
+
return lines.join("\n");
|
|
13932
|
+
}
|
|
13834
13933
|
function registerTools(api, orchestrator) {
|
|
13835
13934
|
const actionTypes = [
|
|
13836
13935
|
"store_episode",
|
|
@@ -13912,6 +14011,237 @@ ${formatted}`
|
|
|
13912
14011
|
},
|
|
13913
14012
|
{ name: "memory_search" }
|
|
13914
14013
|
);
|
|
14014
|
+
api.registerTool(
|
|
14015
|
+
{
|
|
14016
|
+
name: "continuity_incident_open",
|
|
14017
|
+
label: "Open Continuity Incident",
|
|
14018
|
+
description: "Create a new continuity incident record in append-only storage.",
|
|
14019
|
+
parameters: Type.Object({
|
|
14020
|
+
symptom: Type.String({
|
|
14021
|
+
description: "Observed continuity failure symptom."
|
|
14022
|
+
}),
|
|
14023
|
+
triggerWindow: Type.Optional(
|
|
14024
|
+
Type.String({
|
|
14025
|
+
description: "Optional time window when incident occurred."
|
|
14026
|
+
})
|
|
14027
|
+
),
|
|
14028
|
+
suspectedCause: Type.Optional(
|
|
14029
|
+
Type.String({
|
|
14030
|
+
description: "Optional suspected root cause."
|
|
14031
|
+
})
|
|
14032
|
+
)
|
|
14033
|
+
}),
|
|
14034
|
+
async execute(_toolCallId, params) {
|
|
14035
|
+
if (!orchestrator.config.identityContinuityEnabled) {
|
|
14036
|
+
return toolResult(
|
|
14037
|
+
"Identity continuity is disabled. Enable `identityContinuityEnabled: true` to open incidents."
|
|
14038
|
+
);
|
|
14039
|
+
}
|
|
14040
|
+
if (!orchestrator.config.continuityIncidentLoggingEnabled) {
|
|
14041
|
+
return toolResult(
|
|
14042
|
+
"Continuity incident logging is disabled. Enable `continuityIncidentLoggingEnabled: true` to open incidents."
|
|
14043
|
+
);
|
|
14044
|
+
}
|
|
14045
|
+
const symptom = typeof params.symptom === "string" ? params.symptom.trim() : "";
|
|
14046
|
+
if (!symptom) {
|
|
14047
|
+
return toolResult("Missing required field: symptom");
|
|
14048
|
+
}
|
|
14049
|
+
const created = await orchestrator.storage.appendContinuityIncident({
|
|
14050
|
+
symptom,
|
|
14051
|
+
triggerWindow: typeof params.triggerWindow === "string" ? params.triggerWindow : void 0,
|
|
14052
|
+
suspectedCause: typeof params.suspectedCause === "string" ? params.suspectedCause : void 0
|
|
14053
|
+
});
|
|
14054
|
+
log.info(`continuity-incident open id=${created.id}`);
|
|
14055
|
+
return toolResult(`Continuity incident opened.
|
|
14056
|
+
|
|
14057
|
+
${formatContinuityIncidentSummary(created)}`);
|
|
14058
|
+
}
|
|
14059
|
+
},
|
|
14060
|
+
{ name: "continuity_incident_open" }
|
|
14061
|
+
);
|
|
14062
|
+
api.registerTool(
|
|
14063
|
+
{
|
|
14064
|
+
name: "continuity_incident_close",
|
|
14065
|
+
label: "Close Continuity Incident",
|
|
14066
|
+
description: "Close an open continuity incident with required verification details.",
|
|
14067
|
+
parameters: Type.Object({
|
|
14068
|
+
id: Type.String({
|
|
14069
|
+
description: "Incident ID to close."
|
|
14070
|
+
}),
|
|
14071
|
+
fixApplied: Type.String({
|
|
14072
|
+
description: "What fix was applied."
|
|
14073
|
+
}),
|
|
14074
|
+
verificationResult: Type.String({
|
|
14075
|
+
description: "How closure was verified."
|
|
14076
|
+
}),
|
|
14077
|
+
preventiveRule: Type.Optional(
|
|
14078
|
+
Type.String({
|
|
14079
|
+
description: "Optional preventive follow-up rule."
|
|
14080
|
+
})
|
|
14081
|
+
)
|
|
14082
|
+
}),
|
|
14083
|
+
async execute(_toolCallId, params) {
|
|
14084
|
+
if (!orchestrator.config.identityContinuityEnabled) {
|
|
14085
|
+
return toolResult(
|
|
14086
|
+
"Identity continuity is disabled. Enable `identityContinuityEnabled: true` to close incidents."
|
|
14087
|
+
);
|
|
14088
|
+
}
|
|
14089
|
+
if (!orchestrator.config.continuityIncidentLoggingEnabled) {
|
|
14090
|
+
return toolResult(
|
|
14091
|
+
"Continuity incident logging is disabled. Enable `continuityIncidentLoggingEnabled: true` to close incidents."
|
|
14092
|
+
);
|
|
14093
|
+
}
|
|
14094
|
+
const id = typeof params.id === "string" ? params.id.trim() : "";
|
|
14095
|
+
const fixApplied = typeof params.fixApplied === "string" ? params.fixApplied.trim() : "";
|
|
14096
|
+
const verificationResult = typeof params.verificationResult === "string" ? params.verificationResult.trim() : "";
|
|
14097
|
+
const preventiveRule = typeof params.preventiveRule === "string" ? params.preventiveRule.trim() : void 0;
|
|
14098
|
+
if (!id) return toolResult("Missing required field: id");
|
|
14099
|
+
if (!fixApplied) return toolResult("Missing required field: fixApplied");
|
|
14100
|
+
if (!verificationResult) return toolResult("Missing required field: verificationResult");
|
|
14101
|
+
const closed = await orchestrator.storage.closeContinuityIncident(id, {
|
|
14102
|
+
fixApplied,
|
|
14103
|
+
verificationResult,
|
|
14104
|
+
preventiveRule
|
|
14105
|
+
});
|
|
14106
|
+
if (!closed) return toolResult(`Incident not found: ${id}`);
|
|
14107
|
+
log.info(`continuity-incident close id=${id}`);
|
|
14108
|
+
return toolResult(`Continuity incident closed.
|
|
14109
|
+
|
|
14110
|
+
${formatContinuityIncidentSummary(closed)}`);
|
|
14111
|
+
}
|
|
14112
|
+
},
|
|
14113
|
+
{ name: "continuity_incident_close" }
|
|
14114
|
+
);
|
|
14115
|
+
api.registerTool(
|
|
14116
|
+
{
|
|
14117
|
+
name: "continuity_incident_list",
|
|
14118
|
+
label: "List Continuity Incidents",
|
|
14119
|
+
description: "List continuity incidents and optionally filter by state.",
|
|
14120
|
+
parameters: Type.Object({
|
|
14121
|
+
state: Type.Optional(
|
|
14122
|
+
Type.String({
|
|
14123
|
+
enum: ["open", "closed", "all"],
|
|
14124
|
+
description: "Incident state filter (default: open)."
|
|
14125
|
+
})
|
|
14126
|
+
),
|
|
14127
|
+
limit: Type.Optional(
|
|
14128
|
+
Type.Number({
|
|
14129
|
+
description: "Max incidents to return (default: 25, max: 200).",
|
|
14130
|
+
minimum: 1,
|
|
14131
|
+
maximum: 200
|
|
14132
|
+
})
|
|
14133
|
+
)
|
|
14134
|
+
}),
|
|
14135
|
+
async execute(_toolCallId, params) {
|
|
14136
|
+
if (!orchestrator.config.identityContinuityEnabled) {
|
|
14137
|
+
return toolResult(
|
|
14138
|
+
"Identity continuity is disabled. Enable `identityContinuityEnabled: true` to list incidents."
|
|
14139
|
+
);
|
|
14140
|
+
}
|
|
14141
|
+
const state = params.state === "closed" || params.state === "all" ? params.state : "open";
|
|
14142
|
+
const limitRaw = typeof params.limit === "number" ? params.limit : 25;
|
|
14143
|
+
const limit = Math.max(1, Math.min(200, Math.floor(limitRaw)));
|
|
14144
|
+
const incidents = await orchestrator.storage.readContinuityIncidents(limit);
|
|
14145
|
+
const filtered = state === "all" ? incidents : incidents.filter((incident) => incident.state === state);
|
|
14146
|
+
if (filtered.length === 0) {
|
|
14147
|
+
return toolResult(`No continuity incidents found for state=${state}.`);
|
|
14148
|
+
}
|
|
14149
|
+
const body = filtered.map((incident, index) => formatContinuityIncidentSummary(incident, index)).join("\n\n");
|
|
14150
|
+
return toolResult(`## Continuity Incidents (${filtered.length}, state=${state})
|
|
14151
|
+
|
|
14152
|
+
${body}`);
|
|
14153
|
+
}
|
|
14154
|
+
},
|
|
14155
|
+
{ name: "continuity_incident_list" }
|
|
14156
|
+
);
|
|
14157
|
+
api.registerTool(
|
|
14158
|
+
{
|
|
14159
|
+
name: "identity_anchor_get",
|
|
14160
|
+
label: "Get Identity Anchor",
|
|
14161
|
+
description: "Read the identity continuity anchor document used for recovery-safe identity context.",
|
|
14162
|
+
parameters: Type.Object({}),
|
|
14163
|
+
async execute() {
|
|
14164
|
+
if (!orchestrator.config.identityContinuityEnabled) {
|
|
14165
|
+
return toolResult(
|
|
14166
|
+
"Identity continuity is disabled. Enable `identityContinuityEnabled: true` to use identity anchor tools."
|
|
14167
|
+
);
|
|
14168
|
+
}
|
|
14169
|
+
const anchor = await orchestrator.storage.readIdentityAnchor();
|
|
14170
|
+
if (!anchor) {
|
|
14171
|
+
return toolResult(
|
|
14172
|
+
"No identity anchor found yet. Use `identity_anchor_update` to create one."
|
|
14173
|
+
);
|
|
14174
|
+
}
|
|
14175
|
+
return toolResult(`## Identity Anchor
|
|
14176
|
+
|
|
14177
|
+
${anchor}`);
|
|
14178
|
+
}
|
|
14179
|
+
},
|
|
14180
|
+
{ name: "identity_anchor_get" }
|
|
14181
|
+
);
|
|
14182
|
+
api.registerTool(
|
|
14183
|
+
{
|
|
14184
|
+
name: "identity_anchor_update",
|
|
14185
|
+
label: "Update Identity Anchor",
|
|
14186
|
+
description: "Conservatively update identity anchor sections without overwriting existing material.",
|
|
14187
|
+
parameters: Type.Object({
|
|
14188
|
+
identityTraits: Type.Optional(
|
|
14189
|
+
Type.String({
|
|
14190
|
+
description: "Updates for the 'Identity Traits' section."
|
|
14191
|
+
})
|
|
14192
|
+
),
|
|
14193
|
+
communicationPreferences: Type.Optional(
|
|
14194
|
+
Type.String({
|
|
14195
|
+
description: "Updates for the 'Communication Preferences' section."
|
|
14196
|
+
})
|
|
14197
|
+
),
|
|
14198
|
+
operatingPrinciples: Type.Optional(
|
|
14199
|
+
Type.String({
|
|
14200
|
+
description: "Updates for the 'Operating Principles' section."
|
|
14201
|
+
})
|
|
14202
|
+
),
|
|
14203
|
+
continuityNotes: Type.Optional(
|
|
14204
|
+
Type.String({
|
|
14205
|
+
description: "Updates for the 'Continuity Notes' section."
|
|
14206
|
+
})
|
|
14207
|
+
)
|
|
14208
|
+
}),
|
|
14209
|
+
async execute(_toolCallId, params) {
|
|
14210
|
+
if (!orchestrator.config.identityContinuityEnabled) {
|
|
14211
|
+
return toolResult(
|
|
14212
|
+
"Identity continuity is disabled. Enable `identityContinuityEnabled: true` to use identity anchor tools."
|
|
14213
|
+
);
|
|
14214
|
+
}
|
|
14215
|
+
const updates = {
|
|
14216
|
+
"Identity Traits": typeof params.identityTraits === "string" ? params.identityTraits : void 0,
|
|
14217
|
+
"Communication Preferences": typeof params.communicationPreferences === "string" ? params.communicationPreferences : void 0,
|
|
14218
|
+
"Operating Principles": typeof params.operatingPrinciples === "string" ? params.operatingPrinciples : void 0,
|
|
14219
|
+
"Continuity Notes": typeof params.continuityNotes === "string" ? params.continuityNotes : void 0
|
|
14220
|
+
};
|
|
14221
|
+
const hasUpdate = Object.values(updates).some(
|
|
14222
|
+
(value) => typeof value === "string" && value.trim().length > 0
|
|
14223
|
+
);
|
|
14224
|
+
if (!hasUpdate) {
|
|
14225
|
+
return toolResult(
|
|
14226
|
+
"No updates provided. Supply at least one section field to update the identity anchor."
|
|
14227
|
+
);
|
|
14228
|
+
}
|
|
14229
|
+
const existing = await orchestrator.storage.readIdentityAnchor();
|
|
14230
|
+
const merged = mergeIdentityAnchor(existing, updates);
|
|
14231
|
+
await orchestrator.storage.writeIdentityAnchor(merged);
|
|
14232
|
+
const updatedSections = Object.entries(updates).filter(([, value]) => typeof value === "string" && value.trim().length > 0).map(([name]) => name);
|
|
14233
|
+
log.info(
|
|
14234
|
+
`identity-anchor update sections=${updatedSections.join(",")} chars=${merged.length}`
|
|
14235
|
+
);
|
|
14236
|
+
return toolResult(
|
|
14237
|
+
`Identity anchor updated (${updatedSections.length} section${updatedSections.length === 1 ? "" : "s"}).
|
|
14238
|
+
|
|
14239
|
+
${merged}`
|
|
14240
|
+
);
|
|
14241
|
+
}
|
|
14242
|
+
},
|
|
14243
|
+
{ name: "identity_anchor_update" }
|
|
14244
|
+
);
|
|
13915
14245
|
api.registerTool(
|
|
13916
14246
|
{
|
|
13917
14247
|
name: "memory_feedback",
|
|
@@ -15311,6 +15641,21 @@ async function readAllMemoryFiles(memoryDir) {
|
|
|
15311
15641
|
}
|
|
15312
15642
|
return out;
|
|
15313
15643
|
}
|
|
15644
|
+
function formatContinuityIncidentCli(incident) {
|
|
15645
|
+
const lines = [
|
|
15646
|
+
`${incident.id} [${incident.state}]`,
|
|
15647
|
+
` opened: ${incident.openedAt}`
|
|
15648
|
+
];
|
|
15649
|
+
if (incident.closedAt) lines.push(` closed: ${incident.closedAt}`);
|
|
15650
|
+
if (incident.triggerWindow) lines.push(` window: ${incident.triggerWindow}`);
|
|
15651
|
+
lines.push(` symptom: ${incident.symptom}`);
|
|
15652
|
+
if (incident.suspectedCause) lines.push(` suspected-cause: ${incident.suspectedCause}`);
|
|
15653
|
+
if (incident.fixApplied) lines.push(` fix-applied: ${incident.fixApplied}`);
|
|
15654
|
+
if (incident.verificationResult) lines.push(` verification: ${incident.verificationResult}`);
|
|
15655
|
+
if (incident.preventiveRule) lines.push(` preventive-rule: ${incident.preventiveRule}`);
|
|
15656
|
+
if (incident.filePath) lines.push(` path: ${incident.filePath}`);
|
|
15657
|
+
return lines.join("\n");
|
|
15658
|
+
}
|
|
15314
15659
|
function registerCli(api, orchestrator) {
|
|
15315
15660
|
api.registerCli(
|
|
15316
15661
|
({ program }) => {
|
|
@@ -15697,6 +16042,90 @@ function registerCli(api, orchestrator) {
|
|
|
15697
16042
|
}
|
|
15698
16043
|
console.log(identity);
|
|
15699
16044
|
});
|
|
16045
|
+
const continuityCmd = cmd.command("continuity").description("Identity continuity incident workflow commands");
|
|
16046
|
+
continuityCmd.command("incidents").description("List continuity incidents").option("--state <state>", "Filter by state: open|closed|all", "open").option("--limit <number>", "Maximum incidents to list", "25").action(async (...args) => {
|
|
16047
|
+
if (!orchestrator.config.identityContinuityEnabled) {
|
|
16048
|
+
console.log("Identity continuity is disabled.");
|
|
16049
|
+
return;
|
|
16050
|
+
}
|
|
16051
|
+
const options = args[0] ?? {};
|
|
16052
|
+
const stateRaw = String(options.state ?? "open").toLowerCase();
|
|
16053
|
+
const state = stateRaw === "closed" || stateRaw === "all" ? stateRaw : "open";
|
|
16054
|
+
const limit = Math.max(1, Math.min(200, parseInt(String(options.limit ?? "25"), 10) || 25));
|
|
16055
|
+
const incidents = await orchestrator.storage.readContinuityIncidents(limit);
|
|
16056
|
+
const filtered = state === "all" ? incidents : incidents.filter((incident) => incident.state === state);
|
|
16057
|
+
if (filtered.length === 0) {
|
|
16058
|
+
console.log(`No continuity incidents found for state=${state}.`);
|
|
16059
|
+
return;
|
|
16060
|
+
}
|
|
16061
|
+
console.log(`=== Continuity Incidents (${filtered.length}, state=${state}) ===
|
|
16062
|
+
`);
|
|
16063
|
+
for (const incident of filtered) {
|
|
16064
|
+
console.log(formatContinuityIncidentCli(incident));
|
|
16065
|
+
console.log();
|
|
16066
|
+
}
|
|
16067
|
+
});
|
|
16068
|
+
continuityCmd.command("incident-open").description("Open a continuity incident").option("--symptom <text>", "Required symptom description").option("--trigger-window <window>", "Optional incident trigger window").option("--suspected-cause <text>", "Optional suspected cause").action(async (...args) => {
|
|
16069
|
+
if (!orchestrator.config.identityContinuityEnabled) {
|
|
16070
|
+
console.log("Identity continuity is disabled.");
|
|
16071
|
+
return;
|
|
16072
|
+
}
|
|
16073
|
+
if (!orchestrator.config.continuityIncidentLoggingEnabled) {
|
|
16074
|
+
console.log("Continuity incident logging is disabled.");
|
|
16075
|
+
return;
|
|
16076
|
+
}
|
|
16077
|
+
const options = args[0] ?? {};
|
|
16078
|
+
const symptom = String(options.symptom ?? "").trim();
|
|
16079
|
+
if (!symptom) {
|
|
16080
|
+
console.log("Missing required --symptom.");
|
|
16081
|
+
return;
|
|
16082
|
+
}
|
|
16083
|
+
const created = await orchestrator.storage.appendContinuityIncident({
|
|
16084
|
+
symptom,
|
|
16085
|
+
triggerWindow: options.triggerWindow ? String(options.triggerWindow) : void 0,
|
|
16086
|
+
suspectedCause: options.suspectedCause ? String(options.suspectedCause) : void 0
|
|
16087
|
+
});
|
|
16088
|
+
console.log("Opened continuity incident:\n");
|
|
16089
|
+
console.log(formatContinuityIncidentCli(created));
|
|
16090
|
+
});
|
|
16091
|
+
continuityCmd.command("incident-close").description("Close a continuity incident").option("--id <id>", "Required incident ID").option("--fix-applied <text>", "Required fix description").option("--verification-result <text>", "Required verification result").option("--preventive-rule <text>", "Optional preventive rule").action(async (...args) => {
|
|
16092
|
+
if (!orchestrator.config.identityContinuityEnabled) {
|
|
16093
|
+
console.log("Identity continuity is disabled.");
|
|
16094
|
+
return;
|
|
16095
|
+
}
|
|
16096
|
+
if (!orchestrator.config.continuityIncidentLoggingEnabled) {
|
|
16097
|
+
console.log("Continuity incident logging is disabled.");
|
|
16098
|
+
return;
|
|
16099
|
+
}
|
|
16100
|
+
const options = args[0] ?? {};
|
|
16101
|
+
const id = String(options.id ?? "").trim();
|
|
16102
|
+
const fixApplied = String(options.fixApplied ?? "").trim();
|
|
16103
|
+
const verificationResult = String(options.verificationResult ?? "").trim();
|
|
16104
|
+
const preventiveRule = options.preventiveRule ? String(options.preventiveRule).trim() : void 0;
|
|
16105
|
+
if (!id) {
|
|
16106
|
+
console.log("Missing required --id.");
|
|
16107
|
+
return;
|
|
16108
|
+
}
|
|
16109
|
+
if (!fixApplied) {
|
|
16110
|
+
console.log("Missing required --fix-applied.");
|
|
16111
|
+
return;
|
|
16112
|
+
}
|
|
16113
|
+
if (!verificationResult) {
|
|
16114
|
+
console.log("Missing required --verification-result.");
|
|
16115
|
+
return;
|
|
16116
|
+
}
|
|
16117
|
+
const closed = await orchestrator.storage.closeContinuityIncident(id, {
|
|
16118
|
+
fixApplied,
|
|
16119
|
+
verificationResult,
|
|
16120
|
+
preventiveRule
|
|
16121
|
+
});
|
|
16122
|
+
if (!closed) {
|
|
16123
|
+
console.log(`Incident not found: ${id}`);
|
|
16124
|
+
return;
|
|
16125
|
+
}
|
|
16126
|
+
console.log("Closed continuity incident:\n");
|
|
16127
|
+
console.log(formatContinuityIncidentCli(closed));
|
|
16128
|
+
});
|
|
15700
16129
|
cmd.command("access").description("Show memory access statistics").option("-n, --top <number>", "Show top N most accessed", "20").action(async (...args) => {
|
|
15701
16130
|
const options = args[0] ?? {};
|
|
15702
16131
|
const top = parseInt(options.top ?? "20", 10);
|