@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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WP-B: the replay's write window over a graph store.
|
|
3
|
+
*
|
|
4
|
+
* `applyIngest` used to rewrite a whole facts file for every input that
|
|
5
|
+
* touched an entity. The store now holds a batch itself (`beginBatch` and
|
|
6
|
+
* `flushBatch` in store/graph-store.ts): row writes, closures, dirty marks and
|
|
7
|
+
* log entries stay in memory and each touched facts file is written once per
|
|
8
|
+
* flush. This wrapper only decides when a window opens and closes:
|
|
9
|
+
*
|
|
10
|
+
* - the first row write, closure, log entry or dirty mark through the wrapper
|
|
11
|
+
* opens a batch on the store underneath;
|
|
12
|
+
* - `flush()` writes it and closes it, so code that takes the store underneath
|
|
13
|
+
* after a flush (the legacy import, the page compiler, the brief) writes at
|
|
14
|
+
* once, as it always did.
|
|
15
|
+
*
|
|
16
|
+
* Reads go through the same store, so `applyIngest`, the extractors and the
|
|
17
|
+
* proposal builders see every row at once. Entities, ledger and cursor are
|
|
18
|
+
* written at once. A process killed before a flush loses only rows whose days
|
|
19
|
+
* the cursor has not passed. A store without batch calls is passed through
|
|
20
|
+
* unchanged and `flush()` then has nothing to write.
|
|
21
|
+
*/
|
|
22
|
+
import type { BatchFlushResult, GraphStore } from "../types.js";
|
|
23
|
+
export type FlushResult = BatchFlushResult;
|
|
24
|
+
export interface BufferedStore extends GraphStore {
|
|
25
|
+
/** Writes everything held in memory and closes the window. */
|
|
26
|
+
flush(): FlushResult;
|
|
27
|
+
/** Rows written since the last flush. */
|
|
28
|
+
bufferedRows(): number;
|
|
29
|
+
/** The store underneath. */
|
|
30
|
+
readonly real: GraphStore;
|
|
31
|
+
}
|
|
32
|
+
export declare function bufferStore(real: GraphStore): BufferedStore;
|
|
33
|
+
//# sourceMappingURL=buffered-store.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export function bufferStore(real) {
|
|
2
|
+
const canBatch = typeof real.beginBatch === "function" && typeof real.flushBatch === "function";
|
|
3
|
+
const open = () => {
|
|
4
|
+
if (canBatch)
|
|
5
|
+
real.beginBatch?.();
|
|
6
|
+
};
|
|
7
|
+
return {
|
|
8
|
+
real,
|
|
9
|
+
root: real.root,
|
|
10
|
+
init: () => real.init(),
|
|
11
|
+
schema: () => real.schema(),
|
|
12
|
+
readEntity: (ref) => real.readEntity(ref),
|
|
13
|
+
upsertEntity: (input) => real.upsertEntity(input),
|
|
14
|
+
listEntities: (type) => real.listEntities(type),
|
|
15
|
+
removeEntity: (ref) => real.removeEntity(ref),
|
|
16
|
+
listAudiences: () => real.listAudiences(),
|
|
17
|
+
readRows: (ref, options) => real.readRows(ref, options),
|
|
18
|
+
writeRows(ref, audience, rows) {
|
|
19
|
+
open();
|
|
20
|
+
return real.writeRows(ref, audience, rows);
|
|
21
|
+
},
|
|
22
|
+
closeRow(ref, audience, id, closure) {
|
|
23
|
+
open();
|
|
24
|
+
return real.closeRow(ref, audience, id, closure);
|
|
25
|
+
},
|
|
26
|
+
listEntitiesWithRows: (audiences) => real.listEntitiesWithRows(audiences),
|
|
27
|
+
appendLog(entry) {
|
|
28
|
+
open();
|
|
29
|
+
real.appendLog(entry);
|
|
30
|
+
},
|
|
31
|
+
readLog: (limit) => real.readLog(limit),
|
|
32
|
+
appendLedger: (entry) => real.appendLedger(entry),
|
|
33
|
+
readLedger: (run) => real.readLedger(run),
|
|
34
|
+
readCursor: () => real.readCursor(),
|
|
35
|
+
writeCursor: (cursor) => real.writeCursor(cursor),
|
|
36
|
+
markDirty(refs) {
|
|
37
|
+
open();
|
|
38
|
+
real.markDirty(refs);
|
|
39
|
+
},
|
|
40
|
+
readDirty: () => real.readDirty(),
|
|
41
|
+
clearDirty: (refs) => real.clearDirty(refs),
|
|
42
|
+
flush() {
|
|
43
|
+
if (!canBatch || !real.flushBatch)
|
|
44
|
+
return { files: 0, rows: 0, closures: 0, logEntries: 0, ms: 0 };
|
|
45
|
+
return real.flushBatch({ end: true });
|
|
46
|
+
},
|
|
47
|
+
bufferedRows: () => real.batchRows?.() ?? 0,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=buffered-store.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { GraphContext } from "../types.js";
|
|
2
|
+
export declare const REPLAY_CONFIG_RELATIVE = ".hq/ontology-replay.yaml";
|
|
3
|
+
export interface ReplayConfig {
|
|
4
|
+
/** Source class ids switched off. */
|
|
5
|
+
disabled: Set<string>;
|
|
6
|
+
/** Company uid in mesh rows and receipts, when the vault names one. */
|
|
7
|
+
companyUid: string | null;
|
|
8
|
+
git: {
|
|
9
|
+
/** Folders under the HQ root that hold clones, one level deep. */
|
|
10
|
+
repoRoots: string[];
|
|
11
|
+
/** Repo folders (relative to the HQ root) named for this company. */
|
|
12
|
+
repos: string[];
|
|
13
|
+
/** Remote owners whose clones belong to this company. Discovered from `repos` when empty. */
|
|
14
|
+
remoteOwners: string[];
|
|
15
|
+
};
|
|
16
|
+
transcripts: {
|
|
17
|
+
/** Folder of this member's Claude Code transcripts for this HQ root. */
|
|
18
|
+
dir: string;
|
|
19
|
+
maxPrompts: number;
|
|
20
|
+
maxChars: number;
|
|
21
|
+
};
|
|
22
|
+
/** Work mesh cache folder of this member. */
|
|
23
|
+
meshCacheDir: string;
|
|
24
|
+
/** Extra principal ids of the member (a sign-in subject, an email) for audience lists. */
|
|
25
|
+
memberPrincipals: string[];
|
|
26
|
+
/** Model step: items per relationship-typing request. */
|
|
27
|
+
typingBatch: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Repo folders (absolute) that `companies/manifest.yaml` lists for a company
|
|
31
|
+
* other than this one, in either manifest shape (companies under a
|
|
32
|
+
* `companies:` key, or at the top level). Null when the manifest cannot be
|
|
33
|
+
* read or names no company at all (an empty or cut-off file): what belongs to
|
|
34
|
+
* another company is then unknown, and a caller must take nothing it was not
|
|
35
|
+
* told is this company's.
|
|
36
|
+
*/
|
|
37
|
+
export declare function otherCompanyRepoDirs(hqRoot: string, company: string): string[] | null;
|
|
38
|
+
/** `~/.claude/projects/<hq root with every non-alphanumeric character as a dash>`. */
|
|
39
|
+
export declare function defaultTranscriptDir(hqRoot: string, home?: string): string;
|
|
40
|
+
export declare function loadReplayConfig(context: GraphContext, env?: NodeJS.ProcessEnv): ReplayConfig;
|
|
41
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WP-B: what the replay reads for a company. Nothing here names a company.
|
|
3
|
+
* The defaults describe the standard company folder layout; a company can
|
|
4
|
+
* override them in `<companyRoot>/.hq/ontology-replay.yaml` (local, never
|
|
5
|
+
* synced), and the rest is discovered from the vault (manifest, `.hq/config.json`).
|
|
6
|
+
*/
|
|
7
|
+
import * as fs from "node:fs";
|
|
8
|
+
import * as os from "node:os";
|
|
9
|
+
import * as path from "node:path";
|
|
10
|
+
import yaml from "js-yaml";
|
|
11
|
+
import { asRecord, asString, readJsonFile, stringList } from "./util.js";
|
|
12
|
+
export const REPLAY_CONFIG_RELATIVE = ".hq/ontology-replay.yaml";
|
|
13
|
+
function manifestEntry(hqRoot, company) {
|
|
14
|
+
try {
|
|
15
|
+
const loaded = asRecord(yaml.load(fs.readFileSync(path.join(hqRoot, "companies", "manifest.yaml"), "utf8"), { schema: yaml.CORE_SCHEMA }));
|
|
16
|
+
const direct = asRecord(loaded[company]);
|
|
17
|
+
if (Object.keys(direct).length > 0)
|
|
18
|
+
return direct;
|
|
19
|
+
return asRecord(asRecord(loaded.companies)[company]);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Repo folders (absolute) that `companies/manifest.yaml` lists for a company
|
|
27
|
+
* other than this one, in either manifest shape (companies under a
|
|
28
|
+
* `companies:` key, or at the top level). Null when the manifest cannot be
|
|
29
|
+
* read or names no company at all (an empty or cut-off file): what belongs to
|
|
30
|
+
* another company is then unknown, and a caller must take nothing it was not
|
|
31
|
+
* told is this company's.
|
|
32
|
+
*/
|
|
33
|
+
export function otherCompanyRepoDirs(hqRoot, company) {
|
|
34
|
+
let loaded;
|
|
35
|
+
try {
|
|
36
|
+
loaded = asRecord(yaml.load(fs.readFileSync(path.join(hqRoot, "companies", "manifest.yaml"), "utf8"), { schema: yaml.CORE_SCHEMA }));
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const dirs = new Set();
|
|
42
|
+
let companies = 0;
|
|
43
|
+
for (const [table, nested] of [[loaded, false], [asRecord(loaded.companies), true]]) {
|
|
44
|
+
for (const [slug, entry] of Object.entries(table)) {
|
|
45
|
+
if (!nested && slug === "companies")
|
|
46
|
+
continue;
|
|
47
|
+
if (Object.keys(asRecord(entry)).length === 0)
|
|
48
|
+
continue;
|
|
49
|
+
companies += 1;
|
|
50
|
+
if (slug === company)
|
|
51
|
+
continue;
|
|
52
|
+
for (const repo of stringList(asRecord(entry).repos))
|
|
53
|
+
dirs.add(path.resolve(hqRoot, repo));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (companies === 0)
|
|
57
|
+
return null;
|
|
58
|
+
return [...dirs].sort();
|
|
59
|
+
}
|
|
60
|
+
/** `~/.claude/projects/<hq root with every non-alphanumeric character as a dash>`. */
|
|
61
|
+
export function defaultTranscriptDir(hqRoot, home = os.homedir()) {
|
|
62
|
+
return path.join(home, ".claude", "projects", path.resolve(hqRoot).replace(/[^A-Za-z0-9]/g, "-"));
|
|
63
|
+
}
|
|
64
|
+
export function loadReplayConfig(context, env = process.env) {
|
|
65
|
+
let raw;
|
|
66
|
+
try {
|
|
67
|
+
raw = asRecord(yaml.load(fs.readFileSync(path.join(context.companyRoot, ...REPLAY_CONFIG_RELATIVE.split("/")), "utf8"), { schema: yaml.CORE_SCHEMA }));
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
raw = {};
|
|
71
|
+
}
|
|
72
|
+
const manifest = manifestEntry(context.hqRoot, context.company);
|
|
73
|
+
const local = asRecord(readJsonFile(path.join(context.companyRoot, ".hq", "config.json")));
|
|
74
|
+
const git = asRecord(raw.git);
|
|
75
|
+
const transcripts = asRecord(raw.transcripts);
|
|
76
|
+
const member = asRecord(raw.member);
|
|
77
|
+
const home = env.HOME?.trim() || os.homedir();
|
|
78
|
+
const classes = asRecord(raw.classes);
|
|
79
|
+
const disabled = new Set(stringList(raw.disabled));
|
|
80
|
+
for (const [id, value] of Object.entries(classes)) {
|
|
81
|
+
if (value === false || asRecord(value).enabled === false)
|
|
82
|
+
disabled.add(id);
|
|
83
|
+
}
|
|
84
|
+
for (const id of (env.HQ_ONTOLOGY_REPLAY_DISABLE ?? "").split(","))
|
|
85
|
+
if (id.trim() !== "")
|
|
86
|
+
disabled.add(id.trim());
|
|
87
|
+
return {
|
|
88
|
+
disabled,
|
|
89
|
+
companyUid: asString(raw.company_uid) || asString(local.companyUid) || asString(manifest.cloud_uid) || null,
|
|
90
|
+
git: {
|
|
91
|
+
repoRoots: stringList(git.repo_roots).length > 0 ? stringList(git.repo_roots) : ["repos/private", "repos/public"],
|
|
92
|
+
repos: [...new Set([...stringList(manifest.repos), ...stringList(git.repos)])],
|
|
93
|
+
remoteOwners: stringList(git.remote_owners).map((owner) => owner.toLowerCase()),
|
|
94
|
+
},
|
|
95
|
+
transcripts: {
|
|
96
|
+
dir: asString(transcripts.dir) || env.HQ_ONTOLOGY_TRANSCRIPTS_DIR?.trim() || defaultTranscriptDir(context.hqRoot, home),
|
|
97
|
+
maxPrompts: typeof transcripts.max_prompts === "number" ? transcripts.max_prompts : 12,
|
|
98
|
+
maxChars: typeof transcripts.max_chars === "number" ? transcripts.max_chars : 600,
|
|
99
|
+
},
|
|
100
|
+
meshCacheDir: asString(raw.mesh_cache_dir) || env.HQ_ONTOLOGY_MESH_CACHE_DIR?.trim() || path.join(home, ".hq", "work-mesh", "cache"),
|
|
101
|
+
memberPrincipals: stringList(member.principals),
|
|
102
|
+
typingBatch: typeof raw.typing_batch === "number" && raw.typing_batch > 0 ? raw.typing_batch : 40,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { importLegacy as defaultImportLegacy } from "../legacy/index.js";
|
|
2
|
+
import { compilePages as defaultCompilePages } from "../pages/index.js";
|
|
3
|
+
import { type AudienceKey, type EntityRef, type GraphContext, type GraphSchema, type GraphStore, type IngestRow, type IsoDate, type LegacyImportResult, type MemberIdentity, type Contradiction, type ModelRunner, type ModelStep, type Origin, type RebuildOptions, type ReplayRunResult, type Resolver, type RuleExtractor, type SourceRef, type UpdateOptions } from "../types.js";
|
|
4
|
+
import { briefCommand as defaultBriefCommand } from "../read/index.js";
|
|
5
|
+
import { type ClassedInput, type Corpus } from "./readers.js";
|
|
6
|
+
export declare const TYPING_PROMPT_VERSION = "replay-typing-v1";
|
|
7
|
+
export declare const PENDING_RELATIVE: string;
|
|
8
|
+
export declare const TRANSCRIPT_CACHE_RELATIVE: string;
|
|
9
|
+
/** The incremental listing's manifest: path, size and mtime per source class (listing-manifest.ts). */
|
|
10
|
+
export declare const LISTING_MANIFEST_RELATIVE: string;
|
|
11
|
+
/** Set to 1 to run rules only: every model request becomes a pending marker. */
|
|
12
|
+
export declare const NO_MODEL_ENV = "HQ_ONTOLOGY_REPLAY_NO_MODEL";
|
|
13
|
+
/** Set to 1 to make `update` list the whole corpus again (the same as `--full-listing`). */
|
|
14
|
+
export declare const FULL_LISTING_ENV = "HQ_ONTOLOGY_REPLAY_FULL_LISTING";
|
|
15
|
+
/** The model step's cap per day. The scheduled daily run uses exactly this; one run can raise it (`resolveDayBudget`). */
|
|
16
|
+
export declare const DEFAULT_DAY_BUDGET: {
|
|
17
|
+
readonly inputTokens: 150000;
|
|
18
|
+
readonly outputTokens: 20000;
|
|
19
|
+
};
|
|
20
|
+
/** Thrown for a daily cap that is not a whole number of 1 or more. */
|
|
21
|
+
export declare class DayBudgetError extends RangeError {
|
|
22
|
+
constructor(name: string, value: unknown);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The daily cap a run uses: the defaults, with either side replaced by the
|
|
26
|
+
* run's own `maxInputTokens` / `maxOutputTokens`. Absent options change
|
|
27
|
+
* nothing. Zero, a negative, a fraction or a non-number is refused: switching
|
|
28
|
+
* the model off is `--no-model`, not a cap of zero.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveDayBudget(options?: {
|
|
31
|
+
maxInputTokens?: number;
|
|
32
|
+
maxOutputTokens?: number;
|
|
33
|
+
}): {
|
|
34
|
+
inputTokens: number;
|
|
35
|
+
outputTokens: number;
|
|
36
|
+
overridden: boolean;
|
|
37
|
+
};
|
|
38
|
+
/** What the run's model step was allowed, what it used, and whether a cap stopped it. */
|
|
39
|
+
export interface ModelCapReport {
|
|
40
|
+
/** The cap per day this run ran under. */
|
|
41
|
+
dayInputTokens: number;
|
|
42
|
+
dayOutputTokens: number;
|
|
43
|
+
/** True when the run raised or lowered the default cap. */
|
|
44
|
+
overridden: boolean;
|
|
45
|
+
/** Tokens this run's model step used (not the day's earlier runs). */
|
|
46
|
+
usedInputTokens: number;
|
|
47
|
+
usedOutputTokens: number;
|
|
48
|
+
/** Items left pending because the daily cap was reached. */
|
|
49
|
+
pendingAtDayCap: number;
|
|
50
|
+
/** Items left pending because the run's own budget (`--budget-tokens`) was reached. */
|
|
51
|
+
pendingAtRunBudget: number;
|
|
52
|
+
/** Items left pending for any other reason (usage limit, sign-out, timeout, provider error). */
|
|
53
|
+
pendingOther: number;
|
|
54
|
+
}
|
|
55
|
+
/** Seams for tests. Production passes nothing. */
|
|
56
|
+
export interface ReplayDeps {
|
|
57
|
+
now?: () => Date;
|
|
58
|
+
store?: GraphStore;
|
|
59
|
+
resolver?: Resolver;
|
|
60
|
+
/** Builds the resolver once the legacy import is done. Default: WP-C's `createResolver`. */
|
|
61
|
+
createResolver?: (store: GraphStore, schema: GraphSchema) => Resolver;
|
|
62
|
+
modelStep?: ModelStep | null;
|
|
63
|
+
/** Runner for the step the engine creates itself (when `modelStep` is not given). Default: the `claude -p` turn. */
|
|
64
|
+
modelRunner?: ModelRunner;
|
|
65
|
+
/** Model name stamped on `by agent:<model>` rows. */
|
|
66
|
+
modelName?: string;
|
|
67
|
+
importLegacy?: typeof defaultImportLegacy | null;
|
|
68
|
+
/**
|
|
69
|
+
* How the legacy import gets the org layer (reporting lines, workspace
|
|
70
|
+
* members). The commands pass `fetch`: a read-only call with the signed-in
|
|
71
|
+
* session that falls back to the kept answer. Default: WP-C's default
|
|
72
|
+
* (`cache`, no network), so a test never calls out.
|
|
73
|
+
*/
|
|
74
|
+
orgLayer?: "fetch" | "cache" | "off";
|
|
75
|
+
/** Finds the signed-in member when the context has none. Default: the CLI's whoami answer. */
|
|
76
|
+
resolveMember?: (context: GraphContext) => MemberIdentity | null;
|
|
77
|
+
/** Default: WP-E's brief, written at the end of a run. Null switches it off. */
|
|
78
|
+
brief?: typeof defaultBriefCommand | null;
|
|
79
|
+
/** Default: WP-F's proposals package (standing decisions, contradiction proposals). Null switches it off. */
|
|
80
|
+
proposals?: ProposalsSeam | null;
|
|
81
|
+
compilePages?: typeof defaultCompilePages | null;
|
|
82
|
+
corpus?: Corpus;
|
|
83
|
+
extractors?: RuleExtractor[];
|
|
84
|
+
/** Called before each input is ingested in the rows step. Throw to simulate a kill. */
|
|
85
|
+
onInput?: (input: ClassedInput, day: IsoDate) => void;
|
|
86
|
+
/** Stop cleanly after the current input when this returns true. */
|
|
87
|
+
shouldStop?: () => boolean;
|
|
88
|
+
log?: (line: string) => void;
|
|
89
|
+
env?: NodeJS.ProcessEnv;
|
|
90
|
+
/**
|
|
91
|
+
* Rows held in memory before facts files, ledger lines and the cursor are
|
|
92
|
+
* written. 0 writes after every day. Default 60,000.
|
|
93
|
+
*/
|
|
94
|
+
flushRows?: number;
|
|
95
|
+
}
|
|
96
|
+
/** The parts of WP-F's proposals package the replay calls. Looked up by name so a missing one is skipped, not fatal. */
|
|
97
|
+
export interface ProposalsSeam {
|
|
98
|
+
replayDecisions?: (context: GraphContext, options: {
|
|
99
|
+
store?: GraphStore;
|
|
100
|
+
}) => {
|
|
101
|
+
applied: number;
|
|
102
|
+
rowsAdded: number;
|
|
103
|
+
rowsClosed: number;
|
|
104
|
+
failed: unknown[];
|
|
105
|
+
};
|
|
106
|
+
fileProposals?: (context: GraphContext, proposals: readonly never[]) => number;
|
|
107
|
+
proposalsFromContradictions?: (contradictions: readonly Contradiction[], lookup: never) => unknown[];
|
|
108
|
+
rowLookup?: (store: GraphStore) => unknown;
|
|
109
|
+
}
|
|
110
|
+
export interface ReplayReport extends ReplayRunResult {
|
|
111
|
+
graphRoot: string;
|
|
112
|
+
member: string;
|
|
113
|
+
legacy?: LegacyImportResult | {
|
|
114
|
+
skipped: string;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Entities whose rows an `update` changed, sorted. The update's closing lint
|
|
118
|
+
* checks these and no others. Absent on a rebuild, which touches everything.
|
|
119
|
+
*/
|
|
120
|
+
touched?: EntityRef[];
|
|
121
|
+
inputs: number;
|
|
122
|
+
inputsByClass: Record<string, number>;
|
|
123
|
+
excluded: Record<string, number>;
|
|
124
|
+
scanMs: number;
|
|
125
|
+
wallMs: number;
|
|
126
|
+
counters: Record<string, number>;
|
|
127
|
+
notes: string[];
|
|
128
|
+
/** Present when the run had a model step that reports totals. */
|
|
129
|
+
modelCap?: ModelCapReport;
|
|
130
|
+
}
|
|
131
|
+
interface TypingItem {
|
|
132
|
+
ref: SourceRef;
|
|
133
|
+
audience: AudienceKey;
|
|
134
|
+
date: IsoDate;
|
|
135
|
+
text: string;
|
|
136
|
+
entities: EntityRef[];
|
|
137
|
+
}
|
|
138
|
+
/** Turns a typing reply into edge rows. Anything that does not check out is dropped. */
|
|
139
|
+
export declare function parseTypingReply(reply: string, items: readonly TypingItem[], learned: IsoDate, by: Origin): IngestRow[];
|
|
140
|
+
export declare function runRebuildWith(context: GraphContext, options: RebuildOptions, deps?: ReplayDeps): Promise<ReplayReport>;
|
|
141
|
+
export declare function runUpdateWith(context: GraphContext, options: UpdateOptions, deps?: ReplayDeps): Promise<ReplayReport>;
|
|
142
|
+
/** The lines of the run summary that say what the model step was allowed, what it used and why it stopped. */
|
|
143
|
+
export declare function modelCapLines(cap: ModelCapReport): string[];
|
|
144
|
+
export declare function formatReport(report: ReplayReport): string;
|
|
145
|
+
export {};
|
|
146
|
+
//# sourceMappingURL=engine.d.ts.map
|