@agent-arc-status/reference 0.3.0

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.
@@ -0,0 +1,327 @@
1
+ /**
2
+ * Runtime validator for arc.status events.
3
+ *
4
+ * Mirrors the JSON Schema in `spec/schema.json` but is hand-rolled so the
5
+ * reference implementation ships with zero runtime dependencies. For users
6
+ * who want canonical-schema validation, `spec/schema.json` is also published
7
+ * and works with any standard JSON Schema validator (e.g. ajv).
8
+ */
9
+ import { ARC_STATUS_PHASES, } from "./types.js";
10
+ /**
11
+ * Canonical RFC 3339 grammar for `sent_at`, kept as a string so it can be
12
+ * shared byte-for-byte with `spec/schema.json`'s `sent_at.pattern`. The
13
+ * equivalence test asserts the two are identical, preventing future drift.
14
+ *
15
+ * It bounds month (01–12), day (01–31), hour (00–23), minute/second (00–59),
16
+ * and the UTC offset (≤ ±14:00); fractional seconds are optional (1–9 digits).
17
+ * It rejects leap seconds (`:60`), lowercase `t`/`z`, and the space separator.
18
+ * Per-month calendar validity (e.g. Feb 30) cannot be expressed portably in a
19
+ * regex and is enforced by `isValidCalendarDate` below.
20
+ */
21
+ export const RFC3339_PATTERN = "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])T([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(\\.\\d{1,9})?(Z|[+-](0\\d|1[0-4]):[0-5]\\d)$";
22
+ const RFC3339_RE = new RegExp(RFC3339_PATTERN);
23
+ const PROTOCOL_VERSION_RE = /^\d+\.\d+(\.\d+)?$/;
24
+ /**
25
+ * The fields the Protocol defines. Any other key is a conformance violation
26
+ * unless it is an `x_`-prefixed application extension (spec §3.2). Mirrors the
27
+ * schema's `additionalProperties:false` + `patternProperties:{"^x_":{}}`.
28
+ */
29
+ const KNOWN_KEYS = new Set([
30
+ "arc_id",
31
+ "phase",
32
+ "title",
33
+ "body",
34
+ "step",
35
+ "total",
36
+ "eta_minutes",
37
+ "sent_at",
38
+ "arc_kind",
39
+ "protocol_version",
40
+ ]);
41
+ function isPlainObject(value) {
42
+ return typeof value === "object" && value !== null && !Array.isArray(value);
43
+ }
44
+ function isPhase(value) {
45
+ return (typeof value === "string" &&
46
+ ARC_STATUS_PHASES.includes(value));
47
+ }
48
+ /**
49
+ * The RFC 3339 grammar admits day 01–31 for every month; this rejects the
50
+ * calendar-impossible combinations the regex cannot (e.g. 2026-02-30,
51
+ * 2026-04-31) by round-tripping the date components through `Date.UTC` and
52
+ * checking nothing rolled over (Feb 30 → Mar 2). Assumes the string already
53
+ * matched `RFC3339_RE`, so the slices are well-formed.
54
+ */
55
+ function isValidCalendarDate(ts) {
56
+ const year = Number(ts.slice(0, 4));
57
+ const month = Number(ts.slice(5, 7));
58
+ const day = Number(ts.slice(8, 10));
59
+ const probe = new Date(Date.UTC(year, month - 1, day));
60
+ return (probe.getUTCFullYear() === year &&
61
+ probe.getUTCMonth() + 1 === month &&
62
+ probe.getUTCDate() === day);
63
+ }
64
+ /**
65
+ * Validate a candidate event against the Protocol's wire-format rules.
66
+ *
67
+ * This checks structural conformance only: required fields present, types
68
+ * correct, enums respected, numeric bounds satisfied, timestamp parseable.
69
+ *
70
+ * It does NOT validate phase-ordering rules across a sequence of events;
71
+ * see `validateSequence` for that.
72
+ */
73
+ export function validate(candidate) {
74
+ const issues = [];
75
+ if (!isPlainObject(candidate)) {
76
+ return {
77
+ ok: false,
78
+ issues: [{ path: "", message: "event must be a JSON object" }],
79
+ };
80
+ }
81
+ const e = candidate;
82
+ // unknown fields: only x_-prefixed extensions are permitted (spec §3.2)
83
+ for (const key of Object.keys(e)) {
84
+ if (!KNOWN_KEYS.has(key) && !key.startsWith("x_")) {
85
+ issues.push({
86
+ path: key,
87
+ message: "unknown field; only x_-prefixed extensions are permitted",
88
+ });
89
+ }
90
+ }
91
+ // arc_id
92
+ if (typeof e.arc_id !== "string") {
93
+ issues.push({ path: "arc_id", message: "must be a string" });
94
+ }
95
+ else if (e.arc_id.length < 1 || e.arc_id.length > 128) {
96
+ issues.push({
97
+ path: "arc_id",
98
+ message: "must be between 1 and 128 characters",
99
+ });
100
+ }
101
+ // phase
102
+ if (!isPhase(e.phase)) {
103
+ issues.push({
104
+ path: "phase",
105
+ message: `must be one of: ${ARC_STATUS_PHASES.join(", ")}`,
106
+ });
107
+ }
108
+ // title
109
+ if (typeof e.title !== "string") {
110
+ issues.push({ path: "title", message: "must be a string" });
111
+ }
112
+ else if (e.title.length < 1 || e.title.length > 200) {
113
+ issues.push({
114
+ path: "title",
115
+ message: "must be between 1 and 200 characters",
116
+ });
117
+ }
118
+ else if (e.title.includes("\n")) {
119
+ issues.push({
120
+ path: "title",
121
+ message: "should not contain newlines (use body for multi-line content)",
122
+ });
123
+ }
124
+ // sent_at
125
+ if (typeof e.sent_at !== "string") {
126
+ issues.push({ path: "sent_at", message: "must be a string" });
127
+ }
128
+ else if (!RFC3339_RE.test(e.sent_at)) {
129
+ issues.push({
130
+ path: "sent_at",
131
+ message: "must be an RFC 3339 timestamp (canonical: YYYY-MM-DDTHH:MM:SS[.fff]Z)",
132
+ });
133
+ }
134
+ else if (!isValidCalendarDate(e.sent_at)) {
135
+ issues.push({ path: "sent_at", message: "is not a valid calendar date" });
136
+ }
137
+ // body
138
+ if (e.body !== undefined) {
139
+ if (typeof e.body !== "string") {
140
+ issues.push({ path: "body", message: "must be a string when present" });
141
+ }
142
+ else if (e.body.length > 32000) {
143
+ issues.push({ path: "body", message: "must be ≤ 32000 characters" });
144
+ }
145
+ }
146
+ // step
147
+ if (e.step !== undefined) {
148
+ if (typeof e.step !== "number" || !Number.isInteger(e.step) || e.step < 1) {
149
+ issues.push({ path: "step", message: "must be an integer ≥ 1" });
150
+ }
151
+ }
152
+ // total
153
+ if (e.total !== undefined) {
154
+ if (typeof e.total !== "number" ||
155
+ !Number.isInteger(e.total) ||
156
+ e.total < 1) {
157
+ issues.push({ path: "total", message: "must be an integer ≥ 1" });
158
+ }
159
+ }
160
+ // step ≤ total
161
+ if (typeof e.step === "number" &&
162
+ typeof e.total === "number" &&
163
+ Number.isInteger(e.step) &&
164
+ Number.isInteger(e.total) &&
165
+ e.step > e.total) {
166
+ issues.push({
167
+ path: "step",
168
+ message: "must be ≤ total when both are present",
169
+ });
170
+ }
171
+ // eta_minutes
172
+ if (e.eta_minutes !== undefined) {
173
+ if (typeof e.eta_minutes !== "number" || e.eta_minutes < 0) {
174
+ issues.push({
175
+ path: "eta_minutes",
176
+ message: "must be a number ≥ 0",
177
+ });
178
+ }
179
+ }
180
+ // arc_kind
181
+ if (e.arc_kind !== undefined) {
182
+ if (typeof e.arc_kind !== "string") {
183
+ issues.push({ path: "arc_kind", message: "must be a string when present" });
184
+ }
185
+ else if (e.arc_kind.length > 64) {
186
+ issues.push({ path: "arc_kind", message: "must be ≤ 64 characters" });
187
+ }
188
+ }
189
+ // protocol_version
190
+ if (e.protocol_version !== undefined) {
191
+ if (typeof e.protocol_version !== "string") {
192
+ issues.push({
193
+ path: "protocol_version",
194
+ message: "must be a string when present",
195
+ });
196
+ }
197
+ else if (!PROTOCOL_VERSION_RE.test(e.protocol_version)) {
198
+ issues.push({
199
+ path: "protocol_version",
200
+ message: "must match <major>.<minor>(.<patch>)?",
201
+ });
202
+ }
203
+ }
204
+ if (issues.length > 0) {
205
+ return { ok: false, issues };
206
+ }
207
+ return { ok: true, event: e };
208
+ }
209
+ /**
210
+ * Validate phase-ordering for a sequence of events belonging to a single arc.
211
+ *
212
+ * Enforces §4.5–§4.6 of the spec:
213
+ * - exactly one `started`, at the beginning
214
+ * - the last event is a terminal (`done` or terminal `blocked`), unless
215
+ * `options.partial` is set (in-flight prefix)
216
+ * - at most one `done`, and no events after it
217
+ * - after `blocked`, the next event is `milestone` (resume), `done`, or
218
+ * end-of-arc; `started`, `heartbeat`, and a second consecutive `blocked`
219
+ * are illegal
220
+ * - (optional) `sent_at` is non-decreasing when `checkMonotonicSentAt` is set
221
+ *
222
+ * Does NOT re-validate individual events; call `validate` first if needed.
223
+ */
224
+ export function validateSequence(events, options = {}) {
225
+ const issues = [];
226
+ if (events.length === 0) {
227
+ return { ok: true, issues };
228
+ }
229
+ // arc_id consistency
230
+ const arcId = events[0]?.arc_id;
231
+ for (let i = 1; i < events.length; i++) {
232
+ if (events[i]?.arc_id !== arcId) {
233
+ issues.push({
234
+ index: i,
235
+ message: `arc_id mismatch: expected ${arcId}, got ${events[i]?.arc_id}`,
236
+ });
237
+ }
238
+ }
239
+ // first event must be started
240
+ if (events[0]?.phase !== "started") {
241
+ issues.push({
242
+ index: 0,
243
+ message: "first event in an arc must be phase=started",
244
+ });
245
+ }
246
+ // exactly one started, exactly one done (or arc may terminate in blocked)
247
+ let startedCount = 0;
248
+ let doneCount = 0;
249
+ let sawDoneAt = null;
250
+ for (let i = 0; i < events.length; i++) {
251
+ const phase = events[i]?.phase;
252
+ if (phase === "started")
253
+ startedCount++;
254
+ if (phase === "done") {
255
+ doneCount++;
256
+ if (sawDoneAt === null)
257
+ sawDoneAt = i;
258
+ }
259
+ }
260
+ if (startedCount !== 1) {
261
+ issues.push({
262
+ index: 0,
263
+ message: `arc must contain exactly one started event, found ${startedCount}`,
264
+ });
265
+ }
266
+ if (doneCount > 1) {
267
+ issues.push({
268
+ index: 0,
269
+ message: `arc must contain at most one done event, found ${doneCount}`,
270
+ });
271
+ }
272
+ if (sawDoneAt !== null && sawDoneAt !== events.length - 1) {
273
+ issues.push({
274
+ index: sawDoneAt,
275
+ message: "no events may follow a done event",
276
+ });
277
+ }
278
+ // after blocked, next non-blocked phase must be milestone or done
279
+ for (let i = 0; i < events.length - 1; i++) {
280
+ if (events[i]?.phase === "blocked") {
281
+ const next = events[i + 1]?.phase;
282
+ if (next === "started") {
283
+ issues.push({
284
+ index: i + 1,
285
+ message: "started cannot follow blocked",
286
+ });
287
+ }
288
+ if (next === "heartbeat") {
289
+ issues.push({
290
+ index: i + 1,
291
+ message: "blocked must be followed by milestone (resume), done (resolve), or end-of-arc; heartbeat is not a legal resume signal",
292
+ });
293
+ }
294
+ if (next === "blocked") {
295
+ issues.push({
296
+ index: i + 1,
297
+ message: "consecutive blocked events are not allowed; emit a milestone (resume) before re-blocking (§4.5)",
298
+ });
299
+ }
300
+ }
301
+ }
302
+ // last event must be a terminal for a complete arc (§4.6)
303
+ if (!options.partial) {
304
+ const lastPhase = events[events.length - 1]?.phase;
305
+ if (lastPhase !== "done" && lastPhase !== "blocked") {
306
+ issues.push({
307
+ index: events.length - 1,
308
+ message: "a complete arc must end in a terminal event (done or terminal blocked); pass { partial: true } to validate an in-flight prefix",
309
+ });
310
+ }
311
+ }
312
+ // optional: sent_at non-decreasing in emission order (off by default; §7.5)
313
+ if (options.checkMonotonicSentAt) {
314
+ for (let i = 1; i < events.length; i++) {
315
+ const prev = Date.parse(events[i - 1]?.sent_at ?? "");
316
+ const cur = Date.parse(events[i]?.sent_at ?? "");
317
+ if (!Number.isNaN(prev) && !Number.isNaN(cur) && cur < prev) {
318
+ issues.push({
319
+ index: i,
320
+ message: "sent_at decreased from the previous event; not allowed when checkMonotonicSentAt is set",
321
+ });
322
+ }
323
+ }
324
+ }
325
+ return { ok: issues.length === 0, issues };
326
+ }
327
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,iBAAiB,GAGlB,MAAM,YAAY,CAAC;AAapB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,eAAe,GAC1B,gIAAgI,CAAC;AAEnI,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC;AAE/C,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACzB,QAAQ;IACR,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,aAAa;IACb,SAAS;IACT,UAAU;IACV,kBAAkB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,MAAM,CAAC,IAAI,CAAC;oBACV,KAAK,EAAE,CAAC;oBACR,OAAO,EACL,yFAAyF;iBAC5F,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;AAC7C,CAAC"}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@agent-arc-status/reference",
3
+ "version": "0.3.0",
4
+ "description": "Reference implementation of the Agent Arc Status Protocol: types, parser, validator, renderer, cadence, state, and delegation-tree tooling. Zero runtime dependencies.",
5
+ "license": "MIT",
6
+ "author": "Joe Fisher",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/joethefisher/agent-arc-status.git",
10
+ "directory": "packages/reference"
11
+ },
12
+ "homepage": "https://github.com/joethefisher/agent-arc-status#readme",
13
+ "bugs": "https://github.com/joethefisher/agent-arc-status/issues",
14
+ "keywords": [
15
+ "agent",
16
+ "agents",
17
+ "ai",
18
+ "llm",
19
+ "observability",
20
+ "progress",
21
+ "webhook",
22
+ "arc-status"
23
+ ],
24
+ "type": "module",
25
+ "main": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.js"
31
+ }
32
+ },
33
+ "files": [
34
+ "dist",
35
+ "README.md",
36
+ "LICENSE"
37
+ ],
38
+ "publishConfig": {
39
+ "access": "public",
40
+ "provenance": true
41
+ },
42
+ "scripts": {
43
+ "build": "tsc",
44
+ "test": "vitest run",
45
+ "test:watch": "vitest",
46
+ "typecheck": "tsc --noEmit"
47
+ },
48
+ "engines": {
49
+ "node": ">=20"
50
+ }
51
+ }