agents-relay 2.0.219 → 2.0.221

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.
@@ -136,37 +136,49 @@ function raceAbort(work, signal) {
136
136
  return Promise.race([work, aborted]).finally(() => { if (rejectAbort)
137
137
  signal.removeEventListener('abort', rejectAbort); });
138
138
  }
139
- // Only Vlog's Visioner evidence follows the source-manifest/index artifact schema.
140
- // Distribution Visioner has a separate domain contract and cannot reuse it.
139
+ // Vlog's Visioner sources actual Markcut perception and lightweight normalized
140
+ // media; the historical vision-segment-index.json contract was retired.
141
+ // Distribution Visioner has a separate domain contract.
141
142
  function requiresVlogVisionerEvidence(agent) {
142
143
  return agent === 'visioner' || agent === 'vlog-visioner';
143
144
  }
144
145
  async function validateVisionerResult(result, projectRoot) {
145
- const artifacts = result.artifacts, output = result.output;
146
- if (!artifacts || Array.isArray(artifacts) || typeof artifacts !== 'object' || !['vision-evidence.json', 'vision-segment-index.json', 'metadata.json'].every(name => Object.prototype.hasOwnProperty.call(artifacts, name) && typeof output[name] === 'string'))
147
- throw new Error('Visioner requires evidence, index, and metadata artifacts');
146
+ const output = result.output;
147
+ const artifacts = result.artifacts;
148
+ const names = ['vision-evidence.json', 'vision-normalized-manifest.json', 'metadata.json'];
149
+ if (!output || !artifacts || Array.isArray(artifacts) || typeof artifacts !== 'object' ||
150
+ !names.every(name => Object.prototype.hasOwnProperty.call(artifacts, name) && typeof output[name] === 'string'))
151
+ throw new Error('Visioner requires source-linked evidence, normalized manifest and Markcut metadata artifacts');
148
152
  const files = artifacts;
149
153
  const evidence = files['vision-evidence.json'];
150
- const index = files['vision-segment-index.json'];
154
+ const normalized = files['vision-normalized-manifest.json'];
151
155
  const metadata = files['metadata.json'];
152
- if (!evidence || evidence.status !== 'EVIDENCE_READY_UNREVIEWED' || evidence.stage !== 'visioner' || !Array.isArray(evidence.sources) || !Array.isArray(evidence.observations)
153
- || !index || index.status !== 'SOURCE_LINKED_UNREVIEWED' || !Array.isArray(index.sources) || !Array.isArray(index.observations) || !metadata || typeof metadata !== 'object')
154
- throw new Error('Visioner artifacts do not satisfy the source-linked evidence contract');
155
- const artifactFiles = new Map();
156
- for (const name of ['vision-evidence.json', 'vision-segment-index.json', 'metadata.json']) {
156
+ if (!evidence || evidence.status !== 'EVIDENCE_READY_UNREVIEWED' || evidence.stage !== 'visioner' ||
157
+ !Array.isArray(evidence.sources) || !Array.isArray(evidence.observations) || !Array.isArray(evidence.summary) ||
158
+ !normalized || normalized.profile !== 'markcut-vision-normalized-v1' || normalized.usage !== 'vision-understanding-only' ||
159
+ !Array.isArray(normalized.sources) || !metadata || typeof metadata !== 'object' || Array.isArray(metadata))
160
+ throw new Error('Visioner artifacts do not satisfy the current source-linked evidence contract');
161
+ const actualFiles = new Map();
162
+ for (const name of names) {
157
163
  const actual = await realpath(resolve(projectRoot, String(output[name])));
158
164
  if (!inside(projectRoot, actual))
159
165
  throw new Error(`Visioner artifact escapes project root: ${name}`);
160
166
  const bytes = await readFile(actual), parsed = JSON.parse(bytes.toString('utf8'));
161
167
  if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed) || canonical(parsed) !== canonical(files[name]))
162
168
  throw new Error(`Visioner structured artifact differs from file: ${name}`);
163
- artifactFiles.set(name, { bytes, parsed: parsed });
169
+ actualFiles.set(name, bytes);
164
170
  }
165
- const evidenceFile = artifactFiles.get('vision-evidence.json'), indexFile = artifactFiles.get('vision-segment-index.json'), metadataFile = artifactFiles.get('metadata.json');
166
- // Stage authority is the source-linked structure and original media IDs, not repeated checksum validation.
167
- if (evidenceFile.parsed.status !== 'EVIDENCE_READY_UNREVIEWED' || indexFile.parsed.status !== 'SOURCE_LINKED_UNREVIEWED'
168
- || !metadataFile.parsed)
169
- throw new Error('Visioner structured evidence does not satisfy the Stage contract');
171
+ if (evidence.markcut_metadata_sha256 !== digestBytes(actualFiles.get('metadata.json')) ||
172
+ normalized.sourceManifestSha256 !== evidence.manifest_hash)
173
+ throw new Error('Visioner normalized and Markcut source provenance does not match');
174
+ const originalSources = evidence.sources;
175
+ const normalizedSources = normalized.sources;
176
+ if (originalSources.length === 0 || originalSources.length !== normalizedSources.length ||
177
+ new Set(originalSources.map(source => source.source_id)).size !== originalSources.length ||
178
+ originalSources.some(source => typeof source.source_id !== 'string' || typeof source.source_sha256 !== 'string' ||
179
+ !(source.source_id in metadata) ||
180
+ !normalizedSources.some(item => item.sourceId === source.source_id && item.sourceSha256 === source.source_sha256)))
181
+ throw new Error('Visioner normalized manifest does not cover every original source identity');
170
182
  }
171
183
  export async function runAgentShortcut(options) {
172
184
  const { store, job, task, projectPath, neoRoot } = options;
@@ -92,6 +92,27 @@ export class LocalAuthorityDurableStore {
92
92
  priority: 200,
93
93
  });
94
94
  }
95
+ /** Host-owned mobile Review is a SQLite lifecycle fact, never a GitHub
96
+ * projection. Use the same authoritative host-invocation ledger as the
97
+ * preview CLI and do not acknowledge a decision without durable storage. */
98
+ async recordHostInvocationEvent(delivery, outcome, fingerprint) {
99
+ if (!this.authority.recordHostInvocationEvent)
100
+ throw new Error('SQLite host invocation event ledger unavailable');
101
+ await this.authority.recordHostInvocationEvent(delivery, outcome, fingerprint);
102
+ }
103
+ async hasHostInvocationDecision(jobId, taskId, invocationId, fingerprint) {
104
+ if (!this.authority.hasHostInvocationDecision)
105
+ throw new Error('SQLite host invocation decision ledger unavailable');
106
+ return this.authority.hasHostInvocationDecision(jobId, taskId, invocationId, fingerprint);
107
+ }
108
+ async recordHostInvocationDecision(delivery, fingerprint) {
109
+ if (!this.authority.recordHostInvocationDecision)
110
+ throw new Error('SQLite host invocation decision ledger unavailable');
111
+ const receipt = await this.authority.recordHostInvocationDecision(delivery, fingerprint);
112
+ if (receipt.outcome === 'accepted')
113
+ publishLocalCommit(await this.load(delivery.jobId));
114
+ return receipt;
115
+ }
95
116
  async recordExecutionProcess(record) {
96
117
  await this.authority.recordExecutionProcess(record);
97
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-relay",
3
- "version": "2.0.219",
3
+ "version": "2.0.221",
4
4
  "description": "Durable async agent jobs coordinated through GitHub pull requests",
5
5
  "repository": {
6
6
  "type": "git",