agent-remnote 1.1.0 → 1.2.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/CHANGELOG.md +11 -0
- package/README.md +19 -0
- package/dist/main.js +2097 -388
- package/package.json +4 -2
- package/plugin-artifacts/PluginZip.zip +0 -0
- package/plugin-artifacts/dist/README.md +50 -0
- package/plugin-artifacts/dist/blank-line-B2rM3oxN.js +1 -0
- package/plugin-artifacts/dist/index-4b5IDxii.js +3 -0
- package/plugin-artifacts/dist/index-BnR23rlw.js +12 -0
- package/plugin-artifacts/dist/index-BpbrUbge.js +20 -0
- package/plugin-artifacts/dist/index-CMP2i-HY.js +1 -0
- package/plugin-artifacts/dist/index-CTg2hlbS.js +58 -0
- package/plugin-artifacts/dist/index-Ch_qCilz.js +1 -0
- package/plugin-artifacts/dist/index-OYpYHp3Y.js +1 -0
- package/plugin-artifacts/dist/index-XfOTAlvl.js +5 -0
- package/plugin-artifacts/dist/index-dJjNfQvw.js +1 -0
- package/plugin-artifacts/dist/index-sandbox.css +1 -0
- package/plugin-artifacts/dist/index-sandbox.js +1 -0
- package/plugin-artifacts/dist/index.css +1 -0
- package/plugin-artifacts/dist/index.html +2 -0
- package/plugin-artifacts/dist/index.js +1 -0
- package/plugin-artifacts/dist/indexPlugin-DQCvhQLc.js +12 -0
- package/plugin-artifacts/dist/indexPlugin.css +1 -0
- package/plugin-artifacts/dist/jsx-runtime-D6ZSwAL5.js +8 -0
- package/plugin-artifacts/dist/manifest.json +29 -0
- package/plugin-artifacts/dist/sample_widget-sandbox.js +1 -0
- package/plugin-artifacts/dist/sample_widget.js +1 -0
- package/plugin-artifacts/dist/widget-bootstrap.js +52 -0
package/dist/main.js
CHANGED
|
@@ -75988,7 +75988,37 @@ var migration6 = {
|
|
|
75988
75988
|
};
|
|
75989
75989
|
|
|
75990
75990
|
// src/internal/store/migrations/index.ts
|
|
75991
|
-
var
|
|
75991
|
+
var BACKUP_ARTIFACTS_TABLE_SQL = `CREATE TABLE IF NOT EXISTS backup_artifacts (
|
|
75992
|
+
source_op_id TEXT PRIMARY KEY,
|
|
75993
|
+
source_txn TEXT NOT NULL,
|
|
75994
|
+
source_op_type TEXT NOT NULL CHECK (source_op_type IN ('replace_children_with_markdown','replace_selection_with_markdown')),
|
|
75995
|
+
backup_kind TEXT NOT NULL CHECK (backup_kind IN ('children_replace','selection_replace')),
|
|
75996
|
+
cleanup_policy TEXT NOT NULL CHECK (cleanup_policy IN ('auto','visible')),
|
|
75997
|
+
cleanup_state TEXT NOT NULL CHECK (cleanup_state IN ('pending','orphan','retained','cleaned')),
|
|
75998
|
+
backup_rem_id TEXT,
|
|
75999
|
+
source_parent_id TEXT,
|
|
76000
|
+
source_anchor_id TEXT,
|
|
76001
|
+
result_json TEXT NOT NULL DEFAULT '{}',
|
|
76002
|
+
created_at INTEGER NOT NULL,
|
|
76003
|
+
updated_at INTEGER NOT NULL,
|
|
76004
|
+
cleaned_at INTEGER
|
|
76005
|
+
);`;
|
|
76006
|
+
var IDX_BACKUP_ARTIFACTS_STATE_SQL = `CREATE INDEX IF NOT EXISTS idx_backup_artifacts_state ON backup_artifacts(cleanup_state, updated_at DESC);`;
|
|
76007
|
+
var IDX_BACKUP_ARTIFACTS_KIND_SQL = `CREATE INDEX IF NOT EXISTS idx_backup_artifacts_kind ON backup_artifacts(backup_kind, updated_at DESC);`;
|
|
76008
|
+
var UQ_BACKUP_ARTIFACTS_REM_SQL = `CREATE UNIQUE INDEX IF NOT EXISTS uq_backup_artifacts_backup_rem_id ON backup_artifacts(backup_rem_id) WHERE backup_rem_id IS NOT NULL;`;
|
|
76009
|
+
var m0007 = {
|
|
76010
|
+
version: 7,
|
|
76011
|
+
name: "add_backup_artifacts",
|
|
76012
|
+
checksumInput: [BACKUP_ARTIFACTS_TABLE_SQL, IDX_BACKUP_ARTIFACTS_STATE_SQL, IDX_BACKUP_ARTIFACTS_KIND_SQL, UQ_BACKUP_ARTIFACTS_REM_SQL].join(`
|
|
76013
|
+
`),
|
|
76014
|
+
apply: (db) => {
|
|
76015
|
+
db.exec(BACKUP_ARTIFACTS_TABLE_SQL);
|
|
76016
|
+
db.exec(IDX_BACKUP_ARTIFACTS_STATE_SQL);
|
|
76017
|
+
db.exec(IDX_BACKUP_ARTIFACTS_KIND_SQL);
|
|
76018
|
+
db.exec(UQ_BACKUP_ARTIFACTS_REM_SQL);
|
|
76019
|
+
}
|
|
76020
|
+
};
|
|
76021
|
+
var migrationSpecs = [migration, migration2, migration3, migration4, migration5, migration6, m0007];
|
|
75992
76022
|
|
|
75993
76023
|
// src/internal/store/db.ts
|
|
75994
76024
|
class StoreSchemaError extends Error {
|
|
@@ -76128,6 +76158,32 @@ CREATE UNIQUE INDEX IF NOT EXISTS uq_workspace_bindings_current
|
|
|
76128
76158
|
|
|
76129
76159
|
CREATE INDEX IF NOT EXISTS idx_workspace_bindings_updated_at
|
|
76130
76160
|
ON workspace_bindings(updated_at DESC);
|
|
76161
|
+
|
|
76162
|
+
CREATE TABLE IF NOT EXISTS backup_artifacts (
|
|
76163
|
+
source_op_id TEXT PRIMARY KEY,
|
|
76164
|
+
source_txn TEXT NOT NULL,
|
|
76165
|
+
source_op_type TEXT NOT NULL CHECK (source_op_type IN ('replace_children_with_markdown','replace_selection_with_markdown')),
|
|
76166
|
+
backup_kind TEXT NOT NULL CHECK (backup_kind IN ('children_replace','selection_replace')),
|
|
76167
|
+
cleanup_policy TEXT NOT NULL CHECK (cleanup_policy IN ('auto','visible')),
|
|
76168
|
+
cleanup_state TEXT NOT NULL CHECK (cleanup_state IN ('pending','orphan','retained','cleaned')),
|
|
76169
|
+
backup_rem_id TEXT,
|
|
76170
|
+
source_parent_id TEXT,
|
|
76171
|
+
source_anchor_id TEXT,
|
|
76172
|
+
result_json TEXT NOT NULL DEFAULT '{}',
|
|
76173
|
+
created_at INTEGER NOT NULL,
|
|
76174
|
+
updated_at INTEGER NOT NULL,
|
|
76175
|
+
cleaned_at INTEGER
|
|
76176
|
+
);
|
|
76177
|
+
|
|
76178
|
+
CREATE INDEX IF NOT EXISTS idx_backup_artifacts_state
|
|
76179
|
+
ON backup_artifacts(cleanup_state, updated_at DESC);
|
|
76180
|
+
|
|
76181
|
+
CREATE INDEX IF NOT EXISTS idx_backup_artifacts_kind
|
|
76182
|
+
ON backup_artifacts(backup_kind, updated_at DESC);
|
|
76183
|
+
|
|
76184
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_backup_artifacts_backup_rem_id
|
|
76185
|
+
ON backup_artifacts(backup_rem_id)
|
|
76186
|
+
WHERE backup_rem_id IS NOT NULL;
|
|
76131
76187
|
`;
|
|
76132
76188
|
function absoluteDefaultStorePath() {
|
|
76133
76189
|
return path12.join(homeDir(), ".agent-remnote", "store.sqlite");
|
|
@@ -76496,6 +76552,102 @@ function maybeInitializeDefaultStoreFromLegacy(resolvedStorePath, params3) {
|
|
|
76496
76552
|
} catch {}
|
|
76497
76553
|
}
|
|
76498
76554
|
}
|
|
76555
|
+
|
|
76556
|
+
// src/internal/store/index.ts
|
|
76557
|
+
function normalizeString(value8) {
|
|
76558
|
+
return typeof value8 === "string" ? value8.trim() : "";
|
|
76559
|
+
}
|
|
76560
|
+
function normalizeNullableString(value8) {
|
|
76561
|
+
const normalized = normalizeString(value8);
|
|
76562
|
+
return normalized || null;
|
|
76563
|
+
}
|
|
76564
|
+
function upsertBackupArtifact(db, params3) {
|
|
76565
|
+
const sourceOpId = normalizeString(params3.sourceOpId);
|
|
76566
|
+
const sourceTxn = normalizeString(params3.sourceTxn);
|
|
76567
|
+
const sourceOpType = normalizeString(params3.sourceOpType);
|
|
76568
|
+
if (!sourceOpId || !sourceTxn || !sourceOpType)
|
|
76569
|
+
return;
|
|
76570
|
+
const now2 = Number.isFinite(params3.now) ? Math.floor(params3.now) : Date.now();
|
|
76571
|
+
const existing = db.prepare(`SELECT created_at FROM backup_artifacts WHERE source_op_id=?`).get(sourceOpId);
|
|
76572
|
+
const createdAt = Number.isFinite(existing?.created_at) ? Math.floor(existing.created_at) : now2;
|
|
76573
|
+
const cleanedAt = params3.cleanedAt === null ? null : Number.isFinite(params3.cleanedAt) ? Math.floor(params3.cleanedAt) : params3.cleanupState === "cleaned" ? now2 : null;
|
|
76574
|
+
db.prepare(`INSERT INTO backup_artifacts(
|
|
76575
|
+
source_op_id, source_txn, source_op_type, backup_kind, cleanup_policy, cleanup_state,
|
|
76576
|
+
backup_rem_id, source_parent_id, source_anchor_id, result_json, created_at, updated_at, cleaned_at
|
|
76577
|
+
) VALUES (
|
|
76578
|
+
@source_op_id, @source_txn, @source_op_type, @backup_kind, @cleanup_policy, @cleanup_state,
|
|
76579
|
+
@backup_rem_id, @source_parent_id, @source_anchor_id, @result_json, @created_at, @updated_at, @cleaned_at
|
|
76580
|
+
)
|
|
76581
|
+
ON CONFLICT(source_op_id) DO UPDATE SET
|
|
76582
|
+
source_txn=excluded.source_txn,
|
|
76583
|
+
source_op_type=excluded.source_op_type,
|
|
76584
|
+
backup_kind=excluded.backup_kind,
|
|
76585
|
+
cleanup_policy=excluded.cleanup_policy,
|
|
76586
|
+
cleanup_state=excluded.cleanup_state,
|
|
76587
|
+
backup_rem_id=excluded.backup_rem_id,
|
|
76588
|
+
source_parent_id=excluded.source_parent_id,
|
|
76589
|
+
source_anchor_id=excluded.source_anchor_id,
|
|
76590
|
+
result_json=excluded.result_json,
|
|
76591
|
+
updated_at=excluded.updated_at,
|
|
76592
|
+
cleaned_at=excluded.cleaned_at`).run({
|
|
76593
|
+
source_op_id: sourceOpId,
|
|
76594
|
+
source_txn: sourceTxn,
|
|
76595
|
+
source_op_type: sourceOpType,
|
|
76596
|
+
backup_kind: params3.backupKind,
|
|
76597
|
+
cleanup_policy: params3.cleanupPolicy,
|
|
76598
|
+
cleanup_state: params3.cleanupState,
|
|
76599
|
+
backup_rem_id: normalizeNullableString(params3.backupRemId),
|
|
76600
|
+
source_parent_id: normalizeNullableString(params3.sourceParentId),
|
|
76601
|
+
source_anchor_id: normalizeNullableString(params3.sourceAnchorId),
|
|
76602
|
+
result_json: JSON.stringify(params3.result ?? {}),
|
|
76603
|
+
created_at: createdAt,
|
|
76604
|
+
updated_at: now2,
|
|
76605
|
+
cleaned_at: cleanedAt
|
|
76606
|
+
});
|
|
76607
|
+
}
|
|
76608
|
+
function listBackupArtifacts(db, params3) {
|
|
76609
|
+
const states = Array.isArray(params3?.states) && params3.states.length > 0 ? Array.from(new Set(params3.states)) : [];
|
|
76610
|
+
const kinds = Array.isArray(params3?.kinds) && params3.kinds.length > 0 ? Array.from(new Set(params3.kinds)) : [];
|
|
76611
|
+
const limitRaw = Number(params3?.limit ?? 100);
|
|
76612
|
+
const limit = Number.isFinite(limitRaw) && limitRaw > 0 ? Math.min(500, Math.floor(limitRaw)) : 100;
|
|
76613
|
+
const where = [];
|
|
76614
|
+
const args2 = [];
|
|
76615
|
+
if (!params3?.includeCleaned && states.length === 0) {
|
|
76616
|
+
where.push(`cleanup_state != 'cleaned'`);
|
|
76617
|
+
}
|
|
76618
|
+
if (states.length > 0) {
|
|
76619
|
+
where.push(`cleanup_state IN (${states.map(() => "?").join(", ")})`);
|
|
76620
|
+
args2.push(...states);
|
|
76621
|
+
}
|
|
76622
|
+
if (kinds.length > 0) {
|
|
76623
|
+
where.push(`backup_kind IN (${kinds.map(() => "?").join(", ")})`);
|
|
76624
|
+
args2.push(...kinds);
|
|
76625
|
+
}
|
|
76626
|
+
const backupRemId = normalizeString(params3?.backupRemId);
|
|
76627
|
+
if (backupRemId) {
|
|
76628
|
+
where.push(`backup_rem_id = ?`);
|
|
76629
|
+
args2.push(backupRemId);
|
|
76630
|
+
}
|
|
76631
|
+
const olderThanHours = Number(params3?.olderThanHours);
|
|
76632
|
+
if (Number.isFinite(olderThanHours) && olderThanHours > 0) {
|
|
76633
|
+
where.push(`created_at <= ?`);
|
|
76634
|
+
args2.push(Date.now() - Math.floor(olderThanHours * 60 * 60 * 1000));
|
|
76635
|
+
}
|
|
76636
|
+
const sql = `SELECT * FROM backup_artifacts` + (where.length > 0 ? ` WHERE ${where.join(" AND ")}` : "") + ` ORDER BY updated_at DESC LIMIT ${limit}`;
|
|
76637
|
+
return db.prepare(sql).all(...args2);
|
|
76638
|
+
}
|
|
76639
|
+
function updateBackupArtifactsCleanupState(db, params3) {
|
|
76640
|
+
const sourceOpIds = Array.from(new Set(params3.sourceOpIds.map((item) => normalizeString(item)).filter(Boolean)));
|
|
76641
|
+
if (sourceOpIds.length === 0)
|
|
76642
|
+
return 0;
|
|
76643
|
+
const now2 = Number.isFinite(params3.now) ? Math.floor(params3.now) : Date.now();
|
|
76644
|
+
const cleanedAt = params3.cleanupState === "cleaned" ? now2 : null;
|
|
76645
|
+
const result = db.prepare(`UPDATE backup_artifacts
|
|
76646
|
+
SET cleanup_state=?, updated_at=?, cleaned_at=?
|
|
76647
|
+
WHERE source_op_id IN (${sourceOpIds.map(() => "?").join(", ")})`).run(params3.cleanupState, now2, cleanedAt, ...sourceOpIds);
|
|
76648
|
+
return Number(result.changes ?? 0);
|
|
76649
|
+
}
|
|
76650
|
+
|
|
76499
76651
|
// src/internal/queue/db.ts
|
|
76500
76652
|
class QueueSchemaError extends Error {
|
|
76501
76653
|
_tag = "QueueSchemaError";
|
|
@@ -76610,10 +76762,16 @@ var OP_CATALOG = {
|
|
|
76610
76762
|
delete_rem: {
|
|
76611
76763
|
op_type: "delete_rem",
|
|
76612
76764
|
aliases: ["rem.delete"],
|
|
76613
|
-
payload: { required: ["rem_id"], optional: [] },
|
|
76765
|
+
payload: { required: ["rem_id"], optional: ["max_delete_subtree_nodes"] },
|
|
76614
76766
|
description: "Delete a Rem.",
|
|
76615
76767
|
id_fields: ["rem_id"]
|
|
76616
76768
|
},
|
|
76769
|
+
delete_backup_artifact: {
|
|
76770
|
+
op_type: "delete_backup_artifact",
|
|
76771
|
+
payload: { required: ["rem_id"], optional: ["max_delete_subtree_nodes"] },
|
|
76772
|
+
description: "Delete a backup artifact and verify the Rem is actually gone.",
|
|
76773
|
+
id_fields: ["rem_id"]
|
|
76774
|
+
},
|
|
76617
76775
|
create_single_rem_with_markdown: {
|
|
76618
76776
|
op_type: "create_single_rem_with_markdown",
|
|
76619
76777
|
aliases: ["rem.createSingleWithMarkdown"],
|
|
@@ -76644,7 +76802,7 @@ var OP_CATALOG = {
|
|
|
76644
76802
|
op_type: "replace_children_with_markdown",
|
|
76645
76803
|
payload: {
|
|
76646
76804
|
required: ["parent_id", "markdown"],
|
|
76647
|
-
optional: ["indent_mode", "indent_size", "parse_mode", "prepared", "staged", "bundle"]
|
|
76805
|
+
optional: ["indent_mode", "indent_size", "parse_mode", "prepared", "staged", "bundle", "backup", "assertions"]
|
|
76648
76806
|
},
|
|
76649
76807
|
description: "Replace the direct children of a Rem with Markdown.",
|
|
76650
76808
|
id_fields: ["parent_id"]
|
|
@@ -76872,7 +77030,7 @@ function isCreateOp(opType) {
|
|
|
76872
77030
|
return opType.startsWith("create_") || opType === "create_tree_with_markdown" || opType === "create_single_rem_with_markdown" || opType === "create_link_rem";
|
|
76873
77031
|
}
|
|
76874
77032
|
function isStructureOp(opType) {
|
|
76875
|
-
return opType === "move_rem" || opType === "delete_rem" || opType === "replace_selection_with_markdown" || opType === "replace_children_with_markdown";
|
|
77033
|
+
return opType === "move_rem" || opType === "delete_rem" || opType === "delete_backup_artifact" || opType === "replace_selection_with_markdown" || opType === "replace_children_with_markdown";
|
|
76876
77034
|
}
|
|
76877
77035
|
function deriveConflictKeys(opTypeRaw, payload) {
|
|
76878
77036
|
const opType = canonicalizeOpType(opTypeRaw);
|
|
@@ -77463,11 +77621,11 @@ function riskScore(risk) {
|
|
|
77463
77621
|
}
|
|
77464
77622
|
}
|
|
77465
77623
|
function computeConflictClusterRisk(params3) {
|
|
77466
|
-
const hasDelete = params3.opTypes.has("delete_rem");
|
|
77624
|
+
const hasDelete = params3.opTypes.has("delete_rem") || params3.opTypes.has("delete_backup_artifact");
|
|
77467
77625
|
if (hasDelete && params3.opCount > 0) {
|
|
77468
77626
|
return {
|
|
77469
77627
|
risk: "high",
|
|
77470
|
-
note: "
|
|
77628
|
+
note: "destructive delete op mixed with other ops; execution order matters and may require manual review"
|
|
77471
77629
|
};
|
|
77472
77630
|
}
|
|
77473
77631
|
if (params3.conflictKey.startsWith("global:")) {
|
|
@@ -77857,6 +78015,21 @@ function handleOpAckMessage(params3) {
|
|
|
77857
78015
|
}
|
|
77858
78016
|
}
|
|
77859
78017
|
];
|
|
78018
|
+
try {
|
|
78019
|
+
syncBackupArtifactFromAck(params3.db, {
|
|
78020
|
+
now: params3.now,
|
|
78021
|
+
opId,
|
|
78022
|
+
status: status2,
|
|
78023
|
+
result: params3.msg?.result ?? null
|
|
78024
|
+
});
|
|
78025
|
+
} catch (error4) {
|
|
78026
|
+
actions.push({
|
|
78027
|
+
_tag: "Log",
|
|
78028
|
+
level: "warn",
|
|
78029
|
+
event: "backup_artifact_sync_failed",
|
|
78030
|
+
details: { connId: params3.connId, opId, attemptId, status: status2, error: String(error4) }
|
|
78031
|
+
});
|
|
78032
|
+
}
|
|
77860
78033
|
if (status2 === "success" && ackRes.duplicate === false) {
|
|
77861
78034
|
try {
|
|
77862
78035
|
const mappings = [];
|
|
@@ -77950,6 +78123,36 @@ function handleOpAckMessage(params3) {
|
|
|
77950
78123
|
});
|
|
77951
78124
|
return { actions, touchAckTimestamp: true, invalidateStatusLineReason: "op_acked" };
|
|
77952
78125
|
}
|
|
78126
|
+
function syncBackupArtifactFromAck(db, params3) {
|
|
78127
|
+
const opRow = db.prepare(`SELECT txn_id, type, payload_json FROM queue_ops WHERE op_id=?`).get(params3.opId);
|
|
78128
|
+
const opType = typeof opRow?.type === "string" ? opRow.type : "";
|
|
78129
|
+
if (opType !== "replace_children_with_markdown" && opType !== "replace_selection_with_markdown")
|
|
78130
|
+
return;
|
|
78131
|
+
let payload = {};
|
|
78132
|
+
try {
|
|
78133
|
+
payload = JSON.parse(String(opRow?.payload_json ?? "{}"));
|
|
78134
|
+
} catch {}
|
|
78135
|
+
const backupPolicy = typeof payload?.backup === "string" && payload.backup.trim() === "visible" ? "visible" : "auto";
|
|
78136
|
+
const backupKind = opType === "replace_children_with_markdown" ? "children_replace" : "selection_replace";
|
|
78137
|
+
const backupRemId = typeof params3.result?.backup_rem_id === "string" && params3.result.backup_rem_id.trim() ? params3.result.backup_rem_id.trim() : null;
|
|
78138
|
+
const cleanupState = params3.status === "success" ? backupPolicy === "visible" && backupRemId ? "retained" : backupRemId ? params3.result?.backup_hidden === true || params3.result?.backup_cleanup_state === "pending" ? "pending" : "orphan" : "cleaned" : backupRemId ? backupPolicy === "visible" ? "retained" : params3.status === "retry" ? "pending" : "orphan" : null;
|
|
78139
|
+
if (!cleanupState)
|
|
78140
|
+
return;
|
|
78141
|
+
upsertBackupArtifact(db, {
|
|
78142
|
+
sourceOpId: params3.opId,
|
|
78143
|
+
sourceTxn: typeof opRow?.txn_id === "string" ? opRow.txn_id : "",
|
|
78144
|
+
sourceOpType: opType,
|
|
78145
|
+
backupKind,
|
|
78146
|
+
cleanupPolicy: backupPolicy,
|
|
78147
|
+
cleanupState,
|
|
78148
|
+
backupRemId,
|
|
78149
|
+
sourceParentId: typeof params3.result?.parent_id === "string" ? params3.result.parent_id : typeof payload?.parent_id === "string" ? payload.parent_id : null,
|
|
78150
|
+
sourceAnchorId: opType === "replace_children_with_markdown" ? typeof payload?.parent_id === "string" ? payload.parent_id : null : Array.isArray(params3.result?.selection_rem_ids) ? String(params3.result.selection_rem_ids[0] ?? "") : Array.isArray(payload?.target?.rem_ids) ? String(payload.target.rem_ids[0] ?? "") : null,
|
|
78151
|
+
result: params3.result ?? {},
|
|
78152
|
+
now: params3.now,
|
|
78153
|
+
cleanedAt: cleanupState === "cleaned" ? params3.now : null
|
|
78154
|
+
});
|
|
78155
|
+
}
|
|
77953
78156
|
// src/kernel/op-catalog/idFields.ts
|
|
77954
78157
|
function idFieldPathsForOpType(opTypeRaw) {
|
|
77955
78158
|
const opType = canonicalizeOpType(opTypeRaw);
|
|
@@ -93473,6 +93676,11 @@ function requireOkUiContext(snapshot2) {
|
|
|
93473
93676
|
}
|
|
93474
93677
|
// src/kernel/write-plan/compile.ts
|
|
93475
93678
|
var ALIAS_RE = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
|
|
93679
|
+
var WRITE_STRUCTURE_ASSERTIONS = new Set([
|
|
93680
|
+
"single-root",
|
|
93681
|
+
"preserve-anchor",
|
|
93682
|
+
"no-literal-bullet"
|
|
93683
|
+
]);
|
|
93476
93684
|
function getObject(value8) {
|
|
93477
93685
|
return value8 && typeof value8 === "object" && !Array.isArray(value8) ? value8 : null;
|
|
93478
93686
|
}
|
|
@@ -93686,6 +93894,16 @@ var ACTIONS = {
|
|
|
93686
93894
|
}
|
|
93687
93895
|
const payload = { parent_id: rem_id, markdown };
|
|
93688
93896
|
Object.assign(payload, buildMarkdownPayloadFields(input));
|
|
93897
|
+
if (typeof input.backup === "string")
|
|
93898
|
+
payload.backup = input.backup;
|
|
93899
|
+
if (Array.isArray(input.assertions)) {
|
|
93900
|
+
const assertions = input.assertions;
|
|
93901
|
+
const valid = assertions.every((value8) => typeof value8 === "string" && WRITE_STRUCTURE_ASSERTIONS.has(value8));
|
|
93902
|
+
if (!valid) {
|
|
93903
|
+
throw new Error("rem.children.replace input.assertions must only include: single-root, preserve-anchor, no-literal-bullet");
|
|
93904
|
+
}
|
|
93905
|
+
payload.assertions = assertions;
|
|
93906
|
+
}
|
|
93689
93907
|
return { ops: [{ type: "replace_children_with_markdown", payload }] };
|
|
93690
93908
|
}
|
|
93691
93909
|
},
|
|
@@ -93814,6 +94032,100 @@ function compileWritePlanV1(plan, params3) {
|
|
|
93814
94032
|
}
|
|
93815
94033
|
return { alias_map: aliasMap, ops };
|
|
93816
94034
|
}
|
|
94035
|
+
// src/kernel/write-plan/shape.ts
|
|
94036
|
+
var STRUCTURED_MARKDOWN_LINE_RE = /^\s{0,3}(?:#{1,6}\s+\S|[-*+]\s+\S|\d+\.\s+\S|```|~~~)/m;
|
|
94037
|
+
var ROOT_HEADING_RE = /^#{1,6}\s+\S/;
|
|
94038
|
+
var ROOT_LIST_ITEM_RE = /^(?:[-*+]|\d+\.)\s+\S/;
|
|
94039
|
+
function looksLikeStructuredMarkdown(input) {
|
|
94040
|
+
const normalized = input.replace(/\r\n?/g, `
|
|
94041
|
+
`).trim();
|
|
94042
|
+
if (!normalized)
|
|
94043
|
+
return false;
|
|
94044
|
+
return STRUCTURED_MARKDOWN_LINE_RE.test(normalized);
|
|
94045
|
+
}
|
|
94046
|
+
function trimBoundaryBlankLinesLocal(input) {
|
|
94047
|
+
const normalized = input.replace(/\r\n?/g, `
|
|
94048
|
+
`);
|
|
94049
|
+
const lines3 = normalized.split(`
|
|
94050
|
+
`);
|
|
94051
|
+
let start4 = 0;
|
|
94052
|
+
while (start4 < lines3.length && lines3[start4]?.trim().length === 0)
|
|
94053
|
+
start4 += 1;
|
|
94054
|
+
if (start4 >= lines3.length)
|
|
94055
|
+
return "";
|
|
94056
|
+
let end6 = lines3.length - 1;
|
|
94057
|
+
while (end6 >= start4 && lines3[end6]?.trim().length === 0)
|
|
94058
|
+
end6 -= 1;
|
|
94059
|
+
if (end6 < start4)
|
|
94060
|
+
return "";
|
|
94061
|
+
let inFence = false;
|
|
94062
|
+
for (let i = start4;i <= end6; i += 1) {
|
|
94063
|
+
if (/^\s*```/.test(lines3[i] ?? ""))
|
|
94064
|
+
inFence = !inFence;
|
|
94065
|
+
}
|
|
94066
|
+
const keptEnd = inFence ? lines3.length - 1 : end6;
|
|
94067
|
+
return lines3.slice(start4, keptEnd + 1).join(`
|
|
94068
|
+
`);
|
|
94069
|
+
}
|
|
94070
|
+
function countTopLevelMarkdownRoots(input) {
|
|
94071
|
+
const normalized = trimBoundaryBlankLinesLocal(input.replace(/\r\n?/g, `
|
|
94072
|
+
`));
|
|
94073
|
+
if (!normalized)
|
|
94074
|
+
return 0;
|
|
94075
|
+
const lines3 = normalized.split(`
|
|
94076
|
+
`);
|
|
94077
|
+
const commonIndent = lines3.filter((line4) => line4.trim().length > 0).reduce((min5, line4) => {
|
|
94078
|
+
const indent3 = line4.match(/^[ \t]*/)?.[0].length ?? 0;
|
|
94079
|
+
return min5 === null ? indent3 : Math.min(min5, indent3);
|
|
94080
|
+
}, null) ?? 0;
|
|
94081
|
+
let inFence = false;
|
|
94082
|
+
let count4 = 0;
|
|
94083
|
+
for (const rawLine of lines3) {
|
|
94084
|
+
const line4 = rawLine.slice(commonIndent);
|
|
94085
|
+
if (/^\s*(```|~~~)/.test(line4)) {
|
|
94086
|
+
inFence = !inFence;
|
|
94087
|
+
continue;
|
|
94088
|
+
}
|
|
94089
|
+
if (inFence)
|
|
94090
|
+
continue;
|
|
94091
|
+
const trimmed2 = line4.trim();
|
|
94092
|
+
if (!trimmed2)
|
|
94093
|
+
continue;
|
|
94094
|
+
if (/^[ \t]/.test(line4))
|
|
94095
|
+
continue;
|
|
94096
|
+
if (ROOT_HEADING_RE.test(trimmed2)) {
|
|
94097
|
+
count4 += 1;
|
|
94098
|
+
continue;
|
|
94099
|
+
}
|
|
94100
|
+
if (ROOT_LIST_ITEM_RE.test(trimmed2))
|
|
94101
|
+
count4 += 1;
|
|
94102
|
+
}
|
|
94103
|
+
return count4;
|
|
94104
|
+
}
|
|
94105
|
+
function decideOutlineWriteShape(params3) {
|
|
94106
|
+
if (params3.preserveAnchor === true) {
|
|
94107
|
+
return {
|
|
94108
|
+
shape: "expand_in_place",
|
|
94109
|
+
outline_suitable: true,
|
|
94110
|
+
top_level_roots: 0
|
|
94111
|
+
};
|
|
94112
|
+
}
|
|
94113
|
+
const markdown = typeof params3.markdown === "string" ? params3.markdown : "";
|
|
94114
|
+
const topLevelRoots = countTopLevelMarkdownRoots(markdown);
|
|
94115
|
+
const structured = looksLikeStructuredMarkdown(markdown);
|
|
94116
|
+
if (structured && topLevelRoots === 1) {
|
|
94117
|
+
return {
|
|
94118
|
+
shape: "single_root_outline",
|
|
94119
|
+
outline_suitable: true,
|
|
94120
|
+
top_level_roots: 1
|
|
94121
|
+
};
|
|
94122
|
+
}
|
|
94123
|
+
return {
|
|
94124
|
+
shape: "normal",
|
|
94125
|
+
outline_suitable: false,
|
|
94126
|
+
top_level_roots: topLevelRoots
|
|
94127
|
+
};
|
|
94128
|
+
}
|
|
93817
94129
|
// src/services/Payload.ts
|
|
93818
94130
|
import { promises as fs17 } from "node:fs";
|
|
93819
94131
|
class Payload extends Tag2("Payload")() {
|
|
@@ -95202,13 +95514,54 @@ function trimBoundaryBlankLines(input) {
|
|
|
95202
95514
|
return lines3.slice(start4, keptEnd + 1).join(`
|
|
95203
95515
|
`);
|
|
95204
95516
|
}
|
|
95205
|
-
var
|
|
95206
|
-
|
|
95517
|
+
var STRUCTURED_MARKDOWN_LINE_RE2 = /^\s{0,3}(?:#{1,6}\s+\S|[-*+]\s+\S|\d+\.\s+\S|```|~~~)/m;
|
|
95518
|
+
var ROOT_HEADING_RE2 = /^#{1,6}\s+\S/;
|
|
95519
|
+
var ROOT_LIST_ITEM_RE2 = /^(?:[-*+]|\d+\.)\s+\S/;
|
|
95520
|
+
function looksLikeStructuredMarkdown2(input) {
|
|
95207
95521
|
const normalized = input.replace(/\r\n?/g, `
|
|
95208
95522
|
`).trim();
|
|
95209
95523
|
if (!normalized)
|
|
95210
95524
|
return false;
|
|
95211
|
-
return
|
|
95525
|
+
return STRUCTURED_MARKDOWN_LINE_RE2.test(normalized);
|
|
95526
|
+
}
|
|
95527
|
+
function countTopLevelMarkdownRoots2(input) {
|
|
95528
|
+
const normalized = trimBoundaryBlankLines(input.replace(/\r\n?/g, `
|
|
95529
|
+
`));
|
|
95530
|
+
if (!normalized)
|
|
95531
|
+
return 0;
|
|
95532
|
+
const lines3 = normalized.split(`
|
|
95533
|
+
`);
|
|
95534
|
+
const commonIndent = lines3.filter((line4) => line4.trim().length > 0).reduce((min5, line4) => {
|
|
95535
|
+
const indent3 = line4.match(/^[ \t]*/)?.[0].length ?? 0;
|
|
95536
|
+
return min5 === null ? indent3 : Math.min(min5, indent3);
|
|
95537
|
+
}, null) ?? 0;
|
|
95538
|
+
let inFence = false;
|
|
95539
|
+
let count4 = 0;
|
|
95540
|
+
for (const rawLine of lines3) {
|
|
95541
|
+
const line4 = rawLine.slice(commonIndent);
|
|
95542
|
+
if (/^\s*(```|~~~)/.test(line4)) {
|
|
95543
|
+
inFence = !inFence;
|
|
95544
|
+
continue;
|
|
95545
|
+
}
|
|
95546
|
+
if (inFence)
|
|
95547
|
+
continue;
|
|
95548
|
+
const trimmed2 = line4.trim();
|
|
95549
|
+
if (!trimmed2)
|
|
95550
|
+
continue;
|
|
95551
|
+
if (/^[ \t]/.test(line4))
|
|
95552
|
+
continue;
|
|
95553
|
+
if (ROOT_HEADING_RE2.test(trimmed2)) {
|
|
95554
|
+
count4 += 1;
|
|
95555
|
+
continue;
|
|
95556
|
+
}
|
|
95557
|
+
if (ROOT_LIST_ITEM_RE2.test(trimmed2)) {
|
|
95558
|
+
count4 += 1;
|
|
95559
|
+
}
|
|
95560
|
+
}
|
|
95561
|
+
return count4;
|
|
95562
|
+
}
|
|
95563
|
+
function isSingleRootOutlineMarkdown(input) {
|
|
95564
|
+
return countTopLevelMarkdownRoots2(input) === 1;
|
|
95212
95565
|
}
|
|
95213
95566
|
|
|
95214
95567
|
// src/lib/hostApiUseCases.ts
|
|
@@ -95301,24 +95654,91 @@ function executeReadOutlineUseCase(params3) {
|
|
|
95301
95654
|
if (!resolvedId) {
|
|
95302
95655
|
return yield* fail8(new CliError({ code: "INVALID_ARGS", message: "You must provide --id or --ref", exitCode: 2 }));
|
|
95303
95656
|
}
|
|
95304
|
-
|
|
95657
|
+
const activeBackupRemIds = yield* sync3(() => {
|
|
95658
|
+
const db = openStoreDb(cfg.storeDb);
|
|
95659
|
+
try {
|
|
95660
|
+
return new Set(listBackupArtifacts(db, { includeCleaned: false, limit: 1000 }).map((item) => String(item.backup_rem_id ?? "").trim()).filter(Boolean));
|
|
95661
|
+
} finally {
|
|
95662
|
+
db.close();
|
|
95663
|
+
}
|
|
95664
|
+
}).pipe(catchAll2(() => succeed8(new Set)));
|
|
95665
|
+
const result = yield* tryPromise2({
|
|
95305
95666
|
try: async () => await executeOutlineRemSubtree({
|
|
95306
95667
|
id: resolvedId,
|
|
95307
95668
|
dbPath: cfg.remnoteDb ?? workspace.dbPath,
|
|
95308
95669
|
maxDepth: params3.depth,
|
|
95309
95670
|
startOffset: params3.offset,
|
|
95310
95671
|
maxNodes: params3.nodes,
|
|
95311
|
-
format:
|
|
95672
|
+
format: "json",
|
|
95312
95673
|
excludeProperties: params3.excludeProperties === true,
|
|
95313
95674
|
includeEmpty: params3.includeEmpty === true,
|
|
95314
95675
|
expandReferences: params3.expandReferences === false ? false : undefined,
|
|
95315
95676
|
maxReferenceDepth: params3.maxReferenceDepth,
|
|
95316
|
-
detail:
|
|
95677
|
+
detail: true
|
|
95317
95678
|
}),
|
|
95318
95679
|
catch: (error4) => cliErrorFromUnknown(error4, { code: "DB_UNAVAILABLE" })
|
|
95319
95680
|
});
|
|
95681
|
+
if (activeBackupRemIds.size === 0) {
|
|
95682
|
+
if (params3.format === "json")
|
|
95683
|
+
return result;
|
|
95684
|
+
const tree2 = Array.isArray(result.tree) ? result.tree : [];
|
|
95685
|
+
return {
|
|
95686
|
+
...result,
|
|
95687
|
+
markdown: outlineNodesToMarkdown(tree2),
|
|
95688
|
+
...params3.detail === true ? {} : { tree: simplifyOutlineTree(tree2) }
|
|
95689
|
+
};
|
|
95690
|
+
}
|
|
95691
|
+
const tree = Array.isArray(result.tree) ? result.tree : [];
|
|
95692
|
+
const filteredTree = filterOutlineTreeByHiddenBackupSubtrees(tree, activeBackupRemIds, resolvedId);
|
|
95693
|
+
const filtered = {
|
|
95694
|
+
...result,
|
|
95695
|
+
nodeCount: filteredTree.length,
|
|
95696
|
+
totalNodeCount: filteredTree.length,
|
|
95697
|
+
hasMore: Boolean(result.hasMore),
|
|
95698
|
+
nextOffset: result.nextOffset ?? null,
|
|
95699
|
+
markdown: outlineNodesToMarkdown(filteredTree),
|
|
95700
|
+
tree: params3.detail === true ? filteredTree : simplifyOutlineTree(filteredTree)
|
|
95701
|
+
};
|
|
95702
|
+
if (params3.format === "json")
|
|
95703
|
+
return filtered;
|
|
95704
|
+
return filtered;
|
|
95320
95705
|
});
|
|
95321
95706
|
}
|
|
95707
|
+
function filterOutlineTreeByHiddenBackupSubtrees(tree, hiddenIds, rootId) {
|
|
95708
|
+
const out = [];
|
|
95709
|
+
let skipDepth = null;
|
|
95710
|
+
for (const node of tree) {
|
|
95711
|
+
const depth = Number(node?.depth ?? 0);
|
|
95712
|
+
if (skipDepth !== null) {
|
|
95713
|
+
if (depth > skipDepth)
|
|
95714
|
+
continue;
|
|
95715
|
+
skipDepth = null;
|
|
95716
|
+
}
|
|
95717
|
+
const id2 = typeof node?.id === "string" ? node.id : "";
|
|
95718
|
+
if (id2 && id2 !== rootId && hiddenIds.has(id2)) {
|
|
95719
|
+
skipDepth = depth;
|
|
95720
|
+
continue;
|
|
95721
|
+
}
|
|
95722
|
+
out.push(node);
|
|
95723
|
+
}
|
|
95724
|
+
return out;
|
|
95725
|
+
}
|
|
95726
|
+
function outlineNodesToMarkdown(nodes) {
|
|
95727
|
+
return nodes.map((node) => {
|
|
95728
|
+
const depth = Number(node?.depth ?? 0);
|
|
95729
|
+
const text14 = typeof node?.text === "string" && node.text.trim() ? node.text : "(empty)";
|
|
95730
|
+
return `${" ".repeat(Math.max(0, depth))}- ${text14}`;
|
|
95731
|
+
}).join(`
|
|
95732
|
+
`);
|
|
95733
|
+
}
|
|
95734
|
+
function simplifyOutlineTree(nodes) {
|
|
95735
|
+
return nodes.map((node) => ({
|
|
95736
|
+
id: node.id,
|
|
95737
|
+
depth: node.depth,
|
|
95738
|
+
text: node.text,
|
|
95739
|
+
references: Array.isArray(node.references) ? node.references : []
|
|
95740
|
+
}));
|
|
95741
|
+
}
|
|
95322
95742
|
function executeDailyRemIdUseCase(params3) {
|
|
95323
95743
|
return gen2(function* () {
|
|
95324
95744
|
if (params3.date && params3.offsetDays !== undefined) {
|
|
@@ -96013,7 +96433,7 @@ var dailyWriteCommand = exports_Command.make("write", {
|
|
|
96013
96433
|
const markdownRaw = markdownInput !== undefined ? yield* readMarkdownTextFromInputSpec(markdownInput) : undefined;
|
|
96014
96434
|
const markdownValue = markdownRaw !== undefined ? trimBoundaryBlankLines(markdownRaw) : undefined;
|
|
96015
96435
|
const textValue = text15 !== undefined ? trimBoundaryBlankLines(text15) : undefined;
|
|
96016
|
-
if (textValue && !forceText2 &&
|
|
96436
|
+
if (textValue && !forceText2 && looksLikeStructuredMarkdown2(textValue)) {
|
|
96017
96437
|
return yield* fail8(new CliError({
|
|
96018
96438
|
code: "INVALID_ARGS",
|
|
96019
96439
|
message: "Input passed to --text looks like structured Markdown. Use --markdown instead.",
|
|
@@ -96036,7 +96456,8 @@ var dailyWriteCommand = exports_Command.make("write", {
|
|
|
96036
96456
|
const lines3 = content.split(`
|
|
96037
96457
|
`).length;
|
|
96038
96458
|
const chars = content.length;
|
|
96039
|
-
const
|
|
96459
|
+
const writeShape = decideOutlineWriteShape({ markdown: markdownValue });
|
|
96460
|
+
const shouldBundle = bulkMode === "always" || bulkMode === "auto" && (hasBundleTitle || (lines3 >= BULK_THRESHOLD_LINES || chars >= BULK_THRESHOLD_CHARS) && !(markdownValue !== undefined && !hasBundleTitle && writeShape.shape === "single_root_outline" && isSingleRootOutlineMarkdown(markdownValue)));
|
|
96040
96461
|
const metaValue = meta ? yield* payloadSvc.readJson(meta) : undefined;
|
|
96041
96462
|
const body = {
|
|
96042
96463
|
version: 1,
|
|
@@ -96321,6 +96742,200 @@ var readDbCommand = exports_Command.make("db", {}).pipe(exports_Command.withSubc
|
|
|
96321
96742
|
// src/commands/db/index.ts
|
|
96322
96743
|
var dbCommand = readDbCommand;
|
|
96323
96744
|
|
|
96745
|
+
// src/commands/backup/cleanup.ts
|
|
96746
|
+
function optionToUndefined14(opt) {
|
|
96747
|
+
return isSome2(opt) ? opt.value : undefined;
|
|
96748
|
+
}
|
|
96749
|
+
var backupCleanupCommand = exports_Command.make("cleanup", {
|
|
96750
|
+
apply: boolean8("apply"),
|
|
96751
|
+
backupRemId: text9("backup-rem-id").pipe(optional5, map34(optionToUndefined14)),
|
|
96752
|
+
maxDeleteSubtreeNodes: integer7("max-delete-subtree-nodes").pipe(optional5, map34(optionToUndefined14)),
|
|
96753
|
+
state: choice5("state", ["pending", "orphan", "retained", "cleaned"]).pipe(repeated5),
|
|
96754
|
+
kind: choice5("kind", ["children_replace", "selection_replace"]).pipe(repeated5),
|
|
96755
|
+
olderThanHours: integer7("older-than-hours").pipe(optional5, map34(optionToUndefined14)),
|
|
96756
|
+
limit: integer7("limit").pipe(withDefault5(100)),
|
|
96757
|
+
wait: boolean8("wait"),
|
|
96758
|
+
timeoutMs: integer7("timeout-ms").pipe(optional5, map34(optionToUndefined14)),
|
|
96759
|
+
pollMs: integer7("poll-ms").pipe(optional5, map34(optionToUndefined14)),
|
|
96760
|
+
notify: boolean8("no-notify").pipe(map34((value8) => !value8)),
|
|
96761
|
+
ensureDaemon: boolean8("no-ensure-daemon").pipe(map34((value8) => !value8))
|
|
96762
|
+
}, ({
|
|
96763
|
+
apply,
|
|
96764
|
+
backupRemId,
|
|
96765
|
+
maxDeleteSubtreeNodes,
|
|
96766
|
+
state,
|
|
96767
|
+
kind,
|
|
96768
|
+
olderThanHours,
|
|
96769
|
+
limit: limit2,
|
|
96770
|
+
wait: wait2,
|
|
96771
|
+
timeoutMs: timeoutMs2,
|
|
96772
|
+
pollMs: pollMs2,
|
|
96773
|
+
notify: notify2,
|
|
96774
|
+
ensureDaemon: ensureDaemon3
|
|
96775
|
+
}) => gen2(function* () {
|
|
96776
|
+
if (maxDeleteSubtreeNodes !== undefined && maxDeleteSubtreeNodes <= 0) {
|
|
96777
|
+
return yield* fail8(new CliError({
|
|
96778
|
+
code: "INVALID_ARGS",
|
|
96779
|
+
message: "--max-delete-subtree-nodes must be >= 1",
|
|
96780
|
+
exitCode: 2
|
|
96781
|
+
}));
|
|
96782
|
+
}
|
|
96783
|
+
if (olderThanHours !== undefined && olderThanHours < 0) {
|
|
96784
|
+
return yield* fail8(new CliError({
|
|
96785
|
+
code: "INVALID_ARGS",
|
|
96786
|
+
message: "--older-than-hours must be a non-negative integer",
|
|
96787
|
+
exitCode: 2
|
|
96788
|
+
}));
|
|
96789
|
+
}
|
|
96790
|
+
if (limit2 < 1) {
|
|
96791
|
+
return yield* fail8(new CliError({
|
|
96792
|
+
code: "INVALID_ARGS",
|
|
96793
|
+
message: "--limit must be >= 1",
|
|
96794
|
+
exitCode: 2
|
|
96795
|
+
}));
|
|
96796
|
+
}
|
|
96797
|
+
if (!wait2 && (timeoutMs2 !== undefined || pollMs2 !== undefined)) {
|
|
96798
|
+
return yield* fail8(new CliError({
|
|
96799
|
+
code: "INVALID_ARGS",
|
|
96800
|
+
message: "Use --wait to enable --timeout-ms/--poll-ms",
|
|
96801
|
+
exitCode: 2
|
|
96802
|
+
}));
|
|
96803
|
+
}
|
|
96804
|
+
if (!apply && wait2) {
|
|
96805
|
+
return yield* fail8(new CliError({
|
|
96806
|
+
code: "INVALID_ARGS",
|
|
96807
|
+
message: "--wait requires --apply",
|
|
96808
|
+
exitCode: 2
|
|
96809
|
+
}));
|
|
96810
|
+
}
|
|
96811
|
+
yield* failInRemoteMode({
|
|
96812
|
+
command: "backup cleanup",
|
|
96813
|
+
reason: "backup governance currently reads and updates the local store registry directly"
|
|
96814
|
+
});
|
|
96815
|
+
const cfg = yield* AppConfig;
|
|
96816
|
+
const payloadSvc = yield* Payload;
|
|
96817
|
+
const db = openStoreDb(cfg.storeDb);
|
|
96818
|
+
try {
|
|
96819
|
+
const states = state.length > 0 ? state : backupRemId ? [] : ["orphan"];
|
|
96820
|
+
const items = listBackupArtifacts(db, {
|
|
96821
|
+
states,
|
|
96822
|
+
kinds: kind,
|
|
96823
|
+
backupRemId,
|
|
96824
|
+
olderThanHours,
|
|
96825
|
+
limit: limit2
|
|
96826
|
+
}).filter((item) => typeof item.backup_rem_id === "string" && item.backup_rem_id.length > 0);
|
|
96827
|
+
if (backupRemId && items.length === 0) {
|
|
96828
|
+
return yield* fail8(new CliError({
|
|
96829
|
+
code: "INVALID_ARGS",
|
|
96830
|
+
message: `No backup artifact found for --backup-rem-id ${backupRemId}`,
|
|
96831
|
+
exitCode: 2
|
|
96832
|
+
}));
|
|
96833
|
+
}
|
|
96834
|
+
if (!apply) {
|
|
96835
|
+
yield* writeSuccess({
|
|
96836
|
+
data: { dry_run: true, items, count: items.length },
|
|
96837
|
+
ids: items.map((item) => item.backup_rem_id).filter(Boolean),
|
|
96838
|
+
md: [`- dry_run: true`, `- count: ${items.length}`].join(`
|
|
96839
|
+
`)
|
|
96840
|
+
});
|
|
96841
|
+
return;
|
|
96842
|
+
}
|
|
96843
|
+
const ops = items.map((item) => normalizeOp({
|
|
96844
|
+
type: "delete_backup_artifact",
|
|
96845
|
+
payload: {
|
|
96846
|
+
rem_id: item.backup_rem_id,
|
|
96847
|
+
...maxDeleteSubtreeNodes !== undefined ? { max_delete_subtree_nodes: maxDeleteSubtreeNodes } : {}
|
|
96848
|
+
}
|
|
96849
|
+
}, payloadSvc.normalizeKeys));
|
|
96850
|
+
const data = ops.length > 0 ? yield* enqueueOps({
|
|
96851
|
+
ops,
|
|
96852
|
+
notify: notify2,
|
|
96853
|
+
ensureDaemon: ensureDaemon3
|
|
96854
|
+
}) : { txn_id: "", op_ids: [], notified: false };
|
|
96855
|
+
updateBackupArtifactsCleanupState(db, {
|
|
96856
|
+
sourceOpIds: items.map((item) => item.source_op_id),
|
|
96857
|
+
cleanupState: wait2 && ops.length === 0 ? "cleaned" : "pending"
|
|
96858
|
+
});
|
|
96859
|
+
const waited = wait2 && data.txn_id ? yield* waitForTxn({ txnId: data.txn_id, timeoutMs: timeoutMs2, pollMs: pollMs2 }) : null;
|
|
96860
|
+
if (waited?.status === "succeeded") {
|
|
96861
|
+
updateBackupArtifactsCleanupState(db, {
|
|
96862
|
+
sourceOpIds: items.map((item) => item.source_op_id),
|
|
96863
|
+
cleanupState: "cleaned"
|
|
96864
|
+
});
|
|
96865
|
+
}
|
|
96866
|
+
yield* writeSuccess({
|
|
96867
|
+
data: {
|
|
96868
|
+
dry_run: false,
|
|
96869
|
+
items,
|
|
96870
|
+
count: items.length,
|
|
96871
|
+
...data.txn_id ? data : {},
|
|
96872
|
+
...waited ? waited : {}
|
|
96873
|
+
},
|
|
96874
|
+
ids: [data.txn_id, ...data.op_ids].filter(Boolean),
|
|
96875
|
+
md: [
|
|
96876
|
+
`- dry_run: false`,
|
|
96877
|
+
`- count: ${items.length}`,
|
|
96878
|
+
...data.txn_id ? [`- txn_id: ${data.txn_id}`] : [],
|
|
96879
|
+
...waited ? [`- status: ${waited.status}`, `- elapsed_ms: ${waited.elapsed_ms ?? ""}`] : []
|
|
96880
|
+
].join(`
|
|
96881
|
+
`)
|
|
96882
|
+
});
|
|
96883
|
+
} finally {
|
|
96884
|
+
db.close();
|
|
96885
|
+
}
|
|
96886
|
+
}).pipe(catchAll2(writeFailure))).pipe(exports_Command.withDescription("Dry-run by default. Use --apply to enqueue delete_backup_artifact cleanup for backup artifacts."));
|
|
96887
|
+
|
|
96888
|
+
// src/commands/backup/list.ts
|
|
96889
|
+
function optionToUndefined15(opt) {
|
|
96890
|
+
return isSome2(opt) ? opt.value : undefined;
|
|
96891
|
+
}
|
|
96892
|
+
var backupListCommand = exports_Command.make("list", {
|
|
96893
|
+
state: choice5("state", ["pending", "orphan", "retained", "cleaned"]).pipe(repeated5),
|
|
96894
|
+
kind: choice5("kind", ["children_replace", "selection_replace"]).pipe(repeated5),
|
|
96895
|
+
olderThanHours: integer7("older-than-hours").pipe(optional5, map34(optionToUndefined15)),
|
|
96896
|
+
limit: integer7("limit").pipe(withDefault5(100))
|
|
96897
|
+
}, ({ state, kind, olderThanHours, limit: limit2 }) => gen2(function* () {
|
|
96898
|
+
if (olderThanHours !== undefined && olderThanHours < 0) {
|
|
96899
|
+
return yield* fail8(new CliError({
|
|
96900
|
+
code: "INVALID_ARGS",
|
|
96901
|
+
message: "--older-than-hours must be a non-negative integer",
|
|
96902
|
+
exitCode: 2
|
|
96903
|
+
}));
|
|
96904
|
+
}
|
|
96905
|
+
if (limit2 < 1) {
|
|
96906
|
+
return yield* fail8(new CliError({
|
|
96907
|
+
code: "INVALID_ARGS",
|
|
96908
|
+
message: "--limit must be >= 1",
|
|
96909
|
+
exitCode: 2
|
|
96910
|
+
}));
|
|
96911
|
+
}
|
|
96912
|
+
yield* failInRemoteMode({
|
|
96913
|
+
command: "backup list",
|
|
96914
|
+
reason: "backup governance currently reads the local store registry directly"
|
|
96915
|
+
});
|
|
96916
|
+
const cfg = yield* AppConfig;
|
|
96917
|
+
const db = openStoreDb(cfg.storeDb);
|
|
96918
|
+
try {
|
|
96919
|
+
const items = listBackupArtifacts(db, {
|
|
96920
|
+
states: state,
|
|
96921
|
+
kinds: kind,
|
|
96922
|
+
olderThanHours,
|
|
96923
|
+
limit: limit2
|
|
96924
|
+
});
|
|
96925
|
+
yield* writeSuccess({
|
|
96926
|
+
data: { items, count: items.length },
|
|
96927
|
+
ids: items.map((item) => item.backup_rem_id).filter((item) => typeof item === "string" && item.length > 0),
|
|
96928
|
+
md: [`- count: ${items.length}`, ...items.map((item) => `- ${item.source_op_id}: ${item.cleanup_state}`)].join(`
|
|
96929
|
+
`)
|
|
96930
|
+
});
|
|
96931
|
+
} finally {
|
|
96932
|
+
db.close();
|
|
96933
|
+
}
|
|
96934
|
+
}).pipe(catchAll2(writeFailure))).pipe(exports_Command.withDescription("List backup artifacts from the local store registry."));
|
|
96935
|
+
|
|
96936
|
+
// src/commands/backup/index.ts
|
|
96937
|
+
var backupCommand = exports_Command.make("backup", {}).pipe(exports_Command.withSubcommands([backupListCommand, backupCleanupCommand]), exports_Command.withDescription("Backup artifact governance commands."));
|
|
96938
|
+
|
|
96324
96939
|
// src/commands/ops/list.ts
|
|
96325
96940
|
var opsListCommand = exports_Command.make("list", {}, () => gen2(function* () {
|
|
96326
96941
|
const types = Object.keys(TYPES).sort();
|
|
@@ -96411,22 +97026,22 @@ var opsSchemaCommand = exports_Command.make("schema", { type: text9("type") }, (
|
|
|
96411
97026
|
var opsCommand = exports_Command.make("ops", {}).pipe(exports_Command.withSubcommands([opsListCommand, opsSchemaCommand]));
|
|
96412
97027
|
|
|
96413
97028
|
// src/commands/apply.ts
|
|
96414
|
-
function
|
|
97029
|
+
function optionToUndefined16(opt) {
|
|
96415
97030
|
return isSome2(opt) ? opt.value : undefined;
|
|
96416
97031
|
}
|
|
96417
97032
|
function readOptionalText2(name) {
|
|
96418
|
-
return text9(name).pipe(optional5, map34(
|
|
97033
|
+
return text9(name).pipe(optional5, map34(optionToUndefined16));
|
|
96419
97034
|
}
|
|
96420
97035
|
var payloadSpec = text9("payload");
|
|
96421
97036
|
var metaSpec2 = readOptionalText2("meta");
|
|
96422
97037
|
var clientId2 = readOptionalText2("client-id");
|
|
96423
97038
|
var idempotencyKey2 = readOptionalText2("idempotency-key");
|
|
96424
|
-
var priority2 = integer7("priority").pipe(optional5, map34(
|
|
97039
|
+
var priority2 = integer7("priority").pipe(optional5, map34(optionToUndefined16));
|
|
96425
97040
|
var notify2 = boolean8("no-notify").pipe(map34((v) => !v));
|
|
96426
97041
|
var ensureDaemon3 = boolean8("no-ensure-daemon").pipe(map34((v) => !v));
|
|
96427
97042
|
var wait2 = boolean8("wait");
|
|
96428
|
-
var timeoutMs2 = integer7("timeout-ms").pipe(optional5, map34(
|
|
96429
|
-
var pollMs2 = integer7("poll-ms").pipe(optional5, map34(
|
|
97043
|
+
var timeoutMs2 = integer7("timeout-ms").pipe(optional5, map34(optionToUndefined16));
|
|
97044
|
+
var pollMs2 = integer7("poll-ms").pipe(optional5, map34(optionToUndefined16));
|
|
96430
97045
|
var applyCommand = exports_Command.make("apply", {
|
|
96431
97046
|
payload: payloadSpec,
|
|
96432
97047
|
notify: notify2,
|
|
@@ -96861,14 +97476,14 @@ function ensureApiDaemon(params3) {
|
|
|
96861
97476
|
}
|
|
96862
97477
|
|
|
96863
97478
|
// src/commands/api/ensure.ts
|
|
96864
|
-
function
|
|
97479
|
+
function optionToUndefined17(opt) {
|
|
96865
97480
|
return isSome2(opt) ? opt.value : undefined;
|
|
96866
97481
|
}
|
|
96867
|
-
var host = text9("host").pipe(optional5, map34(
|
|
96868
|
-
var port3 = integer7("port").pipe(optional5, map34(
|
|
96869
|
-
var pidFile8 = text9("pid-file").pipe(optional5, map34(
|
|
96870
|
-
var logFile5 = text9("log-file").pipe(optional5, map34(
|
|
96871
|
-
var stateFile3 = text9("state-file").pipe(optional5, map34(
|
|
97482
|
+
var host = text9("host").pipe(optional5, map34(optionToUndefined17));
|
|
97483
|
+
var port3 = integer7("port").pipe(optional5, map34(optionToUndefined17));
|
|
97484
|
+
var pidFile8 = text9("pid-file").pipe(optional5, map34(optionToUndefined17));
|
|
97485
|
+
var logFile5 = text9("log-file").pipe(optional5, map34(optionToUndefined17));
|
|
97486
|
+
var stateFile3 = text9("state-file").pipe(optional5, map34(optionToUndefined17));
|
|
96872
97487
|
var apiEnsureCommand = exports_Command.make("ensure", {
|
|
96873
97488
|
host,
|
|
96874
97489
|
port: port3,
|
|
@@ -96891,11 +97506,11 @@ var apiEnsureCommand = exports_Command.make("ensure", {
|
|
|
96891
97506
|
}).pipe(catchAll2(writeFailure)));
|
|
96892
97507
|
|
|
96893
97508
|
// src/commands/api/logs.ts
|
|
96894
|
-
function
|
|
97509
|
+
function optionToUndefined18(opt) {
|
|
96895
97510
|
return isSome2(opt) ? opt.value : undefined;
|
|
96896
97511
|
}
|
|
96897
|
-
var pidFile9 = text9("pid-file").pipe(optional5, map34(
|
|
96898
|
-
var file7 = text9("file").pipe(optional5, map34(
|
|
97512
|
+
var pidFile9 = text9("pid-file").pipe(optional5, map34(optionToUndefined18));
|
|
97513
|
+
var file7 = text9("file").pipe(optional5, map34(optionToUndefined18));
|
|
96899
97514
|
var apiLogsCommand = exports_Command.make("logs", { pidFile: pidFile9, file: file7, lines: integer7("lines").pipe(withDefault5(200)), follow: boolean8("follow") }, ({ pidFile: pidFile10, file: file8, lines: lines3, follow }) => gen2(function* () {
|
|
96900
97515
|
const cfg = yield* AppConfig;
|
|
96901
97516
|
const apiFiles = yield* ApiDaemonFiles;
|
|
@@ -96948,14 +97563,14 @@ var apiLogsCommand = exports_Command.make("logs", { pidFile: pidFile9, file: fil
|
|
|
96948
97563
|
}).pipe(catchAll2(writeFailure)));
|
|
96949
97564
|
|
|
96950
97565
|
// src/commands/api/restart.ts
|
|
96951
|
-
function
|
|
97566
|
+
function optionToUndefined19(opt) {
|
|
96952
97567
|
return isSome2(opt) ? opt.value : undefined;
|
|
96953
97568
|
}
|
|
96954
|
-
var host2 = text9("host").pipe(optional5, map34(
|
|
96955
|
-
var port4 = integer7("port").pipe(optional5, map34(
|
|
96956
|
-
var pidFile10 = text9("pid-file").pipe(optional5, map34(
|
|
96957
|
-
var logFile6 = text9("log-file").pipe(optional5, map34(
|
|
96958
|
-
var stateFile4 = text9("state-file").pipe(optional5, map34(
|
|
97569
|
+
var host2 = text9("host").pipe(optional5, map34(optionToUndefined19));
|
|
97570
|
+
var port4 = integer7("port").pipe(optional5, map34(optionToUndefined19));
|
|
97571
|
+
var pidFile10 = text9("pid-file").pipe(optional5, map34(optionToUndefined19));
|
|
97572
|
+
var logFile6 = text9("log-file").pipe(optional5, map34(optionToUndefined19));
|
|
97573
|
+
var stateFile4 = text9("state-file").pipe(optional5, map34(optionToUndefined19));
|
|
96959
97574
|
var apiRestartCommand = exports_Command.make("restart", {
|
|
96960
97575
|
force: boolean8("force"),
|
|
96961
97576
|
host: host2,
|
|
@@ -97446,23 +98061,23 @@ function runHttpApiRuntime(params3) {
|
|
|
97446
98061
|
}
|
|
97447
98062
|
|
|
97448
98063
|
// src/commands/api/serve.ts
|
|
97449
|
-
function
|
|
98064
|
+
function optionToUndefined20(opt) {
|
|
97450
98065
|
return isSome2(opt) ? opt.value : undefined;
|
|
97451
98066
|
}
|
|
97452
|
-
var host3 = text9("host").pipe(optional5, map34(
|
|
97453
|
-
var port5 = integer7("port").pipe(optional5, map34(
|
|
97454
|
-
var stateFile5 = text9("state-file").pipe(optional5, map34(
|
|
98067
|
+
var host3 = text9("host").pipe(optional5, map34(optionToUndefined20));
|
|
98068
|
+
var port5 = integer7("port").pipe(optional5, map34(optionToUndefined20));
|
|
98069
|
+
var stateFile5 = text9("state-file").pipe(optional5, map34(optionToUndefined20));
|
|
97455
98070
|
var apiServeCommand = exports_Command.make("serve", { host: host3, port: port5, stateFile: stateFile5 }, ({ host: host4, port: port6, stateFile: stateFile6 }) => runHttpApiRuntime({ host: host4, port: port6, stateFile: stateFile6 }).pipe(catchAll2(writeFailure)));
|
|
97456
98071
|
|
|
97457
98072
|
// src/commands/api/start.ts
|
|
97458
|
-
function
|
|
98073
|
+
function optionToUndefined21(opt) {
|
|
97459
98074
|
return isSome2(opt) ? opt.value : undefined;
|
|
97460
98075
|
}
|
|
97461
|
-
var host4 = text9("host").pipe(optional5, map34(
|
|
97462
|
-
var port6 = integer7("port").pipe(optional5, map34(
|
|
97463
|
-
var pidFile11 = text9("pid-file").pipe(optional5, map34(
|
|
97464
|
-
var logFile7 = text9("log-file").pipe(optional5, map34(
|
|
97465
|
-
var stateFile6 = text9("state-file").pipe(optional5, map34(
|
|
98076
|
+
var host4 = text9("host").pipe(optional5, map34(optionToUndefined21));
|
|
98077
|
+
var port6 = integer7("port").pipe(optional5, map34(optionToUndefined21));
|
|
98078
|
+
var pidFile11 = text9("pid-file").pipe(optional5, map34(optionToUndefined21));
|
|
98079
|
+
var logFile7 = text9("log-file").pipe(optional5, map34(optionToUndefined21));
|
|
98080
|
+
var stateFile6 = text9("state-file").pipe(optional5, map34(optionToUndefined21));
|
|
97466
98081
|
var apiStartCommand = exports_Command.make("start", {
|
|
97467
98082
|
host: host4,
|
|
97468
98083
|
port: port6,
|
|
@@ -97485,11 +98100,11 @@ var apiStartCommand = exports_Command.make("start", {
|
|
|
97485
98100
|
}).pipe(catchAll2(writeFailure)));
|
|
97486
98101
|
|
|
97487
98102
|
// src/commands/api/status.ts
|
|
97488
|
-
function
|
|
98103
|
+
function optionToUndefined22(opt) {
|
|
97489
98104
|
return isSome2(opt) ? opt.value : undefined;
|
|
97490
98105
|
}
|
|
97491
|
-
var pidFile12 = text9("pid-file").pipe(optional5, map34(
|
|
97492
|
-
var stateFile7 = text9("state-file").pipe(optional5, map34(
|
|
98106
|
+
var pidFile12 = text9("pid-file").pipe(optional5, map34(optionToUndefined22));
|
|
98107
|
+
var stateFile7 = text9("state-file").pipe(optional5, map34(optionToUndefined22));
|
|
97493
98108
|
var apiStatusCommand = exports_Command.make("status", { pidFile: pidFile12, stateFile: stateFile7 }, ({ pidFile: pidFile13, stateFile: stateFile8 }) => gen2(function* () {
|
|
97494
98109
|
const cfg = yield* AppConfig;
|
|
97495
98110
|
const apiFiles = yield* ApiDaemonFiles;
|
|
@@ -97548,11 +98163,11 @@ var apiStatusCommand = exports_Command.make("status", { pidFile: pidFile12, stat
|
|
|
97548
98163
|
}).pipe(catchAll2(writeFailure)));
|
|
97549
98164
|
|
|
97550
98165
|
// src/commands/api/stop.ts
|
|
97551
|
-
function
|
|
98166
|
+
function optionToUndefined23(opt) {
|
|
97552
98167
|
return isSome2(opt) ? opt.value : undefined;
|
|
97553
98168
|
}
|
|
97554
|
-
var pidFile13 = text9("pid-file").pipe(optional5, map34(
|
|
97555
|
-
var stateFile8 = text9("state-file").pipe(optional5, map34(
|
|
98169
|
+
var pidFile13 = text9("pid-file").pipe(optional5, map34(optionToUndefined23));
|
|
98170
|
+
var stateFile8 = text9("state-file").pipe(optional5, map34(optionToUndefined23));
|
|
97556
98171
|
var apiStopCommand = exports_Command.make("stop", { force: boolean8("force"), pidFile: pidFile13, stateFile: stateFile8 }, ({ force, pidFile: pidFile14, stateFile: stateFile9 }) => gen2(function* () {
|
|
97557
98172
|
const apiFiles = yield* ApiDaemonFiles;
|
|
97558
98173
|
const proc = yield* Process;
|
|
@@ -97628,11 +98243,11 @@ var apiCommand = exports_Command.make("api", {}).pipe(exports_Command.withSubcom
|
|
|
97628
98243
|
]));
|
|
97629
98244
|
|
|
97630
98245
|
// src/commands/read/selection/current.ts
|
|
97631
|
-
function
|
|
98246
|
+
function optionToUndefined24(opt) {
|
|
97632
98247
|
return isSome2(opt) ? opt.value : undefined;
|
|
97633
98248
|
}
|
|
97634
|
-
var stateFile9 = text9("state-file").pipe(optional5, map34(
|
|
97635
|
-
var staleMs2 = integer7("stale-ms").pipe(optional5, map34(
|
|
98249
|
+
var stateFile9 = text9("state-file").pipe(optional5, map34(optionToUndefined24));
|
|
98250
|
+
var staleMs2 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined24));
|
|
97636
98251
|
function toCompact(data) {
|
|
97637
98252
|
return {
|
|
97638
98253
|
selection_kind: data?.selection_kind ?? "",
|
|
@@ -97678,11 +98293,11 @@ var readSelectionCurrentCommand = exports_Command.make("current", { stateFile: s
|
|
|
97678
98293
|
}).pipe(catchAll2(writeFailure)));
|
|
97679
98294
|
|
|
97680
98295
|
// src/commands/read/selection/outline.ts
|
|
97681
|
-
function
|
|
98296
|
+
function optionToUndefined25(opt) {
|
|
97682
98297
|
return isSome2(opt) ? opt.value : undefined;
|
|
97683
98298
|
}
|
|
97684
|
-
var stateFile10 = text9("state-file").pipe(optional5, map34(
|
|
97685
|
-
var staleMs3 = integer7("stale-ms").pipe(optional5, map34(
|
|
98299
|
+
var stateFile10 = text9("state-file").pipe(optional5, map34(optionToUndefined25));
|
|
98300
|
+
var staleMs3 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined25));
|
|
97686
98301
|
var maxDepth = integer7("max-depth").pipe(withDefault5(10));
|
|
97687
98302
|
var maxNodes = integer7("max-nodes").pipe(withDefault5(1000));
|
|
97688
98303
|
var readSelectionOutlineCommand = exports_Command.make("outline", {
|
|
@@ -97693,7 +98308,7 @@ var readSelectionOutlineCommand = exports_Command.make("outline", {
|
|
|
97693
98308
|
excludeProperties: boolean8("exclude-properties"),
|
|
97694
98309
|
includeEmpty: boolean8("include-empty"),
|
|
97695
98310
|
expandReferences: boolean8("expand-references"),
|
|
97696
|
-
maxReferenceDepth: integer7("max-reference-depth").pipe(optional5, map34(
|
|
98311
|
+
maxReferenceDepth: integer7("max-reference-depth").pipe(optional5, map34(optionToUndefined25)),
|
|
97697
98312
|
detail: boolean8("detail")
|
|
97698
98313
|
}, ({
|
|
97699
98314
|
stateFile: stateFile11,
|
|
@@ -97836,11 +98451,11 @@ var readSelectionOutlineCommand = exports_Command.make("outline", {
|
|
|
97836
98451
|
}).pipe(catchAll2(writeFailure)));
|
|
97837
98452
|
|
|
97838
98453
|
// src/commands/read/selection/roots.ts
|
|
97839
|
-
function
|
|
98454
|
+
function optionToUndefined26(opt) {
|
|
97840
98455
|
return isSome2(opt) ? opt.value : undefined;
|
|
97841
98456
|
}
|
|
97842
|
-
var stateFile11 = text9("state-file").pipe(optional5, map34(
|
|
97843
|
-
var staleMs4 = integer7("stale-ms").pipe(optional5, map34(
|
|
98457
|
+
var stateFile11 = text9("state-file").pipe(optional5, map34(optionToUndefined26));
|
|
98458
|
+
var staleMs4 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined26));
|
|
97844
98459
|
var readSelectionRootsCommand = exports_Command.make("roots", { stateFile: stateFile11, staleMs: staleMs4 }, ({ stateFile: stateFile12, staleMs: staleMs5 }) => gen2(function* () {
|
|
97845
98460
|
const cfg = yield* AppConfig;
|
|
97846
98461
|
const hostApi = yield* HostApiClient;
|
|
@@ -97877,11 +98492,11 @@ var readSelectionRootsCommand = exports_Command.make("roots", { stateFile: state
|
|
|
97877
98492
|
}).pipe(catchAll2(writeFailure)));
|
|
97878
98493
|
|
|
97879
98494
|
// src/commands/read/selection/snapshot.ts
|
|
97880
|
-
function
|
|
98495
|
+
function optionToUndefined27(opt) {
|
|
97881
98496
|
return isSome2(opt) ? opt.value : undefined;
|
|
97882
98497
|
}
|
|
97883
|
-
var stateFile12 = text9("state-file").pipe(optional5, map34(
|
|
97884
|
-
var staleMs5 = integer7("stale-ms").pipe(optional5, map34(
|
|
98498
|
+
var stateFile12 = text9("state-file").pipe(optional5, map34(optionToUndefined27));
|
|
98499
|
+
var staleMs5 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined27));
|
|
97885
98500
|
var readSelectionSnapshotCommand = exports_Command.make("snapshot", { stateFile: stateFile12, staleMs: staleMs5 }, ({ stateFile: stateFile13, staleMs: staleMs6 }) => gen2(function* () {
|
|
97886
98501
|
const cfg = yield* AppConfig;
|
|
97887
98502
|
const hostApi = yield* HostApiClient;
|
|
@@ -97928,11 +98543,11 @@ var readSelectionSnapshotCommand = exports_Command.make("snapshot", { stateFile:
|
|
|
97928
98543
|
var readSelectionCommand = exports_Command.make("selection", {}).pipe(exports_Command.withSubcommands([readSelectionSnapshotCommand, readSelectionRootsCommand, readSelectionCurrentCommand, readSelectionOutlineCommand]));
|
|
97929
98544
|
|
|
97930
98545
|
// src/commands/read/uiContext/describe.ts
|
|
97931
|
-
function
|
|
98546
|
+
function optionToUndefined28(opt) {
|
|
97932
98547
|
return isSome2(opt) ? opt.value : undefined;
|
|
97933
98548
|
}
|
|
97934
|
-
var stateFile13 = text9("state-file").pipe(optional5, map34(
|
|
97935
|
-
var staleMs6 = integer7("stale-ms").pipe(optional5, map34(
|
|
98549
|
+
var stateFile13 = text9("state-file").pipe(optional5, map34(optionToUndefined28));
|
|
98550
|
+
var staleMs6 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined28));
|
|
97936
98551
|
var selectionLimit = integer7("selection-limit").pipe(withDefault5(5));
|
|
97937
98552
|
function normalizeText4(value8) {
|
|
97938
98553
|
return typeof value8 === "string" ? value8.trim() : "";
|
|
@@ -98191,11 +98806,11 @@ var readUiContextDescribeCommand = exports_Command.make("describe", { stateFile:
|
|
|
98191
98806
|
}).pipe(catchAll2(writeFailure)));
|
|
98192
98807
|
|
|
98193
98808
|
// src/commands/read/uiContext/focused-rem.ts
|
|
98194
|
-
function
|
|
98809
|
+
function optionToUndefined29(opt) {
|
|
98195
98810
|
return isSome2(opt) ? opt.value : undefined;
|
|
98196
98811
|
}
|
|
98197
|
-
var stateFile14 = text9("state-file").pipe(optional5, map34(
|
|
98198
|
-
var staleMs7 = integer7("stale-ms").pipe(optional5, map34(
|
|
98812
|
+
var stateFile14 = text9("state-file").pipe(optional5, map34(optionToUndefined29));
|
|
98813
|
+
var staleMs7 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined29));
|
|
98199
98814
|
var readUiContextFocusedRemCommand = exports_Command.make("focused-rem", { stateFile: stateFile14, staleMs: staleMs7 }, ({ stateFile: stateFile15, staleMs: staleMs8 }) => gen2(function* () {
|
|
98200
98815
|
const cfg = yield* AppConfig;
|
|
98201
98816
|
const hostApi = yield* HostApiClient;
|
|
@@ -98223,11 +98838,11 @@ var readUiContextFocusedRemCommand = exports_Command.make("focused-rem", { state
|
|
|
98223
98838
|
}).pipe(catchAll2(writeFailure)));
|
|
98224
98839
|
|
|
98225
98840
|
// src/commands/read/uiContext/page.ts
|
|
98226
|
-
function
|
|
98841
|
+
function optionToUndefined30(opt) {
|
|
98227
98842
|
return isSome2(opt) ? opt.value : undefined;
|
|
98228
98843
|
}
|
|
98229
|
-
var stateFile15 = text9("state-file").pipe(optional5, map34(
|
|
98230
|
-
var staleMs8 = integer7("stale-ms").pipe(optional5, map34(
|
|
98844
|
+
var stateFile15 = text9("state-file").pipe(optional5, map34(optionToUndefined30));
|
|
98845
|
+
var staleMs8 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined30));
|
|
98231
98846
|
var readUiContextPageCommand = exports_Command.make("page", { stateFile: stateFile15, staleMs: staleMs8 }, ({ stateFile: stateFile16, staleMs: staleMs9 }) => gen2(function* () {
|
|
98232
98847
|
const cfg = yield* AppConfig;
|
|
98233
98848
|
const hostApi = yield* HostApiClient;
|
|
@@ -98255,11 +98870,11 @@ var readUiContextPageCommand = exports_Command.make("page", { stateFile: stateFi
|
|
|
98255
98870
|
}).pipe(catchAll2(writeFailure)));
|
|
98256
98871
|
|
|
98257
98872
|
// src/commands/read/uiContext/snapshot.ts
|
|
98258
|
-
function
|
|
98873
|
+
function optionToUndefined31(opt) {
|
|
98259
98874
|
return isSome2(opt) ? opt.value : undefined;
|
|
98260
98875
|
}
|
|
98261
|
-
var stateFile16 = text9("state-file").pipe(optional5, map34(
|
|
98262
|
-
var staleMs9 = integer7("stale-ms").pipe(optional5, map34(
|
|
98876
|
+
var stateFile16 = text9("state-file").pipe(optional5, map34(optionToUndefined31));
|
|
98877
|
+
var staleMs9 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined31));
|
|
98263
98878
|
var readUiContextSnapshotCommand = exports_Command.make("snapshot", { stateFile: stateFile16, staleMs: staleMs9 }, ({ stateFile: stateFile17, staleMs: staleMs10 }) => gen2(function* () {
|
|
98264
98879
|
const cfg = yield* AppConfig;
|
|
98265
98880
|
const hostApi = yield* HostApiClient;
|
|
@@ -98293,11 +98908,11 @@ var readUiContextCommand = exports_Command.make("ui-context", {}).pipe(exports_C
|
|
|
98293
98908
|
]));
|
|
98294
98909
|
|
|
98295
98910
|
// src/commands/plugin/current.ts
|
|
98296
|
-
function
|
|
98911
|
+
function optionToUndefined32(opt) {
|
|
98297
98912
|
return isSome2(opt) ? opt.value : undefined;
|
|
98298
98913
|
}
|
|
98299
|
-
var stateFile17 = text9("state-file").pipe(optional5, map34(
|
|
98300
|
-
var staleMs10 = integer7("stale-ms").pipe(optional5, map34(
|
|
98914
|
+
var stateFile17 = text9("state-file").pipe(optional5, map34(optionToUndefined32));
|
|
98915
|
+
var staleMs10 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined32));
|
|
98301
98916
|
var selectionLimit2 = integer7("selection-limit").pipe(withDefault5(5));
|
|
98302
98917
|
function toCompact2(data) {
|
|
98303
98918
|
return {
|
|
@@ -98343,70 +98958,1013 @@ var pluginCurrentCommand = exports_Command.make("current", { stateFile: stateFil
|
|
|
98343
98958
|
yield* writeSuccess({ data: out, ids: ids3, md });
|
|
98344
98959
|
}).pipe(catchAll2(writeFailure)));
|
|
98345
98960
|
|
|
98346
|
-
// src/
|
|
98347
|
-
function
|
|
98348
|
-
return
|
|
98961
|
+
// src/lib/pluginServerHealth.ts
|
|
98962
|
+
function checkPluginServerHealth(baseUrl, timeoutMs3) {
|
|
98963
|
+
return tryPromise2({
|
|
98964
|
+
try: async () => {
|
|
98965
|
+
const controller = new AbortController;
|
|
98966
|
+
const timer2 = setTimeout(() => controller.abort(), timeoutMs3);
|
|
98967
|
+
try {
|
|
98968
|
+
const res = await fetch(`${baseUrl}/manifest.json`, { signal: controller.signal });
|
|
98969
|
+
if (!res.ok) {
|
|
98970
|
+
throw new Error(`Unexpected response status: ${res.status}`);
|
|
98971
|
+
}
|
|
98972
|
+
return { base_url: baseUrl };
|
|
98973
|
+
} finally {
|
|
98974
|
+
clearTimeout(timer2);
|
|
98975
|
+
}
|
|
98976
|
+
},
|
|
98977
|
+
catch: (error4) => new CliError({
|
|
98978
|
+
code: "PLUGIN_UNAVAILABLE",
|
|
98979
|
+
message: "Plugin server is unavailable",
|
|
98980
|
+
exitCode: 1,
|
|
98981
|
+
details: { base_url: baseUrl, error: String(error4?.message || error4) }
|
|
98982
|
+
})
|
|
98983
|
+
});
|
|
98349
98984
|
}
|
|
98350
|
-
|
|
98351
|
-
|
|
98352
|
-
|
|
98353
|
-
|
|
98354
|
-
|
|
98355
|
-
|
|
98356
|
-
|
|
98357
|
-
|
|
98985
|
+
function waitForPluginServerHealth(baseUrl, waitMs, timeoutMs3) {
|
|
98986
|
+
return gen2(function* () {
|
|
98987
|
+
if (!Number.isFinite(waitMs) || waitMs < 0) {
|
|
98988
|
+
return yield* fail8(new CliError({
|
|
98989
|
+
code: "INVALID_ARGS",
|
|
98990
|
+
message: "--wait must be a non-negative integer (ms)",
|
|
98991
|
+
exitCode: 2,
|
|
98992
|
+
details: { wait_ms: waitMs }
|
|
98993
|
+
}));
|
|
98994
|
+
}
|
|
98995
|
+
if (waitMs === 0)
|
|
98996
|
+
return;
|
|
98997
|
+
const deadline = Date.now() + waitMs;
|
|
98998
|
+
while (Date.now() < deadline) {
|
|
98999
|
+
const remaining = Math.max(0, deadline - Date.now());
|
|
99000
|
+
const res = yield* checkPluginServerHealth(baseUrl, Math.min(timeoutMs3, Math.max(1, remaining))).pipe(either3);
|
|
99001
|
+
if (isRight2(res))
|
|
99002
|
+
return;
|
|
99003
|
+
yield* sleep4(millis(300));
|
|
99004
|
+
}
|
|
99005
|
+
return yield* fail8(new CliError({
|
|
99006
|
+
code: "PLUGIN_UNAVAILABLE",
|
|
99007
|
+
message: `Timed out waiting for plugin server to become available (${waitMs}ms)`,
|
|
99008
|
+
exitCode: 1,
|
|
99009
|
+
details: { base_url: baseUrl, wait_ms: waitMs },
|
|
99010
|
+
hint: ["agent-remnote plugin status --json", "agent-remnote plugin logs --lines 200"]
|
|
99011
|
+
}));
|
|
99012
|
+
});
|
|
98358
99013
|
}
|
|
98359
|
-
|
|
98360
|
-
|
|
98361
|
-
|
|
98362
|
-
|
|
98363
|
-
|
|
98364
|
-
|
|
98365
|
-
|
|
98366
|
-
|
|
98367
|
-
|
|
98368
|
-
|
|
98369
|
-
|
|
98370
|
-
|
|
98371
|
-
|
|
98372
|
-
|
|
98373
|
-
|
|
98374
|
-
|
|
98375
|
-
|
|
99014
|
+
|
|
99015
|
+
// src/services/PluginServerFiles.ts
|
|
99016
|
+
import { promises as fs20 } from "node:fs";
|
|
99017
|
+
import path26 from "node:path";
|
|
99018
|
+
class PluginServerFiles extends Tag2("PluginServerFiles")() {
|
|
99019
|
+
}
|
|
99020
|
+
function ensureDir10(p3) {
|
|
99021
|
+
return fs20.mkdir(path26.dirname(p3), { recursive: true }).then(() => {
|
|
99022
|
+
return;
|
|
99023
|
+
});
|
|
99024
|
+
}
|
|
99025
|
+
function defaultPidFile3() {
|
|
99026
|
+
const envPidFile = process.env.REMNOTE_PLUGIN_SERVER_PID_FILE;
|
|
99027
|
+
if (typeof envPidFile === "string" && envPidFile.trim())
|
|
99028
|
+
return resolveUserFilePath(envPidFile);
|
|
99029
|
+
return path26.join(homeDir(), ".agent-remnote", "plugin-server.pid");
|
|
99030
|
+
}
|
|
99031
|
+
function defaultLogFile3() {
|
|
99032
|
+
const envLogFile = process.env.REMNOTE_PLUGIN_SERVER_LOG_FILE;
|
|
99033
|
+
if (typeof envLogFile === "string" && envLogFile.trim())
|
|
99034
|
+
return resolveUserFilePath(envLogFile);
|
|
99035
|
+
return path26.join(homeDir(), ".agent-remnote", "plugin-server.log");
|
|
99036
|
+
}
|
|
99037
|
+
function defaultStateFile3() {
|
|
99038
|
+
const envStateFile = process.env.REMNOTE_PLUGIN_SERVER_STATE_FILE;
|
|
99039
|
+
if (typeof envStateFile === "string" && envStateFile.trim())
|
|
99040
|
+
return resolveUserFilePath(envStateFile);
|
|
99041
|
+
return path26.join(homeDir(), ".agent-remnote", "plugin-server.state.json");
|
|
99042
|
+
}
|
|
99043
|
+
function parseJson3(raw4, filePath) {
|
|
99044
|
+
try {
|
|
99045
|
+
return JSON.parse(raw4);
|
|
99046
|
+
} catch (error4) {
|
|
99047
|
+
throw new CliError({
|
|
99048
|
+
code: "INTERNAL",
|
|
99049
|
+
message: `Failed to parse JSON file: ${filePath}`,
|
|
99050
|
+
exitCode: 1,
|
|
99051
|
+
details: { file_path: filePath, error: String(error4?.message || error4) }
|
|
99052
|
+
});
|
|
99053
|
+
}
|
|
99054
|
+
}
|
|
99055
|
+
var PluginServerFilesLive = succeed10(PluginServerFiles, {
|
|
99056
|
+
defaultPidFile: defaultPidFile3,
|
|
99057
|
+
defaultLogFile: defaultLogFile3,
|
|
99058
|
+
defaultStateFile: defaultStateFile3,
|
|
99059
|
+
readPidFile: (pidFilePath) => tryPromise2({
|
|
99060
|
+
try: async () => {
|
|
99061
|
+
const resolved = resolveUserFilePath(pidFilePath);
|
|
99062
|
+
const raw4 = await fs20.readFile(resolved, "utf8");
|
|
99063
|
+
return parseJson3(raw4, resolved);
|
|
99064
|
+
},
|
|
99065
|
+
catch: (error4) => {
|
|
99066
|
+
const code2 = error4?.code;
|
|
99067
|
+
if (code2 === "ENOENT")
|
|
99068
|
+
return;
|
|
99069
|
+
if (isCliError(error4))
|
|
99070
|
+
return error4;
|
|
99071
|
+
return new CliError({
|
|
99072
|
+
code: "INTERNAL",
|
|
99073
|
+
message: "Failed to read plugin server pid file",
|
|
99074
|
+
exitCode: 1,
|
|
99075
|
+
details: { file_path: pidFilePath, error: String(error4?.message || error4) }
|
|
99076
|
+
});
|
|
98376
99077
|
}
|
|
98377
|
-
|
|
98378
|
-
|
|
98379
|
-
|
|
98380
|
-
|
|
98381
|
-
|
|
98382
|
-
|
|
98383
|
-
|
|
99078
|
+
}).pipe(catchAll2((error4) => {
|
|
99079
|
+
if (error4 === undefined)
|
|
99080
|
+
return succeed8(undefined);
|
|
99081
|
+
return fail8(error4);
|
|
99082
|
+
})),
|
|
99083
|
+
writePidFile: (pidFilePath, value8) => tryPromise2({
|
|
99084
|
+
try: async () => {
|
|
99085
|
+
const resolved = resolveUserFilePath(pidFilePath);
|
|
99086
|
+
await ensureDir10(resolved);
|
|
99087
|
+
await fs20.writeFile(resolved, `${JSON.stringify(value8, null, 2)}
|
|
99088
|
+
`, "utf8");
|
|
99089
|
+
},
|
|
99090
|
+
catch: (error4) => new CliError({
|
|
99091
|
+
code: "INTERNAL",
|
|
99092
|
+
message: "Failed to write plugin server pid file",
|
|
99093
|
+
exitCode: 1,
|
|
99094
|
+
details: { file_path: pidFilePath, error: String(error4?.message || error4) }
|
|
99095
|
+
})
|
|
99096
|
+
}),
|
|
99097
|
+
deletePidFile: (pidFilePath) => tryPromise2({
|
|
99098
|
+
try: async () => {
|
|
99099
|
+
const resolved = resolveUserFilePath(pidFilePath);
|
|
99100
|
+
await fs20.rm(resolved, { force: true });
|
|
99101
|
+
},
|
|
99102
|
+
catch: (error4) => new CliError({
|
|
99103
|
+
code: "INTERNAL",
|
|
99104
|
+
message: "Failed to delete plugin server pid file",
|
|
99105
|
+
exitCode: 1,
|
|
99106
|
+
details: { file_path: pidFilePath, error: String(error4?.message || error4) }
|
|
99107
|
+
})
|
|
99108
|
+
}),
|
|
99109
|
+
readStateFile: (stateFilePath) => tryPromise2({
|
|
99110
|
+
try: async () => {
|
|
99111
|
+
const resolved = resolveUserFilePath(stateFilePath);
|
|
99112
|
+
const raw4 = await fs20.readFile(resolved, "utf8");
|
|
99113
|
+
return parseJson3(raw4, resolved);
|
|
99114
|
+
},
|
|
99115
|
+
catch: (error4) => {
|
|
99116
|
+
const code2 = error4?.code;
|
|
99117
|
+
if (code2 === "ENOENT")
|
|
99118
|
+
return;
|
|
99119
|
+
if (isCliError(error4))
|
|
99120
|
+
return error4;
|
|
99121
|
+
return new CliError({
|
|
99122
|
+
code: "INTERNAL",
|
|
99123
|
+
message: "Failed to read plugin server state file",
|
|
99124
|
+
exitCode: 1,
|
|
99125
|
+
details: { file_path: stateFilePath, error: String(error4?.message || error4) }
|
|
99126
|
+
});
|
|
99127
|
+
}
|
|
99128
|
+
}).pipe(catchAll2((error4) => {
|
|
99129
|
+
if (error4 === undefined)
|
|
99130
|
+
return succeed8(undefined);
|
|
99131
|
+
return fail8(error4);
|
|
99132
|
+
})),
|
|
99133
|
+
writeStateFile: (stateFilePath, value8) => tryPromise2({
|
|
99134
|
+
try: async () => {
|
|
99135
|
+
const resolved = resolveUserFilePath(stateFilePath);
|
|
99136
|
+
await ensureDir10(resolved);
|
|
99137
|
+
await fs20.writeFile(resolved, `${JSON.stringify(value8, null, 2)}
|
|
99138
|
+
`, "utf8");
|
|
99139
|
+
},
|
|
99140
|
+
catch: (error4) => new CliError({
|
|
99141
|
+
code: "INTERNAL",
|
|
99142
|
+
message: "Failed to write plugin server state file",
|
|
99143
|
+
exitCode: 1,
|
|
99144
|
+
details: { file_path: stateFilePath, error: String(error4?.message || error4) }
|
|
99145
|
+
})
|
|
99146
|
+
}),
|
|
99147
|
+
deleteStateFile: (stateFilePath) => tryPromise2({
|
|
99148
|
+
try: async () => {
|
|
99149
|
+
const resolved = resolveUserFilePath(stateFilePath);
|
|
99150
|
+
await fs20.rm(resolved, { force: true });
|
|
99151
|
+
},
|
|
99152
|
+
catch: (error4) => new CliError({
|
|
99153
|
+
code: "INTERNAL",
|
|
99154
|
+
message: "Failed to delete plugin server state file",
|
|
99155
|
+
exitCode: 1,
|
|
99156
|
+
details: { file_path: stateFilePath, error: String(error4?.message || error4) }
|
|
99157
|
+
})
|
|
99158
|
+
})
|
|
99159
|
+
});
|
|
99160
|
+
|
|
99161
|
+
// src/commands/plugin/_shared.ts
|
|
99162
|
+
var PLUGIN_SERVER_HEALTH_TIMEOUT_MS = 2000;
|
|
99163
|
+
var PLUGIN_SERVER_START_WAIT_DEFAULT_MS = 15000;
|
|
99164
|
+
var PLUGIN_SERVER_STOP_WAIT_DEFAULT_MS = 5000;
|
|
99165
|
+
var PLUGIN_SERVER_DEFAULT_HOST = "127.0.0.1";
|
|
99166
|
+
var PLUGIN_SERVER_DEFAULT_PORT = 8080;
|
|
99167
|
+
function pluginServerLocalBaseUrl(host5, port7) {
|
|
99168
|
+
const normalizedHost = host5 === "0.0.0.0" || host5 === "::" ? "127.0.0.1" : host5;
|
|
99169
|
+
return `http://${normalizedHost}:${port7}`;
|
|
99170
|
+
}
|
|
99171
|
+
function childCommandLine3(params3) {
|
|
99172
|
+
const command = process.argv[0];
|
|
99173
|
+
const script = process.argv[1];
|
|
99174
|
+
if (!command || !script) {
|
|
99175
|
+
throw new CliError({
|
|
99176
|
+
code: "INTERNAL",
|
|
99177
|
+
message: "Unable to determine the current executable entrypoint (process.argv is incomplete)",
|
|
99178
|
+
exitCode: 1,
|
|
99179
|
+
details: { argv: process.argv }
|
|
98384
99180
|
});
|
|
99181
|
+
}
|
|
99182
|
+
const execArgv = Array.isArray(process.execArgv) ? process.execArgv : [];
|
|
99183
|
+
const args2 = [...execArgv, script, "plugin", "serve", "--host", params3.host, "--port", String(params3.port), "--state-file", params3.stateFile];
|
|
99184
|
+
return { command, args: args2 };
|
|
99185
|
+
}
|
|
99186
|
+
function toPidFileValue3(params3) {
|
|
99187
|
+
return {
|
|
99188
|
+
pid: params3.pid,
|
|
99189
|
+
started_at: params3.startedAt,
|
|
99190
|
+
host: params3.host,
|
|
99191
|
+
port: params3.port,
|
|
99192
|
+
log_file: params3.logFile,
|
|
99193
|
+
state_file: params3.stateFile,
|
|
99194
|
+
cmd: params3.cmd
|
|
99195
|
+
};
|
|
99196
|
+
}
|
|
99197
|
+
function startPluginServer(params3) {
|
|
99198
|
+
return gen2(function* () {
|
|
99199
|
+
const files = yield* PluginServerFiles;
|
|
99200
|
+
const proc = yield* Process;
|
|
99201
|
+
const host5 = params3.host ?? PLUGIN_SERVER_DEFAULT_HOST;
|
|
99202
|
+
const port7 = params3.port ?? PLUGIN_SERVER_DEFAULT_PORT;
|
|
99203
|
+
const pidFilePath = resolveUserFilePath(params3.pidFile ?? files.defaultPidFile());
|
|
99204
|
+
const logFilePath = resolveUserFilePath(params3.logFile ?? files.defaultLogFile());
|
|
99205
|
+
const stateFilePath = resolveUserFilePath(params3.stateFile ?? files.defaultStateFile());
|
|
99206
|
+
const baseUrl = pluginServerLocalBaseUrl(host5, port7);
|
|
99207
|
+
const existing = yield* files.readPidFile(pidFilePath);
|
|
99208
|
+
if (existing) {
|
|
99209
|
+
const alive = yield* proc.isPidRunning(existing.pid);
|
|
99210
|
+
if (!alive) {
|
|
99211
|
+
yield* files.deletePidFile(pidFilePath);
|
|
99212
|
+
} else {
|
|
99213
|
+
return {
|
|
99214
|
+
started: false,
|
|
99215
|
+
pid: existing.pid,
|
|
99216
|
+
pid_file: pidFilePath,
|
|
99217
|
+
log_file: existing.log_file ?? logFilePath,
|
|
99218
|
+
state_file: existing.state_file ?? stateFilePath,
|
|
99219
|
+
base_url: baseUrl
|
|
99220
|
+
};
|
|
99221
|
+
}
|
|
99222
|
+
}
|
|
99223
|
+
const pre = yield* checkPluginServerHealth(baseUrl, PLUGIN_SERVER_HEALTH_TIMEOUT_MS).pipe(either3);
|
|
99224
|
+
if (isRight2(pre)) {
|
|
99225
|
+
return {
|
|
99226
|
+
started: false,
|
|
99227
|
+
pid_file: pidFilePath,
|
|
99228
|
+
log_file: logFilePath,
|
|
99229
|
+
state_file: stateFilePath,
|
|
99230
|
+
base_url: baseUrl
|
|
99231
|
+
};
|
|
99232
|
+
}
|
|
99233
|
+
const cmd = yield* try_3({
|
|
99234
|
+
try: () => childCommandLine3({ host: host5, port: port7, stateFile: stateFilePath }),
|
|
99235
|
+
catch: (error4) => isCliError(error4) ? error4 : new CliError({
|
|
99236
|
+
code: "INTERNAL",
|
|
99237
|
+
message: "Failed to start plugin server",
|
|
99238
|
+
exitCode: 1,
|
|
99239
|
+
details: { error: String(error4?.message || error4) }
|
|
99240
|
+
})
|
|
99241
|
+
});
|
|
99242
|
+
const pid = yield* proc.spawnDetached({ command: cmd.command, args: cmd.args, logFile: logFilePath });
|
|
99243
|
+
yield* files.writePidFile(pidFilePath, toPidFileValue3({
|
|
99244
|
+
pid,
|
|
99245
|
+
startedAt: Date.now(),
|
|
99246
|
+
host: host5,
|
|
99247
|
+
port: port7,
|
|
99248
|
+
logFile: logFilePath,
|
|
99249
|
+
stateFile: stateFilePath,
|
|
99250
|
+
cmd: [cmd.command, ...cmd.args]
|
|
99251
|
+
}));
|
|
99252
|
+
yield* waitForPluginServerHealth(baseUrl, params3.waitMs, PLUGIN_SERVER_HEALTH_TIMEOUT_MS);
|
|
99253
|
+
return {
|
|
99254
|
+
started: true,
|
|
99255
|
+
pid,
|
|
99256
|
+
pid_file: pidFilePath,
|
|
99257
|
+
log_file: logFilePath,
|
|
99258
|
+
state_file: stateFilePath,
|
|
99259
|
+
base_url: baseUrl
|
|
99260
|
+
};
|
|
99261
|
+
});
|
|
99262
|
+
}
|
|
99263
|
+
function ensurePluginServer(params3) {
|
|
99264
|
+
return gen2(function* () {
|
|
99265
|
+
const files = yield* PluginServerFiles;
|
|
99266
|
+
const proc = yield* Process;
|
|
99267
|
+
const host5 = params3.host ?? PLUGIN_SERVER_DEFAULT_HOST;
|
|
99268
|
+
const port7 = params3.port ?? PLUGIN_SERVER_DEFAULT_PORT;
|
|
99269
|
+
const pidFilePath = resolveUserFilePath(params3.pidFile ?? files.defaultPidFile());
|
|
99270
|
+
const logFilePath = resolveUserFilePath(params3.logFile ?? files.defaultLogFile());
|
|
99271
|
+
const stateFilePath = resolveUserFilePath(params3.stateFile ?? files.defaultStateFile());
|
|
99272
|
+
const baseUrl = pluginServerLocalBaseUrl(host5, port7);
|
|
99273
|
+
const pre = yield* checkPluginServerHealth(baseUrl, PLUGIN_SERVER_HEALTH_TIMEOUT_MS).pipe(either3);
|
|
99274
|
+
if (isRight2(pre)) {
|
|
99275
|
+
const existing = yield* files.readPidFile(pidFilePath);
|
|
99276
|
+
if (existing) {
|
|
99277
|
+
const alive = yield* proc.isPidRunning(existing.pid);
|
|
99278
|
+
if (alive) {
|
|
99279
|
+
return {
|
|
99280
|
+
started: false,
|
|
99281
|
+
pid: existing.pid,
|
|
99282
|
+
pid_file: pidFilePath,
|
|
99283
|
+
log_file: existing.log_file ?? logFilePath,
|
|
99284
|
+
state_file: existing.state_file ?? stateFilePath,
|
|
99285
|
+
base_url: baseUrl
|
|
99286
|
+
};
|
|
99287
|
+
}
|
|
99288
|
+
}
|
|
99289
|
+
return {
|
|
99290
|
+
started: false,
|
|
99291
|
+
pid_file: pidFilePath,
|
|
99292
|
+
log_file: logFilePath,
|
|
99293
|
+
state_file: stateFilePath,
|
|
99294
|
+
base_url: baseUrl
|
|
99295
|
+
};
|
|
99296
|
+
}
|
|
99297
|
+
return yield* startPluginServer(params3);
|
|
99298
|
+
});
|
|
99299
|
+
}
|
|
99300
|
+
|
|
99301
|
+
// src/commands/plugin/ensure.ts
|
|
99302
|
+
function optionToUndefined33(opt) {
|
|
99303
|
+
return isSome2(opt) ? opt.value : undefined;
|
|
99304
|
+
}
|
|
99305
|
+
var host5 = text9("host").pipe(optional5, map34(optionToUndefined33));
|
|
99306
|
+
var port7 = integer7("port").pipe(optional5, map34(optionToUndefined33));
|
|
99307
|
+
var pidFile14 = text9("pid-file").pipe(optional5, map34(optionToUndefined33));
|
|
99308
|
+
var logFile8 = text9("log-file").pipe(optional5, map34(optionToUndefined33));
|
|
99309
|
+
var stateFile18 = text9("state-file").pipe(optional5, map34(optionToUndefined33));
|
|
99310
|
+
var pluginEnsureCommand = exports_Command.make("ensure", {
|
|
99311
|
+
host: host5,
|
|
99312
|
+
port: port7,
|
|
99313
|
+
wait: integer7("wait").pipe(withDefault5(PLUGIN_SERVER_START_WAIT_DEFAULT_MS)),
|
|
99314
|
+
pidFile: pidFile14,
|
|
99315
|
+
logFile: logFile8,
|
|
99316
|
+
stateFile: stateFile18
|
|
99317
|
+
}, ({ host: host6, port: port8, wait: wait3, pidFile: pidFile15, logFile: logFile9, stateFile: stateFile19 }) => gen2(function* () {
|
|
99318
|
+
const result = yield* ensurePluginServer({ host: host6, port: port8, waitMs: wait3, pidFile: pidFile15, logFile: logFile9, stateFile: stateFile19 });
|
|
99319
|
+
yield* writeSuccess({
|
|
99320
|
+
data: result,
|
|
99321
|
+
md: `- started: ${result.started}
|
|
99322
|
+
- pid: ${result.pid ?? ""}
|
|
99323
|
+
- pid_file: ${result.pid_file}
|
|
99324
|
+
- log_file: ${result.log_file}
|
|
99325
|
+
- state_file: ${result.state_file}
|
|
99326
|
+
- base_url: ${result.base_url}
|
|
99327
|
+
`
|
|
99328
|
+
});
|
|
99329
|
+
}).pipe(catchAll2(writeFailure)));
|
|
99330
|
+
|
|
99331
|
+
// src/commands/plugin/logs.ts
|
|
99332
|
+
function optionToUndefined34(opt) {
|
|
99333
|
+
return isSome2(opt) ? opt.value : undefined;
|
|
99334
|
+
}
|
|
99335
|
+
var pidFile15 = text9("pid-file").pipe(optional5, map34(optionToUndefined34));
|
|
99336
|
+
var file8 = text9("file").pipe(optional5, map34(optionToUndefined34));
|
|
99337
|
+
var pluginLogsCommand = exports_Command.make("logs", { pidFile: pidFile15, file: file8, lines: integer7("lines").pipe(withDefault5(200)), follow: boolean8("follow") }, ({ pidFile: pidFile16, file: file9, lines: lines3, follow }) => gen2(function* () {
|
|
99338
|
+
const cfg = yield* AppConfig;
|
|
99339
|
+
const files = yield* PluginServerFiles;
|
|
99340
|
+
const fsAccess = yield* FsAccess;
|
|
99341
|
+
const subprocess = yield* Subprocess;
|
|
99342
|
+
if (!Number.isFinite(lines3) || lines3 <= 0) {
|
|
99343
|
+
return yield* fail8(new CliError({ code: "INVALID_ARGS", message: "--lines must be a positive integer", exitCode: 2 }));
|
|
99344
|
+
}
|
|
99345
|
+
if (cfg.format === "ids") {
|
|
99346
|
+
return yield* fail8(new CliError({ code: "INVALID_ARGS", message: "This command does not support --ids output", exitCode: 2 }));
|
|
99347
|
+
}
|
|
99348
|
+
const pidFilePath = resolveUserFilePath(pidFile16 ?? files.defaultPidFile());
|
|
99349
|
+
const pidInfo = yield* files.readPidFile(pidFilePath);
|
|
99350
|
+
const logFilePath = resolveUserFilePath(file9 ?? pidInfo?.log_file ?? files.defaultLogFile());
|
|
99351
|
+
const exists3 = yield* fsAccess.isFile(logFilePath);
|
|
99352
|
+
if (!exists3) {
|
|
99353
|
+
return yield* fail8(new CliError({
|
|
99354
|
+
code: "INTERNAL",
|
|
99355
|
+
message: `Log file not found: ${logFilePath}`,
|
|
99356
|
+
exitCode: 1,
|
|
99357
|
+
hint: ["agent-remnote plugin start", "agent-remnote plugin status"]
|
|
99358
|
+
}));
|
|
99359
|
+
}
|
|
99360
|
+
if (follow) {
|
|
99361
|
+
if (cfg.format === "json") {
|
|
99362
|
+
return yield* fail8(new CliError({ code: "INVALID_ARGS", message: "--follow is not compatible with --json", exitCode: 2 }));
|
|
99363
|
+
}
|
|
99364
|
+
yield* subprocess.runInherit({ command: "tail", args: ["-n", String(lines3), "-f", logFilePath] });
|
|
99365
|
+
return;
|
|
99366
|
+
}
|
|
99367
|
+
const res = yield* subprocess.run({
|
|
99368
|
+
command: "tail",
|
|
99369
|
+
args: ["-n", String(lines3), logFilePath],
|
|
99370
|
+
timeoutMs: 1e4
|
|
99371
|
+
});
|
|
99372
|
+
if (res.exitCode !== 0) {
|
|
99373
|
+
return yield* fail8(new CliError({
|
|
99374
|
+
code: "INTERNAL",
|
|
99375
|
+
message: "Failed to read log file",
|
|
99376
|
+
exitCode: 1,
|
|
99377
|
+
details: { file: logFilePath, exitCode: res.exitCode, stderr: res.stderr.trim() }
|
|
99378
|
+
}));
|
|
99379
|
+
}
|
|
99380
|
+
const tailLines = res.stdout.trimEnd();
|
|
99381
|
+
yield* writeSuccess({
|
|
99382
|
+
data: { file: logFilePath, lines: lines3, content: tailLines },
|
|
99383
|
+
md: tailLines.length > 0 ? `${tailLines}
|
|
99384
|
+
` : ""
|
|
99385
|
+
});
|
|
99386
|
+
}).pipe(catchAll2(writeFailure)));
|
|
99387
|
+
|
|
99388
|
+
// src/commands/plugin/restart.ts
|
|
99389
|
+
function optionToUndefined35(opt) {
|
|
99390
|
+
return isSome2(opt) ? opt.value : undefined;
|
|
99391
|
+
}
|
|
99392
|
+
var host6 = text9("host").pipe(optional5, map34(optionToUndefined35));
|
|
99393
|
+
var port8 = integer7("port").pipe(optional5, map34(optionToUndefined35));
|
|
99394
|
+
var pidFile16 = text9("pid-file").pipe(optional5, map34(optionToUndefined35));
|
|
99395
|
+
var logFile9 = text9("log-file").pipe(optional5, map34(optionToUndefined35));
|
|
99396
|
+
var stateFile19 = text9("state-file").pipe(optional5, map34(optionToUndefined35));
|
|
99397
|
+
var pluginRestartCommand = exports_Command.make("restart", {
|
|
99398
|
+
force: boolean8("force"),
|
|
99399
|
+
host: host6,
|
|
99400
|
+
port: port8,
|
|
99401
|
+
wait: integer7("wait").pipe(withDefault5(PLUGIN_SERVER_START_WAIT_DEFAULT_MS)),
|
|
99402
|
+
pidFile: pidFile16,
|
|
99403
|
+
logFile: logFile9,
|
|
99404
|
+
stateFile: stateFile19
|
|
99405
|
+
}, ({ force, host: host7, port: port9, wait: wait3, pidFile: pidFile17, logFile: logFile10, stateFile: stateFile20 }) => gen2(function* () {
|
|
99406
|
+
const files = yield* PluginServerFiles;
|
|
99407
|
+
const proc = yield* Process;
|
|
99408
|
+
const pidFilePath = resolveUserFilePath(pidFile17 ?? files.defaultPidFile());
|
|
99409
|
+
const existing = yield* files.readPidFile(pidFilePath);
|
|
99410
|
+
let stoppedPid;
|
|
99411
|
+
if (existing) {
|
|
99412
|
+
const alive = yield* proc.isPidRunning(existing.pid);
|
|
99413
|
+
if (alive) {
|
|
99414
|
+
yield* proc.kill(existing.pid, "SIGTERM");
|
|
99415
|
+
const exited = yield* proc.waitForExit({ pid: existing.pid, timeoutMs: PLUGIN_SERVER_STOP_WAIT_DEFAULT_MS });
|
|
99416
|
+
if (!exited && force) {
|
|
99417
|
+
yield* proc.kill(existing.pid, "SIGKILL");
|
|
99418
|
+
yield* proc.waitForExit({ pid: existing.pid, timeoutMs: PLUGIN_SERVER_STOP_WAIT_DEFAULT_MS });
|
|
99419
|
+
}
|
|
99420
|
+
stoppedPid = existing.pid;
|
|
99421
|
+
}
|
|
99422
|
+
yield* files.deletePidFile(pidFilePath).pipe(catchAll2(() => _void));
|
|
99423
|
+
yield* files.deleteStateFile(existing.state_file ?? resolveUserFilePath(stateFile20 ?? files.defaultStateFile())).pipe(catchAll2(() => _void));
|
|
99424
|
+
}
|
|
99425
|
+
const started = yield* startPluginServer({ host: host7, port: port9, waitMs: wait3, pidFile: pidFile17, logFile: logFile10, stateFile: stateFile20 });
|
|
99426
|
+
yield* writeSuccess({
|
|
99427
|
+
data: { stopped_pid: stoppedPid, ...started },
|
|
99428
|
+
md: `- stopped_pid: ${stoppedPid ?? ""}
|
|
99429
|
+
- started: ${started.started}
|
|
99430
|
+
- pid: ${started.pid ?? ""}
|
|
99431
|
+
- pid_file: ${started.pid_file}
|
|
99432
|
+
- base_url: ${started.base_url}
|
|
99433
|
+
`
|
|
99434
|
+
});
|
|
99435
|
+
}).pipe(catchAll2(writeFailure)));
|
|
99436
|
+
|
|
99437
|
+
// src/commands/plugin/search.ts
|
|
99438
|
+
function optionToUndefined36(opt) {
|
|
99439
|
+
return isSome2(opt) ? opt.value : undefined;
|
|
99440
|
+
}
|
|
99441
|
+
var searchContextRemId = text9("context-rem-id").pipe(optional5, map34(optionToUndefined36));
|
|
99442
|
+
var limit2 = integer7("limit").pipe(withDefault5(20));
|
|
99443
|
+
var timeoutMs3 = integer7("timeout-ms").pipe(withDefault5(3000));
|
|
99444
|
+
var ensureDaemon4 = boolean8("no-ensure-daemon").pipe(map34((v) => !v));
|
|
99445
|
+
function clampInt6(value8, min5, max7) {
|
|
99446
|
+
if (!Number.isFinite(value8))
|
|
99447
|
+
return min5;
|
|
99448
|
+
return Math.max(min5, Math.min(max7, Math.floor(value8)));
|
|
99449
|
+
}
|
|
99450
|
+
var pluginSearchCommand = exports_Command.make("search", { query: text9("query"), searchContextRemId, limit: limit2, timeoutMs: timeoutMs3, ensureDaemon: ensureDaemon4 }, ({ query, searchContextRemId: searchContextRemId2, limit: limit3, timeoutMs: timeoutMs4, ensureDaemon: ensureDaemon5 }) => gen2(function* () {
|
|
99451
|
+
const cfg = yield* AppConfig;
|
|
99452
|
+
const ws = yield* WsClient;
|
|
99453
|
+
const hostApi = yield* HostApiClient;
|
|
99454
|
+
const limitEffective = clampInt6(limit3, 1, 100);
|
|
99455
|
+
const rpcTimeoutMs = clampInt6(timeoutMs4, 1, 5000);
|
|
99456
|
+
const wsTimeoutMs = clampInt6(rpcTimeoutMs + 2000, 2000, 15000);
|
|
99457
|
+
const result = cfg.apiBaseUrl ? yield* hostApi.searchPlugin({
|
|
99458
|
+
baseUrl: cfg.apiBaseUrl,
|
|
99459
|
+
query,
|
|
99460
|
+
searchContextRemId: searchContextRemId2,
|
|
99461
|
+
limit: limitEffective,
|
|
99462
|
+
timeoutMs: rpcTimeoutMs,
|
|
99463
|
+
ensureDaemon: ensureDaemon5
|
|
99464
|
+
}) : yield* gen2(function* () {
|
|
99465
|
+
if (ensureDaemon5) {
|
|
99466
|
+
yield* ensureWsSupervisor({ waitMs: WS_START_WAIT_DEFAULT_MS });
|
|
99467
|
+
}
|
|
99468
|
+
return yield* ws.search({
|
|
99469
|
+
url: cfg.wsUrl,
|
|
99470
|
+
timeoutMs: wsTimeoutMs,
|
|
99471
|
+
queryText: query,
|
|
99472
|
+
searchContextRemId: searchContextRemId2,
|
|
99473
|
+
limit: limitEffective,
|
|
99474
|
+
rpcTimeoutMs
|
|
99475
|
+
});
|
|
99476
|
+
});
|
|
99477
|
+
const results = Array.isArray(result.results) ? result.results : [];
|
|
99478
|
+
const mdLines = [`- ok: ${result.ok === true ? "true" : "false"}`, `- results: ${results.length}`];
|
|
99479
|
+
for (const r of results) {
|
|
99480
|
+
const remId = typeof r?.remId === "string" ? r.remId : "";
|
|
99481
|
+
const title = typeof r?.title === "string" ? r.title : "";
|
|
99482
|
+
const snippet = typeof r?.snippet === "string" ? r.snippet : "";
|
|
99483
|
+
mdLines.push(`- ${title || remId}`);
|
|
99484
|
+
if (remId)
|
|
99485
|
+
mdLines.push(` - id: ${remId}`);
|
|
99486
|
+
if (snippet)
|
|
99487
|
+
mdLines.push(` - snippet: ${snippet}`);
|
|
99488
|
+
}
|
|
99489
|
+
yield* writeSuccess({ data: result, md: mdLines.join(`
|
|
99490
|
+
`) });
|
|
99491
|
+
}).pipe(catchAll2(writeFailure)));
|
|
99492
|
+
|
|
99493
|
+
// src/lib/pluginArtifacts.ts
|
|
99494
|
+
import { existsSync as existsSync2, statSync } from "node:fs";
|
|
99495
|
+
import path27 from "node:path";
|
|
99496
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
99497
|
+
function currentDir(moduleUrl) {
|
|
99498
|
+
return path27.dirname(fileURLToPath2(moduleUrl));
|
|
99499
|
+
}
|
|
99500
|
+
function isDirectory(targetPath) {
|
|
99501
|
+
try {
|
|
99502
|
+
return statSync(targetPath).isDirectory();
|
|
99503
|
+
} catch {
|
|
99504
|
+
return false;
|
|
99505
|
+
}
|
|
99506
|
+
}
|
|
99507
|
+
function distCandidates(moduleUrl) {
|
|
99508
|
+
const dir2 = currentDir(moduleUrl);
|
|
99509
|
+
return [
|
|
99510
|
+
path27.resolve(dir2, "../../plugin-artifacts/dist"),
|
|
99511
|
+
path27.resolve(dir2, "../plugin-artifacts/dist"),
|
|
99512
|
+
path27.resolve(dir2, "../../../plugin/dist"),
|
|
99513
|
+
path27.resolve(dir2, "../../plugin/dist")
|
|
99514
|
+
];
|
|
99515
|
+
}
|
|
99516
|
+
function validateDistPath(targetPath) {
|
|
99517
|
+
return isDirectory(targetPath) && existsSync2(path27.join(targetPath, "manifest.json"));
|
|
99518
|
+
}
|
|
99519
|
+
function resolvePluginDistPath(moduleUrl = import.meta.url) {
|
|
99520
|
+
for (const candidate of distCandidates(moduleUrl)) {
|
|
99521
|
+
if (validateDistPath(candidate))
|
|
99522
|
+
return candidate;
|
|
99523
|
+
}
|
|
99524
|
+
throw new CliError({
|
|
99525
|
+
code: "DEPENDENCY_MISSING",
|
|
99526
|
+
message: "Plugin build artifacts are unavailable",
|
|
99527
|
+
exitCode: 1,
|
|
99528
|
+
details: { candidates: distCandidates(moduleUrl) },
|
|
99529
|
+
hint: [
|
|
99530
|
+
"Run npm run build --workspace @remnote/plugin in the repository checkout",
|
|
99531
|
+
"Or install a packaged agent-remnote release that includes plugin artifacts"
|
|
99532
|
+
]
|
|
99533
|
+
});
|
|
99534
|
+
}
|
|
99535
|
+
|
|
99536
|
+
// src/runtime/plugin-static/runPluginStaticRuntime.ts
|
|
99537
|
+
import { createServer as createServer2 } from "node:http";
|
|
99538
|
+
|
|
99539
|
+
// src/lib/pluginStaticFiles.ts
|
|
99540
|
+
import { promises as fs21 } from "node:fs";
|
|
99541
|
+
import path28 from "node:path";
|
|
99542
|
+
var CONTENT_TYPES = new Map([
|
|
99543
|
+
[".css", "text/css; charset=utf-8"],
|
|
99544
|
+
[".html", "text/html; charset=utf-8"],
|
|
99545
|
+
[".js", "application/javascript; charset=utf-8"],
|
|
99546
|
+
[".json", "application/json; charset=utf-8"],
|
|
99547
|
+
[".md", "text/markdown; charset=utf-8"],
|
|
99548
|
+
[".txt", "text/plain; charset=utf-8"]
|
|
99549
|
+
]);
|
|
99550
|
+
function contentTypeFor(filePath) {
|
|
99551
|
+
return CONTENT_TYPES.get(path28.extname(filePath).toLowerCase()) ?? "application/octet-stream";
|
|
99552
|
+
}
|
|
99553
|
+
function normalizeAssetPath(pathname) {
|
|
99554
|
+
let decoded;
|
|
99555
|
+
try {
|
|
99556
|
+
decoded = decodeURIComponent(pathname);
|
|
99557
|
+
} catch {
|
|
99558
|
+
return null;
|
|
99559
|
+
}
|
|
99560
|
+
const raw4 = decoded === "/" ? "index.html" : decoded.replace(/^\/+/, "");
|
|
99561
|
+
const normalized = path28.posix.normalize(raw4);
|
|
99562
|
+
if (!normalized || normalized === "." || normalized.startsWith("../") || normalized === "..")
|
|
99563
|
+
return null;
|
|
99564
|
+
return normalized;
|
|
99565
|
+
}
|
|
99566
|
+
async function readPluginStaticAsset(params3) {
|
|
99567
|
+
const method = params3.method || "GET";
|
|
99568
|
+
if (method !== "GET" && method !== "HEAD") {
|
|
99569
|
+
return { ok: false, statusCode: 405, message: "Method not allowed" };
|
|
99570
|
+
}
|
|
99571
|
+
const relativePath = normalizeAssetPath(params3.pathname);
|
|
99572
|
+
if (!relativePath) {
|
|
99573
|
+
return { ok: false, statusCode: 404, message: "Not found" };
|
|
99574
|
+
}
|
|
99575
|
+
const filePath = path28.resolve(params3.distPath, relativePath);
|
|
99576
|
+
if (filePath !== params3.distPath && !filePath.startsWith(`${params3.distPath}${path28.sep}`)) {
|
|
99577
|
+
return { ok: false, statusCode: 404, message: "Not found" };
|
|
99578
|
+
}
|
|
99579
|
+
try {
|
|
99580
|
+
const stat3 = await fs21.stat(filePath);
|
|
99581
|
+
if (!stat3.isFile()) {
|
|
99582
|
+
return { ok: false, statusCode: 404, message: "Not found" };
|
|
99583
|
+
}
|
|
99584
|
+
const body = method === "HEAD" ? undefined : await fs21.readFile(filePath);
|
|
99585
|
+
return {
|
|
99586
|
+
ok: true,
|
|
99587
|
+
statusCode: 200,
|
|
99588
|
+
contentType: contentTypeFor(filePath),
|
|
99589
|
+
contentLength: stat3.size,
|
|
99590
|
+
body
|
|
99591
|
+
};
|
|
99592
|
+
} catch {
|
|
99593
|
+
return { ok: false, statusCode: 404, message: "Not found" };
|
|
99594
|
+
}
|
|
99595
|
+
}
|
|
99596
|
+
|
|
99597
|
+
// src/runtime/plugin-static/runPluginStaticRuntime.ts
|
|
99598
|
+
function sendText(res, statusCode, message2) {
|
|
99599
|
+
res.statusCode = statusCode;
|
|
99600
|
+
res.setHeader("content-type", "text/plain; charset=utf-8");
|
|
99601
|
+
res.end(message2);
|
|
99602
|
+
}
|
|
99603
|
+
function requestPathname(req) {
|
|
99604
|
+
return new URL(req.url || "/", "http://127.0.0.1").pathname;
|
|
99605
|
+
}
|
|
99606
|
+
async function handleRequest(req, res, distPath) {
|
|
99607
|
+
const result = await readPluginStaticAsset({
|
|
99608
|
+
distPath,
|
|
99609
|
+
pathname: requestPathname(req),
|
|
99610
|
+
method: req.method || "GET"
|
|
99611
|
+
});
|
|
99612
|
+
if (!result.ok) {
|
|
99613
|
+
sendText(res, result.statusCode, result.message);
|
|
99614
|
+
return;
|
|
99615
|
+
}
|
|
99616
|
+
res.statusCode = result.statusCode;
|
|
99617
|
+
res.setHeader("content-type", result.contentType);
|
|
99618
|
+
res.setHeader("content-length", String(result.contentLength));
|
|
99619
|
+
if (result.body === undefined)
|
|
99620
|
+
res.end();
|
|
99621
|
+
else
|
|
99622
|
+
res.end(result.body);
|
|
99623
|
+
}
|
|
99624
|
+
function runPluginStaticRuntime(params3) {
|
|
99625
|
+
return gen2(function* () {
|
|
99626
|
+
const distPath = params3?.distPath ?? (yield* try_3({
|
|
99627
|
+
try: () => resolvePluginDistPath(),
|
|
99628
|
+
catch: (error4) => isCliError(error4) ? error4 : new CliError({
|
|
99629
|
+
code: "DEPENDENCY_MISSING",
|
|
99630
|
+
message: "Plugin build artifacts are unavailable",
|
|
99631
|
+
exitCode: 1,
|
|
99632
|
+
details: { error: String(error4?.message || error4) }
|
|
99633
|
+
})
|
|
99634
|
+
}));
|
|
99635
|
+
const host7 = params3?.host ?? "127.0.0.1";
|
|
99636
|
+
const port9 = params3?.port ?? 8080;
|
|
99637
|
+
const server = createServer2((req, res) => {
|
|
99638
|
+
handleRequest(req, res, distPath).catch(() => {
|
|
99639
|
+
if (!res.headersSent) {
|
|
99640
|
+
sendText(res, 500, "Internal server error");
|
|
99641
|
+
}
|
|
99642
|
+
});
|
|
99643
|
+
});
|
|
99644
|
+
const listen = async((resume2) => {
|
|
99645
|
+
const onError4 = (error4) => {
|
|
99646
|
+
cleanup();
|
|
99647
|
+
resume2(fail8(new CliError({
|
|
99648
|
+
code: "PLUGIN_UNAVAILABLE",
|
|
99649
|
+
message: "Failed to start plugin static server",
|
|
99650
|
+
exitCode: 1,
|
|
99651
|
+
details: { host: host7, port: port9, error: String(error4?.message || error4) }
|
|
99652
|
+
})));
|
|
99653
|
+
};
|
|
99654
|
+
const onListening = () => {
|
|
99655
|
+
cleanup();
|
|
99656
|
+
resume2(_void);
|
|
99657
|
+
};
|
|
99658
|
+
const cleanup = () => {
|
|
99659
|
+
server.off("error", onError4);
|
|
99660
|
+
server.off("listening", onListening);
|
|
99661
|
+
};
|
|
99662
|
+
server.once("error", onError4);
|
|
99663
|
+
server.once("listening", onListening);
|
|
99664
|
+
server.listen(port9, host7);
|
|
99665
|
+
return sync3(cleanup);
|
|
99666
|
+
});
|
|
99667
|
+
yield* listen;
|
|
99668
|
+
const actualPort = (() => {
|
|
99669
|
+
const addr = server.address();
|
|
99670
|
+
return addr && typeof addr === "object" ? addr.port : port9;
|
|
99671
|
+
})();
|
|
99672
|
+
if (params3?.onStarted) {
|
|
99673
|
+
yield* params3.onStarted({ host: host7, port: actualPort, distPath });
|
|
99674
|
+
}
|
|
99675
|
+
const waitForStop = async((resume2) => {
|
|
99676
|
+
let stopping = false;
|
|
99677
|
+
const stop2 = () => {
|
|
99678
|
+
if (stopping)
|
|
99679
|
+
return;
|
|
99680
|
+
stopping = true;
|
|
99681
|
+
try {
|
|
99682
|
+
server.close(() => resume2(_void));
|
|
99683
|
+
} catch {
|
|
99684
|
+
resume2(_void);
|
|
99685
|
+
}
|
|
99686
|
+
};
|
|
99687
|
+
const onTerm = () => stop2();
|
|
99688
|
+
const onInt = () => stop2();
|
|
99689
|
+
process.on("SIGTERM", onTerm);
|
|
99690
|
+
process.on("SIGINT", onInt);
|
|
99691
|
+
return sync3(() => {
|
|
99692
|
+
process.off("SIGTERM", onTerm);
|
|
99693
|
+
process.off("SIGINT", onInt);
|
|
99694
|
+
stop2();
|
|
99695
|
+
});
|
|
99696
|
+
});
|
|
99697
|
+
yield* waitForStop;
|
|
99698
|
+
});
|
|
99699
|
+
}
|
|
99700
|
+
|
|
99701
|
+
// src/commands/plugin/serve.ts
|
|
99702
|
+
function optionToUndefined37(opt) {
|
|
99703
|
+
return isSome2(opt) ? opt.value : undefined;
|
|
99704
|
+
}
|
|
99705
|
+
var host7 = text9("host").pipe(optional5, map34(optionToUndefined37));
|
|
99706
|
+
var port9 = integer7("port").pipe(optional5, map34(optionToUndefined37));
|
|
99707
|
+
var stateFile20 = text9("state-file").pipe(optional5, map34(optionToUndefined37));
|
|
99708
|
+
var pluginServeCommand = exports_Command.make("serve", { host: host7, port: port9, stateFile: stateFile20 }, ({ host: host8, port: port10, stateFile: stateFile21 }) => gen2(function* () {
|
|
99709
|
+
const cfg = yield* AppConfig;
|
|
99710
|
+
const out = yield* Output;
|
|
99711
|
+
const files = yield* PluginServerFiles;
|
|
99712
|
+
const distPath = yield* try_3({
|
|
99713
|
+
try: () => resolvePluginDistPath(),
|
|
99714
|
+
catch: (error4) => isCliError(error4) ? error4 : new CliError({
|
|
99715
|
+
code: "DEPENDENCY_MISSING",
|
|
99716
|
+
message: "Plugin build artifacts are unavailable",
|
|
99717
|
+
exitCode: 1,
|
|
99718
|
+
details: { error: String(error4?.message || error4) }
|
|
99719
|
+
})
|
|
99720
|
+
});
|
|
99721
|
+
const bindHost = host8 ?? "127.0.0.1";
|
|
99722
|
+
const bindPort = port10 ?? 8080;
|
|
99723
|
+
const stateFilePath = stateFile21 ? resolveUserFilePath(stateFile21) : undefined;
|
|
99724
|
+
const runtime6 = runPluginStaticRuntime({
|
|
99725
|
+
host: bindHost,
|
|
99726
|
+
port: bindPort,
|
|
99727
|
+
distPath,
|
|
99728
|
+
onStarted: ({ host: host9, port: port11, distPath: distPath2 }) => gen2(function* () {
|
|
99729
|
+
const baseUrl = pluginServerLocalBaseUrl(host9, port11);
|
|
99730
|
+
if (stateFilePath) {
|
|
99731
|
+
yield* files.writeStateFile(stateFilePath, {
|
|
99732
|
+
running: true,
|
|
99733
|
+
pid: process.pid,
|
|
99734
|
+
host: host9,
|
|
99735
|
+
port: port11,
|
|
99736
|
+
startedAt: Date.now(),
|
|
99737
|
+
localBaseUrl: baseUrl,
|
|
99738
|
+
distPath: distPath2
|
|
99739
|
+
});
|
|
99740
|
+
}
|
|
99741
|
+
if (cfg.format === "json" || cfg.quiet || cfg.format === "ids")
|
|
99742
|
+
return;
|
|
99743
|
+
yield* out.stdout(cfg.debug ? `
|
|
99744
|
+
agent-remnote plugin ready
|
|
99745
|
+
|
|
99746
|
+
Local: ${baseUrl}/
|
|
99747
|
+
Dist: ${distPath2}
|
|
99748
|
+
` : `
|
|
99749
|
+
agent-remnote plugin ready
|
|
99750
|
+
|
|
99751
|
+
Local: ${baseUrl}/
|
|
99752
|
+
`);
|
|
99753
|
+
})
|
|
99754
|
+
}).pipe(ensuring2(stateFilePath ? files.deleteStateFile(stateFilePath).pipe(catchAll2(() => _void)) : _void));
|
|
99755
|
+
yield* runtime6;
|
|
99756
|
+
}).pipe(catchAll2(writeFailure)));
|
|
99757
|
+
|
|
99758
|
+
// src/commands/plugin/start.ts
|
|
99759
|
+
function optionToUndefined38(opt) {
|
|
99760
|
+
return isSome2(opt) ? opt.value : undefined;
|
|
99761
|
+
}
|
|
99762
|
+
var host8 = text9("host").pipe(optional5, map34(optionToUndefined38));
|
|
99763
|
+
var port10 = integer7("port").pipe(optional5, map34(optionToUndefined38));
|
|
99764
|
+
var pidFile17 = text9("pid-file").pipe(optional5, map34(optionToUndefined38));
|
|
99765
|
+
var logFile10 = text9("log-file").pipe(optional5, map34(optionToUndefined38));
|
|
99766
|
+
var stateFile21 = text9("state-file").pipe(optional5, map34(optionToUndefined38));
|
|
99767
|
+
var pluginStartCommand = exports_Command.make("start", {
|
|
99768
|
+
host: host8,
|
|
99769
|
+
port: port10,
|
|
99770
|
+
wait: integer7("wait").pipe(withDefault5(PLUGIN_SERVER_START_WAIT_DEFAULT_MS)),
|
|
99771
|
+
pidFile: pidFile17,
|
|
99772
|
+
logFile: logFile10,
|
|
99773
|
+
stateFile: stateFile21
|
|
99774
|
+
}, ({ host: host9, port: port11, wait: wait3, pidFile: pidFile18, logFile: logFile11, stateFile: stateFile22 }) => gen2(function* () {
|
|
99775
|
+
const result = yield* startPluginServer({ host: host9, port: port11, waitMs: wait3, pidFile: pidFile18, logFile: logFile11, stateFile: stateFile22 });
|
|
99776
|
+
yield* writeSuccess({
|
|
99777
|
+
data: result,
|
|
99778
|
+
md: `- started: ${result.started}
|
|
99779
|
+
- pid: ${result.pid ?? ""}
|
|
99780
|
+
- pid_file: ${result.pid_file}
|
|
99781
|
+
- log_file: ${result.log_file}
|
|
99782
|
+
- state_file: ${result.state_file}
|
|
99783
|
+
- base_url: ${result.base_url}
|
|
99784
|
+
`
|
|
99785
|
+
});
|
|
99786
|
+
}).pipe(catchAll2(writeFailure)));
|
|
99787
|
+
|
|
99788
|
+
// src/commands/plugin/status.ts
|
|
99789
|
+
function optionToUndefined39(opt) {
|
|
99790
|
+
return isSome2(opt) ? opt.value : undefined;
|
|
99791
|
+
}
|
|
99792
|
+
var pidFile18 = text9("pid-file").pipe(optional5, map34(optionToUndefined39));
|
|
99793
|
+
var stateFile22 = text9("state-file").pipe(optional5, map34(optionToUndefined39));
|
|
99794
|
+
function getPluginStatus(params3) {
|
|
99795
|
+
return gen2(function* () {
|
|
99796
|
+
const files = yield* PluginServerFiles;
|
|
99797
|
+
const proc = yield* Process;
|
|
99798
|
+
const pidInfo = yield* files.readPidFile(params3.pidFilePath);
|
|
99799
|
+
const effectiveStateFilePath = resolveUserFilePath(params3.explicitStateFilePath ?? pidInfo?.state_file ?? files.defaultStateFile());
|
|
99800
|
+
const state = yield* files.readStateFile(effectiveStateFilePath);
|
|
99801
|
+
const pid = pidInfo?.pid;
|
|
99802
|
+
const running4 = typeof pid === "number" ? yield* proc.isPidRunning(pid) : false;
|
|
99803
|
+
const host9 = pidInfo?.host ?? state?.host ?? PLUGIN_SERVER_DEFAULT_HOST;
|
|
99804
|
+
const port11 = pidInfo?.port ?? state?.port ?? PLUGIN_SERVER_DEFAULT_PORT;
|
|
99805
|
+
const baseUrl = pluginServerLocalBaseUrl(host9, port11);
|
|
99806
|
+
const health = yield* checkPluginServerHealth(baseUrl, PLUGIN_SERVER_HEALTH_TIMEOUT_MS).pipe(either3);
|
|
99807
|
+
return {
|
|
99808
|
+
service: {
|
|
99809
|
+
running: running4,
|
|
99810
|
+
pid: pid ?? null,
|
|
99811
|
+
pid_file: params3.pidFilePath,
|
|
99812
|
+
log_file: pidInfo?.log_file ?? files.defaultLogFile(),
|
|
99813
|
+
state_file: effectiveStateFilePath,
|
|
99814
|
+
started_at: pidInfo?.started_at ?? state?.startedAt ?? null
|
|
99815
|
+
},
|
|
99816
|
+
state: state ?? null,
|
|
99817
|
+
plugin_server: {
|
|
99818
|
+
healthy: health._tag === "Right",
|
|
99819
|
+
base_url: baseUrl,
|
|
99820
|
+
host: host9,
|
|
99821
|
+
port: port11,
|
|
99822
|
+
dist_path: state?.distPath ?? "",
|
|
99823
|
+
error: health._tag === "Left" ? health.left.message : undefined
|
|
99824
|
+
}
|
|
99825
|
+
};
|
|
99826
|
+
});
|
|
99827
|
+
}
|
|
99828
|
+
var pluginStatusCommand = exports_Command.make("status", { pidFile: pidFile18, stateFile: stateFile22 }, ({ pidFile: pidFile19, stateFile: stateFile23 }) => gen2(function* () {
|
|
99829
|
+
const files = yield* PluginServerFiles;
|
|
99830
|
+
const pidFilePath = resolveUserFilePath(pidFile19 ?? files.defaultPidFile());
|
|
99831
|
+
const data = yield* getPluginStatus({
|
|
99832
|
+
pidFilePath,
|
|
99833
|
+
explicitStateFilePath: stateFile23 ? resolveUserFilePath(stateFile23) : undefined
|
|
99834
|
+
});
|
|
99835
|
+
const md = [
|
|
99836
|
+
`- service_running: ${data.service.running}`,
|
|
99837
|
+
`- pid: ${data.service.pid ?? ""}`,
|
|
99838
|
+
`- pid_file: ${data.service.pid_file}`,
|
|
99839
|
+
`- log_file: ${data.service.log_file}`,
|
|
99840
|
+
`- state_file: ${data.service.state_file}`,
|
|
99841
|
+
`- started_at: ${data.service.started_at ?? ""}`,
|
|
99842
|
+
`- plugin_server_healthy: ${data.plugin_server.healthy}`,
|
|
99843
|
+
`- base_url: ${data.plugin_server.base_url}`,
|
|
99844
|
+
`- host: ${data.plugin_server.host}`,
|
|
99845
|
+
`- port: ${data.plugin_server.port}`,
|
|
99846
|
+
`- dist_path: ${data.plugin_server.dist_path}`
|
|
99847
|
+
].join(`
|
|
99848
|
+
`);
|
|
99849
|
+
yield* writeSuccess({ data, md });
|
|
99850
|
+
}).pipe(catchAll2(writeFailure)));
|
|
99851
|
+
|
|
99852
|
+
// src/commands/plugin/stop.ts
|
|
99853
|
+
function optionToUndefined40(opt) {
|
|
99854
|
+
return isSome2(opt) ? opt.value : undefined;
|
|
99855
|
+
}
|
|
99856
|
+
var pidFile19 = text9("pid-file").pipe(optional5, map34(optionToUndefined40));
|
|
99857
|
+
var stateFile23 = text9("state-file").pipe(optional5, map34(optionToUndefined40));
|
|
99858
|
+
function isEsrch(error4) {
|
|
99859
|
+
if (!(error4 instanceof CliError))
|
|
99860
|
+
return false;
|
|
99861
|
+
const code2 = error4.details?.code;
|
|
99862
|
+
const message2 = String(error4.details?.error ?? error4.message ?? "");
|
|
99863
|
+
return code2 === "ESRCH" || message2.includes("ESRCH");
|
|
99864
|
+
}
|
|
99865
|
+
function stopPluginServer(params3) {
|
|
99866
|
+
return gen2(function* () {
|
|
99867
|
+
const files = yield* PluginServerFiles;
|
|
99868
|
+
const proc = yield* Process;
|
|
99869
|
+
const existing = yield* files.readPidFile(params3.pidFilePath);
|
|
99870
|
+
if (!existing) {
|
|
99871
|
+
yield* files.deleteStateFile(params3.stateFilePath).pipe(catchAll2(() => _void));
|
|
99872
|
+
return {
|
|
99873
|
+
stopped: true,
|
|
99874
|
+
pid_file: params3.pidFilePath
|
|
99875
|
+
};
|
|
99876
|
+
}
|
|
99877
|
+
const cleanupStale = () => gen2(function* () {
|
|
99878
|
+
yield* files.deletePidFile(params3.pidFilePath);
|
|
99879
|
+
yield* files.deleteStateFile(existing.state_file ?? params3.stateFilePath).pipe(catchAll2(() => _void));
|
|
99880
|
+
return {
|
|
99881
|
+
stopped: true,
|
|
99882
|
+
stale: true,
|
|
99883
|
+
pid: existing.pid,
|
|
99884
|
+
pid_file: params3.pidFilePath
|
|
99885
|
+
};
|
|
99886
|
+
});
|
|
99887
|
+
const alive = yield* proc.isPidRunning(existing.pid);
|
|
99888
|
+
if (!alive) {
|
|
99889
|
+
return yield* cleanupStale();
|
|
99890
|
+
}
|
|
99891
|
+
const termResult = yield* proc.kill(existing.pid, "SIGTERM").pipe(either3);
|
|
99892
|
+
if (termResult._tag === "Left") {
|
|
99893
|
+
if (isEsrch(termResult.left)) {
|
|
99894
|
+
return yield* cleanupStale();
|
|
99895
|
+
}
|
|
99896
|
+
return yield* fail8(termResult.left);
|
|
99897
|
+
}
|
|
99898
|
+
const exited = yield* proc.waitForExit({ pid: existing.pid, timeoutMs: PLUGIN_SERVER_STOP_WAIT_DEFAULT_MS });
|
|
99899
|
+
if (!exited) {
|
|
99900
|
+
if (!params3.force) {
|
|
99901
|
+
return yield* fail8(new CliError({
|
|
99902
|
+
code: "INTERNAL",
|
|
99903
|
+
message: `Plugin server did not exit within ${PLUGIN_SERVER_STOP_WAIT_DEFAULT_MS}ms; use --force`,
|
|
99904
|
+
exitCode: 1,
|
|
99905
|
+
details: { pid: existing.pid, pid_file: params3.pidFilePath }
|
|
99906
|
+
}));
|
|
99907
|
+
}
|
|
99908
|
+
yield* proc.kill(existing.pid, "SIGKILL");
|
|
99909
|
+
const killed = yield* proc.waitForExit({ pid: existing.pid, timeoutMs: PLUGIN_SERVER_STOP_WAIT_DEFAULT_MS });
|
|
99910
|
+
if (!killed) {
|
|
99911
|
+
return yield* fail8(new CliError({
|
|
99912
|
+
code: "INTERNAL",
|
|
99913
|
+
message: "Force stop failed (process is still alive)",
|
|
99914
|
+
exitCode: 1,
|
|
99915
|
+
details: { pid: existing.pid, pid_file: params3.pidFilePath }
|
|
99916
|
+
}));
|
|
99917
|
+
}
|
|
99918
|
+
}
|
|
99919
|
+
yield* files.deletePidFile(params3.pidFilePath);
|
|
99920
|
+
yield* files.deleteStateFile(existing.state_file ?? params3.stateFilePath).pipe(catchAll2(() => _void));
|
|
99921
|
+
return {
|
|
99922
|
+
stopped: true,
|
|
99923
|
+
pid: existing.pid,
|
|
99924
|
+
pid_file: params3.pidFilePath
|
|
99925
|
+
};
|
|
99926
|
+
});
|
|
99927
|
+
}
|
|
99928
|
+
var pluginStopCommand = exports_Command.make("stop", { force: boolean8("force"), pidFile: pidFile19, stateFile: stateFile23 }, ({ force, pidFile: pidFile20, stateFile: stateFile24 }) => gen2(function* () {
|
|
99929
|
+
const files = yield* PluginServerFiles;
|
|
99930
|
+
const pidFilePath = resolveUserFilePath(pidFile20 ?? files.defaultPidFile());
|
|
99931
|
+
const stateFilePath = resolveUserFilePath(stateFile24 ?? files.defaultStateFile());
|
|
99932
|
+
const result = yield* stopPluginServer({ force, pidFilePath, stateFilePath });
|
|
99933
|
+
yield* writeSuccess({
|
|
99934
|
+
data: result,
|
|
99935
|
+
md: result.stale === true ? `- stopped: true
|
|
99936
|
+
- stale: true
|
|
99937
|
+
- pid: ${result.pid ?? ""}
|
|
99938
|
+
- pid_file: ${pidFilePath}
|
|
99939
|
+
` : result.pid ? `- stopped: true
|
|
99940
|
+
- pid: ${result.pid}
|
|
99941
|
+
- pid_file: ${pidFilePath}
|
|
99942
|
+
` : `- stopped: true
|
|
99943
|
+
- pid_file: ${pidFilePath}
|
|
99944
|
+
`
|
|
98385
99945
|
});
|
|
98386
|
-
const results = Array.isArray(result.results) ? result.results : [];
|
|
98387
|
-
const mdLines = [`- ok: ${result.ok === true ? "true" : "false"}`, `- results: ${results.length}`];
|
|
98388
|
-
for (const r of results) {
|
|
98389
|
-
const remId = typeof r?.remId === "string" ? r.remId : "";
|
|
98390
|
-
const title = typeof r?.title === "string" ? r.title : "";
|
|
98391
|
-
const snippet = typeof r?.snippet === "string" ? r.snippet : "";
|
|
98392
|
-
mdLines.push(`- ${title || remId}`);
|
|
98393
|
-
if (remId)
|
|
98394
|
-
mdLines.push(` - id: ${remId}`);
|
|
98395
|
-
if (snippet)
|
|
98396
|
-
mdLines.push(` - snippet: ${snippet}`);
|
|
98397
|
-
}
|
|
98398
|
-
yield* writeSuccess({ data: result, md: mdLines.join(`
|
|
98399
|
-
`) });
|
|
98400
99946
|
}).pipe(catchAll2(writeFailure)));
|
|
98401
99947
|
|
|
98402
99948
|
// src/commands/plugin/index.ts
|
|
98403
|
-
var pluginCommand = exports_Command.make("plugin", {}).pipe(exports_Command.withSubcommands([
|
|
99949
|
+
var pluginCommand = exports_Command.make("plugin", {}).pipe(exports_Command.withSubcommands([
|
|
99950
|
+
pluginCurrentCommand,
|
|
99951
|
+
pluginSearchCommand,
|
|
99952
|
+
pluginServeCommand,
|
|
99953
|
+
pluginStartCommand,
|
|
99954
|
+
pluginStopCommand,
|
|
99955
|
+
pluginRestartCommand,
|
|
99956
|
+
pluginEnsureCommand,
|
|
99957
|
+
pluginStatusCommand,
|
|
99958
|
+
pluginLogsCommand,
|
|
99959
|
+
readUiContextCommand,
|
|
99960
|
+
readSelectionCommand
|
|
99961
|
+
]));
|
|
98404
99962
|
|
|
98405
99963
|
// src/commands/read/powerup/list.ts
|
|
98406
|
-
function
|
|
99964
|
+
function optionToUndefined41(opt) {
|
|
98407
99965
|
return isSome2(opt) ? opt.value : undefined;
|
|
98408
99966
|
}
|
|
98409
|
-
var query = text9("query").pipe(optional5, map34(
|
|
99967
|
+
var query = text9("query").pipe(optional5, map34(optionToUndefined41));
|
|
98410
99968
|
var limit3 = integer7("limit").pipe(withDefault5(50));
|
|
98411
99969
|
var offset = integer7("offset").pipe(withDefault5(0));
|
|
98412
99970
|
function safeJsonParse3(input) {
|
|
@@ -98761,11 +100319,11 @@ var readPowerupResolveCommand = exports_Command.make("resolve", { powerup: text9
|
|
|
98761
100319
|
})), catchAll2(writeFailure)));
|
|
98762
100320
|
|
|
98763
100321
|
// src/commands/read/powerup/schema.ts
|
|
98764
|
-
function
|
|
100322
|
+
function optionToUndefined42(opt) {
|
|
98765
100323
|
return isSome2(opt) ? opt.value : undefined;
|
|
98766
100324
|
}
|
|
98767
|
-
var powerup = text9("powerup").pipe(optional5, map34(
|
|
98768
|
-
var id2 = text9("id").pipe(optional5, map34(
|
|
100325
|
+
var powerup = text9("powerup").pipe(optional5, map34(optionToUndefined42));
|
|
100326
|
+
var id2 = text9("id").pipe(optional5, map34(optionToUndefined42));
|
|
98769
100327
|
var limit4 = integer7("limit").pipe(withDefault5(50));
|
|
98770
100328
|
var offset2 = integer7("offset").pipe(withDefault5(0));
|
|
98771
100329
|
var readPowerupSchemaCommand = exports_Command.make("schema", { powerup, id: id2, includeOptions: boolean8("include-options"), limit: limit4, offset: offset2 }, ({ powerup: powerup2, id: id3, includeOptions, limit: limit5, offset: offset3 }) => gen2(function* () {
|
|
@@ -99046,33 +100604,33 @@ function compileTableValueOps(params3) {
|
|
|
99046
100604
|
}
|
|
99047
100605
|
|
|
99048
100606
|
// src/commands/write/_shared.ts
|
|
99049
|
-
function
|
|
100607
|
+
function optionToUndefined43(opt) {
|
|
99050
100608
|
return isSome2(opt) ? opt.value : undefined;
|
|
99051
100609
|
}
|
|
99052
100610
|
function readOptionalText3(name) {
|
|
99053
|
-
return text9(name).pipe(optional5, map34(
|
|
100611
|
+
return text9(name).pipe(optional5, map34(optionToUndefined43));
|
|
99054
100612
|
}
|
|
99055
100613
|
var writeCommonOptions = {
|
|
99056
100614
|
notify: boolean8("no-notify").pipe(map34((v) => !v)),
|
|
99057
100615
|
ensureDaemon: boolean8("no-ensure-daemon").pipe(map34((v) => !v)),
|
|
99058
100616
|
wait: boolean8("wait"),
|
|
99059
|
-
timeoutMs: integer7("timeout-ms").pipe(optional5, map34(
|
|
99060
|
-
pollMs: integer7("poll-ms").pipe(optional5, map34(
|
|
100617
|
+
timeoutMs: integer7("timeout-ms").pipe(optional5, map34(optionToUndefined43)),
|
|
100618
|
+
pollMs: integer7("poll-ms").pipe(optional5, map34(optionToUndefined43)),
|
|
99061
100619
|
dryRun: boolean8("dry-run"),
|
|
99062
|
-
priority: integer7("priority").pipe(optional5, map34(
|
|
100620
|
+
priority: integer7("priority").pipe(optional5, map34(optionToUndefined43)),
|
|
99063
100621
|
clientId: readOptionalText3("client-id"),
|
|
99064
100622
|
idempotencyKey: readOptionalText3("idempotency-key"),
|
|
99065
100623
|
meta: readOptionalText3("meta")
|
|
99066
100624
|
};
|
|
99067
100625
|
|
|
99068
100626
|
// src/commands/write/powerup/apply.ts
|
|
99069
|
-
var dispatchMode = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(
|
|
100627
|
+
var dispatchMode = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined43));
|
|
99070
100628
|
var writePowerupApplyCommand = exports_Command.make("apply", {
|
|
99071
100629
|
rem: text9("rem"),
|
|
99072
|
-
tagId: text9("tag-id").pipe(optional5, map34(
|
|
99073
|
-
powerup: text9("powerup").pipe(optional5, map34(
|
|
99074
|
-
text: text9("text").pipe(optional5, map34(
|
|
99075
|
-
values: text9("values").pipe(optional5, map34(
|
|
100630
|
+
tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined43)),
|
|
100631
|
+
powerup: text9("powerup").pipe(optional5, map34(optionToUndefined43)),
|
|
100632
|
+
text: text9("text").pipe(optional5, map34(optionToUndefined43)),
|
|
100633
|
+
values: text9("values").pipe(optional5, map34(optionToUndefined43)),
|
|
99076
100634
|
ensureTag: boolean8("no-ensure-tag").pipe(map34((v) => !v)),
|
|
99077
100635
|
notify: writeCommonOptions.notify,
|
|
99078
100636
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
@@ -99535,11 +101093,11 @@ var writePowerupOptionCommand = exports_Command.make("option", {}).pipe(exports_
|
|
|
99535
101093
|
|
|
99536
101094
|
// src/commands/write/powerup/property/add.ts
|
|
99537
101095
|
var writePowerupPropertyAddCommand = exports_Command.make("add", {
|
|
99538
|
-
tagId: text9("tag-id").pipe(optional5, map34(
|
|
99539
|
-
powerup: text9("powerup").pipe(optional5, map34(
|
|
101096
|
+
tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined43)),
|
|
101097
|
+
powerup: text9("powerup").pipe(optional5, map34(optionToUndefined43)),
|
|
99540
101098
|
name: text9("name"),
|
|
99541
|
-
type: text9("type").pipe(optional5, map34(
|
|
99542
|
-
options: text9("options").pipe(optional5, map34(
|
|
101099
|
+
type: text9("type").pipe(optional5, map34(optionToUndefined43)),
|
|
101100
|
+
options: text9("options").pipe(optional5, map34(optionToUndefined43)),
|
|
99543
101101
|
notify: writeCommonOptions.notify,
|
|
99544
101102
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
99545
101103
|
wait: writeCommonOptions.wait,
|
|
@@ -99703,14 +101261,14 @@ var writePowerupPropertySetTypeCommand = exports_Command.make("set-type", {
|
|
|
99703
101261
|
var writePowerupPropertyCommand = exports_Command.make("property", {}).pipe(exports_Command.withSubcommands([writePowerupPropertyAddCommand, writePowerupPropertySetTypeCommand]));
|
|
99704
101262
|
|
|
99705
101263
|
// src/commands/write/powerup/record/add.ts
|
|
99706
|
-
var dispatchMode2 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(
|
|
101264
|
+
var dispatchMode2 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined43));
|
|
99707
101265
|
var writePowerupRecordAddCommand = exports_Command.make("add", {
|
|
99708
|
-
tagId: text9("tag-id").pipe(optional5, map34(
|
|
99709
|
-
powerup: text9("powerup").pipe(optional5, map34(
|
|
99710
|
-
parent: text9("parent").pipe(optional5, map34(
|
|
99711
|
-
ref: text9("ref").pipe(optional5, map34(
|
|
99712
|
-
text: text9("text").pipe(optional5, map34(
|
|
99713
|
-
values: text9("values").pipe(optional5, map34(
|
|
101266
|
+
tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined43)),
|
|
101267
|
+
powerup: text9("powerup").pipe(optional5, map34(optionToUndefined43)),
|
|
101268
|
+
parent: text9("parent").pipe(optional5, map34(optionToUndefined43)),
|
|
101269
|
+
ref: text9("ref").pipe(optional5, map34(optionToUndefined43)),
|
|
101270
|
+
text: text9("text").pipe(optional5, map34(optionToUndefined43)),
|
|
101271
|
+
values: text9("values").pipe(optional5, map34(optionToUndefined43)),
|
|
99714
101272
|
extraTag: text9("extra-tag").pipe(repeated5),
|
|
99715
101273
|
notify: writeCommonOptions.notify,
|
|
99716
101274
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
@@ -99928,8 +101486,8 @@ function rowHasTag(doc, tagId) {
|
|
|
99928
101486
|
return Object.prototype.hasOwnProperty.call(tp, tagId);
|
|
99929
101487
|
}
|
|
99930
101488
|
var writePowerupRecordDeleteCommand = exports_Command.make("delete", {
|
|
99931
|
-
tagId: text9("tag-id").pipe(optional5, map34(
|
|
99932
|
-
powerup: text9("powerup").pipe(optional5, map34(
|
|
101489
|
+
tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined43)),
|
|
101490
|
+
powerup: text9("powerup").pipe(optional5, map34(optionToUndefined43)),
|
|
99933
101491
|
rem: text9("rem"),
|
|
99934
101492
|
validateMembership: boolean8("no-validate-membership").pipe(map34((v) => !v)),
|
|
99935
101493
|
notify: writeCommonOptions.notify,
|
|
@@ -100078,7 +101636,7 @@ var writePowerupRecordDeleteCommand = exports_Command.make("delete", {
|
|
|
100078
101636
|
}).pipe(catchAll2(writeFailure)));
|
|
100079
101637
|
|
|
100080
101638
|
// src/commands/write/powerup/record/update.ts
|
|
100081
|
-
var dispatchMode3 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(
|
|
101639
|
+
var dispatchMode3 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined43));
|
|
100082
101640
|
function rowHasTag2(doc, tagId) {
|
|
100083
101641
|
const tp = doc?.tp;
|
|
100084
101642
|
if (!tp || typeof tp !== "object" || Array.isArray(tp))
|
|
@@ -100086,11 +101644,11 @@ function rowHasTag2(doc, tagId) {
|
|
|
100086
101644
|
return Object.prototype.hasOwnProperty.call(tp, tagId);
|
|
100087
101645
|
}
|
|
100088
101646
|
var writePowerupRecordUpdateCommand = exports_Command.make("update", {
|
|
100089
|
-
tagId: text9("tag-id").pipe(optional5, map34(
|
|
100090
|
-
powerup: text9("powerup").pipe(optional5, map34(
|
|
101647
|
+
tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined43)),
|
|
101648
|
+
powerup: text9("powerup").pipe(optional5, map34(optionToUndefined43)),
|
|
100091
101649
|
rem: text9("rem"),
|
|
100092
|
-
text: text9("text").pipe(optional5, map34(
|
|
100093
|
-
values: text9("values").pipe(optional5, map34(
|
|
101650
|
+
text: text9("text").pipe(optional5, map34(optionToUndefined43)),
|
|
101651
|
+
values: text9("values").pipe(optional5, map34(optionToUndefined43)),
|
|
100094
101652
|
validateMembership: boolean8("no-validate-membership").pipe(map34((v) => !v)),
|
|
100095
101653
|
notify: writeCommonOptions.notify,
|
|
100096
101654
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
@@ -100311,9 +101869,9 @@ var writePowerupRecordCommand = exports_Command.make("record", {}).pipe(exports_
|
|
|
100311
101869
|
// src/commands/write/powerup/remove.ts
|
|
100312
101870
|
var writePowerupRemoveCommand = exports_Command.make("remove", {
|
|
100313
101871
|
rem: text9("rem"),
|
|
100314
|
-
tagId: text9("tag-id").pipe(optional5, map34(
|
|
100315
|
-
powerup: text9("powerup").pipe(optional5, map34(
|
|
100316
|
-
removeProperties: boolean8("remove-properties").pipe(optional5, map34(
|
|
101872
|
+
tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined43)),
|
|
101873
|
+
powerup: text9("powerup").pipe(optional5, map34(optionToUndefined43)),
|
|
101874
|
+
removeProperties: boolean8("remove-properties").pipe(optional5, map34(optionToUndefined43)),
|
|
100317
101875
|
notify: writeCommonOptions.notify,
|
|
100318
101876
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
100319
101877
|
wait: writeCommonOptions.wait,
|
|
@@ -100448,7 +102006,7 @@ var powerupCommand = exports_Command.make("powerup", {}).pipe(exports_Command.wi
|
|
|
100448
102006
|
]));
|
|
100449
102007
|
|
|
100450
102008
|
// src/commands/read/query.ts
|
|
100451
|
-
function
|
|
102009
|
+
function optionToUndefined44(opt) {
|
|
100452
102010
|
return isSome2(opt) ? opt.value : undefined;
|
|
100453
102011
|
}
|
|
100454
102012
|
function buildMarkdown3(items, total) {
|
|
@@ -100463,14 +102021,14 @@ function buildMarkdown3(items, total) {
|
|
|
100463
102021
|
return lines3.join(`
|
|
100464
102022
|
`);
|
|
100465
102023
|
}
|
|
100466
|
-
var payload = text9("payload").pipe(optional5, map34(
|
|
100467
|
-
var text15 = text9("text").pipe(optional5, map34(
|
|
102024
|
+
var payload = text9("payload").pipe(optional5, map34(optionToUndefined44));
|
|
102025
|
+
var text15 = text9("text").pipe(optional5, map34(optionToUndefined44));
|
|
100468
102026
|
var tag7 = text9("tag").pipe(repeated5);
|
|
100469
102027
|
var limit5 = integer7("limit").pipe(withDefault5(20));
|
|
100470
102028
|
var offset3 = integer7("offset").pipe(withDefault5(0));
|
|
100471
102029
|
var snippetLength = integer7("snippet-length").pipe(withDefault5(200));
|
|
100472
|
-
var sort2 = choice5("sort", ["rank", "updatedAt", "createdAt"]).pipe(optional5, map34(
|
|
100473
|
-
var sortDirection = choice5("sort-direction", ["asc", "desc"]).pipe(optional5, map34(
|
|
102030
|
+
var sort2 = choice5("sort", ["rank", "updatedAt", "createdAt"]).pipe(optional5, map34(optionToUndefined44));
|
|
102031
|
+
var sortDirection = choice5("sort-direction", ["asc", "desc"]).pipe(optional5, map34(optionToUndefined44));
|
|
100474
102032
|
var readQueryCommand = exports_Command.make("query", { payload, text: text15, tag: tag7, limit: limit5, offset: offset3, snippetLength, sort: sort2, sortDirection }, ({ payload: payload2, text: text16, tag: tag8, limit: limit6, offset: offset4, snippetLength: snippetLength2, sort: sort3, sortDirection: sortDirection2 }) => gen2(function* () {
|
|
100475
102033
|
const cfg = yield* AppConfig;
|
|
100476
102034
|
yield* failInRemoteMode({
|
|
@@ -100593,11 +102151,11 @@ var queueConflictsCommand = exports_Command.make("conflicts", {
|
|
|
100593
102151
|
}).pipe(catchAll2(writeFailure)));
|
|
100594
102152
|
|
|
100595
102153
|
// src/commands/queue/inspect.ts
|
|
100596
|
-
function
|
|
102154
|
+
function optionToUndefined45(opt) {
|
|
100597
102155
|
return isSome2(opt) ? opt.value : undefined;
|
|
100598
102156
|
}
|
|
100599
|
-
var txn = text9("txn").pipe(optional5, map34(
|
|
100600
|
-
var op = text9("op").pipe(optional5, map34(
|
|
102157
|
+
var txn = text9("txn").pipe(optional5, map34(optionToUndefined45));
|
|
102158
|
+
var op = text9("op").pipe(optional5, map34(optionToUndefined45));
|
|
100601
102159
|
var queueInspectCommand = exports_Command.make("inspect", { txn, op }, ({ txn: txn2, op: op2 }) => gen2(function* () {
|
|
100602
102160
|
const cfg = yield* AppConfig;
|
|
100603
102161
|
const queue = yield* Queue;
|
|
@@ -100723,13 +102281,13 @@ var queueStatsCommand = exports_Command.make("stats", { includeConflicts: boolea
|
|
|
100723
102281
|
}).pipe(catchAll2(writeFailure)));
|
|
100724
102282
|
|
|
100725
102283
|
// src/commands/queue/wait.ts
|
|
100726
|
-
function
|
|
102284
|
+
function optionToUndefined46(opt) {
|
|
100727
102285
|
return isSome2(opt) ? opt.value : undefined;
|
|
100728
102286
|
}
|
|
100729
102287
|
var queueWaitCommand = exports_Command.make("wait", {
|
|
100730
102288
|
txn: text9("txn"),
|
|
100731
|
-
timeoutMs: integer7("timeout-ms").pipe(optional5, map34(
|
|
100732
|
-
pollMs: integer7("poll-ms").pipe(optional5, map34(
|
|
102289
|
+
timeoutMs: integer7("timeout-ms").pipe(optional5, map34(optionToUndefined46)),
|
|
102290
|
+
pollMs: integer7("poll-ms").pipe(optional5, map34(optionToUndefined46))
|
|
100733
102291
|
}, ({ txn: txn2, timeoutMs: timeoutMs4, pollMs: pollMs3 }) => gen2(function* () {
|
|
100734
102292
|
const cfg = yield* AppConfig;
|
|
100735
102293
|
const hostApi = yield* HostApiClient;
|
|
@@ -100762,12 +102320,12 @@ var queueCommand = exports_Command.make("queue", {}).pipe(exports_Command.withSu
|
|
|
100762
102320
|
]));
|
|
100763
102321
|
|
|
100764
102322
|
// src/commands/read/by-reference.ts
|
|
100765
|
-
function
|
|
102323
|
+
function optionToUndefined47(opt) {
|
|
100766
102324
|
return isSome2(opt) ? opt.value : undefined;
|
|
100767
102325
|
}
|
|
100768
102326
|
var reference = text9("reference").pipe(repeated5);
|
|
100769
|
-
var timeRange = text9("time").pipe(optional5, map34(
|
|
100770
|
-
var maxDepth2 = integer7("max-depth").pipe(optional5, map34(
|
|
102327
|
+
var timeRange = text9("time").pipe(optional5, map34(optionToUndefined47));
|
|
102328
|
+
var maxDepth2 = integer7("max-depth").pipe(optional5, map34(optionToUndefined47));
|
|
100771
102329
|
var limit6 = integer7("limit").pipe(withDefault5(40));
|
|
100772
102330
|
var offset4 = integer7("offset").pipe(withDefault5(0));
|
|
100773
102331
|
var readByReferenceCommand = exports_Command.make("by-reference", { reference, timeRange, maxDepth: maxDepth2, limit: limit6, offset: offset4 }, ({ reference: reference2, timeRange: timeRange2, maxDepth: maxDepth3, limit: limit7, offset: offset5 }) => gen2(function* () {
|
|
@@ -100808,10 +102366,10 @@ var readConnectionsCommand = exports_Command.make("connections", { id: text9("id
|
|
|
100808
102366
|
}).pipe(catchAll2(writeFailure)));
|
|
100809
102367
|
|
|
100810
102368
|
// src/commands/read/inspect.ts
|
|
100811
|
-
function
|
|
102369
|
+
function optionToUndefined48(opt) {
|
|
100812
102370
|
return isSome2(opt) ? opt.value : undefined;
|
|
100813
102371
|
}
|
|
100814
|
-
var maxReferenceDepth = integer7("max-reference-depth").pipe(optional5, map34(
|
|
102372
|
+
var maxReferenceDepth = integer7("max-reference-depth").pipe(optional5, map34(optionToUndefined48));
|
|
100815
102373
|
var readInspectCommand = exports_Command.make("inspect", {
|
|
100816
102374
|
id: text9("id"),
|
|
100817
102375
|
expandReferences: boolean8("expand-references"),
|
|
@@ -100843,15 +102401,15 @@ var readInspectCommand = exports_Command.make("inspect", {
|
|
|
100843
102401
|
}).pipe(catchAll2(writeFailure)));
|
|
100844
102402
|
|
|
100845
102403
|
// src/commands/read/outline.ts
|
|
100846
|
-
function
|
|
102404
|
+
function optionToUndefined49(opt) {
|
|
100847
102405
|
return isSome2(opt) ? opt.value : undefined;
|
|
100848
102406
|
}
|
|
100849
|
-
var depth = integer7("depth").pipe(optional5, map34(
|
|
100850
|
-
var offset5 = integer7("offset").pipe(optional5, map34(
|
|
100851
|
-
var nodes = integer7("nodes").pipe(optional5, map34(
|
|
100852
|
-
var format9 = choice5("format", ["md", "json"]).pipe(optional5, map34(
|
|
100853
|
-
var id3 = text9("id").pipe(optional5, map34(
|
|
100854
|
-
var ref = text9("ref").pipe(optional5, map34(
|
|
102407
|
+
var depth = integer7("depth").pipe(optional5, map34(optionToUndefined49));
|
|
102408
|
+
var offset5 = integer7("offset").pipe(optional5, map34(optionToUndefined49));
|
|
102409
|
+
var nodes = integer7("nodes").pipe(optional5, map34(optionToUndefined49));
|
|
102410
|
+
var format9 = choice5("format", ["md", "json"]).pipe(optional5, map34(optionToUndefined49));
|
|
102411
|
+
var id3 = text9("id").pipe(optional5, map34(optionToUndefined49));
|
|
102412
|
+
var ref = text9("ref").pipe(optional5, map34(optionToUndefined49));
|
|
100855
102413
|
var readOutlineCommand = exports_Command.make("outline", {
|
|
100856
102414
|
id: id3,
|
|
100857
102415
|
ref,
|
|
@@ -100862,7 +102420,7 @@ var readOutlineCommand = exports_Command.make("outline", {
|
|
|
100862
102420
|
excludeProperties: boolean8("exclude-properties"),
|
|
100863
102421
|
includeEmpty: boolean8("include-empty"),
|
|
100864
102422
|
expandReferences: boolean8("expand-references"),
|
|
100865
|
-
maxReferenceDepth: integer7("max-reference-depth").pipe(optional5, map34(
|
|
102423
|
+
maxReferenceDepth: integer7("max-reference-depth").pipe(optional5, map34(optionToUndefined49)),
|
|
100866
102424
|
detail: boolean8("detail")
|
|
100867
102425
|
}, ({
|
|
100868
102426
|
id: id4,
|
|
@@ -100922,12 +102480,12 @@ var readOutlineCommand = exports_Command.make("outline", {
|
|
|
100922
102480
|
}).pipe(catchAll2(writeFailure)));
|
|
100923
102481
|
|
|
100924
102482
|
// src/commands/read/page-id.ts
|
|
100925
|
-
function
|
|
102483
|
+
function optionToUndefined50(opt) {
|
|
100926
102484
|
return isSome2(opt) ? opt.value : undefined;
|
|
100927
102485
|
}
|
|
100928
|
-
var ref2 = text9("ref").pipe(optional5, map34(
|
|
102486
|
+
var ref2 = text9("ref").pipe(optional5, map34(optionToUndefined50));
|
|
100929
102487
|
var id4 = text9("id").pipe(repeated5);
|
|
100930
|
-
var maxHops = integer7("max-hops").pipe(optional5, map34(
|
|
102488
|
+
var maxHops = integer7("max-hops").pipe(optional5, map34(optionToUndefined50));
|
|
100931
102489
|
var readPageIdCommand = exports_Command.make("page-id", { ref: ref2, id: id4, maxHops, detail: boolean8("detail") }, ({ ref: ref3, id: id5, maxHops: maxHops2, detail }) => gen2(function* () {
|
|
100932
102490
|
const cfg = yield* AppConfig;
|
|
100933
102491
|
yield* failInRemoteMode({
|
|
@@ -100980,11 +102538,11 @@ var readPageIdCommand = exports_Command.make("page-id", { ref: ref2, id: id4, ma
|
|
|
100980
102538
|
}).pipe(catchAll2(writeFailure)));
|
|
100981
102539
|
|
|
100982
102540
|
// src/commands/read/references.ts
|
|
100983
|
-
function
|
|
102541
|
+
function optionToUndefined51(opt) {
|
|
100984
102542
|
return isSome2(opt) ? opt.value : undefined;
|
|
100985
102543
|
}
|
|
100986
|
-
var maxDepth3 = integer7("max-depth").pipe(optional5, map34(
|
|
100987
|
-
var inboundMaxDepth = integer7("inbound-max-depth").pipe(optional5, map34(
|
|
102544
|
+
var maxDepth3 = integer7("max-depth").pipe(optional5, map34(optionToUndefined51));
|
|
102545
|
+
var inboundMaxDepth = integer7("inbound-max-depth").pipe(optional5, map34(optionToUndefined51));
|
|
100988
102546
|
var readReferencesCommand = exports_Command.make("references", {
|
|
100989
102547
|
id: text9("id"),
|
|
100990
102548
|
includeDescendants: boolean8("include-descendants"),
|
|
@@ -101020,10 +102578,10 @@ var readReferencesCommand = exports_Command.make("references", {
|
|
|
101020
102578
|
|
|
101021
102579
|
// src/commands/read/resolve-ref.ts
|
|
101022
102580
|
var ids3 = text9("ids").pipe(repeated5);
|
|
101023
|
-
function
|
|
102581
|
+
function optionToUndefined52(opt) {
|
|
101024
102582
|
return isSome2(opt) ? opt.value : undefined;
|
|
101025
102583
|
}
|
|
101026
|
-
var maxReferenceDepth2 = integer7("max-reference-depth").pipe(optional5, map34(
|
|
102584
|
+
var maxReferenceDepth2 = integer7("max-reference-depth").pipe(optional5, map34(optionToUndefined52));
|
|
101027
102585
|
var readResolveRefCommand = exports_Command.make("resolve-ref", {
|
|
101028
102586
|
ids: ids3,
|
|
101029
102587
|
expandReferences: boolean8("expand-references"),
|
|
@@ -101058,13 +102616,13 @@ function normalizeRemIdInput2(raw4) {
|
|
|
101058
102616
|
}
|
|
101059
102617
|
var tag8 = text9("tag").pipe(repeated5);
|
|
101060
102618
|
var writeRemCreateCommand = exports_Command.make("create", {
|
|
101061
|
-
parent: text9("parent").pipe(optional5, map34(
|
|
101062
|
-
ref: text9("ref").pipe(optional5, map34(
|
|
101063
|
-
text: text9("text").pipe(optional5, map34(
|
|
102619
|
+
parent: text9("parent").pipe(optional5, map34(optionToUndefined43)),
|
|
102620
|
+
ref: text9("ref").pipe(optional5, map34(optionToUndefined43)),
|
|
102621
|
+
text: text9("text").pipe(optional5, map34(optionToUndefined43)),
|
|
101064
102622
|
isDocument: boolean8("is-document"),
|
|
101065
102623
|
tag: tag8,
|
|
101066
|
-
position: integer7("position").pipe(optional5, map34(
|
|
101067
|
-
clientTempId: text9("client-temp-id").pipe(optional5, map34(
|
|
102624
|
+
position: integer7("position").pipe(optional5, map34(optionToUndefined43)),
|
|
102625
|
+
clientTempId: text9("client-temp-id").pipe(optional5, map34(optionToUndefined43)),
|
|
101068
102626
|
forceText: boolean8("force-text"),
|
|
101069
102627
|
notify: writeCommonOptions.notify,
|
|
101070
102628
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
@@ -101140,7 +102698,7 @@ var writeRemCreateCommand = exports_Command.make("create", {
|
|
|
101140
102698
|
const tags2 = Array.isArray(tag9) ? tag9.map(normalizeRemIdInput2).filter(Boolean) : [];
|
|
101141
102699
|
const remClientTempId = clientTempId ? String(clientTempId).trim() : makeTempId();
|
|
101142
102700
|
const textValue = text16 !== undefined ? trimBoundaryBlankLines(text16) : undefined;
|
|
101143
|
-
if (textValue && !forceText2 &&
|
|
102701
|
+
if (textValue && !forceText2 && looksLikeStructuredMarkdown2(textValue)) {
|
|
101144
102702
|
return yield* fail8(new CliError({
|
|
101145
102703
|
code: "INVALID_ARGS",
|
|
101146
102704
|
message: "Input passed to --text looks like structured Markdown. Use rem children append --rem <parentRemId> --markdown ... instead, or pass --force-text to keep it literal.",
|
|
@@ -101247,16 +102805,17 @@ function buildActionEnvelope(params3) {
|
|
|
101247
102805
|
return gen2(function* () {
|
|
101248
102806
|
const payloadSvc = yield* Payload;
|
|
101249
102807
|
const metaValue = params3.metaSpec ? yield* payloadSvc.readJson(params3.metaSpec) : undefined;
|
|
102808
|
+
const input = params3.input ?? {
|
|
102809
|
+
rem_id: params3.remId,
|
|
102810
|
+
...params3.markdown !== undefined ? { markdown: params3.markdown } : {}
|
|
102811
|
+
};
|
|
101250
102812
|
return {
|
|
101251
102813
|
version: 1,
|
|
101252
102814
|
kind: "actions",
|
|
101253
102815
|
actions: [
|
|
101254
102816
|
{
|
|
101255
102817
|
action: params3.action,
|
|
101256
|
-
input
|
|
101257
|
-
rem_id: params3.remId,
|
|
101258
|
-
...params3.markdown !== undefined ? { markdown: params3.markdown } : {}
|
|
101259
|
-
}
|
|
102818
|
+
input
|
|
101260
102819
|
}
|
|
101261
102820
|
],
|
|
101262
102821
|
...params3.priority !== undefined ? { priority: params3.priority } : {},
|
|
@@ -101268,6 +102827,30 @@ function buildActionEnvelope(params3) {
|
|
|
101268
102827
|
};
|
|
101269
102828
|
});
|
|
101270
102829
|
}
|
|
102830
|
+
function resolveCurrentSelectionRemId(params3) {
|
|
102831
|
+
return gen2(function* () {
|
|
102832
|
+
const cfg = yield* AppConfig;
|
|
102833
|
+
const hostApi = yield* HostApiClient;
|
|
102834
|
+
const data = cfg.apiBaseUrl ? yield* hostApi.selectionCurrent({ baseUrl: cfg.apiBaseUrl, stateFile: params3.stateFile, staleMs: params3.staleMs }) : yield* collectSelectionCurrentUseCase({ stateFile: params3.stateFile, staleMs: params3.staleMs });
|
|
102835
|
+
const totalCountRaw = Number(data?.total_count ?? 0);
|
|
102836
|
+
const totalCount = Number.isFinite(totalCountRaw) && totalCountRaw >= 0 ? Math.floor(totalCountRaw) : 0;
|
|
102837
|
+
const truncated = data?.truncated === true;
|
|
102838
|
+
const currentId = typeof data?.current?.id === "string" ? data.current.id.trim() : Array.isArray(data?.ids) ? String(data.ids[0] ?? "").trim() : "";
|
|
102839
|
+
if (truncated || totalCount !== 1 || !currentId) {
|
|
102840
|
+
return yield* fail8(new CliError({
|
|
102841
|
+
code: "INVALID_ARGS",
|
|
102842
|
+
message: "Current selection must resolve to exactly one selected Rem",
|
|
102843
|
+
exitCode: 2,
|
|
102844
|
+
details: { total_count: totalCount, truncated, current_id: currentId || null, selection: data }
|
|
102845
|
+
}));
|
|
102846
|
+
}
|
|
102847
|
+
return {
|
|
102848
|
+
source: "selection",
|
|
102849
|
+
rem_id: currentId,
|
|
102850
|
+
selection: data
|
|
102851
|
+
};
|
|
102852
|
+
});
|
|
102853
|
+
}
|
|
101271
102854
|
function readMarkdownArg(inputSpec) {
|
|
101272
102855
|
return gen2(function* () {
|
|
101273
102856
|
const raw4 = yield* readMarkdownTextFromInputSpec(inputSpec);
|
|
@@ -101320,6 +102903,39 @@ function submitActionEnvelope(params3) {
|
|
|
101320
102903
|
});
|
|
101321
102904
|
});
|
|
101322
102905
|
}
|
|
102906
|
+
function loadTxnDetail(params3) {
|
|
102907
|
+
return gen2(function* () {
|
|
102908
|
+
const cfg = yield* AppConfig;
|
|
102909
|
+
const hostApi = yield* HostApiClient;
|
|
102910
|
+
const queue = yield* Queue;
|
|
102911
|
+
return cfg.apiBaseUrl ? yield* hostApi.queueTxn({ baseUrl: cfg.apiBaseUrl, txnId: params3.txnId }) : yield* queue.inspect({ dbPath: cfg.storeDb, txnId: params3.txnId });
|
|
102912
|
+
});
|
|
102913
|
+
}
|
|
102914
|
+
function parseResultJson(raw4) {
|
|
102915
|
+
const resultJson = raw4?.result_json;
|
|
102916
|
+
if (typeof resultJson === "string" && resultJson.trim()) {
|
|
102917
|
+
try {
|
|
102918
|
+
return JSON.parse(resultJson);
|
|
102919
|
+
} catch {}
|
|
102920
|
+
}
|
|
102921
|
+
return null;
|
|
102922
|
+
}
|
|
102923
|
+
function extractReplaceBackupSummary(txnDetail) {
|
|
102924
|
+
const ops = Array.isArray(txnDetail?.ops) ? txnDetail.ops : [];
|
|
102925
|
+
const replaceOp = ops.find((op2) => ["replace_children_with_markdown", "replace_selection_with_markdown"].includes(String(op2?.type ?? "").trim()));
|
|
102926
|
+
if (!replaceOp)
|
|
102927
|
+
return;
|
|
102928
|
+
const result = parseResultJson(replaceOp.result);
|
|
102929
|
+
if (!result || typeof result !== "object")
|
|
102930
|
+
return;
|
|
102931
|
+
return {
|
|
102932
|
+
policy: typeof result.backup_policy === "string" && result.backup_policy.trim() ? result.backup_policy.trim() : "none",
|
|
102933
|
+
deleted: result.backup_deleted !== false,
|
|
102934
|
+
rem_id: typeof result.backup_rem_id === "string" && result.backup_rem_id.trim() ? result.backup_rem_id.trim() : null,
|
|
102935
|
+
...result.backup_hidden === true ? { hidden: true } : {},
|
|
102936
|
+
...typeof result.backup_cleanup_state === "string" && result.backup_cleanup_state.trim() ? { cleanup_state: result.backup_cleanup_state.trim() } : {}
|
|
102937
|
+
};
|
|
102938
|
+
}
|
|
101323
102939
|
|
|
101324
102940
|
// src/commands/write/rem/children/append.ts
|
|
101325
102941
|
var writeRemChildrenAppendCommand = exports_Command.make("append", {
|
|
@@ -101484,9 +103100,17 @@ var writeRemChildrenPrependCommand = exports_Command.make("prepend", {
|
|
|
101484
103100
|
}).pipe(catchAll2(writeFailure)));
|
|
101485
103101
|
|
|
101486
103102
|
// src/commands/write/rem/children/replace.ts
|
|
103103
|
+
function optionToUndefined53(opt) {
|
|
103104
|
+
return isSome2(opt) ? opt.value : undefined;
|
|
103105
|
+
}
|
|
101487
103106
|
var writeRemChildrenReplaceCommand = exports_Command.make("replace", {
|
|
101488
|
-
rem: text9("rem"),
|
|
103107
|
+
rem: text9("rem").pipe(optional5, map34(optionToUndefined53)),
|
|
103108
|
+
selection: boolean8("selection"),
|
|
103109
|
+
stateFile: text9("state-file").pipe(optional5, map34(optionToUndefined53)),
|
|
103110
|
+
staleMs: integer7("stale-ms").pipe(optional5, map34(optionToUndefined53)),
|
|
101489
103111
|
markdown: text9("markdown"),
|
|
103112
|
+
backup: choice5("backup", ["none", "visible"]).pipe(withDefault5("none")),
|
|
103113
|
+
assert: choice5("assert", ["single-root", "preserve-anchor", "no-literal-bullet"]).pipe(repeated5),
|
|
101490
103114
|
notify: writeCommonOptions.notify,
|
|
101491
103115
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
101492
103116
|
wait: writeCommonOptions.wait,
|
|
@@ -101497,14 +103121,50 @@ var writeRemChildrenReplaceCommand = exports_Command.make("replace", {
|
|
|
101497
103121
|
clientId: writeCommonOptions.clientId,
|
|
101498
103122
|
idempotencyKey: writeCommonOptions.idempotencyKey,
|
|
101499
103123
|
meta: writeCommonOptions.meta
|
|
101500
|
-
}, ({
|
|
103124
|
+
}, ({
|
|
103125
|
+
rem,
|
|
103126
|
+
selection,
|
|
103127
|
+
stateFile: stateFile24,
|
|
103128
|
+
staleMs: staleMs11,
|
|
103129
|
+
markdown: markdown2,
|
|
103130
|
+
backup,
|
|
103131
|
+
assert: assert2,
|
|
103132
|
+
notify: notify3,
|
|
103133
|
+
ensureDaemon: ensureDaemon5,
|
|
103134
|
+
wait: wait3,
|
|
103135
|
+
timeoutMs: timeoutMs4,
|
|
103136
|
+
pollMs: pollMs3,
|
|
103137
|
+
dryRun,
|
|
103138
|
+
priority: priority3,
|
|
103139
|
+
clientId: clientId3,
|
|
103140
|
+
idempotencyKey: idempotencyKey3,
|
|
103141
|
+
meta
|
|
103142
|
+
}) => gen2(function* () {
|
|
101501
103143
|
yield* ensureWaitArgs({ wait: wait3, timeoutMs: timeoutMs4, pollMs: pollMs3, dryRun });
|
|
101502
|
-
const
|
|
103144
|
+
const hasRem = typeof rem === "string" && rem.trim().length > 0;
|
|
103145
|
+
const targetCount = Number(hasRem) + Number(selection === true);
|
|
103146
|
+
if (targetCount !== 1) {
|
|
103147
|
+
return yield* fail8(new CliError({
|
|
103148
|
+
code: "INVALID_ARGS",
|
|
103149
|
+
message: "Provide exactly one target via --rem or --selection",
|
|
103150
|
+
exitCode: 2
|
|
103151
|
+
}));
|
|
103152
|
+
}
|
|
103153
|
+
const target2 = selection ? yield* resolveCurrentSelectionRemId({ stateFile: stateFile24, staleMs: staleMs11 }) : {
|
|
103154
|
+
source: "rem",
|
|
103155
|
+
rem_id: normalizeRemIdInput3(String(rem))
|
|
103156
|
+
};
|
|
103157
|
+
const remId = target2.rem_id;
|
|
101503
103158
|
const markdownValue = yield* readMarkdownArg(markdown2);
|
|
101504
103159
|
const body = yield* buildActionEnvelope({
|
|
101505
103160
|
action: "rem.children.replace",
|
|
101506
103161
|
remId,
|
|
101507
|
-
|
|
103162
|
+
input: {
|
|
103163
|
+
rem_id: remId,
|
|
103164
|
+
markdown: markdownValue,
|
|
103165
|
+
backup,
|
|
103166
|
+
...assert2.length > 0 ? { assertions: assert2 } : {}
|
|
103167
|
+
},
|
|
101508
103168
|
priority: priority3,
|
|
101509
103169
|
clientId: clientId3,
|
|
101510
103170
|
idempotencyKey: idempotencyKey3,
|
|
@@ -101515,24 +103175,32 @@ var writeRemChildrenReplaceCommand = exports_Command.make("replace", {
|
|
|
101515
103175
|
if (dryRun) {
|
|
101516
103176
|
const compiled = yield* dryRunEnvelope(body);
|
|
101517
103177
|
yield* writeSuccess({
|
|
101518
|
-
data: { dry_run: true, ...compiled },
|
|
103178
|
+
data: { dry_run: true, target: { source: target2.source, rem_id: remId }, ...compiled },
|
|
101519
103179
|
md: `- dry_run: true
|
|
101520
103180
|
- action: rem.children.replace
|
|
101521
103181
|
- rem_id: ${remId}
|
|
103182
|
+
- target: ${target2.source}
|
|
101522
103183
|
`
|
|
101523
103184
|
});
|
|
101524
103185
|
return;
|
|
101525
103186
|
}
|
|
101526
103187
|
const data = yield* submitActionEnvelope({ body, wait: wait3, timeoutMs: timeoutMs4, pollMs: pollMs3 });
|
|
103188
|
+
const backupSummary = wait3 && data.status === "succeeded" && typeof data.txn_id === "string" ? extractReplaceBackupSummary(yield* loadTxnDetail({ txnId: data.txn_id })) : undefined;
|
|
101527
103189
|
yield* writeSuccess({
|
|
101528
|
-
data,
|
|
103190
|
+
data: backupSummary ? { ...data, backup: backupSummary } : data,
|
|
101529
103191
|
ids: [data.txn_id, ...Array.isArray(data.op_ids) ? data.op_ids : []],
|
|
101530
103192
|
md: [
|
|
101531
103193
|
`- txn_id: ${data.txn_id}`,
|
|
101532
103194
|
`- op_ids: ${Array.isArray(data.op_ids) ? data.op_ids.length : ""}`,
|
|
101533
103195
|
`- notified: ${data.notified}`,
|
|
101534
103196
|
`- sent: ${data.sent ?? ""}`,
|
|
101535
|
-
...data.status ? [`- status: ${data.status}`, `- elapsed_ms: ${data.elapsed_ms ?? ""}`] : []
|
|
103197
|
+
...data.status ? [`- status: ${data.status}`, `- elapsed_ms: ${data.elapsed_ms ?? ""}`] : [],
|
|
103198
|
+
...backupSummary ? [
|
|
103199
|
+
`- backup_policy: ${backupSummary.policy}`,
|
|
103200
|
+
`- backup_deleted: ${backupSummary.deleted ? "true" : "false"}`,
|
|
103201
|
+
...backupSummary.hidden ? ["- backup_hidden: true"] : [],
|
|
103202
|
+
...backupSummary.cleanup_state ? [`- backup_cleanup_state: ${backupSummary.cleanup_state}`] : []
|
|
103203
|
+
] : []
|
|
101536
103204
|
].join(`
|
|
101537
103205
|
`)
|
|
101538
103206
|
});
|
|
@@ -101547,8 +103215,12 @@ var writeRemChildrenCommand = exports_Command.make("children", {}).pipe(exports_
|
|
|
101547
103215
|
]));
|
|
101548
103216
|
|
|
101549
103217
|
// src/commands/write/rem/delete.ts
|
|
103218
|
+
function optionToUndefined54(opt) {
|
|
103219
|
+
return isSome2(opt) ? opt.value : undefined;
|
|
103220
|
+
}
|
|
101550
103221
|
var writeRemDeleteCommand = exports_Command.make("delete", {
|
|
101551
103222
|
rem: text9("rem"),
|
|
103223
|
+
maxDeleteSubtreeNodes: integer7("max-delete-subtree-nodes").pipe(optional5, map34(optionToUndefined54)),
|
|
101552
103224
|
notify: writeCommonOptions.notify,
|
|
101553
103225
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
101554
103226
|
wait: writeCommonOptions.wait,
|
|
@@ -101559,7 +103231,27 @@ var writeRemDeleteCommand = exports_Command.make("delete", {
|
|
|
101559
103231
|
clientId: writeCommonOptions.clientId,
|
|
101560
103232
|
idempotencyKey: writeCommonOptions.idempotencyKey,
|
|
101561
103233
|
meta: writeCommonOptions.meta
|
|
101562
|
-
}, ({
|
|
103234
|
+
}, ({
|
|
103235
|
+
rem,
|
|
103236
|
+
maxDeleteSubtreeNodes,
|
|
103237
|
+
notify: notify3,
|
|
103238
|
+
ensureDaemon: ensureDaemon5,
|
|
103239
|
+
wait: wait3,
|
|
103240
|
+
timeoutMs: timeoutMs4,
|
|
103241
|
+
pollMs: pollMs3,
|
|
103242
|
+
dryRun,
|
|
103243
|
+
priority: priority3,
|
|
103244
|
+
clientId: clientId3,
|
|
103245
|
+
idempotencyKey: idempotencyKey3,
|
|
103246
|
+
meta
|
|
103247
|
+
}) => gen2(function* () {
|
|
103248
|
+
if (maxDeleteSubtreeNodes !== undefined && maxDeleteSubtreeNodes <= 0) {
|
|
103249
|
+
return yield* fail8(new CliError({
|
|
103250
|
+
code: "INVALID_ARGS",
|
|
103251
|
+
message: "--max-delete-subtree-nodes must be a positive integer",
|
|
103252
|
+
exitCode: 2
|
|
103253
|
+
}));
|
|
103254
|
+
}
|
|
101563
103255
|
if (!wait3 && (timeoutMs4 !== undefined || pollMs3 !== undefined)) {
|
|
101564
103256
|
return yield* fail8(new CliError({
|
|
101565
103257
|
code: "INVALID_ARGS",
|
|
@@ -101576,7 +103268,13 @@ var writeRemDeleteCommand = exports_Command.make("delete", {
|
|
|
101576
103268
|
}
|
|
101577
103269
|
const payloadSvc = yield* Payload;
|
|
101578
103270
|
const op2 = yield* try_3({
|
|
101579
|
-
try: () => normalizeOp({
|
|
103271
|
+
try: () => normalizeOp({
|
|
103272
|
+
type: "delete_rem",
|
|
103273
|
+
payload: {
|
|
103274
|
+
remId: rem,
|
|
103275
|
+
...maxDeleteSubtreeNodes !== undefined ? { maxDeleteSubtreeNodes } : {}
|
|
103276
|
+
}
|
|
103277
|
+
}, payloadSvc.normalizeKeys),
|
|
101580
103278
|
catch: (e) => isCliError(e) ? e : new CliError({
|
|
101581
103279
|
code: "INVALID_PAYLOAD",
|
|
101582
103280
|
message: "Failed to generate op",
|
|
@@ -101630,9 +103328,9 @@ function normalizeRemIdInput4(raw4) {
|
|
|
101630
103328
|
}
|
|
101631
103329
|
var writeRemMoveCommand = exports_Command.make("move", {
|
|
101632
103330
|
rem: text9("rem"),
|
|
101633
|
-
parent: text9("parent").pipe(optional5, map34(
|
|
101634
|
-
ref: text9("ref").pipe(optional5, map34(
|
|
101635
|
-
position: integer7("position").pipe(optional5, map34(
|
|
103331
|
+
parent: text9("parent").pipe(optional5, map34(optionToUndefined43)),
|
|
103332
|
+
ref: text9("ref").pipe(optional5, map34(optionToUndefined43)),
|
|
103333
|
+
position: integer7("position").pipe(optional5, map34(optionToUndefined43)),
|
|
101636
103334
|
notify: writeCommonOptions.notify,
|
|
101637
103335
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
101638
103336
|
wait: writeCommonOptions.wait,
|
|
@@ -101835,7 +103533,7 @@ var writeTagAddCommand = exports_Command.make("add", {
|
|
|
101835
103533
|
var writeTagRemoveCommand = exports_Command.make("remove", {
|
|
101836
103534
|
rem: text9("rem"),
|
|
101837
103535
|
tag: text9("tag"),
|
|
101838
|
-
removeProperties: boolean8("remove-properties").pipe(optional5, map34(
|
|
103536
|
+
removeProperties: boolean8("remove-properties").pipe(optional5, map34(optionToUndefined43)),
|
|
101839
103537
|
notify: writeCommonOptions.notify,
|
|
101840
103538
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
101841
103539
|
wait: writeCommonOptions.wait,
|
|
@@ -101939,85 +103637,85 @@ function normalizeRemIdInput6(raw4) {
|
|
|
101939
103637
|
return link3.remId;
|
|
101940
103638
|
return trimmed2;
|
|
101941
103639
|
}
|
|
101942
|
-
|
|
101943
|
-
|
|
101944
|
-
|
|
101945
|
-
|
|
101946
|
-
|
|
101947
|
-
|
|
101948
|
-
|
|
101949
|
-
|
|
101950
|
-
|
|
101951
|
-
|
|
101952
|
-
|
|
101953
|
-
|
|
101954
|
-
|
|
101955
|
-
|
|
101956
|
-
|
|
101957
|
-
|
|
101958
|
-
|
|
101959
|
-
|
|
101960
|
-
|
|
101961
|
-
|
|
101962
|
-
|
|
101963
|
-
|
|
101964
|
-
|
|
101965
|
-
|
|
101966
|
-
|
|
101967
|
-
|
|
101968
|
-
|
|
101969
|
-
|
|
101970
|
-
|
|
101971
|
-
|
|
101972
|
-
|
|
101973
|
-
|
|
101974
|
-
|
|
101975
|
-
|
|
101976
|
-
|
|
101977
|
-
|
|
101978
|
-
|
|
101979
|
-
|
|
101980
|
-
|
|
101981
|
-
|
|
101982
|
-
|
|
101983
|
-
|
|
101984
|
-
|
|
101985
|
-
|
|
101986
|
-
|
|
101987
|
-
|
|
103640
|
+
var writeRemSetTextCommand = exports_Command.make("set-text", {
|
|
103641
|
+
rem: text9("rem"),
|
|
103642
|
+
text: text9("text"),
|
|
103643
|
+
notify: writeCommonOptions.notify,
|
|
103644
|
+
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
103645
|
+
wait: writeCommonOptions.wait,
|
|
103646
|
+
timeoutMs: writeCommonOptions.timeoutMs,
|
|
103647
|
+
pollMs: writeCommonOptions.pollMs,
|
|
103648
|
+
dryRun: writeCommonOptions.dryRun,
|
|
103649
|
+
priority: writeCommonOptions.priority,
|
|
103650
|
+
clientId: writeCommonOptions.clientId,
|
|
103651
|
+
idempotencyKey: writeCommonOptions.idempotencyKey,
|
|
103652
|
+
meta: writeCommonOptions.meta
|
|
103653
|
+
}, ({ rem, text: text16, notify: notify3, ensureDaemon: ensureDaemon5, wait: wait3, timeoutMs: timeoutMs4, pollMs: pollMs3, dryRun, priority: priority3, clientId: clientId3, idempotencyKey: idempotencyKey3, meta }) => gen2(function* () {
|
|
103654
|
+
if (!wait3 && (timeoutMs4 !== undefined || pollMs3 !== undefined)) {
|
|
103655
|
+
return yield* fail8(new CliError({
|
|
103656
|
+
code: "INVALID_ARGS",
|
|
103657
|
+
message: "Use --wait to enable --timeout-ms/--poll-ms",
|
|
103658
|
+
exitCode: 2
|
|
103659
|
+
}));
|
|
103660
|
+
}
|
|
103661
|
+
if (dryRun && wait3) {
|
|
103662
|
+
return yield* fail8(new CliError({
|
|
103663
|
+
code: "INVALID_ARGS",
|
|
103664
|
+
message: "--wait is not compatible with --dry-run",
|
|
103665
|
+
exitCode: 2
|
|
103666
|
+
}));
|
|
103667
|
+
}
|
|
103668
|
+
yield* failInRemoteMode({
|
|
103669
|
+
command: "rem set-text",
|
|
103670
|
+
reason: "this command enqueues writes to the local queue/store without a HostApiClient branch"
|
|
103671
|
+
});
|
|
103672
|
+
const payloadSvc = yield* Payload;
|
|
103673
|
+
const remId = normalizeRemIdInput6(rem);
|
|
103674
|
+
const textValue = trimBoundaryBlankLines(text16);
|
|
103675
|
+
const op2 = yield* try_3({
|
|
103676
|
+
try: () => normalizeOp({ type: "update_text", payload: { remId, text: textValue } }, payloadSvc.normalizeKeys),
|
|
103677
|
+
catch: (e) => isCliError(e) ? e : new CliError({
|
|
103678
|
+
code: "INVALID_PAYLOAD",
|
|
103679
|
+
message: "Failed to generate op",
|
|
103680
|
+
exitCode: 2,
|
|
103681
|
+
details: { error: String(e?.message || e) }
|
|
103682
|
+
})
|
|
103683
|
+
});
|
|
103684
|
+
const metaValue = meta ? yield* payloadSvc.readJson(meta) : undefined;
|
|
103685
|
+
if (dryRun) {
|
|
103686
|
+
yield* writeSuccess({
|
|
103687
|
+
data: { dry_run: true, ops: [op2], meta: metaValue ? payloadSvc.normalizeKeys(metaValue) : undefined },
|
|
103688
|
+
md: `- dry_run: true
|
|
101988
103689
|
- op: update_text
|
|
101989
103690
|
- rem_id: ${remId}
|
|
101990
103691
|
`
|
|
101991
|
-
});
|
|
101992
|
-
return;
|
|
101993
|
-
}
|
|
101994
|
-
const data = yield* enqueueOps({
|
|
101995
|
-
ops: [op2],
|
|
101996
|
-
priority: priority3,
|
|
101997
|
-
clientId: clientId3,
|
|
101998
|
-
idempotencyKey: idempotencyKey3,
|
|
101999
|
-
meta: metaValue,
|
|
102000
|
-
notify: notify3,
|
|
102001
|
-
ensureDaemon: ensureDaemon5
|
|
102002
103692
|
});
|
|
102003
|
-
|
|
102004
|
-
|
|
102005
|
-
|
|
102006
|
-
|
|
102007
|
-
|
|
102008
|
-
|
|
102009
|
-
|
|
102010
|
-
|
|
102011
|
-
|
|
102012
|
-
|
|
102013
|
-
|
|
102014
|
-
|
|
103693
|
+
return;
|
|
103694
|
+
}
|
|
103695
|
+
const data = yield* enqueueOps({
|
|
103696
|
+
ops: [op2],
|
|
103697
|
+
priority: priority3,
|
|
103698
|
+
clientId: clientId3,
|
|
103699
|
+
idempotencyKey: idempotencyKey3,
|
|
103700
|
+
meta: metaValue,
|
|
103701
|
+
notify: notify3,
|
|
103702
|
+
ensureDaemon: ensureDaemon5
|
|
103703
|
+
});
|
|
103704
|
+
const waited = wait3 ? yield* waitForTxn({ txnId: data.txn_id, timeoutMs: timeoutMs4, pollMs: pollMs3 }) : null;
|
|
103705
|
+
const out = waited ? { ...data, ...waited } : data;
|
|
103706
|
+
yield* writeSuccess({
|
|
103707
|
+
data: out,
|
|
103708
|
+
ids: [data.txn_id, ...data.op_ids],
|
|
103709
|
+
md: [
|
|
103710
|
+
`- txn_id: ${data.txn_id}`,
|
|
103711
|
+
`- op_ids: ${data.op_ids.length}`,
|
|
103712
|
+
`- notified: ${data.notified}`,
|
|
103713
|
+
`- sent: ${data.sent ?? ""}`,
|
|
103714
|
+
...waited ? [`- status: ${waited.status}`, `- elapsed_ms: ${waited.elapsed_ms}`] : []
|
|
103715
|
+
].join(`
|
|
102015
103716
|
`)
|
|
102016
|
-
|
|
102017
|
-
|
|
102018
|
-
}
|
|
102019
|
-
var writeRemSetTextCommand = makeWriteRemTextCommand("set-text");
|
|
102020
|
-
var writeRemTextCommand = makeWriteRemTextCommand("text");
|
|
103717
|
+
});
|
|
103718
|
+
}).pipe(catchAll2(writeFailure)));
|
|
102021
103719
|
|
|
102022
103720
|
// src/commands/rem/index.ts
|
|
102023
103721
|
var remCommand = exports_Command.make("rem", {}).pipe(exports_Command.withSubcommands([
|
|
@@ -102025,7 +103723,6 @@ var remCommand = exports_Command.make("rem", {}).pipe(exports_Command.withSubcom
|
|
|
102025
103723
|
writeRemCreateCommand,
|
|
102026
103724
|
writeRemMoveCommand,
|
|
102027
103725
|
writeRemSetTextCommand,
|
|
102028
|
-
writeRemTextCommand,
|
|
102029
103726
|
writeRemTagCommand,
|
|
102030
103727
|
writeRemDeleteCommand,
|
|
102031
103728
|
readInspectCommand,
|
|
@@ -102043,7 +103740,7 @@ function resolveReplaceTarget(params3) {
|
|
|
102043
103740
|
const _cfg = yield* AppConfig;
|
|
102044
103741
|
yield* failInRemoteMode({
|
|
102045
103742
|
command: "replace target resolution",
|
|
102046
|
-
reason: "replace
|
|
103743
|
+
reason: "replace markdown is an advanced/local-only block replace path that still depends on local selection/ref resolution semantics"
|
|
102047
103744
|
});
|
|
102048
103745
|
const refs = yield* RefResolver;
|
|
102049
103746
|
const hasSelection = params3.selection === true;
|
|
@@ -102155,18 +103852,18 @@ function expandTargetIds(params3) {
|
|
|
102155
103852
|
}
|
|
102156
103853
|
|
|
102157
103854
|
// src/commands/write/replace/block.ts
|
|
102158
|
-
function
|
|
103855
|
+
function optionToUndefined55(opt) {
|
|
102159
103856
|
return isSome2(opt) ? opt.value : undefined;
|
|
102160
103857
|
}
|
|
102161
103858
|
function readOptionalText4(name) {
|
|
102162
|
-
return text9(name).pipe(optional5, map34(
|
|
103859
|
+
return text9(name).pipe(optional5, map34(optionToUndefined55));
|
|
102163
103860
|
}
|
|
102164
103861
|
var selection = boolean8("selection");
|
|
102165
|
-
var
|
|
102166
|
-
var staleMs11 = integer7("stale-ms").pipe(optional5, map34(
|
|
103862
|
+
var stateFile24 = readOptionalText4("state-file");
|
|
103863
|
+
var staleMs11 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined55));
|
|
102167
103864
|
var ref3 = readOptionalText4("ref");
|
|
102168
103865
|
var ids4 = text9("id").pipe(repeated5);
|
|
102169
|
-
var scope5 = choice5("scope", ["roots", "subtree"]).pipe(optional5, map34(
|
|
103866
|
+
var scope5 = choice5("scope", ["roots", "subtree"]).pipe(optional5, map34(optionToUndefined55));
|
|
102170
103867
|
var requireComplete = boolean8("require-complete");
|
|
102171
103868
|
var maxDepth4 = integer7("max-depth").pipe(withDefault5(10));
|
|
102172
103869
|
var maxNodes2 = integer7("max-nodes").pipe(withDefault5(1000));
|
|
@@ -102174,19 +103871,19 @@ var allowDiscontiguous = boolean8("allow-discontiguous");
|
|
|
102174
103871
|
var useCurrentSelection = boolean8("use-current-selection");
|
|
102175
103872
|
var portalId = readOptionalText4("portal-id");
|
|
102176
103873
|
var markdownInline = readOptionalText4("markdown");
|
|
102177
|
-
var
|
|
103874
|
+
var file9 = readOptionalText4("file");
|
|
102178
103875
|
var clientId3 = readOptionalText4("client-id");
|
|
102179
103876
|
var idempotencyKey3 = readOptionalText4("idempotency-key");
|
|
102180
103877
|
var metaSpec3 = readOptionalText4("meta");
|
|
102181
|
-
var priority3 = integer7("priority").pipe(optional5, map34(
|
|
103878
|
+
var priority3 = integer7("priority").pipe(optional5, map34(optionToUndefined55));
|
|
102182
103879
|
var notify3 = boolean8("no-notify").pipe(map34((v) => !v));
|
|
102183
103880
|
var ensureDaemon5 = boolean8("no-ensure-daemon").pipe(map34((v) => !v));
|
|
102184
103881
|
var wait3 = boolean8("wait");
|
|
102185
|
-
var timeoutMs4 = integer7("timeout-ms").pipe(optional5, map34(
|
|
102186
|
-
var pollMs3 = integer7("poll-ms").pipe(optional5, map34(
|
|
103882
|
+
var timeoutMs4 = integer7("timeout-ms").pipe(optional5, map34(optionToUndefined55));
|
|
103883
|
+
var pollMs3 = integer7("poll-ms").pipe(optional5, map34(optionToUndefined55));
|
|
102187
103884
|
var replaceMarkdownCommand = exports_Command.make("markdown", {
|
|
102188
103885
|
selection,
|
|
102189
|
-
stateFile:
|
|
103886
|
+
stateFile: stateFile24,
|
|
102190
103887
|
staleMs: staleMs11,
|
|
102191
103888
|
ref: ref3,
|
|
102192
103889
|
id: ids4,
|
|
@@ -102197,7 +103894,7 @@ var replaceMarkdownCommand = exports_Command.make("markdown", {
|
|
|
102197
103894
|
allowDiscontiguous,
|
|
102198
103895
|
useCurrentSelection,
|
|
102199
103896
|
portalId,
|
|
102200
|
-
file:
|
|
103897
|
+
file: file9,
|
|
102201
103898
|
markdown: markdownInline,
|
|
102202
103899
|
notify: notify3,
|
|
102203
103900
|
ensureDaemon: ensureDaemon5,
|
|
@@ -102211,7 +103908,7 @@ var replaceMarkdownCommand = exports_Command.make("markdown", {
|
|
|
102211
103908
|
meta: metaSpec3
|
|
102212
103909
|
}, ({
|
|
102213
103910
|
selection: selection2,
|
|
102214
|
-
stateFile:
|
|
103911
|
+
stateFile: stateFile25,
|
|
102215
103912
|
staleMs: staleMs12,
|
|
102216
103913
|
ref: ref4,
|
|
102217
103914
|
id: id5,
|
|
@@ -102222,7 +103919,7 @@ var replaceMarkdownCommand = exports_Command.make("markdown", {
|
|
|
102222
103919
|
allowDiscontiguous: allowDiscontiguous2,
|
|
102223
103920
|
useCurrentSelection: useCurrentSelection2,
|
|
102224
103921
|
portalId: portalId2,
|
|
102225
|
-
file:
|
|
103922
|
+
file: file10,
|
|
102226
103923
|
markdown: markdown2,
|
|
102227
103924
|
notify: notify4,
|
|
102228
103925
|
ensureDaemon: ensureDaemon6,
|
|
@@ -102235,6 +103932,10 @@ var replaceMarkdownCommand = exports_Command.make("markdown", {
|
|
|
102235
103932
|
idempotencyKey: idempotencyKey4,
|
|
102236
103933
|
meta
|
|
102237
103934
|
}) => gen2(function* () {
|
|
103935
|
+
yield* failInRemoteMode({
|
|
103936
|
+
command: "replace markdown",
|
|
103937
|
+
reason: "replace markdown is an advanced/local-only block replace command that still depends on local selection/ref resolution semantics"
|
|
103938
|
+
});
|
|
102238
103939
|
if (!wait4 && (timeoutMs5 !== undefined || pollMs4 !== undefined)) {
|
|
102239
103940
|
return yield* fail8(new CliError({
|
|
102240
103941
|
code: "INVALID_ARGS",
|
|
@@ -102251,18 +103952,18 @@ var replaceMarkdownCommand = exports_Command.make("markdown", {
|
|
|
102251
103952
|
}
|
|
102252
103953
|
const fileInput = yield* FileInput;
|
|
102253
103954
|
const payloadSvc = yield* Payload;
|
|
102254
|
-
const resolvedTarget = yield* resolveReplaceTarget({ selection: selection2, stateFile:
|
|
102255
|
-
if (
|
|
103955
|
+
const resolvedTarget = yield* resolveReplaceTarget({ selection: selection2, stateFile: stateFile25, staleMs: staleMs12, ref: ref4, ids: id5 });
|
|
103956
|
+
if (file10 && markdown2) {
|
|
102256
103957
|
return yield* fail8(new CliError({
|
|
102257
103958
|
code: "INVALID_ARGS",
|
|
102258
103959
|
message: "Choose only one of --file or --markdown",
|
|
102259
103960
|
exitCode: 2
|
|
102260
103961
|
}));
|
|
102261
103962
|
}
|
|
102262
|
-
if (!
|
|
103963
|
+
if (!file10 && !markdown2) {
|
|
102263
103964
|
return yield* fail8(new CliError({ code: "INVALID_ARGS", message: "You must provide --file or --markdown", exitCode: 2 }));
|
|
102264
103965
|
}
|
|
102265
|
-
const mdRaw = typeof markdown2 === "string" ? markdown2 : yield* fileInput.readTextFromFileSpec({ spec: String(
|
|
103966
|
+
const mdRaw = typeof markdown2 === "string" ? markdown2 : yield* fileInput.readTextFromFileSpec({ spec: String(file10) });
|
|
102266
103967
|
const md = trimBoundaryBlankLines(mdRaw);
|
|
102267
103968
|
const scopeValue = scope6 ?? "roots";
|
|
102268
103969
|
if (scopeValue !== "roots") {
|
|
@@ -102338,33 +104039,40 @@ var replaceMarkdownCommand = exports_Command.make("markdown", {
|
|
|
102338
104039
|
});
|
|
102339
104040
|
const waited = wait4 ? yield* waitForTxn({ txnId: data.txn_id, timeoutMs: timeoutMs5, pollMs: pollMs4 }) : null;
|
|
102340
104041
|
const out = waited ? { ...data, ...waited } : data;
|
|
104042
|
+
const backup = waited?.status === "succeeded" ? yield* loadTxnDetail({ txnId: data.txn_id }).pipe(map17((detail) => extractReplaceBackupSummary(detail)), catchAll2(() => succeed8(undefined))) : undefined;
|
|
102341
104043
|
yield* writeSuccess({
|
|
102342
|
-
data: { ...out, target: resolvedTarget },
|
|
104044
|
+
data: backup ? { ...out, target: resolvedTarget, backup } : { ...out, target: resolvedTarget },
|
|
102343
104045
|
ids: [data.txn_id, ...data.op_ids],
|
|
102344
104046
|
md: [
|
|
102345
104047
|
`- txn_id: ${data.txn_id}`,
|
|
102346
104048
|
`- op_ids: ${data.op_ids.length}`,
|
|
102347
104049
|
`- notified: ${data.notified}`,
|
|
102348
104050
|
`- sent: ${data.sent ?? ""}`,
|
|
102349
|
-
...waited ? [`- status: ${waited.status}`, `- elapsed_ms: ${waited.elapsed_ms}`] : []
|
|
104051
|
+
...waited ? [`- status: ${waited.status}`, `- elapsed_ms: ${waited.elapsed_ms}`] : [],
|
|
104052
|
+
...backup ? [
|
|
104053
|
+
`- backup_policy: ${backup.policy}`,
|
|
104054
|
+
`- backup_deleted: ${backup.deleted ? "true" : "false"}`,
|
|
104055
|
+
...backup.hidden ? ["- backup_hidden: true"] : [],
|
|
104056
|
+
...backup.cleanup_state ? [`- backup_cleanup_state: ${backup.cleanup_state}`] : []
|
|
104057
|
+
] : []
|
|
102350
104058
|
].join(`
|
|
102351
104059
|
`)
|
|
102352
104060
|
});
|
|
102353
|
-
}).pipe(catchAll2(writeFailure)));
|
|
104061
|
+
}).pipe(catchAll2(writeFailure))).pipe(exports_Command.withDescription("advanced/local-only block replace command; canonical anchor-preserving rewrites should prefer rem children replace"));
|
|
102354
104062
|
|
|
102355
104063
|
// src/commands/write/replace/text.ts
|
|
102356
|
-
function
|
|
104064
|
+
function optionToUndefined56(opt) {
|
|
102357
104065
|
return isSome2(opt) ? opt.value : undefined;
|
|
102358
104066
|
}
|
|
102359
104067
|
function readOptionalText5(name) {
|
|
102360
|
-
return text9(name).pipe(optional5, map34(
|
|
104068
|
+
return text9(name).pipe(optional5, map34(optionToUndefined56));
|
|
102361
104069
|
}
|
|
102362
104070
|
var selection2 = boolean8("selection");
|
|
102363
|
-
var
|
|
102364
|
-
var staleMs12 = integer7("stale-ms").pipe(optional5, map34(
|
|
104071
|
+
var stateFile25 = readOptionalText5("state-file");
|
|
104072
|
+
var staleMs12 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined56));
|
|
102365
104073
|
var ref4 = readOptionalText5("ref");
|
|
102366
104074
|
var ids5 = text9("id").pipe(repeated5);
|
|
102367
|
-
var scope6 = choice5("scope", ["roots", "subtree"]).pipe(optional5, map34(
|
|
104075
|
+
var scope6 = choice5("scope", ["roots", "subtree"]).pipe(optional5, map34(optionToUndefined56));
|
|
102368
104076
|
var maxDepth5 = integer7("max-depth").pipe(withDefault5(10));
|
|
102369
104077
|
var maxNodes3 = integer7("max-nodes").pipe(withDefault5(1000));
|
|
102370
104078
|
var requireComplete2 = boolean8("require-complete");
|
|
@@ -102376,12 +104084,12 @@ var flags = readOptionalText5("flags");
|
|
|
102376
104084
|
var clientId4 = readOptionalText5("client-id");
|
|
102377
104085
|
var idempotencyKey4 = readOptionalText5("idempotency-key");
|
|
102378
104086
|
var metaSpec4 = readOptionalText5("meta");
|
|
102379
|
-
var priority4 = integer7("priority").pipe(optional5, map34(
|
|
104087
|
+
var priority4 = integer7("priority").pipe(optional5, map34(optionToUndefined56));
|
|
102380
104088
|
var notify4 = boolean8("no-notify").pipe(map34((v) => !v));
|
|
102381
104089
|
var ensureDaemon6 = boolean8("no-ensure-daemon").pipe(map34((v) => !v));
|
|
102382
104090
|
var wait4 = boolean8("wait");
|
|
102383
|
-
var timeoutMs5 = integer7("timeout-ms").pipe(optional5, map34(
|
|
102384
|
-
var pollMs4 = integer7("poll-ms").pipe(optional5, map34(
|
|
104091
|
+
var timeoutMs5 = integer7("timeout-ms").pipe(optional5, map34(optionToUndefined56));
|
|
104092
|
+
var pollMs4 = integer7("poll-ms").pipe(optional5, map34(optionToUndefined56));
|
|
102385
104093
|
function tryMakeRegExp(pattern2, rawFlags) {
|
|
102386
104094
|
const f = typeof rawFlags === "string" && rawFlags.trim() ? rawFlags.trim() : "g";
|
|
102387
104095
|
const withGlobal = f.includes("g") ? f : `g${f}`;
|
|
@@ -102427,7 +104135,7 @@ function replaceRichText(value8, replacer) {
|
|
|
102427
104135
|
}
|
|
102428
104136
|
var replaceLiteralCommand = exports_Command.make("literal", {
|
|
102429
104137
|
selection: selection2,
|
|
102430
|
-
stateFile:
|
|
104138
|
+
stateFile: stateFile25,
|
|
102431
104139
|
staleMs: staleMs12,
|
|
102432
104140
|
ref: ref4,
|
|
102433
104141
|
id: ids5,
|
|
@@ -102452,7 +104160,7 @@ var replaceLiteralCommand = exports_Command.make("literal", {
|
|
|
102452
104160
|
meta: metaSpec4
|
|
102453
104161
|
}, ({
|
|
102454
104162
|
selection: selection3,
|
|
102455
|
-
stateFile:
|
|
104163
|
+
stateFile: stateFile26,
|
|
102456
104164
|
staleMs: staleMs13,
|
|
102457
104165
|
ref: ref5,
|
|
102458
104166
|
id: id5,
|
|
@@ -102493,7 +104201,7 @@ var replaceLiteralCommand = exports_Command.make("literal", {
|
|
|
102493
104201
|
const cfg = yield* AppConfig;
|
|
102494
104202
|
const payloadSvc = yield* Payload;
|
|
102495
104203
|
const remdb = yield* RemDb;
|
|
102496
|
-
const target2 = yield* resolveReplaceTarget({ selection: selection3, stateFile:
|
|
104204
|
+
const target2 = yield* resolveReplaceTarget({ selection: selection3, stateFile: stateFile26, staleMs: staleMs13, ref: ref5, ids: id5 });
|
|
102497
104205
|
const scopeValue = scope7 ?? "roots";
|
|
102498
104206
|
if (target2.kind === "selection" && requireComplete3) {
|
|
102499
104207
|
const sel = target2.snapshot.selection;
|
|
@@ -102629,11 +104337,11 @@ var writeReplaceCommand = exports_Command.make("replace", {}).pipe(exports_Comma
|
|
|
102629
104337
|
var replaceCommand = writeReplaceCommand;
|
|
102630
104338
|
|
|
102631
104339
|
// src/commands/read/search.ts
|
|
102632
|
-
function
|
|
104340
|
+
function optionToUndefined57(opt) {
|
|
102633
104341
|
return isSome2(opt) ? opt.value : undefined;
|
|
102634
104342
|
}
|
|
102635
|
-
var timeRange2 = text9("time").pipe(optional5, map34(
|
|
102636
|
-
var parentId = text9("parent").pipe(optional5, map34(
|
|
104343
|
+
var timeRange2 = text9("time").pipe(optional5, map34(optionToUndefined57));
|
|
104344
|
+
var parentId = text9("parent").pipe(optional5, map34(optionToUndefined57));
|
|
102637
104345
|
var limit7 = integer7("limit").pipe(withDefault5(10));
|
|
102638
104346
|
var offset6 = integer7("offset").pipe(withDefault5(0));
|
|
102639
104347
|
var timeoutMs6 = integer7("timeout-ms").pipe(withDefault5(30000));
|
|
@@ -102691,10 +104399,10 @@ function normalizeRemIdInput7(raw4) {
|
|
|
102691
104399
|
}
|
|
102692
104400
|
var writeTableCreateCommand = exports_Command.make("create", {
|
|
102693
104401
|
tableTag: text9("table-tag"),
|
|
102694
|
-
parent: text9("parent").pipe(optional5, map34(
|
|
102695
|
-
ref: text9("ref").pipe(optional5, map34(
|
|
102696
|
-
position: integer7("position").pipe(optional5, map34(
|
|
102697
|
-
clientTempId: text9("client-temp-id").pipe(optional5, map34(
|
|
104402
|
+
parent: text9("parent").pipe(optional5, map34(optionToUndefined43)),
|
|
104403
|
+
ref: text9("ref").pipe(optional5, map34(optionToUndefined43)),
|
|
104404
|
+
position: integer7("position").pipe(optional5, map34(optionToUndefined43)),
|
|
104405
|
+
clientTempId: text9("client-temp-id").pipe(optional5, map34(optionToUndefined43)),
|
|
102698
104406
|
notify: writeCommonOptions.notify,
|
|
102699
104407
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
102700
104408
|
wait: writeCommonOptions.wait,
|
|
@@ -103105,8 +104813,8 @@ var writeTableOptionCommand = exports_Command.make("option", {}).pipe(exports_Co
|
|
|
103105
104813
|
var writeTablePropertyAddCommand = exports_Command.make("add", {
|
|
103106
104814
|
tableTag: text9("table-tag"),
|
|
103107
104815
|
name: text9("name"),
|
|
103108
|
-
type: text9("type").pipe(optional5, map34(
|
|
103109
|
-
options: text9("options").pipe(optional5, map34(
|
|
104816
|
+
type: text9("type").pipe(optional5, map34(optionToUndefined43)),
|
|
104817
|
+
options: text9("options").pipe(optional5, map34(optionToUndefined43)),
|
|
103110
104818
|
notify: writeCommonOptions.notify,
|
|
103111
104819
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
103112
104820
|
wait: writeCommonOptions.wait,
|
|
@@ -103242,10 +104950,10 @@ var writeTablePropertyCommand = exports_Command.make("property", {}).pipe(export
|
|
|
103242
104950
|
// src/commands/write/table/record/add.ts
|
|
103243
104951
|
var writeTableRecordAddCommand = exports_Command.make("add", {
|
|
103244
104952
|
tableTag: text9("table-tag"),
|
|
103245
|
-
parent: text9("parent").pipe(optional5, map34(
|
|
103246
|
-
ref: text9("ref").pipe(optional5, map34(
|
|
103247
|
-
text: text9("text").pipe(optional5, map34(
|
|
103248
|
-
values: text9("values").pipe(optional5, map34(
|
|
104953
|
+
parent: text9("parent").pipe(optional5, map34(optionToUndefined43)),
|
|
104954
|
+
ref: text9("ref").pipe(optional5, map34(optionToUndefined43)),
|
|
104955
|
+
text: text9("text").pipe(optional5, map34(optionToUndefined43)),
|
|
104956
|
+
values: text9("values").pipe(optional5, map34(optionToUndefined43)),
|
|
103249
104957
|
notify: writeCommonOptions.notify,
|
|
103250
104958
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
103251
104959
|
wait: writeCommonOptions.wait,
|
|
@@ -103560,8 +105268,8 @@ function rowHasTag4(doc, tagId) {
|
|
|
103560
105268
|
var writeTableRecordUpdateCommand = exports_Command.make("update", {
|
|
103561
105269
|
tableTag: text9("table-tag"),
|
|
103562
105270
|
row: text9("row"),
|
|
103563
|
-
text: text9("text").pipe(optional5, map34(
|
|
103564
|
-
values: text9("values").pipe(optional5, map34(
|
|
105271
|
+
text: text9("text").pipe(optional5, map34(optionToUndefined43)),
|
|
105272
|
+
values: text9("values").pipe(optional5, map34(optionToUndefined43)),
|
|
103565
105273
|
notify: writeCommonOptions.notify,
|
|
103566
105274
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
103567
105275
|
wait: writeCommonOptions.wait,
|
|
@@ -103782,10 +105490,10 @@ var tableCommand = exports_Command.make("table", {}).pipe(exports_Command.withSu
|
|
|
103782
105490
|
var tagCommand = writeTagCommand;
|
|
103783
105491
|
|
|
103784
105492
|
// src/commands/read/todos/list.ts
|
|
103785
|
-
function
|
|
105493
|
+
function optionToUndefined58(opt) {
|
|
103786
105494
|
return isSome2(opt) ? opt.value : undefined;
|
|
103787
105495
|
}
|
|
103788
|
-
var status2 = choice5("status", ["unfinished", "finished", "all"]).pipe(optional5, map34(
|
|
105496
|
+
var status2 = choice5("status", ["unfinished", "finished", "all"]).pipe(optional5, map34(optionToUndefined58));
|
|
103789
105497
|
var sort3 = choice5("sort", [
|
|
103790
105498
|
"dueAsc",
|
|
103791
105499
|
"dueDesc",
|
|
@@ -103793,22 +105501,22 @@ var sort3 = choice5("sort", [
|
|
|
103793
105501
|
"updatedAtDesc",
|
|
103794
105502
|
"createdAtAsc",
|
|
103795
105503
|
"createdAtDesc"
|
|
103796
|
-
]).pipe(optional5, map34(
|
|
105504
|
+
]).pipe(optional5, map34(optionToUndefined58));
|
|
103797
105505
|
var tagId = text9("tag-id").pipe(repeated5);
|
|
103798
105506
|
var tagTitle = text9("tag-title").pipe(repeated5);
|
|
103799
105507
|
var preferTodoOnly = boolean8("prefer-todo-only");
|
|
103800
105508
|
var preferTodoFirst = boolean8("prefer-todo-first");
|
|
103801
105509
|
var includeDescendants = boolean8("no-descendants").pipe(map34((v) => !v));
|
|
103802
|
-
var ancestor = text9("ancestor").pipe(optional5, map34(
|
|
103803
|
-
var dueBefore = text9("due-before").pipe(optional5, map34(
|
|
103804
|
-
var dueAfter = text9("due-after").pipe(optional5, map34(
|
|
105510
|
+
var ancestor = text9("ancestor").pipe(optional5, map34(optionToUndefined58));
|
|
105511
|
+
var dueBefore = text9("due-before").pipe(optional5, map34(optionToUndefined58));
|
|
105512
|
+
var dueAfter = text9("due-after").pipe(optional5, map34(optionToUndefined58));
|
|
103805
105513
|
var includeTagOnlyWhenNoStatus = boolean8("no-tag-only-when-no-status").pipe(map34((v) => !v));
|
|
103806
105514
|
var statusAttrTitle = text9("status-attr-title").pipe(repeated5);
|
|
103807
105515
|
var unfinishedOptionTitle = text9("unfinished-option-title").pipe(repeated5);
|
|
103808
105516
|
var finishedOptionTitle = text9("finished-option-title").pipe(repeated5);
|
|
103809
105517
|
var dueDateAttrTitle = text9("due-date-attr-title").pipe(repeated5);
|
|
103810
105518
|
var alwaysIncludeTagOnlyTitle = text9("always-include-tag-only-title").pipe(repeated5);
|
|
103811
|
-
var snippetLength2 = integer7("snippet-length").pipe(optional5, map34(
|
|
105519
|
+
var snippetLength2 = integer7("snippet-length").pipe(optional5, map34(optionToUndefined58));
|
|
103812
105520
|
var limit9 = integer7("limit").pipe(withDefault5(20));
|
|
103813
105521
|
var offset8 = integer7("offset").pipe(withDefault5(0));
|
|
103814
105522
|
function makeTodosListCommand() {
|
|
@@ -103889,8 +105597,8 @@ function makeTodosListCommand() {
|
|
|
103889
105597
|
var todosListCommand = makeTodosListCommand();
|
|
103890
105598
|
|
|
103891
105599
|
// src/commands/write/powerup/todo/todoAdd.ts
|
|
103892
|
-
var status3 = choice5("status", ["unfinished", "finished", "clear"]).pipe(optional5, map34(
|
|
103893
|
-
var dispatchMode4 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(
|
|
105600
|
+
var status3 = choice5("status", ["unfinished", "finished", "clear"]).pipe(optional5, map34(optionToUndefined43));
|
|
105601
|
+
var dispatchMode4 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined43));
|
|
103894
105602
|
function pickTodoSchema(schemas, tagId2) {
|
|
103895
105603
|
const mapped = schemas.map((s) => ({
|
|
103896
105604
|
tagId: String(s?.tagId ?? ""),
|
|
@@ -103909,10 +105617,10 @@ function pickTodoSchema(schemas, tagId2) {
|
|
|
103909
105617
|
}
|
|
103910
105618
|
var writePowerupTodoAddCommand = exports_Command.make("add", {
|
|
103911
105619
|
rem: text9("rem"),
|
|
103912
|
-
tagId: text9("tag-id").pipe(optional5, map34(
|
|
105620
|
+
tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined43)),
|
|
103913
105621
|
status: status3,
|
|
103914
|
-
due: text9("due").pipe(optional5, map34(
|
|
103915
|
-
values: text9("values").pipe(optional5, map34(
|
|
105622
|
+
due: text9("due").pipe(optional5, map34(optionToUndefined43)),
|
|
105623
|
+
values: text9("values").pipe(optional5, map34(optionToUndefined43)),
|
|
103916
105624
|
notify: writeCommonOptions.notify,
|
|
103917
105625
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
103918
105626
|
wait: writeCommonOptions.wait,
|
|
@@ -104170,12 +105878,12 @@ function todoWriteEffect(params3) {
|
|
|
104170
105878
|
}
|
|
104171
105879
|
|
|
104172
105880
|
// src/commands/write/powerup/todo/todoDone.ts
|
|
104173
|
-
var dispatchMode5 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(
|
|
105881
|
+
var dispatchMode5 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined43));
|
|
104174
105882
|
var writePowerupTodoDoneCommand = exports_Command.make("done", {
|
|
104175
105883
|
rem: text9("rem"),
|
|
104176
|
-
tagId: text9("tag-id").pipe(optional5, map34(
|
|
104177
|
-
due: text9("due").pipe(optional5, map34(
|
|
104178
|
-
values: text9("values").pipe(optional5, map34(
|
|
105884
|
+
tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined43)),
|
|
105885
|
+
due: text9("due").pipe(optional5, map34(optionToUndefined43)),
|
|
105886
|
+
values: text9("values").pipe(optional5, map34(optionToUndefined43)),
|
|
104179
105887
|
notify: writeCommonOptions.notify,
|
|
104180
105888
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
104181
105889
|
wait: writeCommonOptions.wait,
|
|
@@ -104232,8 +105940,8 @@ function pickTodoTagId(schemas, tagId2) {
|
|
|
104232
105940
|
}
|
|
104233
105941
|
var writePowerupTodoRemoveCommand = exports_Command.make("remove", {
|
|
104234
105942
|
rem: text9("rem"),
|
|
104235
|
-
tagId: text9("tag-id").pipe(optional5, map34(
|
|
104236
|
-
removeProperties: boolean8("remove-properties").pipe(optional5, map34(
|
|
105943
|
+
tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined43)),
|
|
105944
|
+
removeProperties: boolean8("remove-properties").pipe(optional5, map34(optionToUndefined43)),
|
|
104237
105945
|
notify: writeCommonOptions.notify,
|
|
104238
105946
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
104239
105947
|
wait: writeCommonOptions.wait,
|
|
@@ -104360,12 +106068,12 @@ var writePowerupTodoRemoveCommand = exports_Command.make("remove", {
|
|
|
104360
106068
|
}).pipe(catchAll2(writeFailure)));
|
|
104361
106069
|
|
|
104362
106070
|
// src/commands/write/powerup/todo/todoUndone.ts
|
|
104363
|
-
var dispatchMode6 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(
|
|
106071
|
+
var dispatchMode6 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined43));
|
|
104364
106072
|
var writePowerupTodoUndoneCommand = exports_Command.make("undone", {
|
|
104365
106073
|
rem: text9("rem"),
|
|
104366
|
-
tagId: text9("tag-id").pipe(optional5, map34(
|
|
104367
|
-
due: text9("due").pipe(optional5, map34(
|
|
104368
|
-
values: text9("values").pipe(optional5, map34(
|
|
106074
|
+
tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined43)),
|
|
106075
|
+
due: text9("due").pipe(optional5, map34(optionToUndefined43)),
|
|
106076
|
+
values: text9("values").pipe(optional5, map34(optionToUndefined43)),
|
|
104369
106077
|
notify: writeCommonOptions.notify,
|
|
104370
106078
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
104371
106079
|
wait: writeCommonOptions.wait,
|
|
@@ -104422,15 +106130,15 @@ var todoCommand = exports_Command.make("todo", {}).pipe(exports_Command.withSubc
|
|
|
104422
106130
|
]));
|
|
104423
106131
|
|
|
104424
106132
|
// src/commands/read/topic/summary.ts
|
|
104425
|
-
function
|
|
106133
|
+
function optionToUndefined59(opt) {
|
|
104426
106134
|
return isSome2(opt) ? opt.value : undefined;
|
|
104427
106135
|
}
|
|
104428
|
-
var keywords = text9("keywords").pipe(optional5, map34(
|
|
104429
|
-
var query2 = text9("query").pipe(optional5, map34(
|
|
104430
|
-
var timeRange3 = text9("time").pipe(optional5, map34(
|
|
104431
|
-
var maxResults = integer7("max-results").pipe(optional5, map34(
|
|
104432
|
-
var maxNodesPerResult = integer7("max-nodes").pipe(optional5, map34(
|
|
104433
|
-
var groupBy2 = choice5("group-by", ["none", "parent", "date"]).pipe(optional5, map34(
|
|
106136
|
+
var keywords = text9("keywords").pipe(optional5, map34(optionToUndefined59));
|
|
106137
|
+
var query2 = text9("query").pipe(optional5, map34(optionToUndefined59));
|
|
106138
|
+
var timeRange3 = text9("time").pipe(optional5, map34(optionToUndefined59));
|
|
106139
|
+
var maxResults = integer7("max-results").pipe(optional5, map34(optionToUndefined59));
|
|
106140
|
+
var maxNodesPerResult = integer7("max-nodes").pipe(optional5, map34(optionToUndefined59));
|
|
106141
|
+
var groupBy2 = choice5("group-by", ["none", "parent", "date"]).pipe(optional5, map34(optionToUndefined59));
|
|
104434
106142
|
var topicSummaryCommand = exports_Command.make("summary", { keywords, query: query2, timeRange: timeRange3, maxResults, maxNodesPerResult, groupBy: groupBy2 }, ({ keywords: keywords2, query: query3, timeRange: timeRange4, maxResults: maxResults2, maxNodesPerResult: maxNodesPerResult2, groupBy: groupBy3 }) => gen2(function* () {
|
|
104435
106143
|
const cfg = yield* AppConfig;
|
|
104436
106144
|
yield* failInRemoteMode({
|
|
@@ -104486,8 +106194,8 @@ function looksLikeRef(raw4) {
|
|
|
104486
106194
|
var writePortalCreateCommand = exports_Command.make("create", {
|
|
104487
106195
|
parent: text9("parent"),
|
|
104488
106196
|
target: text9("target"),
|
|
104489
|
-
position: integer7("position").pipe(optional5, map34(
|
|
104490
|
-
clientTempId: text9("client-temp-id").pipe(optional5, map34(
|
|
106197
|
+
position: integer7("position").pipe(optional5, map34(optionToUndefined43)),
|
|
106198
|
+
clientTempId: text9("client-temp-id").pipe(optional5, map34(optionToUndefined43)),
|
|
104491
106199
|
notify: writeCommonOptions.notify,
|
|
104492
106200
|
ensureDaemon: writeCommonOptions.ensureDaemon,
|
|
104493
106201
|
wait: writeCommonOptions.wait,
|
|
@@ -104688,7 +106396,7 @@ var stackEnsureCommand = exports_Command.make("ensure", {
|
|
|
104688
106396
|
}).pipe(catchAll2(writeFailure)));
|
|
104689
106397
|
|
|
104690
106398
|
// src/commands/stack/status.ts
|
|
104691
|
-
import
|
|
106399
|
+
import path29 from "node:path";
|
|
104692
106400
|
var stackStatusCommand = exports_Command.make("status", {}, () => gen2(function* () {
|
|
104693
106401
|
const cfg = yield* AppConfig;
|
|
104694
106402
|
const daemonFiles = yield* DaemonFiles;
|
|
@@ -104709,7 +106417,7 @@ var stackStatusCommand = exports_Command.make("status", {}, () => gen2(function*
|
|
|
104709
106417
|
const apiBaseUrl = apiLocalBaseUrl(apiPidInfo?.port ?? cfg.apiPort ?? 3000, apiBasePath);
|
|
104710
106418
|
const apiStatus = yield* api.status({ baseUrl: apiBaseUrl, timeoutMs: 2000 }).pipe(either3);
|
|
104711
106419
|
const queueStats2 = yield* queue.stats({ dbPath: cfg.storeDb }).pipe(either3);
|
|
104712
|
-
const stateFilePath = resolveUserFilePath(daemonPidInfo?.state_file ??
|
|
106420
|
+
const stateFilePath = resolveUserFilePath(daemonPidInfo?.state_file ?? path29.join(path29.dirname(daemonPidFile), "ws.state.json"));
|
|
104713
106421
|
const data = {
|
|
104714
106422
|
daemon: {
|
|
104715
106423
|
running: daemonRunning,
|
|
@@ -104755,7 +106463,7 @@ var stackStatusCommand = exports_Command.make("status", {}, () => gen2(function*
|
|
|
104755
106463
|
}).pipe(catchAll2(writeFailure)));
|
|
104756
106464
|
|
|
104757
106465
|
// src/commands/stack/stop.ts
|
|
104758
|
-
import
|
|
106466
|
+
import path30 from "node:path";
|
|
104759
106467
|
var stackStopCommand = exports_Command.make("stop", {}, () => gen2(function* () {
|
|
104760
106468
|
const apiFiles = yield* ApiDaemonFiles;
|
|
104761
106469
|
const daemonFiles = yield* DaemonFiles;
|
|
@@ -104792,7 +106500,7 @@ var stackStopCommand = exports_Command.make("stop", {}, () => gen2(function* ()
|
|
|
104792
106500
|
}
|
|
104793
106501
|
}
|
|
104794
106502
|
yield* daemonFiles.deletePidFile(daemonPidFile).pipe(catchAll2(() => _void));
|
|
104795
|
-
yield* supervisorState.deleteStateFile(resolveUserFilePath(daemonPidInfo?.state_file ??
|
|
106503
|
+
yield* supervisorState.deleteStateFile(resolveUserFilePath(daemonPidInfo?.state_file ?? path30.join(path30.dirname(daemonPidFile), "ws.state.json"))).pipe(catchAll2(() => _void));
|
|
104796
106504
|
yield* writeSuccess({
|
|
104797
106505
|
data: { stopped: true, api_stopped: apiStopped, daemon_stopped: daemonStopped },
|
|
104798
106506
|
md: `- stopped: true
|
|
@@ -104806,23 +106514,23 @@ var stackStopCommand = exports_Command.make("stop", {}, () => gen2(function* ()
|
|
|
104806
106514
|
var stackCommand = exports_Command.make("stack", {}).pipe(exports_Command.withSubcommands([stackEnsureCommand, stackStopCommand, stackStatusCommand]));
|
|
104807
106515
|
|
|
104808
106516
|
// src/commands/index.ts
|
|
104809
|
-
function
|
|
106517
|
+
function optionToUndefined60(opt) {
|
|
104810
106518
|
return isSome2(opt) ? opt.value : undefined;
|
|
104811
106519
|
}
|
|
104812
|
-
var remnoteDb = text9("remnote-db").pipe(optional5, map34(
|
|
104813
|
-
var storeDb = text9("store-db").pipe(optional5, map34(
|
|
104814
|
-
var daemonUrl = text9("daemon-url").pipe(optional5, map34(
|
|
104815
|
-
var wsPort = integer7("ws-port").pipe(optional5, map34(
|
|
104816
|
-
var repo = text9("repo").pipe(optional5, map34(
|
|
104817
|
-
var apiBaseUrl = text9("api-base-url").pipe(optional5, map34(
|
|
104818
|
-
var apiHost = text9("api-host").pipe(optional5, map34(
|
|
104819
|
-
var apiPort = integer7("api-port").pipe(optional5, map34(
|
|
104820
|
-
var apiBasePath = text9("api-base-path").pipe(optional5, map34(
|
|
104821
|
-
var configFile = text9("config-file").pipe(optional5, map34(
|
|
106520
|
+
var remnoteDb = text9("remnote-db").pipe(optional5, map34(optionToUndefined60));
|
|
106521
|
+
var storeDb = text9("store-db").pipe(optional5, map34(optionToUndefined60));
|
|
106522
|
+
var daemonUrl = text9("daemon-url").pipe(optional5, map34(optionToUndefined60));
|
|
106523
|
+
var wsPort = integer7("ws-port").pipe(optional5, map34(optionToUndefined60));
|
|
106524
|
+
var repo = text9("repo").pipe(optional5, map34(optionToUndefined60));
|
|
106525
|
+
var apiBaseUrl = text9("api-base-url").pipe(optional5, map34(optionToUndefined60));
|
|
106526
|
+
var apiHost = text9("api-host").pipe(optional5, map34(optionToUndefined60));
|
|
106527
|
+
var apiPort = integer7("api-port").pipe(optional5, map34(optionToUndefined60));
|
|
106528
|
+
var apiBasePath = text9("api-base-path").pipe(optional5, map34(optionToUndefined60));
|
|
106529
|
+
var configFile = text9("config-file").pipe(optional5, map34(optionToUndefined60));
|
|
104822
106530
|
var appConfigLive = effect(AppConfig, resolveConfig());
|
|
104823
106531
|
var statusLineUpdaterLive = StatusLineUpdaterLive.pipe(provide3([appConfigLive, QueueLive, StatusLineFileLive, TmuxLive, WsBridgeStateLive]));
|
|
104824
106532
|
var statusLineLive = StatusLineControllerLive.pipe(provide3(statusLineUpdaterLive), provide3(appConfigLive));
|
|
104825
|
-
var servicesLive = mergeAll5(appConfigLive, OutputLive, FileInputLive, FsAccessLive, LogWriterFactoryLive, PayloadLive, DaemonFilesLive, ApiDaemonFilesLive, ProcessLive, ChildProcessLive, WsClientLive, HostApiClientLive.pipe(provide3(appConfigLive)), UserConfigFileLive, WorkspaceBindingsLive, QueueLive, RefResolverLive, RemDbLive, StatusLineFileLive, SubprocessLive, SupervisorStateLive, WsBridgeServerLive, WsBridgeStateFileLive, statusLineLive);
|
|
106533
|
+
var servicesLive = mergeAll5(appConfigLive, OutputLive, FileInputLive, FsAccessLive, LogWriterFactoryLive, PayloadLive, DaemonFilesLive, ApiDaemonFilesLive, ProcessLive, ChildProcessLive, WsClientLive, HostApiClientLive.pipe(provide3(appConfigLive)), PluginServerFilesLive, UserConfigFileLive, WorkspaceBindingsLive, QueueLive, RefResolverLive, RemDbLive, StatusLineFileLive, SubprocessLive, SupervisorStateLive, WsBridgeServerLive, WsBridgeStateFileLive, statusLineLive);
|
|
104826
106534
|
var rootCommand = exports_Command.make("agent-remnote", {
|
|
104827
106535
|
json: boolean8("json"),
|
|
104828
106536
|
md: boolean8("md"),
|
|
@@ -104850,6 +106558,7 @@ var rootCommand = exports_Command.make("agent-remnote", {
|
|
|
104850
106558
|
queryCommand,
|
|
104851
106559
|
remCommand,
|
|
104852
106560
|
dailyCommand,
|
|
106561
|
+
backupCommand,
|
|
104853
106562
|
todoCommand,
|
|
104854
106563
|
topicCommand,
|
|
104855
106564
|
powerupCommand,
|