@indigoai-us/hq-cli 5.123.0 → 5.123.1
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 +21 -0
- package/dist/commands/mesh.js +7 -2
- package/dist/commands/update.js +6 -0
- package/dist/lib/mesh/live/backfill-held.d.ts +43 -7
- package/dist/lib/mesh/live/backfill-held.js +323 -42
- package/dist/lib/mesh/live/daemon/config.d.ts +9 -0
- package/dist/lib/mesh/live/daemon/config.js +45 -0
- package/dist/lib/mesh/live/daemon/doctor.d.ts +4 -0
- package/dist/lib/mesh/live/daemon/doctor.js +17 -2
- package/dist/lib/mesh/live/daemon/index.d.ts +4 -2
- package/dist/lib/mesh/live/daemon/index.js +3 -2
- package/dist/lib/mesh/live/daemon/install.d.ts +27 -0
- package/dist/lib/mesh/live/daemon/install.js +54 -4
- package/dist/lib/mesh/live/daemon/run.d.ts +6 -0
- package/dist/lib/mesh/live/daemon/run.js +44 -2
- package/dist/lib/mesh/live/daemon/version-drift.d.ts +5 -0
- package/dist/lib/mesh/live/daemon/version-drift.js +47 -0
- package/dist/lib/mesh/live/paths.d.ts +2 -0
- package/dist/lib/mesh/live/paths.js +4 -0
- package/dist/lib/work-context/reconcile.js +67 -6
- package/dist/lib/work-context/state.d.ts +5 -3
- package/dist/lib/work-context/state.js +28 -4
- package/dist/utils/self-update.d.ts +3 -0
- package/dist/utils/self-update.js +11 -0
- package/package.json +1 -1
|
@@ -112,10 +112,12 @@ export declare function writeSessionState(state: SessionStateFile, root: string)
|
|
|
112
112
|
/** Strip any non-allowlisted fields before durable write. */
|
|
113
113
|
export declare function projectSessionState(state: SessionStateFile): SessionStateFile;
|
|
114
114
|
/**
|
|
115
|
-
* Merge prior local
|
|
116
|
-
*
|
|
115
|
+
* Merge prior local fields into a new state write so PostToolUse bumps and
|
|
116
|
+
* reconcile updates do not clobber an acknowledged company binding.
|
|
117
117
|
*/
|
|
118
|
-
export declare function mergeLocalSessionFields(next: SessionStateFile, prior: SessionStateFile | null
|
|
118
|
+
export declare function mergeLocalSessionFields(next: SessionStateFile, prior: SessionStateFile | null, options?: {
|
|
119
|
+
preserveBindingEpisode?: boolean;
|
|
120
|
+
}): SessionStateFile;
|
|
119
121
|
/**
|
|
120
122
|
* Upgrade the local projection after the server acknowledges a register.
|
|
121
123
|
*
|
|
@@ -103,13 +103,30 @@ export function projectSessionState(state) {
|
|
|
103
103
|
return out;
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
|
-
* Merge prior local
|
|
107
|
-
*
|
|
106
|
+
* Merge prior local fields into a new state write so PostToolUse bumps and
|
|
107
|
+
* reconcile updates do not clobber an acknowledged company binding.
|
|
108
108
|
*/
|
|
109
|
-
export function mergeLocalSessionFields(next, prior) {
|
|
109
|
+
export function mergeLocalSessionFields(next, prior, options = {}) {
|
|
110
110
|
if (!prior)
|
|
111
111
|
return next;
|
|
112
112
|
const out = { ...next };
|
|
113
|
+
// Hook observations commonly carry only tool-write/session metadata. Those
|
|
114
|
+
// writes must not erase a company that an acknowledged register already
|
|
115
|
+
// projected locally; losing it causes held events and repeat registrations.
|
|
116
|
+
// A caller that carries either company field is intentionally changing the
|
|
117
|
+
// binding and remains authoritative.
|
|
118
|
+
if (!out.companyUid && !out.companySlug && (prior.companyUid || prior.companySlug)) {
|
|
119
|
+
out.companyUid = prior.companyUid;
|
|
120
|
+
out.companySlug = prior.companySlug;
|
|
121
|
+
out.contextStatus = prior.contextStatus;
|
|
122
|
+
if (!out.projectId && prior.projectId)
|
|
123
|
+
out.projectId = prior.projectId;
|
|
124
|
+
if (!out.taskId && prior.taskId)
|
|
125
|
+
out.taskId = prior.taskId;
|
|
126
|
+
if (out.version === undefined && prior.version !== undefined) {
|
|
127
|
+
out.version = prior.version;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
113
130
|
if (out.toolWrites === undefined && typeof prior.toolWrites === "number") {
|
|
114
131
|
out.toolWrites = prior.toolWrites;
|
|
115
132
|
}
|
|
@@ -131,7 +148,14 @@ export function mergeLocalSessionFields(next, prior) {
|
|
|
131
148
|
if (!out.transcriptMarker && prior.transcriptMarker) {
|
|
132
149
|
out.transcriptMarker = prior.transcriptMarker;
|
|
133
150
|
}
|
|
134
|
-
|
|
151
|
+
const sameBinding = prior.companyUid === out.companyUid &&
|
|
152
|
+
prior.companySlug === out.companySlug &&
|
|
153
|
+
prior.projectId === out.projectId &&
|
|
154
|
+
prior.taskId === out.taskId;
|
|
155
|
+
if (options.preserveBindingEpisode !== false &&
|
|
156
|
+
!out.bindingEpisodeId &&
|
|
157
|
+
prior.bindingEpisodeId &&
|
|
158
|
+
sameBinding) {
|
|
135
159
|
out.bindingEpisodeId = prior.bindingEpisodeId;
|
|
136
160
|
}
|
|
137
161
|
return out;
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
* version-check), `hq rescue --no-self-update`, and the re-exec guard env.
|
|
58
58
|
*/
|
|
59
59
|
import { type RunningInstall, type UpdateResult } from "./version-gate.js";
|
|
60
|
+
import { type RestartDaemonResult } from "../lib/mesh/live/daemon/install.js";
|
|
60
61
|
/**
|
|
61
62
|
* Set on the re-exec'd child so it can never self-update (and re-exec) again.
|
|
62
63
|
* One update + one re-exec per user invocation, ever.
|
|
@@ -153,6 +154,8 @@ export interface SelfUpdateDeps {
|
|
|
153
154
|
* underneath themselves: hooks, scripts, agents, cron, CI.
|
|
154
155
|
*/
|
|
155
156
|
interactive?: boolean;
|
|
157
|
+
/** Best-effort daemon kick after the CLI install converges (tests). */
|
|
158
|
+
restartDaemon?: () => RestartDaemonResult | void;
|
|
156
159
|
}
|
|
157
160
|
/**
|
|
158
161
|
* Startup path: the running CLI is behind npm `latest`, so update in place and
|
|
@@ -63,6 +63,7 @@ import { CLI_NAME, CLI_VERSION } from "../cli-version.js";
|
|
|
63
63
|
import { buildBunInstallArgv, buildPnpmInstallArgv, buildPrefixedInstallArgv, buildSpawnPlan, checkUpdateConvergence, isLocalDependencyInstall, isPrefixWritable, nonWritablePrefixNote, openInstallOutput, pnpmUpdateEnv, resolveRunningInstall, runUpdateCommand, runSupervisedUpdateCommand, } from "./version-gate.js";
|
|
64
64
|
import { acquireUpdateLock as acquireSharedUpdateLock } from "./update-lock.js";
|
|
65
65
|
import { markLatestIneffective } from "./version-check.js";
|
|
66
|
+
import { restartDaemonServiceIfInstalled } from "../lib/mesh/live/daemon/install.js";
|
|
66
67
|
/**
|
|
67
68
|
* Set on the re-exec'd child so it can never self-update (and re-exec) again.
|
|
68
69
|
* One update + one re-exec per user invocation, ever.
|
|
@@ -278,6 +279,16 @@ async function updateAndReexec(argv, flavor, known, deps) {
|
|
|
278
279
|
console.error(chalk.dim(` Continuing the ${flavor.noun} on ${current}.`));
|
|
279
280
|
return { action: "update-ineffective", latest };
|
|
280
281
|
}
|
|
282
|
+
// A resident mesh daemon keeps the old JS loaded after a global install.
|
|
283
|
+
// Service restart is best-effort and cannot turn a successful update red.
|
|
284
|
+
try {
|
|
285
|
+
const restart = (deps.restartDaemon ?? restartDaemonServiceIfInstalled)();
|
|
286
|
+
if (restart?.message)
|
|
287
|
+
console.error(chalk.yellow(` ${restart.message}`));
|
|
288
|
+
}
|
|
289
|
+
catch {
|
|
290
|
+
// Defensive only; the default helper already absorbs manager failures.
|
|
291
|
+
}
|
|
281
292
|
const childEnv = { ...env, [REEXEC_GUARD_ENV]: "1" };
|
|
282
293
|
const status = (deps.reexec ?? reexecHq)([...argv.slice(2)], childEnv);
|
|
283
294
|
if (status === null) {
|