@open-mercato/cezar 0.15.0 → 0.15.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/dist/automations/github-poller.d.ts +8 -1
- package/dist/automations/github-poller.js +78 -13
- package/dist/automations/github-poller.js.map +1 -1
- package/dist/automations/pr-head.js +15 -1
- package/dist/automations/pr-head.js.map +1 -1
- package/dist/automations/prompts.js +2 -2
- package/dist/automations/types.d.ts +10 -0
- package/dist/automations/types.js +12 -1
- package/dist/automations/types.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/contract/automations.d.ts +31 -1
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +161 -17
- package/dist/contract/projects.d.ts +46 -0
- package/dist/contract/runs.d.ts +15 -0
- package/dist/contract/skills.d.ts +1 -0
- package/dist/contract/telemetry.d.ts +124 -0
- package/dist/contract/workspace.d.ts +3 -0
- package/dist/core/cursor-agent-runner.d.ts +11 -0
- package/dist/core/cursor-agent-runner.js +48 -4
- package/dist/core/cursor-agent-runner.js.map +1 -1
- package/dist/core/disclaim-spawn.d.ts +10 -0
- package/dist/core/disclaim-spawn.js +105 -8
- package/dist/core/disclaim-spawn.js.map +1 -1
- package/dist/git-diff-base.js +26 -19
- package/dist/git-diff-base.js.map +1 -1
- package/dist/git-remotes.d.ts +43 -0
- package/dist/git-remotes.js +127 -0
- package/dist/git-remotes.js.map +1 -0
- package/dist/git-worktree.d.ts +43 -19
- package/dist/git-worktree.js +138 -54
- package/dist/git-worktree.js.map +1 -1
- package/dist/index.js +46 -6
- package/dist/index.js.map +1 -1
- package/dist/runs/auto-name.d.ts +17 -0
- package/dist/runs/auto-name.js +47 -2
- package/dist/runs/auto-name.js.map +1 -1
- package/dist/runs/event-history.d.ts +10 -2
- package/dist/runs/event-history.js +290 -120
- package/dist/runs/event-history.js.map +1 -1
- package/dist/runs/retention.js +1 -1
- package/dist/runs/retention.js.map +1 -1
- package/dist/runs/store.d.ts +16 -3
- package/dist/runs/store.js +89 -10
- package/dist/runs/store.js.map +1 -1
- package/dist/server/checkout.d.ts +4 -0
- package/dist/server/checkout.js +9 -5
- package/dist/server/checkout.js.map +1 -1
- package/dist/server/create-project.d.ts +77 -0
- package/dist/server/create-project.js +342 -0
- package/dist/server/create-project.js.map +1 -0
- package/dist/server/forge/github.d.ts +2 -0
- package/dist/server/forge/github.js +32 -10
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/forge/index.d.ts +1 -12
- package/dist/server/forge/index.js +7 -29
- package/dist/server/forge/index.js.map +1 -1
- package/dist/server/forge/types.d.ts +2 -0
- package/dist/server/git-changes.d.ts +15 -0
- package/dist/server/git-changes.js +51 -1
- package/dist/server/git-changes.js.map +1 -1
- package/dist/server/git.d.ts +3 -2
- package/dist/server/git.js +4 -3
- package/dist/server/git.js.map +1 -1
- package/dist/server/project-context.js +1 -1
- package/dist/server/project-context.js.map +1 -1
- package/dist/server/server.d.ts +609 -302
- package/dist/server/server.js +191 -12
- package/dist/server/server.js.map +1 -1
- package/dist/server/star-count.d.ts +27 -11
- package/dist/server/star-count.js +57 -28
- package/dist/server/star-count.js.map +1 -1
- package/dist/telemetry-cli.d.ts +10 -0
- package/dist/telemetry-cli.js +54 -0
- package/dist/telemetry-cli.js.map +1 -0
- package/dist/telemetry-service.json +1 -0
- package/dist/telemetry.d.ts +79 -0
- package/dist/telemetry.js +453 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/workflows/run.d.ts +28 -0
- package/dist/workflows/run.js +111 -16
- package/dist/workflows/run.js.map +1 -1
- package/dist/workspace/config.d.ts +10 -0
- package/dist/workspace/config.js +16 -0
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/projects-cli.js +3 -0
- package/dist/workspace/projects-cli.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mock-claude.mjs +32 -17
- package/scripts/stamp-telemetry-service.mjs +20 -0
- package/web/dist/assets/agent-task-pickers-mJzYn0UB.js +1 -0
- package/web/dist/assets/{alert-dialog-CF_-dmQ1.js → alert-dialog-Dd1WPOaz.js} +1 -1
- package/web/dist/assets/arrow-left-fsST4JqT.js +1 -0
- package/web/dist/assets/{automation-format-D1nqk0ID.js → automation-format-BTIFWfjt.js} +1 -1
- package/web/dist/assets/automations-route-DJjhwqug.js +1 -0
- package/web/dist/assets/button-BNnH7COh.js +100 -0
- package/web/dist/assets/{centered-state-T0J7VmBb.js → centered-state-sEYB3bgq.js} +1 -1
- package/web/dist/assets/check-DA37PQLT.js +1 -0
- package/web/dist/assets/chevron-left-zbXV2Qbu.js +1 -0
- package/web/dist/assets/chevron-right-Beu1pd6H.js +1 -0
- package/web/dist/assets/{collapsible-RD4hkew7.js → collapsible-MuXfYnM8.js} +1 -1
- package/web/dist/assets/commit-list-Bps23fvP.js +1 -0
- package/web/dist/assets/compare-variants-CQskdfDW.js +1 -0
- package/web/dist/assets/composer-DKWLJeo9.js +18 -0
- package/web/dist/assets/dashboard-BCNe_6p7.js +44 -0
- package/web/dist/assets/diff-CrLUECGW.js +3 -0
- package/web/dist/assets/{diff-stat-CFoeFye2.js → diff-stat-SpfygteL.js} +1 -1
- package/web/dist/assets/diff-view-DP4Gw3QJ.js +13 -0
- package/web/dist/assets/{download-BFQEsJRY.js → download-CBwSbmy_.js} +1 -1
- package/web/dist/assets/dropdown-menu-CxPGHgWX.js +1 -0
- package/web/dist/assets/ellipsis-BmusVE8U.js +1 -0
- package/web/dist/assets/{file-Df5WtpM_.js → file-DkvcUwxT.js} +1 -1
- package/web/dist/assets/file-preview-DxFusXAO.js +2 -0
- package/web/dist/assets/file-text-DBeC0yKb.js +1 -0
- package/web/dist/assets/file-tree-BTJZXRkM.js +1 -0
- package/web/dist/assets/{git-commit-horizontal-DawNm4qg.js → git-commit-horizontal-BM9_nEW7.js} +1 -1
- package/web/dist/assets/git-toolbar-DXyPCDkQ.js +1 -0
- package/web/dist/assets/github-G5fU4gJd.js +1 -0
- package/web/dist/assets/index-BN3w52uE.js +21 -0
- package/web/dist/assets/index-CAvSSpvF.css +2 -0
- package/web/dist/assets/{markdown-Bmfy_1Ll.js → markdown-BpZ4p95p.js} +1 -1
- package/web/dist/assets/{markdown-B_O1ys3h.js → markdown-C5F95Rt-.js} +1 -1
- package/web/dist/assets/{message-square-BOO9s3qX.js → message-square-BFQln9c4.js} +1 -1
- package/web/dist/assets/{pill-bO5OcHuK.js → pill-BcIQGDbn.js} +1 -1
- package/web/dist/assets/project-router-CWMOKp_H.js +3 -0
- package/web/dist/assets/reference-chip-B7lU_Pyh.js +1 -0
- package/web/dist/assets/reference-overflow-ClRRXWez.js +1 -0
- package/web/dist/assets/{refresh-cw-BaFyjVUz.js → refresh-cw-BBEYC6z2.js} +1 -1
- package/web/dist/assets/repo-git-CgxxZ7cO.js +1 -0
- package/web/dist/assets/{run-diff-GZbNs8fA.js → run-diff-BTB7nBeD.js} +1 -1
- package/web/dist/assets/run-header-BPNBEaOy.js +1 -0
- package/web/dist/assets/{image-preview-4SVDrBvn.js → scroll-within-DRt7mAnQ.js} +1 -1
- package/web/dist/assets/{search-x-bpAfQtVY.js → search-x-6BavY3mg.js} +1 -1
- package/web/dist/assets/sheet-D9PeyyRZ.js +1 -0
- package/web/dist/assets/skills-SIMzpL0l.js +1 -0
- package/web/dist/assets/square-DsFAQaY9.js +1 -0
- package/web/dist/assets/tab-link-DEUSZU49.js +1 -0
- package/web/dist/assets/{tag-DLwUkUsN.js → tag-DvCVnA6I.js} +1 -1
- package/web/dist/assets/task-changes-D-aajoMU.js +1 -0
- package/web/dist/assets/task-commits-BYD1GVkS.js +1 -0
- package/web/dist/assets/task-composer-7bdNNMP_.js +12 -0
- package/web/dist/assets/task-files-BfIOz-eN.js +1 -0
- package/web/dist/assets/task-graph-B5-5_IPh.js +1 -0
- package/web/dist/assets/task-notes-CfkTBgo8.js +1 -0
- package/web/dist/assets/task-thread-eEkjTDxr.js +10 -0
- package/web/dist/assets/{terminal-CwrL1hAi.js → terminal-xRHwWarr.js} +1 -1
- package/web/dist/assets/textarea-rKUFh5lI.js +1 -0
- package/web/dist/assets/thread-loading-DLlbK51g.js +1 -0
- package/web/dist/assets/{token-metrics-C149OWmd.js → token-metrics-BcPjL36-.js} +1 -1
- package/web/dist/assets/tooltip-BVqBAGNb.js +1 -0
- package/web/dist/assets/tracker-2DfMzsIE.js +4 -0
- package/web/dist/assets/triangle-alert-CP3Xp0FU.js +1 -0
- package/web/dist/assets/upload-bwO_2kok.js +1 -0
- package/web/dist/assets/use-automations-PceYR6ss.js +5 -0
- package/web/dist/assets/use-now-BAKdIYLG.js +1 -0
- package/web/dist/assets/use-submit-shortcut-BA4NVpJl.js +1 -0
- package/web/dist/assets/workflow-graph-HopaWPea.js +13 -0
- package/web/dist/assets/x-HaVPcg_B.js +1 -0
- package/web/dist/index.html +28 -31
- package/web/dist/assets/agent-task-pickers-C3ydGatB.js +0 -1
- package/web/dist/assets/arrow-left-BxBdc5DC.js +0 -1
- package/web/dist/assets/automations-route-BsflncpV.js +0 -1
- package/web/dist/assets/button-CjSjKnkd.js +0 -100
- package/web/dist/assets/check-DAAMuI4o.js +0 -1
- package/web/dist/assets/chevron-left-CvcqxpQZ.js +0 -1
- package/web/dist/assets/chevron-right-DKiL3NWw.js +0 -1
- package/web/dist/assets/commit-list-BJac2uO6.js +0 -1
- package/web/dist/assets/compare-variants-CfqICvRy.js +0 -1
- package/web/dist/assets/composer-DZx3cwQW.js +0 -18
- package/web/dist/assets/dashboard-CpCDiZdE.js +0 -44
- package/web/dist/assets/diff-LG2cl0PE.js +0 -3
- package/web/dist/assets/diff-controls-QgdH-r3F.js +0 -1
- package/web/dist/assets/diff-view-BVwSaBb2.js +0 -13
- package/web/dist/assets/dropdown-menu-DkEK7m00.js +0 -1
- package/web/dist/assets/editable-title-CJSWyCcL.js +0 -1
- package/web/dist/assets/ellipsis-vertical-CB0adfr7.js +0 -1
- package/web/dist/assets/external-link-DPKRidDg.js +0 -1
- package/web/dist/assets/eye-CEHQ0c-s.js +0 -1
- package/web/dist/assets/file-preview-kYsqZiLU.js +0 -2
- package/web/dist/assets/file-text-m0tZu8sU.js +0 -1
- package/web/dist/assets/git-merge-B7oVXcKc.js +0 -1
- package/web/dist/assets/git-toolbar-B0K4Q5Zv.js +0 -1
- package/web/dist/assets/github-C4WaHPni.js +0 -1
- package/web/dist/assets/index-CiQrbvAq.js +0 -21
- package/web/dist/assets/index-WWaEax-B.css +0 -2
- package/web/dist/assets/pencil-CCR9uUZ1.js +0 -1
- package/web/dist/assets/reference-chip-Bx_mG9QG.js +0 -1
- package/web/dist/assets/repo-git-Mn3_jrGP.js +0 -1
- package/web/dist/assets/run-header-i1D5Lvfs.js +0 -1
- package/web/dist/assets/sheet-DCdZVHFk.js +0 -1
- package/web/dist/assets/skills-Dea5ynJK.js +0 -1
- package/web/dist/assets/tab-link-BVItTl_Y.js +0 -1
- package/web/dist/assets/task-changes-xNbBM7FO.js +0 -1
- package/web/dist/assets/task-commits-BYozE_X3.js +0 -1
- package/web/dist/assets/task-composer-Brx0sa7_.js +0 -12
- package/web/dist/assets/task-files-MAPO-efK.js +0 -1
- package/web/dist/assets/task-graph-BSLCUr1E.js +0 -1
- package/web/dist/assets/task-thread-CRVmwchQ.js +0 -9
- package/web/dist/assets/textarea-Bb0_Hz53.js +0 -1
- package/web/dist/assets/thread-loading-Bo6IOu3Y.js +0 -1
- package/web/dist/assets/toaster-Hj_czp_o.js +0 -3
- package/web/dist/assets/tooltip--PYfu68E.js +0 -1
- package/web/dist/assets/tracker-DM5WtYD0.js +0 -4
- package/web/dist/assets/trash-2-EdjdGvEo.js +0 -1
- package/web/dist/assets/triangle-alert-DpH3QFz6.js +0 -1
- package/web/dist/assets/use-automations-XKvBTPM-.js +0 -5
- package/web/dist/assets/use-now-CrM50BFB.js +0 -1
- package/web/dist/assets/use-submit-shortcut-BJ10ZshV.js +0 -1
- package/web/dist/assets/workflow-graph-Y2Pr7ubb.js +0 -13
- package/web/dist/assets/x-BkwTUDpG.js +0 -1
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Usage telemetry — the ONE module that talks to the telemetry worker.
|
|
3
|
+
*
|
|
4
|
+
* Opt-in: nothing leaves the machine until the user said yes (the cockpit's consent bar,
|
|
5
|
+
* Settings → Privacy, or `cezar telemetry enable`), recorded as `telemetry` in
|
|
6
|
+
* `~/.cezar/config.json`. `CEZ_TELEMETRY=0` / `DO_NOT_TRACK=1` block it even then; no env var
|
|
7
|
+
* can grant it. See docs/telemetry.md. Everything here is
|
|
8
|
+
* fire-and-forget — a 3 s timeout, no retries, never throws, never awaited on a path
|
|
9
|
+
* the user waits for (the one exception is `app_stop`, which `flushTelemetry` bounds).
|
|
10
|
+
*
|
|
11
|
+
* Error reports are WIDE EVENTS (https://loggingsucks.com/): one report carries everything known
|
|
12
|
+
* about the process and the failure as flat, queryable `context` fields — the process's own half
|
|
13
|
+
* (`baseContext`), whatever the boot registered (`registerTelemetryContext`: run counts, install
|
|
14
|
+
* kind…) and the caller's specifics — so a report is debuggable without a second search.
|
|
15
|
+
*
|
|
16
|
+
* The only identity is `cezarId`, a random UUIDv7 in `~/.cezar/config.json` (written on the
|
|
17
|
+
* first send after consent, deleted when it is withdrawn), and the user's home directory is
|
|
18
|
+
* scrubbed from every error message and stack.
|
|
19
|
+
*/
|
|
20
|
+
import { randomBytes } from 'node:crypto';
|
|
21
|
+
import { readFileSync } from 'node:fs';
|
|
22
|
+
import { dirname, join } from 'node:path';
|
|
23
|
+
import { fileURLToPath } from 'node:url';
|
|
24
|
+
import { homedir, tmpdir } from 'node:os';
|
|
25
|
+
import { cezarHomeDir } from './paths.js';
|
|
26
|
+
import { detectInstallKind } from './self-update/layout.js';
|
|
27
|
+
import { loadWorkspaceConfig, mergeWriteWorkspaceConfig } from './workspace/config.js';
|
|
28
|
+
export const DEFAULT_TELEMETRY_URL = 'https://stats.openmercato.cloud';
|
|
29
|
+
/** Bump when what is collected changes: a `granted` for an older version counts as never asked. */
|
|
30
|
+
export const TELEMETRY_POLICY_VERSION = 1;
|
|
31
|
+
/** Development builds (local, worktrees, PR previews) report under this service. */
|
|
32
|
+
export const DEV_TELEMETRY_SERVICE = '01a12ad9-3297-793f-b9e5-81d4df2d1216';
|
|
33
|
+
/** Public releases ship `dist/telemetry-service.json`, written at release time by
|
|
34
|
+
* scripts/stamp-telemetry-service.mjs; anything without the stamp is a development build. */
|
|
35
|
+
const SERVICE = stampedTelemetryService() ?? DEV_TELEMETRY_SERVICE;
|
|
36
|
+
export function stampedTelemetryService(file = join(dirname(fileURLToPath(import.meta.url)), 'telemetry-service.json')) {
|
|
37
|
+
try {
|
|
38
|
+
const { service } = JSON.parse(readFileSync(file, 'utf8'));
|
|
39
|
+
return typeof service === 'string' && /^[\w.:@/+-]{1,64}$/.test(service) ? service : undefined;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const TIMEOUT_MS = 3_000;
|
|
46
|
+
/** At most one report per minute for the same error (the worker's "don't flood" rule). */
|
|
47
|
+
const ERROR_THROTTLE_MS = 60_000;
|
|
48
|
+
let version = '0.0.0';
|
|
49
|
+
/** The exact build (`0.14.0-nightly.20261007.63`): context on error reports only. */
|
|
50
|
+
let fullVersion = '0.0.0';
|
|
51
|
+
/** One lookup per `~/.cezar` (keyed, so a `CEZ_HOME` switch never reuses another home's id). */
|
|
52
|
+
const cezarIds = new Map();
|
|
53
|
+
const pending = new Set();
|
|
54
|
+
const lastReported = new Map();
|
|
55
|
+
/** The answer as last read from (or written to) `~/.cezar/config.json`. */
|
|
56
|
+
let consent = 'unknown';
|
|
57
|
+
/** What stops sending whatever the user answered: `env` — `CEZ_TELEMETRY=0` or `DO_NOT_TRACK=1`;
|
|
58
|
+
* `automation` — test runners, CI, `CEZ_DRY_RUN=1`, where nobody could have answered (lifted by
|
|
59
|
+
* `CEZ_TELEMETRY=1`, which still needs consent). */
|
|
60
|
+
export function telemetryBlockedBy() {
|
|
61
|
+
const env = process.env;
|
|
62
|
+
if (env.CEZ_TELEMETRY === '0' || env.DO_NOT_TRACK === '1')
|
|
63
|
+
return 'env';
|
|
64
|
+
if (env.CEZ_TELEMETRY === '1')
|
|
65
|
+
return null;
|
|
66
|
+
return env.VITEST || env.NODE_TEST_CONTEXT || env.CI || env.CEZ_DRY_RUN === '1' ? 'automation' : null;
|
|
67
|
+
}
|
|
68
|
+
export function telemetryEnabled() {
|
|
69
|
+
return consent === 'granted' && telemetryBlockedBy() === null;
|
|
70
|
+
}
|
|
71
|
+
export function telemetryConsent() {
|
|
72
|
+
return consent;
|
|
73
|
+
}
|
|
74
|
+
function consentOf(config) {
|
|
75
|
+
const answer = config.telemetry;
|
|
76
|
+
if (!answer)
|
|
77
|
+
return 'unknown';
|
|
78
|
+
if (answer.consent === 'denied')
|
|
79
|
+
return 'denied';
|
|
80
|
+
return answer.policyVersion === TELEMETRY_POLICY_VERSION ? 'granted' : 'unknown';
|
|
81
|
+
}
|
|
82
|
+
/** Re-read the answer — another process (`cezar telemetry disable`) may have changed it. */
|
|
83
|
+
export async function loadTelemetryConsent() {
|
|
84
|
+
try {
|
|
85
|
+
consent = consentOf(await loadWorkspaceConfig());
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
consent = 'unknown';
|
|
89
|
+
}
|
|
90
|
+
syncCrashReporter();
|
|
91
|
+
return consent;
|
|
92
|
+
}
|
|
93
|
+
/** Record the user's answer. Withdrawing deletes the install id and the daily-ping marker, so a
|
|
94
|
+
* later yes starts as a new installation. */
|
|
95
|
+
export async function setTelemetryConsent(answer) {
|
|
96
|
+
const written = await mergeWriteWorkspaceConfig((config) => {
|
|
97
|
+
config.telemetry = { consent: answer, policyVersion: TELEMETRY_POLICY_VERSION, decidedAt: new Date().toISOString() };
|
|
98
|
+
if (answer === 'denied') {
|
|
99
|
+
delete config.cezarId;
|
|
100
|
+
delete config.lastActiveOn;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
if (answer === 'denied') {
|
|
104
|
+
cezarIds.clear();
|
|
105
|
+
lastReported.clear();
|
|
106
|
+
}
|
|
107
|
+
consent = consentOf(written);
|
|
108
|
+
syncCrashReporter();
|
|
109
|
+
return consent;
|
|
110
|
+
}
|
|
111
|
+
/** Sends are queued behind an id lookup; this re-checks the file first, so a withdrawal made by
|
|
112
|
+
* another process stops the very next send rather than the next restart. */
|
|
113
|
+
async function stillGranted() {
|
|
114
|
+
return (await loadTelemetryConsent()) === 'granted' && telemetryBlockedBy() === null;
|
|
115
|
+
}
|
|
116
|
+
function telemetryUrl() {
|
|
117
|
+
return (process.env.CEZ_TELEMETRY_URL || DEFAULT_TELEMETRY_URL).replace(/\/+$/, '');
|
|
118
|
+
}
|
|
119
|
+
function platform() {
|
|
120
|
+
if (process.platform === 'darwin')
|
|
121
|
+
return 'macos';
|
|
122
|
+
if (process.platform === 'win32')
|
|
123
|
+
return 'windows';
|
|
124
|
+
return process.platform;
|
|
125
|
+
}
|
|
126
|
+
/** How this cezar was launched — the worker's `runtime` field on every event and report: `app`
|
|
127
|
+
* when the Tauri desktop shell spawned it (the shell sets `CEZ_DESKTOP=1` on its sidecar), `cli`
|
|
128
|
+
* for every npm/npx/terminal launch. A browser tab against the desktop's server is still `app`:
|
|
129
|
+
* this names the process, the page's own surface is `client.surface` on error reports. */
|
|
130
|
+
export function telemetryRuntime() {
|
|
131
|
+
return process.env.CEZ_DESKTOP === '1' ? 'app' : 'cli';
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The `version` every event carries: the release plus its channel, never the exact build. Nightly
|
|
135
|
+
* and PR builds stamp a new version per build (`0.14.0-nightly.20261007.63`,
|
|
136
|
+
* `0.14.0-pr1322.2590`); sent as-is, every build would be its own row in version charts and
|
|
137
|
+
* every new nightly would reopen resolved errors as "regressed". So:
|
|
138
|
+
*
|
|
139
|
+
* 0.14.0 → 0.14.0 (stable)
|
|
140
|
+
* 0.14.0-nightly.20261007.63 → 0.14.0-nightly
|
|
141
|
+
* 0.14.0-pr1322.2590 → 0.14.0-pr
|
|
142
|
+
* 0.13.0+cez-207a3912, a checkout, anything else → 0.13.0-dev
|
|
143
|
+
*/
|
|
144
|
+
export function telemetryVersion(raw, checkout = false) {
|
|
145
|
+
const match = /^(\d+\.\d+\.\d+)(?:-([0-9A-Za-z.-]+))?(?:\+.*)?$/.exec(raw.trim());
|
|
146
|
+
if (!match)
|
|
147
|
+
return 'unknown';
|
|
148
|
+
const [, base, pre] = match;
|
|
149
|
+
if (checkout || raw.includes('+'))
|
|
150
|
+
return `${base}-dev`;
|
|
151
|
+
if (!pre)
|
|
152
|
+
return base;
|
|
153
|
+
if (/^nightly(\.|$)/.test(pre))
|
|
154
|
+
return `${base}-nightly`;
|
|
155
|
+
if (/^pr\d+/.test(pre))
|
|
156
|
+
return `${base}-pr`;
|
|
157
|
+
return `${base}-dev`;
|
|
158
|
+
}
|
|
159
|
+
/** Set once at boot; every event carries it. A source checkout (`npm run dev`, a worktree) is a
|
|
160
|
+
* dev build whatever its package.json says. Resolves once the stored answer is known. */
|
|
161
|
+
export async function initTelemetry(opts) {
|
|
162
|
+
fullVersion = opts.version;
|
|
163
|
+
version = telemetryVersion(opts.version, detectInstallKind(process.argv[1] ?? '') === 'checkout');
|
|
164
|
+
refreshProjectRoots();
|
|
165
|
+
await loadTelemetryConsent();
|
|
166
|
+
}
|
|
167
|
+
let crashReporterWanted = false;
|
|
168
|
+
let crashing = false;
|
|
169
|
+
function onUncaught(err, origin) {
|
|
170
|
+
if (crashing)
|
|
171
|
+
process.exit(1);
|
|
172
|
+
crashing = true;
|
|
173
|
+
try {
|
|
174
|
+
console.error(err);
|
|
175
|
+
reportError(err, { source: 'process', handler: origin }, { code: 'uncaught_exception' });
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
// the exit below must happen whatever reporting does
|
|
179
|
+
}
|
|
180
|
+
process.exitCode = 1; // a crash never exits 0, even if the loop drains before the flush
|
|
181
|
+
void flushTelemetry(1_000).finally(() => process.exit(1));
|
|
182
|
+
}
|
|
183
|
+
/** Attach or detach the handler to match the current answer — a no-op until `installCrashReporter`. */
|
|
184
|
+
function syncCrashReporter() {
|
|
185
|
+
const attached = process.listeners('uncaughtException').includes(onUncaught);
|
|
186
|
+
const want = crashReporterWanted && telemetryEnabled();
|
|
187
|
+
if (want && !attached)
|
|
188
|
+
process.on('uncaughtException', onUncaught);
|
|
189
|
+
if (!want && attached)
|
|
190
|
+
process.off('uncaughtException', onUncaught);
|
|
191
|
+
}
|
|
192
|
+
/** Crash reporting. Node exits synchronously after an uncaught exception, before an async send
|
|
193
|
+
* can start, so the report needs a real handler: print as Node would, report, flush (bounded),
|
|
194
|
+
* exit 1. Attached only while telemetry is on, leaving Node's own crash path untouched
|
|
195
|
+
* otherwise; it follows consent given or withdrawn later in the process's life. */
|
|
196
|
+
export function installCrashReporter() {
|
|
197
|
+
crashReporterWanted = true;
|
|
198
|
+
syncCrashReporter();
|
|
199
|
+
}
|
|
200
|
+
/** RFC 9562 UUIDv7: 48-bit Unix-ms timestamp, then random bits — sortable by creation time. */
|
|
201
|
+
export function uuidv7(now = Date.now()) {
|
|
202
|
+
const b = randomBytes(16);
|
|
203
|
+
b.writeUIntBE(now, 0, 6);
|
|
204
|
+
b[6] = (b[6] & 0x0f) | 0x70;
|
|
205
|
+
b[8] = (b[8] & 0x3f) | 0x80;
|
|
206
|
+
const h = b.toString('hex');
|
|
207
|
+
return `${h.slice(0, 8)}-${h.slice(8, 12)}-${h.slice(12, 16)}-${h.slice(16, 20)}-${h.slice(20)}`;
|
|
208
|
+
}
|
|
209
|
+
/** This machine's `cezarId`, created on first use. The merge-write keeps an id another process
|
|
210
|
+
* wrote first; a read-only home degrades to a per-process id. */
|
|
211
|
+
function cezarId() {
|
|
212
|
+
const home = cezarHomeDir();
|
|
213
|
+
const cached = cezarIds.get(home);
|
|
214
|
+
if (cached)
|
|
215
|
+
return cached;
|
|
216
|
+
const lookup = (async () => {
|
|
217
|
+
const fresh = uuidv7();
|
|
218
|
+
try {
|
|
219
|
+
const written = await mergeWriteWorkspaceConfig((config) => {
|
|
220
|
+
config.cezarId ??= fresh;
|
|
221
|
+
});
|
|
222
|
+
return written.cezarId ?? fresh;
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
return fresh;
|
|
226
|
+
}
|
|
227
|
+
})();
|
|
228
|
+
cezarIds.set(home, lookup);
|
|
229
|
+
return lookup;
|
|
230
|
+
}
|
|
231
|
+
/** Track a send (including the id lookup before it) so `flushTelemetry` can wait for it. */
|
|
232
|
+
function inFlight(p) {
|
|
233
|
+
const tracked = p.catch(() => undefined).finally(() => pending.delete(tracked));
|
|
234
|
+
pending.add(tracked);
|
|
235
|
+
}
|
|
236
|
+
function post(path, body) {
|
|
237
|
+
const p = fetch(`${telemetryUrl()}${path}`, {
|
|
238
|
+
method: 'POST',
|
|
239
|
+
headers: { 'content-type': 'application/json' },
|
|
240
|
+
body: JSON.stringify(body),
|
|
241
|
+
signal: AbortSignal.timeout(TIMEOUT_MS),
|
|
242
|
+
})
|
|
243
|
+
.then(async (res) => {
|
|
244
|
+
if (process.env.CEZ_TELEMETRY_DEBUG === '1') {
|
|
245
|
+
console.log(` [telemetry] ${path} → ${res.status} ${await res.text().catch(() => '')}\n ${JSON.stringify(body)}`);
|
|
246
|
+
}
|
|
247
|
+
return res.ok;
|
|
248
|
+
})
|
|
249
|
+
.catch((err) => {
|
|
250
|
+
if (process.env.CEZ_TELEMETRY_DEBUG === '1')
|
|
251
|
+
console.log(` [telemetry] ${path} failed: ${String(err)}`);
|
|
252
|
+
return false;
|
|
253
|
+
})
|
|
254
|
+
.finally(() => pending.delete(p));
|
|
255
|
+
pending.add(p);
|
|
256
|
+
return p;
|
|
257
|
+
}
|
|
258
|
+
/** One metric event. `extra` rides along for breakdowns the worker may or may not keep. */
|
|
259
|
+
/** A cockpit device id (`cezar:sid` in the browser's localStorage): a UUIDv7, or nothing. */
|
|
260
|
+
const SID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
261
|
+
/** The header the cockpit sends its device id in; anything that is not a v7 UUID is ignored. */
|
|
262
|
+
export function deviceSid(header) {
|
|
263
|
+
return header && SID_RE.test(header) ? header.toLowerCase() : undefined;
|
|
264
|
+
}
|
|
265
|
+
/** `indexKey` / `user.id`: `<cezarId>:<sid>` for something a cockpit device did, the bare
|
|
266
|
+
* `cezarId` for the process itself (boot, stop, daily ping, server errors). */
|
|
267
|
+
function statsKey(id, sid) {
|
|
268
|
+
return sid ? `${id}:${sid}` : id;
|
|
269
|
+
}
|
|
270
|
+
export function track(event, extra = {}, opts = {}) {
|
|
271
|
+
if (!telemetryEnabled())
|
|
272
|
+
return;
|
|
273
|
+
if (!/^[a-z][a-z0-9_]{0,47}$/.test(event))
|
|
274
|
+
return;
|
|
275
|
+
const body = { service: SERVICE, version, platform: platform(), runtime: telemetryRuntime(), ...extra };
|
|
276
|
+
// The worker's `label` charset; anything else (a model's `[1m]`) would 400 the event.
|
|
277
|
+
if (typeof body.label === 'string')
|
|
278
|
+
body.label = body.label.replace(/[^\w .:@/+-]/g, '_').slice(0, 64);
|
|
279
|
+
inFlight(stillGranted().then((ok) => ok ? cezarId().then((id) => post(`/track/${event}`, { ...body, indexKey: statsKey(id, opts.sid) })) : false));
|
|
280
|
+
}
|
|
281
|
+
/** The fields every event carries, for `cezar telemetry inspect` — the same object `track` builds. */
|
|
282
|
+
export function telemetryEnvelope() {
|
|
283
|
+
return { service: SERVICE, version, platform: platform(), runtime: telemetryRuntime() };
|
|
284
|
+
}
|
|
285
|
+
/** What is sent, by name: kept beside the senders so `inspect` and docs/telemetry.md can't drift
|
|
286
|
+
* far from them. */
|
|
287
|
+
export const TELEMETRY_EVENTS = [
|
|
288
|
+
'cezar_run', 'app_start', 'app_stop', 'task_start', 'page_viewed', 'message_sent', 'open_in',
|
|
289
|
+
'project_added', 'diff_comment_added', 'task_archived', 'task_unarchived', 'task_pinned',
|
|
290
|
+
'task_unpinned', 'task_deleted', 'project_create_failed', 'add_project_opened', 'error',
|
|
291
|
+
];
|
|
292
|
+
/** Once per UTC day while telemetry is on: `cezar_run`. Without consent: nothing at all. */
|
|
293
|
+
export async function sendDailyPing() {
|
|
294
|
+
if (!(await stillGranted()))
|
|
295
|
+
return;
|
|
296
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
297
|
+
if ((await loadWorkspaceConfig()).lastActiveOn === today)
|
|
298
|
+
return;
|
|
299
|
+
const base = { service: SERVICE, version, platform: platform(), runtime: telemetryRuntime() };
|
|
300
|
+
const ok = await post('/track/cezar_run', { ...base, indexKey: await cezarId() });
|
|
301
|
+
if (ok) {
|
|
302
|
+
await mergeWriteWorkspaceConfig((config) => {
|
|
303
|
+
config.lastActiveOn = today;
|
|
304
|
+
}).catch(() => undefined);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/** The daily ping at boot, then hourly so a cockpit left running crosses midnight — and picks
|
|
308
|
+
* up a consent given meanwhile by another process. */
|
|
309
|
+
export function startDailyPing() {
|
|
310
|
+
void sendDailyPing();
|
|
311
|
+
setInterval(() => void sendDailyPing(), 60 * 60 * 1000).unref();
|
|
312
|
+
}
|
|
313
|
+
/** Registered project roots, refreshed off the hot path: `reportError` is synchronous. */
|
|
314
|
+
let projectRoots = [];
|
|
315
|
+
function refreshProjectRoots() {
|
|
316
|
+
void loadWorkspaceConfig()
|
|
317
|
+
.then((config) => {
|
|
318
|
+
projectRoots = (config.projects ?? []).map((p) => p.root).filter((root) => typeof root === 'string');
|
|
319
|
+
})
|
|
320
|
+
.catch(() => undefined);
|
|
321
|
+
}
|
|
322
|
+
/** `process.cwd()` throws once the directory is deleted; a report must survive that. */
|
|
323
|
+
function safeCwd() {
|
|
324
|
+
try {
|
|
325
|
+
return process.cwd();
|
|
326
|
+
}
|
|
327
|
+
catch {
|
|
328
|
+
return '';
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
/** Replace every path that names the user or their work: project roots and the working directory
|
|
332
|
+
* become `<repo>`, the temp dir `<tmp>`, the home directory `~` — longest first, so a repo under
|
|
333
|
+
* home is `<repo>`, not `~/code/<name>`. */
|
|
334
|
+
export function scrub(text) {
|
|
335
|
+
const pairs = [
|
|
336
|
+
...projectRoots.map((root) => [root, '<repo>']),
|
|
337
|
+
[safeCwd(), '<repo>'],
|
|
338
|
+
[tmpdir(), '<tmp>'],
|
|
339
|
+
[homedir(), '~'],
|
|
340
|
+
];
|
|
341
|
+
return pairs
|
|
342
|
+
.filter(([path]) => path.length > 1)
|
|
343
|
+
.sort((a, b) => b[0].length - a[0].length)
|
|
344
|
+
.reduce((out, [path, mask]) => out.split(path).join(mask), text);
|
|
345
|
+
}
|
|
346
|
+
/** The worker's cap on `context` keys. */
|
|
347
|
+
const MAX_CONTEXT_KEYS = 50;
|
|
348
|
+
const providers = [];
|
|
349
|
+
/** Add a slice every error report carries (evaluated per report, so it is always current). A
|
|
350
|
+
* provider that throws is skipped — context must never cost the report. */
|
|
351
|
+
export function registerTelemetryContext(provider) {
|
|
352
|
+
providers.push(provider);
|
|
353
|
+
}
|
|
354
|
+
function flag(name) {
|
|
355
|
+
return process.env[name] === '1';
|
|
356
|
+
}
|
|
357
|
+
/** The process's own half of every wide event: what build, on what surface, how long up, how
|
|
358
|
+
* loaded. Low-cost reads only. */
|
|
359
|
+
function baseContext() {
|
|
360
|
+
const mem = process.memoryUsage();
|
|
361
|
+
return {
|
|
362
|
+
'app.supervised': flag('CEZ_SUPERVISED'),
|
|
363
|
+
'app.remote': flag('CEZ_REMOTE'),
|
|
364
|
+
'app.dry_run': flag('CEZ_DRY_RUN'),
|
|
365
|
+
'process.uptime_s': Math.round(process.uptime()),
|
|
366
|
+
'process.rss_mb': Math.round(mem.rss / 1_048_576),
|
|
367
|
+
'process.heap_used_mb': Math.round(mem.heapUsed / 1_048_576),
|
|
368
|
+
'build.version_full': fullVersion,
|
|
369
|
+
'runtime.node': process.versions.node,
|
|
370
|
+
'runtime.arch': process.arch,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
/** Flags that change behavior, as the worker's `featureFlags` (booleans only). Defaults mirror
|
|
374
|
+
* each flag's own: default-on features are on unless set to 0. */
|
|
375
|
+
function featureFlags() {
|
|
376
|
+
const env = process.env;
|
|
377
|
+
return {
|
|
378
|
+
dispatch: env.CEZ_DISPATCH !== '0',
|
|
379
|
+
automations: env.CEZ_AUTOMATIONS !== '0',
|
|
380
|
+
followups: env.CEZ_FOLLOWUPS === '1',
|
|
381
|
+
skills_auto_update: env.CEZ_SKILLS_AUTO_UPDATE !== '0',
|
|
382
|
+
approval_gate: env.CEZ_APPROVAL_GATE === '1',
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
export function reportError(error, context = {}, opts = {}) {
|
|
386
|
+
if (!telemetryEnabled())
|
|
387
|
+
return;
|
|
388
|
+
try {
|
|
389
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
390
|
+
const type = (err.name || 'Error').slice(0, 128);
|
|
391
|
+
const message = scrub(err.message || String(error)).slice(0, 2048);
|
|
392
|
+
const key = `${type}:${message}`;
|
|
393
|
+
const now = Date.now();
|
|
394
|
+
if (now - (lastReported.get(key) ?? 0) < ERROR_THROTTLE_MS)
|
|
395
|
+
return;
|
|
396
|
+
lastReported.set(key, now);
|
|
397
|
+
refreshProjectRoots(); // a project added since boot is masked from the next report on
|
|
398
|
+
const errCode = err.code;
|
|
399
|
+
const code = opts.code ?? (typeof errCode === 'string' ? errCode : undefined);
|
|
400
|
+
// The caller's specifics first: when the cap bites, the generic slices are what gets cut.
|
|
401
|
+
const flat = {};
|
|
402
|
+
const slices = [context];
|
|
403
|
+
for (const provider of providers) {
|
|
404
|
+
try {
|
|
405
|
+
slices.push(provider());
|
|
406
|
+
}
|
|
407
|
+
catch {
|
|
408
|
+
// a broken provider costs its own slice, never the report
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
slices.push(baseContext());
|
|
412
|
+
for (const slice of slices) {
|
|
413
|
+
for (const [k, v] of Object.entries(slice)) {
|
|
414
|
+
if (v === undefined || k in flat)
|
|
415
|
+
continue;
|
|
416
|
+
if (Object.keys(flat).length >= MAX_CONTEXT_KEYS)
|
|
417
|
+
break;
|
|
418
|
+
flat[k] = typeof v === 'string' ? scrub(v).slice(0, 1024) : v;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
const occurredAt = new Date().toISOString();
|
|
422
|
+
inFlight(stillGranted().then((ok) => ok && cezarId().then((id) => post('/track/error', {
|
|
423
|
+
service: SERVICE,
|
|
424
|
+
version,
|
|
425
|
+
platform: platform(),
|
|
426
|
+
runtime: telemetryRuntime(),
|
|
427
|
+
occurredAt,
|
|
428
|
+
error: {
|
|
429
|
+
type,
|
|
430
|
+
message,
|
|
431
|
+
...(code ? { code: code.slice(0, 128) } : {}),
|
|
432
|
+
...(err.stack ? { stack: scrub(err.stack).slice(0, 16_384) } : {}),
|
|
433
|
+
},
|
|
434
|
+
user: { id: statsKey(id, opts.sid) },
|
|
435
|
+
featureFlags: featureFlags(),
|
|
436
|
+
context: flat,
|
|
437
|
+
...(opts.fingerprint ? { fingerprint: opts.fingerprint.slice(0, 128) } : {}),
|
|
438
|
+
}))));
|
|
439
|
+
}
|
|
440
|
+
catch {
|
|
441
|
+
// reporting must never throw
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
/** Wait (bounded) for in-flight sends — used at shutdown so `app_stop` gets out. */
|
|
445
|
+
export async function flushTelemetry(maxMs = 1_500) {
|
|
446
|
+
if (pending.size === 0)
|
|
447
|
+
return;
|
|
448
|
+
await Promise.race([
|
|
449
|
+
Promise.allSettled([...pending]),
|
|
450
|
+
new Promise((resolve) => setTimeout(resolve, maxMs).unref()),
|
|
451
|
+
]);
|
|
452
|
+
}
|
|
453
|
+
//# sourceMappingURL=telemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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E,CAAC,CAAC,CAAC,EAAE,CAAC;aACnE;YACD,IAAI,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE;YACpC,YAAY,EAAE,YAAY,EAAE;YAC5B,OAAO,EAAE,IAAI;YACb,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC7E,CAAC,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;IAAC,MAAM,CAAC;QACP,6BAA6B;IAC/B,CAAC;AACH,CAAC;AAED,oFAAoF;AACpF,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAAK,GAAG,KAAK;IAChD,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO;IAC/B,MAAM,OAAO,CAAC,IAAI,CAAC;QACjB,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;QAChC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC;KAC7D,CAAC,CAAC;AACL,CAAC"}
|
package/dist/workflows/run.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export declare function turnEndMarkerText(turnText: string): string;
|
|
|
33
33
|
* meaning exactly what it meant).
|
|
34
34
|
*/
|
|
35
35
|
export declare function endsWithMonitoringMarker(turnText: string): boolean;
|
|
36
|
+
/** Strict superset of the historical DONE suffix check, accepting trailing task references. */
|
|
37
|
+
export declare function endsWithDoneMarker(turnText: string): boolean;
|
|
36
38
|
/**
|
|
37
39
|
* Preserve boundaries between complete assistant text blocks while a turn is
|
|
38
40
|
* accumulated for marker parsing. The runners join these same v1 blocks with
|
|
@@ -227,6 +229,8 @@ export declare const QUEUE_WATCHDOG_MS = 60000;
|
|
|
227
229
|
export declare function runAccountKey(run: Pick<RunRecord, 'runner' | 'agentProfile'>, fallbackRunner: RunnerId): string;
|
|
228
230
|
export interface StartRunInput {
|
|
229
231
|
task: string;
|
|
232
|
+
/** The cockpit device that started this task (telemetry only, `x-cezar-sid`). */
|
|
233
|
+
deviceSid?: string;
|
|
230
234
|
model?: string;
|
|
231
235
|
/** Agent backend chosen for this task (GUI). Unset = the config default. */
|
|
232
236
|
runner?: RunnerId;
|
|
@@ -460,6 +464,10 @@ export declare class RunManager {
|
|
|
460
464
|
*/
|
|
461
465
|
private readonly unitParents;
|
|
462
466
|
private readonly pendingJobs;
|
|
467
|
+
/** The creation-time namer's branch answer per queued run (spec
|
|
468
|
+
* 2026-10-11-branch-naming-instructions) — `execute` awaits it, bounded, before the fork. */
|
|
469
|
+
private readonly pendingBranchNames;
|
|
470
|
+
private readonly branchNameWaitMs;
|
|
463
471
|
/** Interrupted agent turns recovered after a process restart. Unlike an
|
|
464
472
|
* explicit user Continue, these are bulk scheduler work and must re-enter
|
|
465
473
|
* through `pump()` so both workspace and per-project caps are honored. */
|
|
@@ -533,6 +541,9 @@ export declare class RunManager {
|
|
|
533
541
|
/** The project/workspace secret store (spec 2026-10-10-project-secrets-vault-options);
|
|
534
542
|
* check steps read it with the `checks` audience. */
|
|
535
543
|
secrets?: SecretStore;
|
|
544
|
+
/** How long a fork waits for the namer's branch (spec 2026-10-11-branch-naming-instructions).
|
|
545
|
+
* Tests shorten it; the default is the slow-model budget. */
|
|
546
|
+
branchNameWaitMs?: number;
|
|
536
547
|
});
|
|
537
548
|
/**
|
|
538
549
|
* Release everything this manager owns without touching run records
|
|
@@ -764,6 +775,12 @@ export declare class RunManager {
|
|
|
764
775
|
* working. Delivered into the still-open session so the run is working again, not parking —
|
|
765
776
|
* a task that never parks still hears its parent within one turn. Not on a turn that asked: a
|
|
766
777
|
* run parking on the Guard waits for the human, and a message must not stand in for the answer.
|
|
778
|
+
*
|
|
779
|
+
* The ask is read through `turnEndMarkerText` (#997), the same normalization `resolveAskTurn`
|
|
780
|
+
* uses: this guard runs BEFORE the ask is resolved, and a delivery sets `rePrompted` — which
|
|
781
|
+
* auto-continues the turn and suppresses the ask card entirely. Reading the raw text here
|
|
782
|
+
* would let a question with a trailing `CEZ:PR=` line be answered by a sibling's message
|
|
783
|
+
* instead of by the human, which is exactly what this guard exists to prevent.
|
|
767
784
|
*/
|
|
768
785
|
private deliverOwnInbox;
|
|
769
786
|
/** What arrived in this run's inbox since it last looked, as the opening-prompt block; the
|
|
@@ -1239,7 +1256,18 @@ export declare class RunManager {
|
|
|
1239
1256
|
* refresh). A user-owned title (`titleOrigin: 'user'`) is never overwritten;
|
|
1240
1257
|
* namer-owned titles may be replaced by fresher namer results.
|
|
1241
1258
|
*/
|
|
1259
|
+
/**
|
|
1260
|
+
* Resolves to the namer's branch (spec 2026-10-11-branch-naming-instructions) on the
|
|
1261
|
+
* creation call — undefined whenever naming is off, unconfigured, or the answer was unusable.
|
|
1262
|
+
*/
|
|
1242
1263
|
private autoNameRun;
|
|
1264
|
+
/**
|
|
1265
|
+
* The branch a fresh fork should use (spec 2026-10-11-branch-naming-instructions): the
|
|
1266
|
+
* namer's answer, made unique against existing branches, awaited for at most
|
|
1267
|
+
* `BRANCH_NAME_WAIT_MS` and only when instructions are set — the zero-config fork stays
|
|
1268
|
+
* instant. Undefined means `cez/<id8>`; a late answer is dropped, never applied as a rename.
|
|
1269
|
+
*/
|
|
1270
|
+
private awaitGeneratedBranch;
|
|
1243
1271
|
recordTurnEnd(runId: string, turnText: string, owner?: ActiveRun): Promise<void>;
|
|
1244
1272
|
/**
|
|
1245
1273
|
* In-band declarations from the finished turn (spec
|