agendex-cli 1.0.0 → 1.1.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/dist/cli.js +47 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1924,6 +1924,19 @@ function parseDate2(value) {
|
|
|
1924
1924
|
return;
|
|
1925
1925
|
return date;
|
|
1926
1926
|
}
|
|
1927
|
+
function liveSessionIdentity(input) {
|
|
1928
|
+
if (input.sourcePlanPath) {
|
|
1929
|
+
return hashPath(`plannotator-live:${resolve2(input.sourcePlanPath)}`);
|
|
1930
|
+
}
|
|
1931
|
+
if (input.session.reviewId) {
|
|
1932
|
+
return hashPath(`plannotator-live-review:${input.session.reviewId}`);
|
|
1933
|
+
}
|
|
1934
|
+
const project = input.session.project ?? input.planResponse.versionInfo?.project ?? input.planResponse.projectRoot;
|
|
1935
|
+
if (project && input.session.label) {
|
|
1936
|
+
return hashPath(`plannotator-live:${project}:${input.session.label}:${input.mode}`);
|
|
1937
|
+
}
|
|
1938
|
+
return hashPath(input.sessionPath);
|
|
1939
|
+
}
|
|
1927
1940
|
function metadataRecord(metadata) {
|
|
1928
1941
|
return {
|
|
1929
1942
|
source: "plannotator",
|
|
@@ -2090,7 +2103,13 @@ async function parseLiveSession(filePath) {
|
|
|
2090
2103
|
};
|
|
2091
2104
|
return [
|
|
2092
2105
|
{
|
|
2093
|
-
id:
|
|
2106
|
+
id: liveSessionIdentity({
|
|
2107
|
+
sessionPath: filePath,
|
|
2108
|
+
session,
|
|
2109
|
+
planResponse,
|
|
2110
|
+
mode: responseMode,
|
|
2111
|
+
sourcePlanPath
|
|
2112
|
+
}),
|
|
2094
2113
|
agent: origin ?? "plannotator",
|
|
2095
2114
|
title: extractTitle5(planResponse.plan, session.label ?? filePath),
|
|
2096
2115
|
content: planResponse.plan,
|
|
@@ -2182,6 +2201,12 @@ var plannotatorAdapter = {
|
|
|
2182
2201
|
return false;
|
|
2183
2202
|
if (!isSafePlannotatorUrl(metadata.url))
|
|
2184
2203
|
return false;
|
|
2204
|
+
if (payload.action === "approve") {
|
|
2205
|
+
return await postJson(apiUrl(metadata.url, "/api/approve"), {
|
|
2206
|
+
...payload.feedback.trim() && { feedback: payload.feedback.trim() },
|
|
2207
|
+
planSave: { enabled: true }
|
|
2208
|
+
});
|
|
2209
|
+
}
|
|
2185
2210
|
const feedback = formatWritebackFeedback(plan, payload);
|
|
2186
2211
|
if (metadata.mode === "review" || metadata.mode === "annotate") {
|
|
2187
2212
|
return await postJson(apiUrl(metadata.url, "/api/feedback"), {
|
|
@@ -3581,7 +3606,13 @@ async function requestChanges(id, payload) {
|
|
|
3581
3606
|
return false;
|
|
3582
3607
|
const ok = await adapter.requestChanges(plan, payload);
|
|
3583
3608
|
if (ok) {
|
|
3584
|
-
const
|
|
3609
|
+
const writebackAt = Date.now();
|
|
3610
|
+
const plannotator = typeof plan.metadata.plannotator === "object" && plan.metadata.plannotator !== null ? {
|
|
3611
|
+
...plan.metadata.plannotator,
|
|
3612
|
+
...payload.action === "approve" ? { status: "approved" } : {},
|
|
3613
|
+
lastWritebackStatus: "sent",
|
|
3614
|
+
lastWritebackAt: writebackAt
|
|
3615
|
+
} : undefined;
|
|
3585
3616
|
if (plannotator)
|
|
3586
3617
|
plan.metadata = { ...plan.metadata, plannotator };
|
|
3587
3618
|
plan.updatedAt = new Date;
|
|
@@ -4635,7 +4666,7 @@ var RESTART_WINDOW_MS = 60000;
|
|
|
4635
4666
|
var RESTART_DELAY_MS = 5000;
|
|
4636
4667
|
var PLANNOTATOR_WRITEBACK_POLL_INTERVAL_MS = 15000;
|
|
4637
4668
|
var PLANNOTATOR_WRITEBACK_EXPIRED_ERROR = "Write-back expired before delivery.";
|
|
4638
|
-
var PLANNOTATOR_WRITEBACK_FAILED_ERROR = "No live Plannotator session accepted the
|
|
4669
|
+
var PLANNOTATOR_WRITEBACK_FAILED_ERROR = "No live Plannotator session accepted the write-back payload.";
|
|
4639
4670
|
var PLANNOTATOR_LIVENESS_SWEEP_INTERVAL_MS = 20000;
|
|
4640
4671
|
function isRecord5(value) {
|
|
4641
4672
|
return typeof value === "object" && value !== null;
|
|
@@ -4814,6 +4845,7 @@ async function runWorker() {
|
|
|
4814
4845
|
return;
|
|
4815
4846
|
}
|
|
4816
4847
|
const ok = await requestChanges(job.localPlanId, {
|
|
4848
|
+
action: job.action,
|
|
4817
4849
|
feedback: job.feedback,
|
|
4818
4850
|
revisedContent: job.revisedContent,
|
|
4819
4851
|
annotations: job.annotations,
|
|
@@ -4824,7 +4856,11 @@ async function runWorker() {
|
|
|
4824
4856
|
if (ok) {
|
|
4825
4857
|
const updatedPlan = getById(job.localPlanId);
|
|
4826
4858
|
if (updatedPlan) {
|
|
4827
|
-
|
|
4859
|
+
const updatedPayload = planToSyncPayload(updatedPlan, config.deviceId, hostname2, await getSyncIpAddress());
|
|
4860
|
+
syncQueue.push(updatedPayload);
|
|
4861
|
+
if (isLivePlannotatorPayload(updatedPayload)) {
|
|
4862
|
+
liveSessions.set(updatedPayload.localPlanId, updatedPayload);
|
|
4863
|
+
}
|
|
4828
4864
|
}
|
|
4829
4865
|
pendingWritebackReports.set(job._id, "sent");
|
|
4830
4866
|
persistPendingWritebackReports();
|
|
@@ -4948,8 +4984,12 @@ async function startSupervisor() {
|
|
|
4948
4984
|
const scriptPath = resolve6(process.argv[1] ?? fileURLToPath(new URL("./cli.ts", import.meta.url)));
|
|
4949
4985
|
const restartTimes = [];
|
|
4950
4986
|
while (!stopping) {
|
|
4951
|
-
|
|
4952
|
-
|
|
4987
|
+
const workerArgs = [scriptPath, "start", "--worker"];
|
|
4988
|
+
if (isDevMode())
|
|
4989
|
+
workerArgs.push("--dev");
|
|
4990
|
+
workerProc = spawn2(process.execPath, workerArgs, {
|
|
4991
|
+
stdio: ["ignore", "inherit", "inherit"],
|
|
4992
|
+
env: { ...process.env, ...isDevMode() ? { AGENDEX_DEV: "1" } : {} }
|
|
4953
4993
|
});
|
|
4954
4994
|
const exitCode = await new Promise((resolve7) => {
|
|
4955
4995
|
workerProc?.once("exit", (code) => resolve7(code));
|
|
@@ -5418,7 +5458,7 @@ import { join as join15 } from "node:path";
|
|
|
5418
5458
|
// package.json
|
|
5419
5459
|
var package_default = {
|
|
5420
5460
|
name: "agendex-cli",
|
|
5421
|
-
version: "1.
|
|
5461
|
+
version: "1.1.0",
|
|
5422
5462
|
description: "Agendex CLI for login, sync, and daemon workflows",
|
|
5423
5463
|
homepage: "https://github.com/Tyru5/Agendex#readme",
|
|
5424
5464
|
bugs: {
|