@indigoai-us/hq-cli 5.345.247 → 5.345.250
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 +95 -0
- package/assets/lanes-hooks/hq-lanes-drain.sh +1 -1
- package/contracts/host-canary-release.json +14 -0
- package/dist/command-catalog.generated.d.ts +1198 -0
- package/dist/command-catalog.generated.js +1476 -0
- package/dist/command-registration-plan.d.ts +6 -0
- package/dist/command-registration-plan.js +1 -0
- package/dist/commands/core-job-run-native.js +4 -0
- package/dist/commands/core-knowledge-prefs.d.ts +1 -1
- package/dist/commands/core-knowledge-prefs.js +1 -16
- package/dist/commands/core.js +0 -2
- package/dist/commands/daemon.js +21 -0
- package/dist/commands/lanes-hold.js +7 -7
- package/dist/commands/lanes-resume.js +2 -2
- package/dist/commands/lanes-review.js +1 -1
- package/dist/commands/lanes-session-start.d.ts +1 -1
- package/dist/commands/lanes-session-start.js +3 -3
- package/dist/commands/lanes-shared.d.ts +1 -1
- package/dist/commands/lanes.d.ts +2 -2
- package/dist/commands/lanes.js +50 -50
- package/dist/commands/mesh.d.ts +25 -0
- package/dist/commands/mesh.js +48 -8
- package/dist/commands/ontology-graph.d.ts +63 -0
- package/dist/commands/ontology-graph.js +470 -0
- package/dist/commands/sync-core.js +6 -0
- package/dist/fast-scaffold.js +1 -3
- package/dist/hq-cloud-sync-runner/bin/sync-runner.js +281 -256
- package/dist/hq-cloud-sync-runner/package.json +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +48 -1
- package/dist/lanes-monitor-check-argv.d.ts +1 -1
- package/dist/lanes-monitor-check-argv.js +1 -1
- package/dist/lanes-monitor-check-fast.d.ts +1 -1
- package/dist/lanes-monitor-check-fast.js +1 -1
- package/dist/lanes-session-start-argv.d.ts +1 -1
- package/dist/lanes-session-start-argv.js +1 -1
- package/dist/lib/capacity/sign-in.d.ts +1 -1
- package/dist/lib/capacity/sign-in.js +1 -1
- package/dist/lib/daemon/hook-requests-conduct-link.js +2 -2
- package/dist/lib/daemon/installed-cli-restart.d.ts +57 -0
- package/dist/lib/daemon/installed-cli-restart.js +114 -0
- package/dist/lib/daemon/lanes-monitor-state.d.ts +2 -2
- package/dist/lib/daemon/lanes-monitor-state.js +2 -2
- package/dist/lib/daemon/legacy-journal-gate.d.ts +32 -0
- package/dist/lib/daemon/legacy-journal-gate.js +102 -0
- package/dist/lib/daemon/machine-checks.d.ts +7 -0
- package/dist/lib/daemon/machine-checks.js +10 -0
- package/dist/lib/daemon/merge-sections.d.ts +3 -3
- package/dist/lib/daemon/merge-sections.js +7 -7
- package/dist/lib/daemon/remote-control-pools.js +1 -1
- package/dist/lib/daemon/run.d.ts +3 -1
- package/dist/lib/daemon/run.js +49 -6
- package/dist/lib/daemon/state-file.d.ts +1 -1
- package/dist/lib/daemon/state-file.js +1 -1
- package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
- package/dist/lib/flag-registry-worker-source.generated.js +1 -1
- package/dist/lib/flag-snapshot-file.d.ts +2 -0
- package/dist/lib/flag-snapshot-file.js +118 -48
- package/dist/lib/hook-engine/canary-gate.d.ts +57 -3
- package/dist/lib/hook-engine/canary-gate.js +138 -6
- package/dist/lib/hook-engine/coverage.d.ts +82 -13
- package/dist/lib/hook-engine/coverage.js +214 -18
- package/dist/lib/hook-engine/registration-identity.d.ts +5 -0
- package/dist/lib/hook-engine/registration-identity.js +1 -1
- package/dist/lib/hook-engine/resolve.d.ts +23 -0
- package/dist/lib/hook-engine/resolve.js +48 -1
- package/dist/lib/hook-engine/stable-heal.d.ts +87 -0
- package/dist/lib/hook-engine/stable-heal.js +214 -0
- package/dist/lib/hot-channels/graph-context.d.ts +105 -0
- package/dist/lib/hot-channels/graph-context.js +380 -0
- package/dist/lib/hot-channels/signals-pass.js +27 -1
- package/dist/lib/lanes/claude-credential.d.ts +1 -1
- package/dist/lib/lanes/claude-credential.js +1 -1
- package/dist/lib/lanes/delivery-core.d.ts +1 -1
- package/dist/lib/lanes/delivery-core.js +1 -1
- package/dist/lib/lanes/delivery.d.ts +10 -10
- package/dist/lib/lanes/delivery.js +8 -8
- package/dist/lib/lanes/dropbox.d.ts +1 -1
- package/dist/lib/lanes/dropbox.js +1 -1
- package/dist/lib/lanes/hooks-install.js +2 -2
- package/dist/lib/lanes/index.d.ts +1 -1
- package/dist/lib/lanes/index.js +1 -1
- package/dist/lib/lanes/monitor.js +1 -1
- package/dist/lib/lanes/quota-notice.js +1 -1
- package/dist/lib/lanes/quota.d.ts +1 -1
- package/dist/lib/lanes/quota.js +1 -1
- package/dist/lib/lanes/repo-merge-hold.d.ts +2 -2
- package/dist/lib/lanes/repo-merge-hold.js +2 -2
- package/dist/lib/lanes/spawn.d.ts +4 -4
- package/dist/lib/lanes/spawn.js +5 -5
- package/dist/lib/mesh/live/company-flag-refresh.d.ts +61 -0
- package/dist/lib/mesh/live/company-flag-refresh.js +159 -0
- package/dist/lib/mesh/live/company-reporting-gaps.d.ts +61 -0
- package/dist/lib/mesh/live/company-reporting-gaps.js +238 -0
- package/dist/lib/mesh/live/daemon/duplicate-unit.d.ts +156 -0
- package/dist/lib/mesh/live/daemon/duplicate-unit.js +616 -0
- package/dist/lib/mesh/live/daemon/run.d.ts +13 -0
- package/dist/lib/mesh/live/daemon/run.js +35 -2
- package/dist/lib/mesh/live/direct-drain.js +1 -1
- package/dist/lib/mesh/live/emit.d.ts +3 -0
- package/dist/lib/mesh/live/emit.js +32 -9
- package/dist/lib/mesh/live/flush.d.ts +3 -0
- package/dist/lib/mesh/live/flush.js +115 -32
- package/dist/lib/mesh/live/liveness-carry.d.ts +1 -1
- package/dist/lib/mesh/live/liveness-carry.js +1 -1
- package/dist/lib/mesh/live/reporting-privacy.d.ts +119 -3
- package/dist/lib/mesh/live/reporting-privacy.js +235 -11
- package/dist/lib/mesh/live/spool.d.ts +17 -2
- package/dist/lib/mesh/live/spool.js +22 -6
- package/dist/lib/ontology-graph/legacy/coverage.d.ts +67 -0
- package/dist/lib/ontology-graph/legacy/coverage.js +192 -0
- package/dist/lib/ontology-graph/legacy/index.d.ts +199 -0
- package/dist/lib/ontology-graph/legacy/index.js +1150 -0
- package/dist/lib/ontology-graph/legacy/parse.d.ts +49 -0
- package/dist/lib/ontology-graph/legacy/parse.js +126 -0
- package/dist/lib/ontology-graph/legacy/report.d.ts +14 -0
- package/dist/lib/ontology-graph/legacy/report.js +254 -0
- package/dist/lib/ontology-graph/legacy/verb-map.d.ts +35 -0
- package/dist/lib/ontology-graph/legacy/verb-map.js +84 -0
- package/dist/lib/ontology-graph/lint/checks.d.ts +140 -0
- package/dist/lib/ontology-graph/lint/checks.js +717 -0
- package/dist/lib/ontology-graph/lint/coverage.d.ts +106 -0
- package/dist/lib/ontology-graph/lint/coverage.js +241 -0
- package/dist/lib/ontology-graph/lint/daily-job.d.ts +259 -0
- package/dist/lib/ontology-graph/lint/daily-job.js +595 -0
- package/dist/lib/ontology-graph/lint/index.d.ts +65 -0
- package/dist/lib/ontology-graph/lint/index.js +176 -0
- package/dist/lib/ontology-graph/model/files.d.ts +20 -0
- package/dist/lib/ontology-graph/model/files.js +89 -0
- package/dist/lib/ontology-graph/model/index.d.ts +65 -0
- package/dist/lib/ontology-graph/model/index.js +100 -0
- package/dist/lib/ontology-graph/model/pass-tasks.d.ts +156 -0
- package/dist/lib/ontology-graph/model/pass-tasks.js +345 -0
- package/dist/lib/ontology-graph/model/pass.d.ts +109 -0
- package/dist/lib/ontology-graph/model/pass.js +958 -0
- package/dist/lib/ontology-graph/model/runner.d.ts +50 -0
- package/dist/lib/ontology-graph/model/runner.js +160 -0
- package/dist/lib/ontology-graph/model/step.d.ts +197 -0
- package/dist/lib/ontology-graph/model/step.js +526 -0
- package/dist/lib/ontology-graph/model/tasks.d.ts +183 -0
- package/dist/lib/ontology-graph/model/tasks.js +349 -0
- package/dist/lib/ontology-graph/not-implemented.d.ts +5 -0
- package/dist/lib/ontology-graph/not-implemented.js +8 -0
- package/dist/lib/ontology-graph/org/compare.d.ts +28 -0
- package/dist/lib/ontology-graph/org/compare.js +239 -0
- package/dist/lib/ontology-graph/org/derive.d.ts +67 -0
- package/dist/lib/ontology-graph/org/derive.js +359 -0
- package/dist/lib/ontology-graph/org/index.d.ts +102 -0
- package/dist/lib/ontology-graph/org/index.js +630 -0
- package/dist/lib/ontology-graph/org/load.d.ts +31 -0
- package/dist/lib/ontology-graph/org/load.js +476 -0
- package/dist/lib/ontology-graph/org/role.d.ts +38 -0
- package/dist/lib/ontology-graph/org/role.js +268 -0
- package/dist/lib/ontology-graph/org/structure.d.ts +63 -0
- package/dist/lib/ontology-graph/org/structure.js +437 -0
- package/dist/lib/ontology-graph/org/text.d.ts +97 -0
- package/dist/lib/ontology-graph/org/text.js +321 -0
- package/dist/lib/ontology-graph/org/types.d.ts +457 -0
- package/dist/lib/ontology-graph/org/types.js +80 -0
- package/dist/lib/ontology-graph/pages/index.d.ts +64 -0
- package/dist/lib/ontology-graph/pages/index.js +193 -0
- package/dist/lib/ontology-graph/pages/render.d.ts +144 -0
- package/dist/lib/ontology-graph/pages/render.js +688 -0
- package/dist/lib/ontology-graph/proposals/apply.d.ts +109 -0
- package/dist/lib/ontology-graph/proposals/apply.js +468 -0
- package/dist/lib/ontology-graph/proposals/group.d.ts +63 -0
- package/dist/lib/ontology-graph/proposals/group.js +232 -0
- package/dist/lib/ontology-graph/proposals/index.d.ts +173 -0
- package/dist/lib/ontology-graph/proposals/index.js +474 -0
- package/dist/lib/ontology-graph/proposals/model.d.ts +162 -0
- package/dist/lib/ontology-graph/proposals/model.js +196 -0
- package/dist/lib/ontology-graph/proposals/org-chart.d.ts +82 -0
- package/dist/lib/ontology-graph/proposals/org-chart.js +340 -0
- package/dist/lib/ontology-graph/read/brief.d.ts +26 -0
- package/dist/lib/ontology-graph/read/brief.js +254 -0
- package/dist/lib/ontology-graph/read/graph-index.d.ts +76 -0
- package/dist/lib/ontology-graph/read/graph-index.js +198 -0
- package/dist/lib/ontology-graph/read/index.d.ts +59 -0
- package/dist/lib/ontology-graph/read/index.js +803 -0
- package/dist/lib/ontology-graph/read/member.d.ts +7 -0
- package/dist/lib/ontology-graph/read/member.js +34 -0
- package/dist/lib/ontology-graph/read/names.d.ts +49 -0
- package/dist/lib/ontology-graph/read/names.js +297 -0
- package/dist/lib/ontology-graph/read/reader-setting.d.ts +19 -0
- package/dist/lib/ontology-graph/read/reader-setting.js +62 -0
- package/dist/lib/ontology-graph/read/test-graph.d.ts +37 -0
- package/dist/lib/ontology-graph/read/test-graph.js +150 -0
- package/dist/lib/ontology-graph/replay/buffered-store.d.ts +33 -0
- package/dist/lib/ontology-graph/replay/buffered-store.js +50 -0
- package/dist/lib/ontology-graph/replay/config.d.ts +41 -0
- package/dist/lib/ontology-graph/replay/config.js +105 -0
- package/dist/lib/ontology-graph/replay/engine.d.ts +146 -0
- package/dist/lib/ontology-graph/replay/engine.js +1240 -0
- package/dist/lib/ontology-graph/replay/extractors.d.ts +59 -0
- package/dist/lib/ontology-graph/replay/extractors.js +1555 -0
- package/dist/lib/ontology-graph/replay/index.d.ts +91 -0
- package/dist/lib/ontology-graph/replay/index.js +220 -0
- package/dist/lib/ontology-graph/replay/listing-manifest.d.ts +66 -0
- package/dist/lib/ontology-graph/replay/listing-manifest.js +242 -0
- package/dist/lib/ontology-graph/replay/member.d.ts +19 -0
- package/dist/lib/ontology-graph/replay/member.js +65 -0
- package/dist/lib/ontology-graph/replay/mentions.d.ts +58 -0
- package/dist/lib/ontology-graph/replay/mentions.js +239 -0
- package/dist/lib/ontology-graph/replay/readers.d.ts +98 -0
- package/dist/lib/ontology-graph/replay/readers.js +1251 -0
- package/dist/lib/ontology-graph/replay/rules.d.ts +127 -0
- package/dist/lib/ontology-graph/replay/rules.js +374 -0
- package/dist/lib/ontology-graph/replay/scope.d.ts +35 -0
- package/dist/lib/ontology-graph/replay/scope.js +115 -0
- package/dist/lib/ontology-graph/replay/transcripts.d.ts +39 -0
- package/dist/lib/ontology-graph/replay/transcripts.js +224 -0
- package/dist/lib/ontology-graph/replay/util.d.ts +55 -0
- package/dist/lib/ontology-graph/replay/util.js +256 -0
- package/dist/lib/ontology-graph/resolve/entity-index.d.ts +159 -0
- package/dist/lib/ontology-graph/resolve/entity-index.js +652 -0
- package/dist/lib/ontology-graph/resolve/index.d.ts +113 -0
- package/dist/lib/ontology-graph/resolve/index.js +214 -0
- package/dist/lib/ontology-graph/resolve/machine.d.ts +34 -0
- package/dist/lib/ontology-graph/resolve/machine.js +95 -0
- package/dist/lib/ontology-graph/resolve/normalize.d.ts +35 -0
- package/dist/lib/ontology-graph/resolve/normalize.js +124 -0
- package/dist/lib/ontology-graph/resolve/org-chart.d.ts +107 -0
- package/dist/lib/ontology-graph/resolve/org-chart.js +578 -0
- package/dist/lib/ontology-graph/resolve/org-layer.d.ts +78 -0
- package/dist/lib/ontology-graph/resolve/org-layer.js +159 -0
- package/dist/lib/ontology-graph/resolve/org-seed.d.ts +141 -0
- package/dist/lib/ontology-graph/resolve/org-seed.js +631 -0
- package/dist/lib/ontology-graph/resolve/org-sources.d.ts +165 -0
- package/dist/lib/ontology-graph/resolve/org-sources.js +634 -0
- package/dist/lib/ontology-graph/resolve/roster.d.ts +76 -0
- package/dist/lib/ontology-graph/resolve/roster.js +226 -0
- package/dist/lib/ontology-graph/resolve/seed.d.ts +267 -0
- package/dist/lib/ontology-graph/resolve/seed.js +1198 -0
- package/dist/lib/ontology-graph/resolve/upsert.d.ts +58 -0
- package/dist/lib/ontology-graph/resolve/upsert.js +139 -0
- package/dist/lib/ontology-graph/resolve/writer.d.ts +128 -0
- package/dist/lib/ontology-graph/resolve/writer.js +351 -0
- package/dist/lib/ontology-graph/schema/authority.d.ts +107 -0
- package/dist/lib/ontology-graph/schema/authority.js +186 -0
- package/dist/lib/ontology-graph/schema/default-schema.d.ts +10 -0
- package/dist/lib/ontology-graph/schema/default-schema.js +242 -0
- package/dist/lib/ontology-graph/schema/grammar.d.ts +57 -0
- package/dist/lib/ontology-graph/schema/grammar.js +409 -0
- package/dist/lib/ontology-graph/schema/index.d.ts +12 -0
- package/dist/lib/ontology-graph/schema/index.js +10 -0
- package/dist/lib/ontology-graph/schema/validate.d.ts +13 -0
- package/dist/lib/ontology-graph/schema/validate.js +132 -0
- package/dist/lib/ontology-graph/store/files.d.ts +34 -0
- package/dist/lib/ontology-graph/store/files.js +207 -0
- package/dist/lib/ontology-graph/store/fs.d.ts +30 -0
- package/dist/lib/ontology-graph/store/fs.js +101 -0
- package/dist/lib/ontology-graph/store/graph-store.d.ts +14 -0
- package/dist/lib/ontology-graph/store/graph-store.js +520 -0
- package/dist/lib/ontology-graph/store/index.d.ts +18 -0
- package/dist/lib/ontology-graph/store/index.js +15 -0
- package/dist/lib/ontology-graph/store/ingest.d.ts +37 -0
- package/dist/lib/ontology-graph/store/ingest.js +323 -0
- package/dist/lib/ontology-graph/store/paths.d.ts +114 -0
- package/dist/lib/ontology-graph/store/paths.js +232 -0
- package/dist/lib/ontology-graph/types.d.ts +1190 -0
- package/dist/lib/ontology-graph/types.js +131 -0
- package/dist/lib/secret-scan/gitleaks-rules.generated.js +1 -1
- package/dist/lib/sync-core/engine-holds.d.ts +1 -1
- package/dist/lib/sync-core/engine-holds.js +12 -2
- package/dist/lib/sync-core/hand-back.d.ts +2 -1
- package/dist/lib/sync-core/hand-back.js +16 -2
- package/dist/lib/sync-core/legacy-journal-export-child.d.ts +2 -0
- package/dist/lib/sync-core/legacy-journal-export-child.js +24 -0
- package/dist/lib/sync-core/legacy-journal-export.d.ts +39 -0
- package/dist/lib/sync-core/legacy-journal-export.js +241 -0
- package/dist/lib/sync-core/legacy-journal-reader.d.ts +15 -0
- package/dist/lib/sync-core/legacy-journal-reader.js +56 -0
- package/dist/lib/sync-core/reconcile.d.ts +3 -0
- package/dist/lib/sync-core/reconcile.js +43 -3
- package/dist/utils/cli-telemetry.d.ts +1 -0
- package/dist/utils/cli-telemetry.js +6 -3
- package/dist/utils/frontmatter.d.ts +14 -0
- package/dist/utils/frontmatter.js +18 -0
- package/dist/utils/hook-engine-rollup.d.ts +96 -0
- package/dist/utils/hook-engine-rollup.js +725 -0
- package/dist/utils/interactive-caller.js +1 -1
- package/package.json +9 -9
- package/scripts/install-hook-engine.mjs +4 -0
- package/assets/scaffold/core/scripts/knowledge-prefs.sh +0 -55
|
@@ -8,6 +8,7 @@ import { SYNC_CORE_FULL_RELEASE, SYNC_CORE_RELEASE, compareSyncCoreReleases, ful
|
|
|
8
8
|
import { readSyncCoreSkips } from "./skip.js";
|
|
9
9
|
import { isLiveCompanyEntity, joinedCompanySlug, setUpJoinedCompany } from "./company-adoption.js";
|
|
10
10
|
import { heldDeletesHandoverLine, readEngineHeldDeletes, writeHandbackKeep } from "./engine-holds.js";
|
|
11
|
+
import { legacyJournalDirs, legacyJournalExportState, removeLegacyJournalExport, writeLegacyJournalExport, } from "./legacy-journal-export.js";
|
|
11
12
|
import { SYNC_RUST_ENGINE_ROLLOUT_FLAG } from "./flag.js";
|
|
12
13
|
import { readSyncCoreRolloutState, syncCoreRolloutStatePath, writeSyncCoreRolloutState, } from "./rollout-state.js";
|
|
13
14
|
function message(error) {
|
|
@@ -151,6 +152,14 @@ async function setUpJoinedCompanies(deps, memberships, ctx) {
|
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
}
|
|
155
|
+
function dropLegacyJournalExport(home, vault, warnings) {
|
|
156
|
+
try {
|
|
157
|
+
removeLegacyJournalExport(home, vault);
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
warnings.push(`could not remove the old copy of the current sync's record of ${vault.slug ?? vault.uid}: ${message(error)}`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
154
163
|
export async function reconcileSyncCore(deps) {
|
|
155
164
|
const now = deps.now ?? (() => new Date());
|
|
156
165
|
const log = deps.log ?? (() => { });
|
|
@@ -272,6 +281,8 @@ export async function reconcileSyncCore(deps) {
|
|
|
272
281
|
const engineHome = syncCoreEngineHome(deps.home, vault.uid);
|
|
273
282
|
if (!before)
|
|
274
283
|
clearEngineStatus(deps.home, vault.uid);
|
|
284
|
+
if (!before && !pending)
|
|
285
|
+
dropLegacyJournalExport(deps.home, vault, warnings);
|
|
275
286
|
writeEngineHome({ home: deps.home, hqRoot: deps.hqRoot, vault, phase: "full", tokenFile: deps.tokenFile, platform, release: engineRelease });
|
|
276
287
|
const wasFull = before?.phase === "full";
|
|
277
288
|
const alreadyOff = vault.kind === "personal"
|
|
@@ -312,6 +323,31 @@ export async function reconcileSyncCore(deps) {
|
|
|
312
323
|
...(firstCycle ? { firstCycle } : {}),
|
|
313
324
|
...(downloadStreams !== undefined ? { downloadStreams } : {}),
|
|
314
325
|
});
|
|
326
|
+
if (vault.kind === "company" && wasFull && !alreadyOff && switchesBefore.unreadable === undefined) {
|
|
327
|
+
dropLegacyJournalExport(deps.home, vault, warnings);
|
|
328
|
+
}
|
|
329
|
+
const cycledSinceOff = vault.kind === "company" && wasFull && alreadyOff
|
|
330
|
+
? engineFirstCycle(engineHome, vault.uid, legacyOffSince)
|
|
331
|
+
: null;
|
|
332
|
+
if (cycledSinceOff && Date.parse(cycledSinceOff.at) > Date.parse(legacyOffSince)) {
|
|
333
|
+
try {
|
|
334
|
+
if (deps.readLegacyJournal) {
|
|
335
|
+
const exported = writeLegacyJournalExport({ home: deps.home, vault, readJournal: deps.readLegacyJournal, env, now: () => now().getTime(), offSince: Date.parse(legacyOffSince) });
|
|
336
|
+
if (exported.status === "written") {
|
|
337
|
+
log(`${vault.uid}: ${exported.replaced ? "replaced an unusable copy of" : "wrote"} what the current sync last synced for ${exported.entries} files ${exported.replaced ? "at" : "to"} ${exported.file}, so the new sync engine can tell an old copy from an edit that was never uploaded`);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
else if (deps.legacyJournalUnavailable) {
|
|
341
|
+
const state = legacyJournalExportState(deps.home, vault, now().getTime());
|
|
342
|
+
if ((state === "missing" || state === "unusable") && legacyJournalDirs(deps.home, env, vault.slug ?? "").length > 0) {
|
|
343
|
+
log(`${vault.uid}: not copying the current sync's record of ${vault.slug ?? vault.uid} for the new sync engine: ${deps.legacyJournalUnavailable}`);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
catch (error) {
|
|
348
|
+
warnings.push(`could not copy the current sync's record of ${vault.slug ?? vault.uid} for the new sync engine: ${message(error)}; the engine keeps treating files that differ from the vault as conflicts`);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
315
351
|
if (firstCycle && firstCycle !== recorded && (!recorded || firstCycle.planned > 0))
|
|
316
352
|
log(`${vault.uid}: first full cycle ${firstCycle.at}: ${firstCycle.planned} planned, ${firstCycle.completed} completed, ${firstCycle.held} held`);
|
|
317
353
|
if (vault.kind === "company" && vault.slug)
|
|
@@ -335,7 +371,7 @@ export async function reconcileSyncCore(deps) {
|
|
|
335
371
|
if (vault.phase !== "full")
|
|
336
372
|
continue;
|
|
337
373
|
const engineHome = syncCoreEngineHome(deps.home, vault.uid);
|
|
338
|
-
const heldDeletes = readEngineHeldDeletes(engineHome, vault.uid);
|
|
374
|
+
const heldDeletes = readEngineHeldDeletes(engineHome, vault.uid, (line) => warnings.push(line));
|
|
339
375
|
if (heldDeletes && heldDeletes !== "unreadable") {
|
|
340
376
|
try {
|
|
341
377
|
writeHandbackKeep(deps.home, vault, heldDeletes, at);
|
|
@@ -368,8 +404,12 @@ export async function reconcileSyncCore(deps) {
|
|
|
368
404
|
};
|
|
369
405
|
writeSyncCoreRolloutState(deps.home, state);
|
|
370
406
|
for (const uid of stopped) {
|
|
371
|
-
if (
|
|
372
|
-
|
|
407
|
+
if (handedBack.some((vault) => vault.uid === uid))
|
|
408
|
+
continue;
|
|
409
|
+
removeEngineOwnership(deps.home, uid);
|
|
410
|
+
const vault = previousByUid.get(uid);
|
|
411
|
+
if (vault)
|
|
412
|
+
dropLegacyJournalExport(deps.home, vault, warnings);
|
|
373
413
|
}
|
|
374
414
|
const patch = {
|
|
375
415
|
...(personalOff ? { personal: false } : {}),
|
|
@@ -87,6 +87,7 @@ export declare const CLI_TELEMETRY_CONSENT_TTL_MS: number;
|
|
|
87
87
|
* throws. Only `true` allows a send.
|
|
88
88
|
*/
|
|
89
89
|
export declare function hasCliTelemetryConsent(token: string, machineIdentity: boolean, signal: AbortSignal): Promise<boolean>;
|
|
90
|
+
export declare function readCliTelemetryConsent(token: string, machineIdentity: boolean, signal: AbortSignal): Promise<boolean | null>;
|
|
90
91
|
export declare function telemetryDisclosureMarkerPath(): string;
|
|
91
92
|
/**
|
|
92
93
|
* Print the one-line disclosure at most once per machine. Returns whether
|
|
@@ -362,13 +362,16 @@ async function fetchCliTelemetryConsent(token, signal) {
|
|
|
362
362
|
* throws. Only `true` allows a send.
|
|
363
363
|
*/
|
|
364
364
|
export async function hasCliTelemetryConsent(token, machineIdentity, signal) {
|
|
365
|
+
return (await readCliTelemetryConsent(token, machineIdentity, signal)) === true;
|
|
366
|
+
}
|
|
367
|
+
export async function readCliTelemetryConsent(token, machineIdentity, signal) {
|
|
365
368
|
try {
|
|
366
369
|
// Agents and machine identities are always collected; the server answers
|
|
367
370
|
// `agent-required` for them, so no request is needed.
|
|
368
371
|
if (machineIdentity)
|
|
369
372
|
return true;
|
|
370
373
|
if (signal.aborted)
|
|
371
|
-
return
|
|
374
|
+
return null;
|
|
372
375
|
const subject = consentSubjectKey(token);
|
|
373
376
|
if (subject) {
|
|
374
377
|
const cached = readCachedConsent(subject, Date.now());
|
|
@@ -389,10 +392,10 @@ export async function hasCliTelemetryConsent(token, machineIdentity, signal) {
|
|
|
389
392
|
});
|
|
390
393
|
pendingConsentReads.set(key, pending);
|
|
391
394
|
}
|
|
392
|
-
return
|
|
395
|
+
return await pending;
|
|
393
396
|
}
|
|
394
397
|
catch {
|
|
395
|
-
return
|
|
398
|
+
return null;
|
|
396
399
|
}
|
|
397
400
|
}
|
|
398
401
|
/**
|
|
@@ -32,4 +32,18 @@ export declare function splitFrontmatterBody(text: string, lineEndings?: "lf" |
|
|
|
32
32
|
yaml: string;
|
|
33
33
|
body: string;
|
|
34
34
|
} | null;
|
|
35
|
+
/**
|
|
36
|
+
* The lenient split for hand-written files. The text opens with `---`
|
|
37
|
+
* (anything may follow on that line) and the block ends at the first later
|
|
38
|
+
* line that starts with `---` (anything may follow there too). `yaml` is the
|
|
39
|
+
* text between the two lines, ending in its newline; `body` is everything
|
|
40
|
+
* after the closing line; `closeAt` is the index of the newline before the
|
|
41
|
+
* closing fence. Null when either fence is missing. Takes the text as given
|
|
42
|
+
* (no BOM stripping) and never parses YAML.
|
|
43
|
+
*/
|
|
44
|
+
export declare function splitLenientFrontmatter(text: string): {
|
|
45
|
+
yaml: string;
|
|
46
|
+
body: string;
|
|
47
|
+
closeAt: number;
|
|
48
|
+
} | null;
|
|
35
49
|
//# sourceMappingURL=frontmatter.d.ts.map
|
|
@@ -39,4 +39,22 @@ export function splitFrontmatterBody(text, lineEndings = "lf-or-crlf") {
|
|
|
39
39
|
const match = (lineEndings === "lf" ? LF_BLOCK_RE : BLOCK_RE).exec(text);
|
|
40
40
|
return match ? { yaml: match[2], body: match[3] } : null;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* The lenient split for hand-written files. The text opens with `---`
|
|
44
|
+
* (anything may follow on that line) and the block ends at the first later
|
|
45
|
+
* line that starts with `---` (anything may follow there too). `yaml` is the
|
|
46
|
+
* text between the two lines, ending in its newline; `body` is everything
|
|
47
|
+
* after the closing line; `closeAt` is the index of the newline before the
|
|
48
|
+
* closing fence. Null when either fence is missing. Takes the text as given
|
|
49
|
+
* (no BOM stripping) and never parses YAML.
|
|
50
|
+
*/
|
|
51
|
+
export function splitLenientFrontmatter(text) {
|
|
52
|
+
if (!text.startsWith("---"))
|
|
53
|
+
return null;
|
|
54
|
+
const closeAt = text.indexOf("\n---", 3);
|
|
55
|
+
if (closeAt < 0)
|
|
56
|
+
return null;
|
|
57
|
+
const after = text.indexOf("\n", closeAt + 1);
|
|
58
|
+
return { yaml: text.slice(text.indexOf("\n") + 1, closeAt + 1), body: after < 0 ? "" : text.slice(after + 1), closeAt };
|
|
59
|
+
}
|
|
42
60
|
//# sourceMappingURL=frontmatter.js.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export declare const HOOK_ENGINE_ROLLUP_EVENT = "hook_engine_failure_rollup";
|
|
2
|
+
export declare const HOOK_ENGINE_LOG_RELATIVE: string;
|
|
3
|
+
export declare const HOOK_ENGINE_ROLLUP_STATE_FILE = "hook-engine-rollup.json";
|
|
4
|
+
export declare const HOOK_ENGINE_ROLLUP_LOOKBACK_DAYS = 7;
|
|
5
|
+
export declare const HOOK_ENGINE_ROLLUP_MAX_READ_BYTES: number;
|
|
6
|
+
export declare const HOOK_ENGINE_ROLLUP_MAX_GROUPS = 500;
|
|
7
|
+
export declare const HOOK_ENGINE_ROLLUP_BATCH_SIZE = 50;
|
|
8
|
+
export declare const HOOK_ENGINE_ROLLUP_POST_TIMEOUT_MS = 15000;
|
|
9
|
+
export declare const HOOK_ENGINE_ROLLUP_MAX_CONFIRM_GAP_MS: number;
|
|
10
|
+
export declare const HOOK_ENGINE_SHIPPED_HOOK_IDS: ReadonlySet<string>;
|
|
11
|
+
export type HookEngineFailureKind = "bridge" | "dispatch-failure" | "run-deny" | "run-fault";
|
|
12
|
+
export type HookEngineFailureReason = "budget" | "died" | "unreadable" | "spawn" | "other" | "none";
|
|
13
|
+
export interface HookEngineFailureProperties {
|
|
14
|
+
kind: HookEngineFailureKind;
|
|
15
|
+
hook: string;
|
|
16
|
+
hookEvent: string;
|
|
17
|
+
bridgeStatus: string;
|
|
18
|
+
reason: HookEngineFailureReason;
|
|
19
|
+
code?: number;
|
|
20
|
+
timedOut?: boolean;
|
|
21
|
+
host: string;
|
|
22
|
+
engine: string;
|
|
23
|
+
release?: string;
|
|
24
|
+
count: number;
|
|
25
|
+
medianMs?: number;
|
|
26
|
+
p95Ms?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface HookEngineRollupEvent {
|
|
29
|
+
eventName: typeof HOOK_ENGINE_ROLLUP_EVENT;
|
|
30
|
+
app: "hq-cli";
|
|
31
|
+
source: "cli";
|
|
32
|
+
occurredAt: string;
|
|
33
|
+
consentBasis: HookEngineRollupConsentBasis;
|
|
34
|
+
schemaVersion: 1;
|
|
35
|
+
idempotencyKey: string;
|
|
36
|
+
properties: HookEngineFailureProperties;
|
|
37
|
+
}
|
|
38
|
+
export type HookEngineRollupConsentBasis = "opted-in" | "agent-required";
|
|
39
|
+
export type HookEngineRollupConsent = "yes" | "no" | "unknown";
|
|
40
|
+
export type HookEngineRollupPostResult = "ok" | "retry" | "rejected";
|
|
41
|
+
export interface HookEngineRollupClient {
|
|
42
|
+
subject: string;
|
|
43
|
+
consentBasis?: HookEngineRollupConsentBasis;
|
|
44
|
+
consent(): Promise<HookEngineRollupConsent>;
|
|
45
|
+
post(events: readonly HookEngineRollupEvent[]): Promise<HookEngineRollupPostResult>;
|
|
46
|
+
}
|
|
47
|
+
export interface HookEngineRollupOptions {
|
|
48
|
+
home: string;
|
|
49
|
+
stateFile: string;
|
|
50
|
+
env?: NodeJS.ProcessEnv;
|
|
51
|
+
now?: () => number;
|
|
52
|
+
maxConfirmGapMs?: number;
|
|
53
|
+
client?: () => HookEngineRollupClient | null;
|
|
54
|
+
newRunId?: () => string;
|
|
55
|
+
}
|
|
56
|
+
export type HookEngineRollupResult = {
|
|
57
|
+
status: "disabled" | "up-to-date" | "no-identity" | "not-consented" | "consent-unknown" | "started" | "nothing-to-send";
|
|
58
|
+
} | {
|
|
59
|
+
status: "sent";
|
|
60
|
+
events: number;
|
|
61
|
+
rejected: number;
|
|
62
|
+
droppedGroups: number;
|
|
63
|
+
} | {
|
|
64
|
+
status: "send-failed";
|
|
65
|
+
};
|
|
66
|
+
interface Classified {
|
|
67
|
+
day: string;
|
|
68
|
+
properties: Omit<HookEngineFailureProperties, "count" | "medianMs" | "p95Ms">;
|
|
69
|
+
ms?: number;
|
|
70
|
+
}
|
|
71
|
+
export declare function isSafeHookEngineRollupProperties(value: unknown): value is HookEngineFailureProperties;
|
|
72
|
+
export declare function engineVersion(value: unknown): {
|
|
73
|
+
engine: string;
|
|
74
|
+
release?: string;
|
|
75
|
+
};
|
|
76
|
+
export declare function runReason(kind: "run-deny" | "run-fault", value: unknown): HookEngineFailureReason;
|
|
77
|
+
export declare function classifyHookEngineRow(row: Record<string, unknown>): Omit<Classified, "day"> | null;
|
|
78
|
+
export declare function aggregateHookEngineFailures(rows: readonly Classified[], maxGroups?: number): {
|
|
79
|
+
groups: Array<{
|
|
80
|
+
day: string;
|
|
81
|
+
properties: HookEngineFailureProperties;
|
|
82
|
+
}>;
|
|
83
|
+
dropped: number;
|
|
84
|
+
};
|
|
85
|
+
export declare function buildHookEngineRollupEvents(groups: ReadonlyArray<{
|
|
86
|
+
day: string;
|
|
87
|
+
properties: HookEngineFailureProperties;
|
|
88
|
+
}>, runId: string, consentBasis?: HookEngineRollupConsentBasis): HookEngineRollupEvent[];
|
|
89
|
+
export declare function defaultHookEngineRollupClient(): HookEngineRollupClient | null;
|
|
90
|
+
export declare function hookEngineRollupLogLine(result: HookEngineRollupResult, previous: HookEngineRollupResult["status"] | undefined): {
|
|
91
|
+
level: "info" | "warn";
|
|
92
|
+
message: string;
|
|
93
|
+
} | null;
|
|
94
|
+
export declare function runHookEngineRollup(options: HookEngineRollupOptions): Promise<HookEngineRollupResult>;
|
|
95
|
+
export {};
|
|
96
|
+
//# sourceMappingURL=hook-engine-rollup.d.ts.map
|