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.
- package/dist/agent-shortcut.js +29 -17
- package/dist/local-authority-store.js +21 -0
- package/package.json +1 -1
package/dist/agent-shortcut.js
CHANGED
|
@@ -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
|
-
//
|
|
140
|
-
//
|
|
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
|
|
146
|
-
|
|
147
|
-
|
|
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
|
|
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' ||
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
169
|
+
actualFiles.set(name, bytes);
|
|
164
170
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
}
|