Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/shared-proposals-persist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sapiom/harness": minor
---

Prepare crash-atomic, project-wide Agent Map proposal persistence for the SAP-3060 transport, with attributed operation history, bounded session-scoped idempotency receipts, and history-derived stale-write rebasing. Exact results are retained for a bounded retry window, while older same-session request IDs cannot apply twice. Agent Map workspace reads now return a coherent versioned workspace-and-proposal snapshot, and the named browser-safe contracts required by the accepted-delta bus payload are exported from the package entry point.
2 changes: 2 additions & 0 deletions packages/harness/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"node-pty": "^1.1.0",
"open": "^10.1.0",
"typescript": "~5.9.3",
"uuid": "^10.0.0",
"ws": "^8.18.0",
"zod": "^3.25.0"
},
Expand All @@ -84,6 +85,7 @@
"@types/node": "^20.11.30",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@types/uuid": "^10.0.0",
"@types/ws": "^8.5.10",
"@vitejs/plugin-react": "^4.3.4",
"@xterm/addon-fit": "^0.10.0",
Expand Down
18 changes: 6 additions & 12 deletions packages/harness/src/core/agent-map-proposal-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,21 @@ import {
type ProposalValidationIssue,
type ProposalValidationResult,
} from "../shared/agent-map.js";

const UUID_V7 =
"[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}";
const hasControlCharacter = (value: string): boolean =>
[...value].some((character) => {
const codePoint = character.codePointAt(0) ?? 0;
return codePoint <= 0x1f || codePoint === 0x7f;
});
import {
AGENT_MAP_UUID_V7_PATTERN,
isAgentMapBoundedText,
} from "../shared/agent-map-codec.js";

const boundedText = (maximum: number, allowEmpty = false) =>
z
.string()
.max(maximum)
.refine((value) => (allowEmpty ? true : value.length > 0))
.refine((value) => value.trim() === value)
.refine((value) => !hasControlCharacter(value));
.refine((value) => isAgentMapBoundedText(value, maximum, allowEmpty));

const opaqueId = <T>(prefix: string) =>
z
.string()
.regex(new RegExp(`^${prefix}_${UUID_V7}$`, "u"))
.regex(new RegExp(`^${prefix}_${AGENT_MAP_UUID_V7_PATTERN}$`, "u"))
.transform((value) => value as T);

export const planNodeIdSchema = opaqueId<PlanNodeId>("node");
Expand Down
Loading
Loading