@vecteur/cli 0.4.3 → 0.4.4
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/package.json +1 -1
- package/src/contract.js +57 -24
package/package.json
CHANGED
package/src/contract.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// GENERATED by scripts/gen-contract.mjs from owner TypeScript projections.
|
|
2
|
-
export const OWNER_CONTRACT_IDENTITY = "api-sha256:5fe54838e61336acc12ae1ff2409970a21fac99c7457383ca9c7a6d8c6e882cc;run-wire-sha256:
|
|
2
|
+
export const OWNER_CONTRACT_IDENTITY = "api-sha256:5fe54838e61336acc12ae1ff2409970a21fac99c7457383ca9c7a6d8c6e882cc;run-wire-sha256:33813b7048376590b87c76d2bb5273199045b2a594b141ab63350aac92f9ede0";
|
|
3
3
|
export const RECOVERY_ACTIONS = Object.freeze({"delete_project":{"label":"Delete a project","href":"/projects"},"upgrade_plan":{"label":"Upgrade your plan","href":"/dashboard/billing"},"wait_for_reset":{"label":"Wait until the UTC reset","href":null}});
|
|
4
4
|
export const EVENT_KINDS = Object.freeze(["source","step_started","step_finished","synthesis","artifact","cta","state_advanced","terminal","heartbeat","assistant_delta","step_label","context_frame","knowledge_binding","engineering_projection","provider_attempt","clarification"]);
|
|
5
|
-
export const TERMINAL_FIELDS = Object.freeze(["answer","defect","evidence_dag","instruction_source","intent","missing_input_need","missing_inputs","provider_retry_offer","recovery","state","steps"]);
|
|
5
|
+
export const TERMINAL_FIELDS = Object.freeze(["answer","defect","deliverable_asked","evidence_dag","instruction_source","intent","missing_input_need","missing_inputs","provider_retry_offer","recovery","refusal_unfounded","state","steps","unmet_wanted"]);
|
|
6
6
|
export const ARTIFACT_MEDIA_TYPES = Object.freeze({"code":"text/plain","csv":"text/csv","docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document","drive":"application/vnd.google-drive","html":"text/html","md":"text/markdown","pdf":"application/pdf","xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
|
|
7
|
-
export const TERMINAL_RECOVERY_DECLARATIONS = Object.freeze({"artifact_publication_missing":[["start_run",["project_id"]]],"artifact_store_unavailable":[["start_run",["project_id"]]],"budget_exhausted":[["start_run",["project_id"]]],"cancelled":[["start_run",["project_id"]]],"cause_unrecorded":[["start_run",["project_id"]]],"clarification_custody_invalid":[["start_run",["project_id"]]],"clarification_custody_lost":[["start_run",["project_id"]]],"clarification_resume_invalid":[["start_run",["project_id"]]],"clarification_unpersisted":[["start_run",["project_id"]]],"context_unselected":[["start_run",["project_id"]]],"credential_class_disclosure":[["start_run",["project_id"]]],"design_state_missing":[["start_run",["project_id"]]],"evidence_admission_invalid":[["start_run",["project_id"]]],"evidence_artifact_invalid":[["start_run",["project_id"]]],"evidence_artifact_unbound":[["start_run",["project_id"]]],"evidence_binding_unresolved":[["start_run",["project_id"]]],"evidence_context_invalid":[["start_run",["project_id"]]],"evidence_extract_unreached":[["start_run",["project_id"]]],"evidence_missing":[["start_run",["project_id"]]],"evidence_owner_receipt_mismatch":[["start_run",["project_id"]]],"evidence_owner_receipt_missing":[["start_run",["project_id"]]],"evidence_payload_invalid":[["start_run",["project_id"]]],"evidence_reached_invalid":[["start_run",["project_id"]]],"evidence_replay_invalid":[["start_run",["project_id"]]],"evidence_run_mismatch":[["start_run",["project_id"]]],"evidence_seal_collision":[["start_run",["project_id"]]],"evidence_selected_unreached":[["start_run",["project_id"]]],"execution_route_invalid":[["start_run",["project_id"]]],"executor_root_invalid":[["start_run",["project_id"]]],"extraction_offer_invalid":[["start_run",["project_id"]]],"extraction_offer_tampered":[["start_run",["project_id"]]],"fact_support_unread":[["start_run",["project_id"]]],"harness_arm_invalid":[["start_run",["project_id"]]],"harness_event_unmapped":[["start_run",["project_id"]]],"harness_exited":[["start_run",["project_id"]]],"harness_mapping_failed":[["start_run",["project_id"]]],"harness_session_invalid":[["start_run",["project_id"]]],"harness_session_missing":[["start_run",["project_id"]]],"harness_timeout":[["start_run",["project_id"]]],"lease_interval_invalid":[["start_run",["project_id"]]],"ledger_malformed":[["start_run",["project_id"]]],"max_tokens":[["start_run",["project_id"]]],"profile_eligibility_changed":[["start_run",["project_id"]]],"prompt_provenance_unavailable":[["start_run",["project_id"]]],"provider_budget_exhausted":[["start_run",["project_id"]]],"provider_budget_missing":[["start_run",["project_id"]]],"provider_budget_unavailable":[["start_run",["project_id"]]],"provider_relay_absent":[["start_run",["project_id"]]],"provider_route_control_invalid":[["start_run",["project_id"]]],"provider_route_exhausted":[["start_run",["project_id"]],["retry_run",["source_run_id","offer_id","generation"]]],"provider_route_failure_unobserved":[["start_run",["project_id"]]],"provider_route_reconciliation_invalid":[["start_run",["project_id"]]],"provider_route_restart_terminal":[["start_run",["project_id"]]],"provider_training_opted_in":[["start_run",["project_id"]]],"publish_seal_missing":[["start_run",["project_id"]]],"replay_capture_digest_mismatch":[["start_run",["project_id"]]],"replay_capture_invalid":[["start_run",["project_id"]]],"replay_config_incomplete":[["start_run",["project_id"]]],"replay_failed":[["start_run",["project_id"]]],"replay_no_requests":[["start_run",["project_id"]]],"replay_patch_invalid":[["start_run",["project_id"]]],"replay_plugin_absent":[["start_run",["project_id"]]],"replay_provider_socket":[["start_run",["project_id"]]],"replay_receipt_invalid":[["start_run",["project_id"]]],"replay_receipt_owner_chown":[["start_run",["project_id"]]],"replay_receipt_owner_incomplete":[["start_run",["project_id"]]],"replay_receipt_owner_invalid":[["start_run",["project_id"]]],"replay_request_observation_count":[["start_run",["project_id"]]],"replay_request_observation_invalid":[["start_run",["project_id"]]],"replay_request_observation_missing":[["start_run",["project_id"]]],"replay_request_owner_chown":[["start_run",["project_id"]]],"replay_socket_observation_invalid":[["start_run",["project_id"]]],"replay_socket_observation_missing":[["start_run",["project_id"]]],"replay_socket_owner_chown":[["start_run",["project_id"]]],"run_database_capability_refused":[["start_run",["project_id"]]],"runtime_unavailable":[["start_run",["project_id"]]],"sealed_contract_violated":[["start_run",["project_id"]]],"sealed_file_missing":[["start_run",["project_id"]]],"seat_patch_absent":[["start_run",["project_id"]]],"seat_patch_drift":[["start_run",["project_id"]]],"selection_admission_invalid":[["start_run",["project_id"]]],"selection_context_invalid":[["start_run",["project_id"]]],"selection_receipt_conflict":[["start_run",["project_id"]]],"selection_receipt_invalid":[["start_run",["project_id"]]],"selection_receipt_missing":[["start_run",["project_id"]]],"selection_required":[["start_run",["project_id"]]],"state_corrupt":[["start_run",["project_id"]]],"state_file_invalid":[["start_run",["project_id"]]],"state_invalid":[["start_run",["project_id"]]],"state_payload_overflow":[["start_run",["project_id"]]],"state_unencodable":[["start_run",["project_id"]]],"state_version_unknown":[["start_run",["project_id"]]],"usage_egress_mismatch":[["start_run",["project_id"]]],"web_without_miss":[["start_run",["project_id"]]]});
|
|
7
|
+
export const TERMINAL_RECOVERY_DECLARATIONS = Object.freeze({"artifact_publication_missing":[["start_run",["project_id"]]],"artifact_store_unavailable":[["start_run",["project_id"]]],"budget_exhausted":[["start_run",["project_id"]]],"cancelled":[["start_run",["project_id"]]],"cause_unrecorded":[["start_run",["project_id"]]],"clarification_custody_invalid":[["start_run",["project_id"]]],"clarification_custody_lost":[["start_run",["project_id"]]],"clarification_resume_invalid":[["start_run",["project_id"]]],"clarification_unpersisted":[["start_run",["project_id"]]],"context_unselected":[["start_run",["project_id"]]],"credential_class_disclosure":[["start_run",["project_id"]]],"deliverable_missing":[["start_run",["project_id"]]],"design_state_missing":[["start_run",["project_id"]]],"evidence_admission_invalid":[["start_run",["project_id"]]],"evidence_artifact_invalid":[["start_run",["project_id"]]],"evidence_artifact_unbound":[["start_run",["project_id"]]],"evidence_binding_unresolved":[["start_run",["project_id"]]],"evidence_context_invalid":[["start_run",["project_id"]]],"evidence_extract_unreached":[["start_run",["project_id"]]],"evidence_missing":[["start_run",["project_id"]]],"evidence_owner_receipt_mismatch":[["start_run",["project_id"]]],"evidence_owner_receipt_missing":[["start_run",["project_id"]]],"evidence_payload_invalid":[["start_run",["project_id"]]],"evidence_reached_invalid":[["start_run",["project_id"]]],"evidence_replay_invalid":[["start_run",["project_id"]]],"evidence_run_mismatch":[["start_run",["project_id"]]],"evidence_seal_collision":[["start_run",["project_id"]]],"evidence_selected_unreached":[["start_run",["project_id"]]],"execution_route_invalid":[["start_run",["project_id"]]],"executor_root_invalid":[["start_run",["project_id"]]],"extraction_offer_invalid":[["start_run",["project_id"]]],"extraction_offer_tampered":[["start_run",["project_id"]]],"fact_support_unread":[["start_run",["project_id"]]],"harness_arm_invalid":[["start_run",["project_id"]]],"harness_event_unmapped":[["start_run",["project_id"]]],"harness_exited":[["start_run",["project_id"]]],"harness_mapping_failed":[["start_run",["project_id"]]],"harness_session_invalid":[["start_run",["project_id"]]],"harness_session_missing":[["start_run",["project_id"]]],"harness_timeout":[["start_run",["project_id"]]],"infeasible_physics":[["start_run",["project_id"]]],"lease_interval_invalid":[["start_run",["project_id"]]],"ledger_malformed":[["start_run",["project_id"]]],"max_tokens":[["start_run",["project_id"]]],"no_facts":[["start_run",["project_id"]]],"not_a_decision_i_can_make":[["start_run",["project_id"]]],"out_of_physics":[["start_run",["project_id"]]],"profile_eligibility_changed":[["start_run",["project_id"]]],"prompt_provenance_unavailable":[["start_run",["project_id"]]],"provider_budget_exhausted":[["start_run",["project_id"]]],"provider_budget_missing":[["start_run",["project_id"]]],"provider_budget_unavailable":[["start_run",["project_id"]]],"provider_relay_absent":[["start_run",["project_id"]]],"provider_route_control_invalid":[["start_run",["project_id"]]],"provider_route_exhausted":[["start_run",["project_id"]],["retry_run",["source_run_id","offer_id","generation"]]],"provider_route_failure_unobserved":[["start_run",["project_id"]]],"provider_route_reconciliation_invalid":[["start_run",["project_id"]]],"provider_route_restart_terminal":[["start_run",["project_id"]]],"provider_training_opted_in":[["start_run",["project_id"]]],"publish_seal_missing":[["start_run",["project_id"]]],"refusal_unfounded":[["start_run",["project_id"]]],"replay_capture_digest_mismatch":[["start_run",["project_id"]]],"replay_capture_invalid":[["start_run",["project_id"]]],"replay_config_incomplete":[["start_run",["project_id"]]],"replay_failed":[["start_run",["project_id"]]],"replay_no_requests":[["start_run",["project_id"]]],"replay_patch_invalid":[["start_run",["project_id"]]],"replay_plugin_absent":[["start_run",["project_id"]]],"replay_provider_socket":[["start_run",["project_id"]]],"replay_receipt_invalid":[["start_run",["project_id"]]],"replay_receipt_owner_chown":[["start_run",["project_id"]]],"replay_receipt_owner_incomplete":[["start_run",["project_id"]]],"replay_receipt_owner_invalid":[["start_run",["project_id"]]],"replay_request_observation_count":[["start_run",["project_id"]]],"replay_request_observation_invalid":[["start_run",["project_id"]]],"replay_request_observation_missing":[["start_run",["project_id"]]],"replay_request_owner_chown":[["start_run",["project_id"]]],"replay_socket_observation_invalid":[["start_run",["project_id"]]],"replay_socket_observation_missing":[["start_run",["project_id"]]],"replay_socket_owner_chown":[["start_run",["project_id"]]],"run_database_capability_refused":[["start_run",["project_id"]]],"runtime_unavailable":[["start_run",["project_id"]]],"sealed_contract_violated":[["start_run",["project_id"]]],"sealed_file_missing":[["start_run",["project_id"]]],"seat_patch_absent":[["start_run",["project_id"]]],"seat_patch_drift":[["start_run",["project_id"]]],"selection_admission_invalid":[["start_run",["project_id"]]],"selection_context_invalid":[["start_run",["project_id"]]],"selection_receipt_conflict":[["start_run",["project_id"]]],"selection_receipt_invalid":[["start_run",["project_id"]]],"selection_receipt_missing":[["start_run",["project_id"]]],"selection_required":[["start_run",["project_id"]]],"state_corrupt":[["start_run",["project_id"]]],"state_file_invalid":[["start_run",["project_id"]]],"state_invalid":[["start_run",["project_id"]]],"state_payload_overflow":[["start_run",["project_id"]]],"state_unencodable":[["start_run",["project_id"]]],"state_version_unknown":[["start_run",["project_id"]]],"unreceipted_numbers":[["start_run",["project_id"]]],"usage_egress_mismatch":[["start_run",["project_id"]]],"wanted_not_computed":[["start_run",["project_id"]]],"web_without_miss":[["start_run",["project_id"]]]});
|
|
8
8
|
export const ORIGIN_KINDS = Object.freeze(["user","hypothesis","derived","knowledge","file","catalog","default"]);
|
|
9
9
|
export const ORIGIN_WORD = Object.freeze({"user":"your brief","hypothesis":"assumed","derived":"derived","knowledge":"Vecteur knowledge","file":"your file","catalog":"catalogue","default":"default","unattributed":"unstated"});
|
|
10
10
|
const shape=(v,r,o=[])=>!!v&&typeof v==="object"&&!Array.isArray(v)&&r.every(k=>Object.hasOwn(v,k))&&Object.keys(v).every(k=>r.includes(k)||o.includes(k));
|
|
@@ -68,15 +68,36 @@ export function programNodes(step) {
|
|
|
68
68
|
}
|
|
69
69
|
return nodes.length ? nodes : null;
|
|
70
70
|
}
|
|
71
|
+
export const MISSING_INPUT_CODE = 'missing_input';
|
|
72
|
+
const RESULT_ROW = /^call_(\d+)_result$/;
|
|
73
|
+
function isInputNeed(value) {
|
|
74
|
+
if (typeof value !== 'string')
|
|
75
|
+
return false;
|
|
76
|
+
try {
|
|
77
|
+
const decoded = JSON.parse(value);
|
|
78
|
+
return Boolean(decoded) && typeof decoded === 'object' && !Array.isArray(decoded)
|
|
79
|
+
&& 'missing_inputs' in decoded;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export function stepNeedsInput(step) {
|
|
86
|
+
if (stepVerb(step) !== 'run_program')
|
|
87
|
+
return false;
|
|
88
|
+
const results = (step.outputs ?? []).filter((row) => (Boolean(row) && typeof row === 'object' && RESULT_ROW.test(String(row.name ?? ''))));
|
|
89
|
+
return results.length > 0 && results.every((row) => isInputNeed(row.value));
|
|
90
|
+
}
|
|
71
91
|
export function attemptState(step) {
|
|
72
|
-
const produced = (step.outputs ?? []).length > 0;
|
|
73
|
-
if (!produced && (step.refusals ?? []).length > 0)
|
|
92
|
+
const produced = (step.outputs ?? []).length > 0 && !stepNeedsInput(step);
|
|
93
|
+
if (!produced && ((step.refusals ?? []).length > 0 || stepNeedsInput(step)))
|
|
74
94
|
return 'refused';
|
|
75
95
|
return produced ? 'computed' : 'open';
|
|
76
96
|
}
|
|
77
97
|
function attemptOf(step) {
|
|
78
98
|
const state = attemptState(step);
|
|
79
|
-
|
|
99
|
+
const code = stepNeedsInput(step) ? MISSING_INPUT_CODE : (step.refusals?.[0]?.code ?? null);
|
|
100
|
+
return { step, state, code: state === 'refused' ? code : null };
|
|
80
101
|
}
|
|
81
102
|
export function taskGroups(steps) {
|
|
82
103
|
const tasks = [];
|
|
@@ -240,10 +261,7 @@ export function engineeringVerbLabel(verb) {
|
|
|
240
261
|
}
|
|
241
262
|
export function taskTitle(task) {
|
|
242
263
|
for (let index = task.attempts.length - 1; index >= 0; index -= 1) {
|
|
243
|
-
const
|
|
244
|
-
if (attempt.state !== 'computed')
|
|
245
|
-
continue;
|
|
246
|
-
const title = intentTitle(attempt.step);
|
|
264
|
+
const title = intentTitle(task.attempts[index].step);
|
|
247
265
|
if (title)
|
|
248
266
|
return title;
|
|
249
267
|
}
|
|
@@ -257,24 +275,39 @@ export function taskRationale(task) {
|
|
|
257
275
|
}
|
|
258
276
|
return '';
|
|
259
277
|
}
|
|
260
|
-
export const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
278
|
+
export const REFUSAL_REASONS = {
|
|
279
|
+
authoring_defect: 'the program needed a repair',
|
|
280
|
+
owner_refusal: 'an input was outside what the physics owner accepts',
|
|
281
|
+
support_mismatch: 'a number needed its source',
|
|
282
|
+
unit_error: 'a unit did not match',
|
|
283
|
+
capability_gap: 'no physics owner covers this',
|
|
284
|
+
not_converged: 'the physics did not converge',
|
|
285
|
+
budget: 'the budget for this step was spent',
|
|
286
|
+
state_fork: 'the design had moved on since the program was written',
|
|
287
|
+
missing_knowledge_dependency: 'a method note or fact it needed was missing',
|
|
288
|
+
release_withdrawn: 'the data release was withdrawn',
|
|
289
|
+
data_access_denied: 'this data is outside your plan',
|
|
290
|
+
surface_absent: 'it named a tool that does not exist',
|
|
291
|
+
UNKNOWN_TOOL: 'it named a tool that does not exist',
|
|
292
|
+
ABORTED_BEFORE_DISPATCH: 'it was stopped before it ran',
|
|
293
|
+
INVALID_TOOL_OUTPUT: 'its result could not be read',
|
|
294
|
+
facts_unavailable: 'the catalogue was unavailable',
|
|
295
|
+
spacedata_release_absent: 'the catalogue was unavailable',
|
|
296
|
+
spacedata_release_unreadable: 'the catalogue was unavailable',
|
|
297
|
+
invalid_arguments: 'the request was malformed',
|
|
298
|
+
internal_error: 'the catalogue failed',
|
|
299
|
+
[MISSING_INPUT_CODE]: 'it needed an input you had not given',
|
|
270
300
|
};
|
|
301
|
+
export const REFUSAL_FALLBACK = 'it was not accepted';
|
|
302
|
+
export function refusalReason(refusal) {
|
|
303
|
+
const sentence = REFUSAL_REASONS[refusal?.code ?? ''] ?? REFUSAL_FALLBACK;
|
|
304
|
+
const subject = (refusal?.subject ?? '').trim();
|
|
305
|
+
return subject ? `${sentence} — ${subject.split('/').pop() ?? subject}` : sentence;
|
|
306
|
+
}
|
|
271
307
|
export function taskStateWord(task) {
|
|
272
308
|
if (task.state === 'open')
|
|
273
309
|
return 'no result';
|
|
274
|
-
|
|
275
|
-
return task.state;
|
|
276
|
-
const word = REFUSAL_WORDS[task.attempts[task.attempts.length - 1]?.code ?? ''];
|
|
277
|
-
return word ? `refused — ${word}` : 'refused';
|
|
310
|
+
return task.state === 'refused' ? 'not computed' : task.state;
|
|
278
311
|
}
|
|
279
312
|
export function taskUnmet(task) {
|
|
280
313
|
if (task.state !== 'computed')
|