in2-agent-server 0.20260821.185429
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/README.md +369 -0
- package/agents/plan-requirement.md +32 -0
- package/dist/campfire/configItem.js +201 -0
- package/dist/campfire/configItemDescription.js +379 -0
- package/dist/campfire/deriveFromBundle.js +1013 -0
- package/dist/cli.js +465 -0
- package/dist/core/betaFeedback.js +493 -0
- package/dist/core/chapterInstructions.js +473 -0
- package/dist/core/claudeAssets.js +61 -0
- package/dist/core/gate.js +201 -0
- package/dist/core/ids.js +9 -0
- package/dist/core/install.js +60 -0
- package/dist/core/operatorQa.js +462 -0
- package/dist/core/orgCallMeter.js +178 -0
- package/dist/core/parcels.js +1235 -0
- package/dist/core/paths.js +105 -0
- package/dist/core/phases.js +225 -0
- package/dist/core/planFile.js +251 -0
- package/dist/core/planFragments.js +119 -0
- package/dist/core/readsLog.js +398 -0
- package/dist/core/registration.js +24 -0
- package/dist/core/result.js +38 -0
- package/dist/core/resume.js +233 -0
- package/dist/core/revisionChain.js +351 -0
- package/dist/core/richText.js +61 -0
- package/dist/core/semanticHash.js +89 -0
- package/dist/core/sessionOrg.js +60 -0
- package/dist/core/sfQuery.js +19 -0
- package/dist/core/spawn.js +182 -0
- package/dist/core/supervisorContract.js +230 -0
- package/dist/core/telemetry.js +1297 -0
- package/dist/core/telemetryContext.js +154 -0
- package/dist/core/telemetrySpool.js +244 -0
- package/dist/core/transcriptUpload.js +516 -0
- package/dist/core/update.js +363 -0
- package/dist/core/viewer.js +117 -0
- package/dist/core/workspace.js +92 -0
- package/dist/core/writeGrants.js +93 -0
- package/dist/core/writebackManifest.js +92 -0
- package/dist/direct/applyLoop.js +2516 -0
- package/dist/direct/batchReport.js +510 -0
- package/dist/direct/comparatorNoise.js +75 -0
- package/dist/direct/containers.js +85 -0
- package/dist/direct/contamination.js +221 -0
- package/dist/direct/crud.js +56 -0
- package/dist/direct/destructive.js +168 -0
- package/dist/direct/knownTokens.js +94 -0
- package/dist/direct/lint.js +382 -0
- package/dist/direct/metadataSchema.generated.json +1 -0
- package/dist/direct/metadataSchema.js +179 -0
- package/dist/direct/operatorPage.js +349 -0
- package/dist/direct/orgRepo.js +1531 -0
- package/dist/direct/orgRepoSpawnCount.js +21 -0
- package/dist/direct/plannedScope.js +119 -0
- package/dist/direct/preImageTargets.js +63 -0
- package/dist/direct/refVerify.js +191 -0
- package/dist/direct/registry.js +129 -0
- package/dist/direct/removals.js +262 -0
- package/dist/direct/rollback.js +1513 -0
- package/dist/direct/rollbackRun.js +1360 -0
- package/dist/direct/sessionProjection.js +126 -0
- package/dist/direct/snapshotComparability.js +165 -0
- package/dist/direct/sourceTree.js +113 -0
- package/dist/direct/unstatedChanges.js +106 -0
- package/dist/direct/waveAssembly.js +556 -0
- package/dist/direct/waveCounts.js +19 -0
- package/dist/direct/waveDerivation.js +152 -0
- package/dist/direct/waveGrade.js +185 -0
- package/dist/index.js +90 -0
- package/dist/orgread/customFieldSnapshot.js +48 -0
- package/dist/orgread/fieldMetadata.js +178 -0
- package/dist/orgread/genericSnapshot.js +61 -0
- package/dist/orgread/layoutSnapshot.js +151 -0
- package/dist/orgread/salesforceOrgReader.js +184 -0
- package/dist/orgread/snapshotTypes.js +9 -0
- package/dist/projection/bridge.js +26 -0
- package/dist/projection/diff.js +141 -0
- package/dist/projection/mapmd.js +213 -0
- package/dist/projection/nameAmbiguity.js +106 -0
- package/dist/projection/precedent.js +136 -0
- package/dist/projection/project.js +214 -0
- package/dist/projection/scope.js +110 -0
- package/dist/projection/types.js +5 -0
- package/dist/tools/analyze.js +322 -0
- package/dist/tools/auth.js +915 -0
- package/dist/tools/campfire.js +1742 -0
- package/dist/tools/closeBatch.js +154 -0
- package/dist/tools/closeText.js +35 -0
- package/dist/tools/direct.js +1613 -0
- package/dist/tools/feedback.js +318 -0
- package/dist/tools/operator.js +287 -0
- package/dist/tools/org.js +739 -0
- package/dist/tools/phase.js +249 -0
- package/dist/tools/projection.js +172 -0
- package/dist/tools/session.js +313 -0
- package/dist/tools/update.js +82 -0
- package/dist/tools/waves.js +793 -0
- package/package.json +48 -0
- package/reference/campfire-configuration-items-guide.md +710 -0
- package/reference/deployability-cribs.md +119 -0
- package/reference/operator-voice.md +141 -0
- package/reference/org-read-cribs.md +34 -0
- package/reference/scoped-dml-interim.md +68 -0
- package/reference/supervisor-playbook.md +313 -0
- package/reference/templates.md +233 -0
- package/skills/in2-delivery/SKILL.md +322 -0
- package/skills/in2-delivery/references/campfire-configuration-items-guide.md +710 -0
- package/skills/in2-delivery/references/deployability-cribs.md +119 -0
- package/skills/in2-delivery/references/operator-voice.md +141 -0
- package/skills/in2-delivery/references/org-read-cribs.md +34 -0
- package/skills/in2-delivery/references/scoped-dml-interim.md +68 -0
- package/skills/in2-delivery/references/templates.md +233 -0
- package/skills/plan-requirement/SKILL.md +188 -0
- package/viewer/index.html +899 -0
- package/viewer/server.mjs +433 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// PER-REQUIREMENT WRITEBACK STATE, on disk, while the writeback runs.
|
|
2
|
+
//
|
|
3
|
+
// `campfire_write_config_items` already knows, per Configuration Item row, which requirement owns
|
|
4
|
+
// it and whether Campfire confirmed the write on read-back — but that knowledge only ever left the
|
|
5
|
+
// tool as prose in one result, at the end. The session viewer polls the session directory, so a
|
|
6
|
+
// ten-minute writeback showed as one undifferentiated "in progress" for every requirement and then
|
|
7
|
+
// jumped to done. This file is the projection that closes that gap.
|
|
8
|
+
//
|
|
9
|
+
// WHY TWO WRITES RATHER THAN A LIVE PER-ROW FEED. The write loop upserts rows CONCURRENTLY
|
|
10
|
+
// (`WRITE_CONCURRENCY`), and a successful upsert is only a claim until the batched read-back
|
|
11
|
+
// confirms every field — so no requirement can honestly be called `written` before that read-back
|
|
12
|
+
// completes. A per-row feed would either lie early or need a second "unconfirmed" state that means
|
|
13
|
+
// nothing to an operator. So: one write BEFORE the loop (`writing`, with the row count each
|
|
14
|
+
// requirement is about to get) and one AFTER the read-back (`written` / `failed`). Requirements
|
|
15
|
+
// whose rows are all held or skipped never enter the loop and stay `pending` in both.
|
|
16
|
+
//
|
|
17
|
+
// Written through `writeJsonAtomic` (tmp+rename), like every other artifact the viewer reads, so a
|
|
18
|
+
// 2s poll can never catch a torn file.
|
|
19
|
+
//
|
|
20
|
+
// FAIL-OPEN throughout, like `readsLog`: a writeback that refused to write to Campfire because its
|
|
21
|
+
// progress file would not save would trade a real capability for a cosmetic one.
|
|
22
|
+
import { log } from "./result.js";
|
|
23
|
+
import { readJson, writeJsonAtomic, writebackDir } from "./workspace.js";
|
|
24
|
+
import path from "node:path";
|
|
25
|
+
export function writebackManifestPath(sessionId) {
|
|
26
|
+
return path.join(writebackDir(sessionId), "manifest.json");
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Fold Configuration Item rows into one row per requirement.
|
|
30
|
+
*
|
|
31
|
+
* Pure, so the state machine is testable without an org: the tool supplies the same three sets it
|
|
32
|
+
* already computes for its own report (held, skipped, failed) and this decides what each
|
|
33
|
+
* requirement's row says.
|
|
34
|
+
*/
|
|
35
|
+
export function writebackManifestRows(input) {
|
|
36
|
+
const held = new Set(input.held ?? []);
|
|
37
|
+
const skipped = new Set(input.skipped ?? []);
|
|
38
|
+
const failed = new Set(input.failedRequirements ?? []);
|
|
39
|
+
// Insertion order preserves the derivation's own sort (requirement, then type/name), so the
|
|
40
|
+
// manifest reads in the same order as the tool's report.
|
|
41
|
+
const counts = new Map();
|
|
42
|
+
for (const row of input.rows) {
|
|
43
|
+
const extId = row.requirement;
|
|
44
|
+
if (!extId)
|
|
45
|
+
continue; // an unowned row belongs to no requirement; the tool refuses on those anyway
|
|
46
|
+
const writable = !held.has(row.metadataKey) && !skipped.has(row.metadataKey);
|
|
47
|
+
counts.set(extId, (counts.get(extId) ?? 0) + (writable ? 1 : 0));
|
|
48
|
+
}
|
|
49
|
+
return [...counts].map(([extId, ciCount]) => {
|
|
50
|
+
// Nothing to write for this requirement (every row held or skipped) — it is not in flight and
|
|
51
|
+
// it did not fail; it is waiting on the operator's reconcile-and-rerun.
|
|
52
|
+
if (ciCount === 0)
|
|
53
|
+
return { extId, status: "pending", ciCount, writtenAt: null };
|
|
54
|
+
if (!input.done)
|
|
55
|
+
return { extId, status: "writing", ciCount, writtenAt: null };
|
|
56
|
+
return {
|
|
57
|
+
extId,
|
|
58
|
+
status: failed.has(extId) ? "failed" : "written",
|
|
59
|
+
ciCount,
|
|
60
|
+
writtenAt: input.at
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Write (or merge into) the session's writeback manifest. Never throws.
|
|
66
|
+
*
|
|
67
|
+
* MERGES rather than replaces, because the tool is DESIGNED to be called once per wave — its own
|
|
68
|
+
* `waves` argument exists so the incremental case does not re-derive the whole session and inflate
|
|
69
|
+
* Campfire's per-requirement Configuration Item counter. A replacing write would erase wave 1's
|
|
70
|
+
* `written` rows the moment wave 2 started, which is exactly the state the viewer is here to show.
|
|
71
|
+
* Rows named by this call win; rows only in the file survive untouched.
|
|
72
|
+
*/
|
|
73
|
+
export async function writeWritebackManifest(sessionId, rows) {
|
|
74
|
+
try {
|
|
75
|
+
const file = writebackManifestPath(sessionId);
|
|
76
|
+
let existing = [];
|
|
77
|
+
try {
|
|
78
|
+
const prior = await readJson(file);
|
|
79
|
+
if (Array.isArray(prior?.requirements))
|
|
80
|
+
existing = prior.requirements;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// No manifest yet, or one we cannot parse. Either way this call's rows are the truth.
|
|
84
|
+
}
|
|
85
|
+
const incoming = new Set(rows.map((row) => row.extId));
|
|
86
|
+
const merged = [...existing.filter((row) => row && !incoming.has(row.extId)), ...rows];
|
|
87
|
+
await writeJsonAtomic(file, { requirements: merged });
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
log("writeback manifest not being recorded:", error instanceof Error ? error.message : String(error));
|
|
91
|
+
}
|
|
92
|
+
}
|