@cleocode/contracts 2026.9.26 → 2026.10.2
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/cloud/api.d.ts +469 -2
- package/dist/cloud/api.d.ts.map +1 -1
- package/dist/cloud/api.js +209 -8
- package/dist/cloud/api.js.map +1 -1
- package/dist/cloud/envelope.d.ts +6 -0
- package/dist/cloud/envelope.d.ts.map +1 -1
- package/dist/cloud/envelope.js +12 -0
- package/dist/cloud/envelope.js.map +1 -1
- package/dist/config.d.ts +13 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/heavy-command-hook.d.ts +123 -0
- package/dist/heavy-command-hook.d.ts.map +1 -0
- package/dist/heavy-command-hook.js +17 -0
- package/dist/heavy-command-hook.js.map +1 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +8 -0
- package/dist/install.d.ts.map +1 -1
- package/dist/invariants/index.d.ts +2 -0
- package/dist/invariants/index.d.ts.map +1 -1
- package/dist/invariants/index.js +1 -0
- package/dist/invariants/index.js.map +1 -1
- package/dist/invariants/sync-write-invariants.d.ts +115 -0
- package/dist/invariants/sync-write-invariants.d.ts.map +1 -0
- package/dist/invariants/sync-write-invariants.js +123 -0
- package/dist/invariants/sync-write-invariants.js.map +1 -0
- package/dist/nexus-account.d.ts +91 -3
- package/dist/nexus-account.d.ts.map +1 -1
- package/dist/nexus-account.js +30 -1
- package/dist/nexus-account.js.map +1 -1
- package/dist/nexus-cloud.d.ts +718 -0
- package/dist/nexus-cloud.d.ts.map +1 -0
- package/dist/nexus-cloud.js +418 -0
- package/dist/nexus-cloud.js.map +1 -0
- package/dist/nexus-vault.d.ts +266 -0
- package/dist/nexus-vault.d.ts.map +1 -0
- package/dist/nexus-vault.js +82 -0
- package/dist/nexus-vault.js.map +1 -0
- package/dist/portable-bundle.d.ts +5 -0
- package/dist/portable-bundle.d.ts.map +1 -1
- package/dist/resource-governor.d.ts +13 -0
- package/dist/resource-governor.d.ts.map +1 -1
- package/dist/resource-governor.js +13 -0
- package/dist/resource-governor.js.map +1 -1
- package/dist/sync-schema.d.ts +34 -0
- package/dist/sync-schema.d.ts.map +1 -0
- package/dist/sync-schema.js +34 -0
- package/dist/sync-schema.js.map +1 -0
- package/dist/task.d.ts +49 -1
- package/dist/task.d.ts.map +1 -1
- package/dist/tasks.d.ts +6 -0
- package/dist/tasks.d.ts.map +1 -1
- package/dist/tasks.js.map +1 -1
- package/package.json +2 -2
- package/src/cloud/api.ts +258 -9
- package/src/cloud/envelope.ts +12 -0
- package/src/config.ts +13 -0
- package/src/heavy-command-hook.ts +136 -0
- package/src/index.ts +108 -0
- package/src/install.ts +9 -0
- package/src/invariants/index.ts +6 -0
- package/src/invariants/sync-write-invariants.ts +460 -0
- package/src/nexus-account.ts +120 -3
- package/src/nexus-cloud.ts +673 -0
- package/src/nexus-vault.ts +280 -0
- package/src/portable-bundle.ts +5 -0
- package/src/resource-governor.ts +15 -0
- package/src/sync-schema.ts +34 -0
- package/src/task.ts +49 -1
- package/src/tasks.ts +6 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync write-invariant registry (T12881): every rule TypeScript enforces on a
|
|
3
|
+
* write to a synced table, with the class that says how it survives merged
|
|
4
|
+
* apply (spec `t12859-sync-write-validator-inventory` §3.6.7, journal design
|
|
5
|
+
* §3.6).
|
|
6
|
+
*
|
|
7
|
+
* The raw applier never runs the TypeScript write paths, so a rejection site
|
|
8
|
+
* on a synced write path carries `// @sync-invariant <id>` naming an entry
|
|
9
|
+
* here, or an escape tag (`none:input-shape <reason>`,
|
|
10
|
+
* `none:local-only <reason>`). Gate 38 (`scripts/lint-sync-write-invariants.mjs`)
|
|
11
|
+
* finds the sites with the TypeScript compiler API and fails on an untagged
|
|
12
|
+
* one that is not in its shrink-only baseline, on a dangling tag, and on a
|
|
13
|
+
* registry entry that does not close (§3.6.7 rule 5).
|
|
14
|
+
*
|
|
15
|
+
* Seeded from the inventory's distinct catalogues: the trigger and index
|
|
16
|
+
* guards of §3.6.2, the fifteen post-apply check families PAC-01..PAC-15 of
|
|
17
|
+
* §3.6.5 and the typed merge rules of §3.6.6. The executable post-apply
|
|
18
|
+
* checks and the merge-rule registry belong to the merge engine (T12344) and
|
|
19
|
+
* do not exist yet, so each PAC and each rule carries `pending` naming its
|
|
20
|
+
* own open T12344 item (T12922..T12936 for PAC-01..15, T12937..T12945 for the
|
|
21
|
+
* rules); `--verify-tasks` checks those tasks are open. Trigger-covered
|
|
22
|
+
* entries carry no pending: their triggers and indexes are checked against
|
|
23
|
+
* migrations and fresh stores. The §3.5 Rule 4 guard-class footprint check is
|
|
24
|
+
* not enforced until that class exists.
|
|
25
|
+
*
|
|
26
|
+
* Types and const data only (arch gate 10).
|
|
27
|
+
*
|
|
28
|
+
* @task T12881
|
|
29
|
+
* @epic T12323
|
|
30
|
+
*/
|
|
31
|
+
/** A post-apply check not implemented yet; `task` is its T12344 item. */
|
|
32
|
+
function checkPending(task) {
|
|
33
|
+
return { task, reason: 'the post-apply check is not implemented yet (T12344 item)' };
|
|
34
|
+
}
|
|
35
|
+
/** A merge rule the merge-rule registry does not define yet; `task` is its T12344 item. */
|
|
36
|
+
function rulePending(task) {
|
|
37
|
+
return { task, reason: 'the typed merge-rule registry does not define it yet (T12344 item)' };
|
|
38
|
+
}
|
|
39
|
+
function trigger(id, tables, triggers, inventory, reason) {
|
|
40
|
+
return { id, class: 'trigger-covered', tables, sites: [], triggers, inventory, reason };
|
|
41
|
+
}
|
|
42
|
+
function pac(id, item, task, tables, footprint, reason) {
|
|
43
|
+
return {
|
|
44
|
+
id,
|
|
45
|
+
class: 'post-apply-check',
|
|
46
|
+
tables,
|
|
47
|
+
sites: [],
|
|
48
|
+
check: { footprint },
|
|
49
|
+
inventory: [item],
|
|
50
|
+
pending: checkPending(task),
|
|
51
|
+
reason,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function rule(id, task, table, columns, inventory, reason, tables = [table]) {
|
|
55
|
+
return {
|
|
56
|
+
id,
|
|
57
|
+
class: 'monotonic-merge-rule',
|
|
58
|
+
tables,
|
|
59
|
+
sites: [],
|
|
60
|
+
mergeRule: { table, columns },
|
|
61
|
+
inventory,
|
|
62
|
+
pending: rulePending(task),
|
|
63
|
+
reason,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The sync write-invariant registry, in inventory order.
|
|
68
|
+
*
|
|
69
|
+
* @task T12881
|
|
70
|
+
*/
|
|
71
|
+
export const SYNC_WRITE_INVARIANTS = Object.freeze([
|
|
72
|
+
// §3.6.2: RAISE guards and UNIQUE indexes a migration creates on synced tables.
|
|
73
|
+
trigger('task.parent.no-cycle', ['tasks_tasks'], ['tasks_tasks_parent_cycle_guard_insert', 'tasks_tasks_parent_cycle_guard_update'], ['V10', 'V11'], 'the parent chain is acyclic (the INSERT variant misses a self-parent, §3.6.3 item 2)'),
|
|
74
|
+
trigger('task.parent.type-matrix', ['tasks_tasks'], ['tasks_tasks_parent_type_matrix_insert', 'tasks_tasks_parent_type_matrix_update'], ['X1'], 'parent/child type matrix; weaker than TypeScript (§3.6.3 item 1), the rest is PAC-01'),
|
|
75
|
+
trigger('task.status.pipeline-consistency', ['tasks_tasks'], ['trg_tasks_tasks_status_pipeline_insert', 'trg_tasks_tasks_status_pipeline_update'], ['V19', 'C21'], 'T877: status and pipeline_stage agree on one row'),
|
|
76
|
+
trigger('task.relation.non-containment', ['tasks_task_relations'], ['tasks_task_relations_non_containment_insert', 'tasks_task_relations_non_containment_update'], ['V31'], 'no relation between a parent and its child, on relation writes only (§3.6.3 item 4)'),
|
|
77
|
+
trigger('task.ac.child-target', ['tasks_task_acceptance_criteria'], ['tasks_task_acceptance_child_target_insert', 'tasks_task_acceptance_child_target_update'], ['C28'], 'a child_task AC targets a direct child, on AC writes only (§3.6.3 item 4)'),
|
|
78
|
+
trigger('session.handoff.append-only', ['tasks_session_handoff_entries'], ['trg_tasks_session_handoff_no_update'], ['H2'], 'handoff entries are never updated'),
|
|
79
|
+
trigger('task.claim.lease-iso', ['tasks_tasks'], ['tasks_tasks_lease_iso_insert', 'tasks_tasks_lease_iso_update'], [], 'claim lease timestamps are ISO-8601 (t12736)'),
|
|
80
|
+
trigger('task.ac-binding.unique', ['tasks_evidence_ac_bindings'], ['uq_tasks_evidence_ac_bindings_atom_ac_type'], ['C31'], 'one binding per (evidence atom, AC, binding type)'),
|
|
81
|
+
trigger('release.version.unique', ['tasks_releases'], ['uq_tasks_releases_version'], ['REL-1'], 'one release row per version'),
|
|
82
|
+
trigger('selfimprove.dhq.one-open', ['selfimprove_dhq'], ['ux_selfimprove_dhq_open'], ['D49'], 'at most one open DHQ entry per question_hash'),
|
|
83
|
+
trigger('account.one-active-per-provider', ['accounts'], ['ux_accounts_active_provider'], ['A40'], 'at most one active account per provider (partial UNIQUE)'),
|
|
84
|
+
// §3.6.5: post-apply check families (T12344 items).
|
|
85
|
+
pac('task.tree.shape', 'PAC-01', 'T12922', ['tasks_tasks'], ['rows with a changed parent_id or type', 'their direct children and ancestor chain'], 'saga→epic→task→subtask matrix, non-saga has a parent, depth ≤ 3, no self-parent'),
|
|
86
|
+
pac('task.terminal-parent.live-children', 'PAC-02', 'T12923', ['tasks_tasks'], ['rows whose status, stage or parent changed', 'their parent and siblings'], 'no terminal parent with a live child; epic stage ≥ children; rollup re-evaluated'),
|
|
87
|
+
pac('task.dependency.graph', 'PAC-03', 'T12924', ['tasks_task_dependencies', 'tasks_tasks'], ['dependency edges inserted in the page', 'reachability from each depends_on'], 'dependencies are acyclic, with no self-edge'),
|
|
88
|
+
pac('task.done.evidence', 'PAC-04', 'T12925', ['tasks_tasks', 'tasks_task_acceptance_criteria', 'tasks_evidence_ac_bindings'], ['done rows in the page', 'their AC rows, bindings, acceptance_json and verification_json'], 'a done task has passed verification and every AC bound or waived'),
|
|
89
|
+
pac('task.ac.integrity', 'PAC-05', 'T12926', ['tasks_tasks', 'tasks_task_acceptance_criteria', 'tasks_evidence_ac_bindings'], ['tasks whose AC rows, bindings, acceptance_json, parent_id or relations changed'], 'acceptance_json ⇔ AC rows, child_task ACs match children, bindings resolve'),
|
|
90
|
+
pac('lifecycle.rows', 'PAC-06', 'T12927', ['tasks_lifecycle_pipelines', 'tasks_lifecycle_stages', 'tasks_tasks'], ['lifecycle pipeline, stage and gate rows in the page', 'the owning task row'], 'one pipeline per task, one stage row per name, pipeline_stage ≥ completed stages'),
|
|
91
|
+
pac('derived.mirrors', 'PAC-07', 'T12928', ['tasks_task_labels', 'brain_sticky_tags', 'docs_wikilinks', 'tasks_tasks'], ['owning rows whose JSON or junction changed'], 'junction tables equal their JSON source'),
|
|
92
|
+
pac('session.goal.singletons', 'PAC-08', 'T12929', ['tasks_sessions', 'tasks_task_work_history', 'tasks_goal'], ['session rows whose status, scope or chain changed', 'work-history rows per session'], 'one active session per scope, reciprocal chain, one open interval, one live goal'),
|
|
93
|
+
pac('audit.uniqueness', 'PAC-09', 'T12930', ['tasks_audit_log'], ['audit rows with a non-null idempotency key', 'rollback audit rows'], 'idempotency keys are unique across replicas; at most one rollback per receipt'),
|
|
94
|
+
pac('identity.collisions', 'PAC-10', 'T12931', ['tasks_tasks', 'tasks_sessions', 'brain_observations', 'docs_attachments'], ['inserted rows', "the natural key's index"], 'display-id and natural-key clashes become an alias or re-mint (T12341)'),
|
|
95
|
+
pac('dedupe.at-most-one', 'PAC-11', 'T12932', ['brain_decisions', 'brain_learnings', 'tasks_external_task_links'], ['inserted rows grouped by the natural key'], 'duplicates created on two devices are merged'),
|
|
96
|
+
pac('ref.soft-orphans', 'PAC-12', 'T12933', ['brain_memory_links', 'brain_page_edges', 'docs_attachment_refs', 'tasks_task_commits'], ['reference columns of the rows in the page', 'their targets'], 'cross-DB and polymorphic references resolve'),
|
|
97
|
+
pac('supersession.graph', 'PAC-13', 'T12934', ['brain_decisions', 'docs_attachments', 'tasks_architecture_decisions'], ['rows whose supersession columns changed', 'a chain walk'], 'supersession chains are acyclic with at most one successor'),
|
|
98
|
+
pac('derived.counters', 'PAC-14', 'T12935', ['docs_attachments', 'conduit_attachments', 'docs_pipeline_manifest'], ['the owning rows'], 'derived counters and cross-column facts agree with their rows'),
|
|
99
|
+
pac('apply.preconditions', 'PAC-15', 'T12936', ['tasks_tasks'], ['the whole page'], 'no apply while the local twin collapse has failed; restore is a re-baseline'),
|
|
100
|
+
// §3.6.6: typed merge rules (T12344).
|
|
101
|
+
rule('task.status.absorbing', 'T12937', 'tasks_tasks', ['status', 'completed_at', 'cancelled_at', 'cancellation_reason', 'pipeline_stage'], ['V18', 'V20', 'C22', 'P40', 'P46', 'P47'], 'done, cancelled and archived are absorbing; leaving them needs an explicit op'),
|
|
102
|
+
rule('task.pipeline-stage.max', 'T12938', 'tasks_tasks', ['pipeline_stage'], ['V21', 'C20', 'P01', 'F3'], 'pipeline_stage is the maximum by STAGE_ORDER, except an explicit restore'),
|
|
103
|
+
rule('task.verification.frozen-on-done', 'T12939', 'tasks_tasks', ['verification_json'], ['C01', 'C02', 'C03', 'C17'], 'verification is frozen once done; otherwise merged per gate'),
|
|
104
|
+
rule('session.status.terminal', 'T12940', 'tasks_sessions', ['status', 'ended_at'], ['S7', 'S8', 'S9', 'S10', 'S11', 'S17', 'S18', 'SC2', 'N1', 'SK5', 'P32'], 'ended and orphaned are terminal except on an explicit resume'),
|
|
105
|
+
rule('audit.immutable', 'T12941', 'tasks_audit_log', ['*'], ['SA3'], 'audit rows are immutable', [
|
|
106
|
+
'tasks_audit_log',
|
|
107
|
+
'audit_log',
|
|
108
|
+
]),
|
|
109
|
+
rule('sticky.status.one-way', 'T12942', 'brain_sticky_notes', ['status', 'converted_to_json'], ['SK2', 'SK3', 'B24'], 'active→{converted, archived} is one-way; converted_to_json is write-once'),
|
|
110
|
+
rule('release.status.absorbing', 'T12943', 'tasks_releases', ['status'], ['REL-2', 'REL-3', 'REL-4', 'REL-5', 'REL-6', 'REL-7', 'REL-8'], 'shipped release statuses are absorbing'),
|
|
111
|
+
rule('playbook.approval.once', 'T12944', 'tasks_playbook_approvals', ['status'], ['PB-1', 'PB-4', 'PB-7', 'P33'], 'an approval goes pending→decided once'),
|
|
112
|
+
rule('docs.lifecycle.transitions', 'T12945', 'docs_attachments', ['lifecycle_status'], ['D04', 'D05', 'D31', 'D32', 'D39', 'D50'], 'superseded is sticky; lifecycle transitions follow a matrix'),
|
|
113
|
+
// §3.6.0 identity-layer rows.
|
|
114
|
+
{
|
|
115
|
+
id: 'identity.local-minting',
|
|
116
|
+
class: 'identity-layer',
|
|
117
|
+
tables: ['tasks_tasks', 'tasks_sessions'],
|
|
118
|
+
sites: [],
|
|
119
|
+
inventory: ['V12', 'B07', 'B12'],
|
|
120
|
+
reason: 'ids minted from local state (display ids, integer PKs, device-derived ids) collide across replicas; T12341 uids and re-minting own it, no validator port can',
|
|
121
|
+
},
|
|
122
|
+
]);
|
|
123
|
+
//# sourceMappingURL=sync-write-invariants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-write-invariants.js","sourceRoot":"","sources":["../../src/invariants/sync-write-invariants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAkFH,yEAAyE;AACzE,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,2DAA2D,EAAE,CAAC;AACvF,CAAC;AAED,2FAA2F;AAC3F,SAAS,WAAW,CAAC,IAAY;IAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,oEAAoE,EAAE,CAAC;AAChG,CAAC;AAED,SAAS,OAAO,CACd,EAAU,EACV,MAAyB,EACzB,QAA2B,EAC3B,SAA4B,EAC5B,MAAc;IAEd,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAA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AAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAC1C,6DAA6D,CAC9D;IAED,8BAA8B;IAC9B;QACE,EAAE,EAAE,wBAAwB;QAC5B,KAAK,EAAE,gBAAgB;QACvB,MAAM,EAAE,CAAC,aAAa,EAAE,gBAAgB,CAAC;QACzC,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;QAChC,MAAM,EACJ,8JAA8J;KACjK;CACF,CAAC,CAAC"}
|
package/dist/nexus-account.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare const NEXUS_CLI_CLIENT_ID = "cleo-cli";
|
|
|
28
28
|
*/
|
|
29
29
|
export declare const NEXUS_LOGIN_TARGET = "nexus";
|
|
30
30
|
/** Stable error codes of the Nexus account flows. */
|
|
31
|
-
export declare const NEXUS_ACCOUNT_ERROR_CODES: readonly ["E_NEXUS_INVALID_API_URL", "E_NEXUS_NOT_SIGNED_IN", "E_NEXUS_SESSION_EXPIRED", "E_NEXUS_DEVICE_CODE_START_FAILED", "E_NEXUS_UNTRUSTED_VERIFICATION_URI", "E_NEXUS_DEVICE_CODE_EXPIRED", "E_NEXUS_ACCESS_DENIED", "E_NEXUS_DEVICE_CODE_FAILED", "E_NEXUS_REVOKE_FAILED", "E_NEXUS_REQUEST_FAILED", "E_NEXUS_NOT_A_PROJECT", "E_NEXUS_INVALID_LABEL", "E_NEXUS_UNREACHABLE", "E_NEXUS_REVOKE_PENDING", "E_NEXUS_DEVICE_SIGNED_OUT", "E_NEXUS_DEVICE_REVOKED", "E_NEXUS_CREDENTIAL_COMPROMISED", "E_NEXUS_INSUFFICIENT_SCOPE", "E_NEXUS_REPLICA_COPIED", "E_NEXUS_BUSY", "E_NEXUS_ACCOUNT_AMBIGUOUS", "E_NEXUS_DEVICE_REQUIRED"];
|
|
31
|
+
export declare const NEXUS_ACCOUNT_ERROR_CODES: readonly ["E_NEXUS_INVALID_API_URL", "E_NEXUS_NOT_SIGNED_IN", "E_NEXUS_SESSION_EXPIRED", "E_NEXUS_DEVICE_CODE_START_FAILED", "E_NEXUS_UNTRUSTED_VERIFICATION_URI", "E_NEXUS_DEVICE_CODE_EXPIRED", "E_NEXUS_ACCESS_DENIED", "E_NEXUS_DEVICE_CODE_FAILED", "E_NEXUS_REVOKE_FAILED", "E_NEXUS_REQUEST_FAILED", "E_NEXUS_NOT_A_PROJECT", "E_NEXUS_INVALID_LABEL", "E_NEXUS_UNREACHABLE", "E_NEXUS_REVOKE_PENDING", "E_NEXUS_DEVICE_SIGNED_OUT", "E_NEXUS_DEVICE_REVOKED", "E_NEXUS_CREDENTIAL_COMPROMISED", "E_NEXUS_INSUFFICIENT_SCOPE", "E_NEXUS_REPLICA_COPIED", "E_NEXUS_BUSY", "E_NEXUS_ACCOUNT_AMBIGUOUS", "E_NEXUS_DEVICE_REQUIRED", "E_NEXUS_LINK_FILE_UNSUPPORTED", "E_NEXUS_VAULT_LEASE_HELD", "E_NEXUS_VAULT_BEHIND", "E_NEXUS_VAULT_LOCAL_CHANGES", "E_NEXUS_VAULT_VERIFY_FAILED", "E_NEXUS_VAULT_KEY_UNAVAILABLE", "E_NEXUS_VAULT_NOT_LINKED", "E_NEXUS_VAULT_EMPTY", "E_NEXUS_VAULT_REFUSED", "E_NEXUS_VAULT_STREAM_UPGRADED", "E_NEXUS_VAULT_STORE_BUSY", "E_NEXUS_VAULT_TARGET_OCCUPIED"];
|
|
32
32
|
/** One of {@link NEXUS_ACCOUNT_ERROR_CODES}. */
|
|
33
33
|
export type NexusAccountErrorCode = (typeof NEXUS_ACCOUNT_ERROR_CODES)[number];
|
|
34
34
|
/** The signed-in user, as `/v1/account/me` reports it. */
|
|
@@ -120,9 +120,9 @@ export interface NexusLoginResult {
|
|
|
120
120
|
credentialsPath: string;
|
|
121
121
|
/** Non-fatal problems, e.g. the account lookup failed after a good login. */
|
|
122
122
|
warnings: string[];
|
|
123
|
-
/** The enrolled device; present only with `CLEO_NEXUS_DEVICE=
|
|
123
|
+
/** The enrolled device; present only with device credentials (the default; off with `CLEO_NEXUS_DEVICE=0`). */
|
|
124
124
|
device?: NexusLoginDevice;
|
|
125
|
-
/** Scopes of the stored device credential; present only with
|
|
125
|
+
/** Scopes of the stored device credential; present only with device credentials. */
|
|
126
126
|
scopes?: string[];
|
|
127
127
|
}
|
|
128
128
|
/** Result of `cleo logout nexus`. */
|
|
@@ -141,6 +141,53 @@ export interface NexusLogoutResult {
|
|
|
141
141
|
/** Non-fatal problems. */
|
|
142
142
|
warnings: string[];
|
|
143
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* What happened to one device's sign-out (E9) or revoke (E10) in
|
|
146
|
+
* `cleo logout nexus [--revoke]` with device credentials (the default; `CLEO_NEXUS_DEVICE=0` turns them off) (cleo-nexus
|
|
147
|
+
* device contract §3.5, M3). Holds no secret.
|
|
148
|
+
*
|
|
149
|
+
* - `confirmed`: the server answered 200, or 401 `device-signed-out` /
|
|
150
|
+
* `device-revoked` (a revoke accepts only `device-revoked`);
|
|
151
|
+
* - `pending`: no usable answer (network, timeout, 429, 5xx, or a route the
|
|
152
|
+
* server does not have yet); the credentials stay in their slot and the
|
|
153
|
+
* next `cleo logout nexus`, `cleo login nexus` or cloud command retries;
|
|
154
|
+
* - `unconfirmed`: every credential held was refused as stale, so the CLI
|
|
155
|
+
* cannot finish it; the slot is kept, and a sign-out or revoke of the
|
|
156
|
+
* device on cleocode.dev lets the next retry confirm it;
|
|
157
|
+
* - `signed-out`: a revoke found the device already signed out (E10 401
|
|
158
|
+
* `device-signed-out`). Its credentials are dead, so the CLI cannot revoke
|
|
159
|
+
* it; the revoke slot is cleared (never retried) and the device must be
|
|
160
|
+
* revoked on cleocode.dev.
|
|
161
|
+
*/
|
|
162
|
+
export type NexusDeviceEndOutcome = 'confirmed' | 'pending' | 'unconfirmed' | 'signed-out';
|
|
163
|
+
/** One device row of a {@link NexusDeviceLogoutResult}. */
|
|
164
|
+
export interface NexusDeviceLogoutRow {
|
|
165
|
+
/** Nexus user id of the entry. */
|
|
166
|
+
userId: string;
|
|
167
|
+
/** The device the request ended. */
|
|
168
|
+
deviceId: string;
|
|
169
|
+
/** `sign-out` (E9) or `revoke` (E10). */
|
|
170
|
+
action: 'sign-out' | 'revoke';
|
|
171
|
+
/** `true` for a replaced device's leftover request retried from `retired`. */
|
|
172
|
+
retired: boolean;
|
|
173
|
+
/** Server-side outcome. */
|
|
174
|
+
outcome: NexusDeviceEndOutcome;
|
|
175
|
+
/** `true` when a confirmed revoke removed the (origin, user) entry from `nexus-device.json`. */
|
|
176
|
+
removedLocally: boolean;
|
|
177
|
+
}
|
|
178
|
+
/** Result of `cleo logout nexus [--revoke]` with device credentials. Holds no secret. */
|
|
179
|
+
export interface NexusDeviceLogoutResult {
|
|
180
|
+
/** API origin. */
|
|
181
|
+
apiUrl: string;
|
|
182
|
+
/** `sign-out` or `revoke` (`--revoke`). */
|
|
183
|
+
action: 'sign-out' | 'revoke';
|
|
184
|
+
/** One row per device request settled or retried in this run, sorted by user then device. */
|
|
185
|
+
devices: NexusDeviceLogoutRow[];
|
|
186
|
+
/** The 9.24 session sign-out, when a leftover session was found for the origin. */
|
|
187
|
+
session: NexusLogoutResult | null;
|
|
188
|
+
/** Non-fatal problems: every non-`confirmed` row is named here. */
|
|
189
|
+
warnings: string[];
|
|
190
|
+
}
|
|
144
191
|
/**
|
|
145
192
|
* The binding of a local CLEO project to its Nexus registration, persisted in
|
|
146
193
|
* the project's machine-local `.cleo/nexus-link.json`, keyed by API origin.
|
|
@@ -160,6 +207,30 @@ export interface NexusProjectLink {
|
|
|
160
207
|
streamId: string;
|
|
161
208
|
/** ISO time of the last successful link. */
|
|
162
209
|
linkedAt: string;
|
|
210
|
+
/**
|
|
211
|
+
* This store's replica id as attached on the server (device contract
|
|
212
|
+
* §3.6, §3.7). A cache, not the source of truth: the store's active
|
|
213
|
+
* `_sync_replica` row is. Absent before the first device-credential link.
|
|
214
|
+
*/
|
|
215
|
+
replicaId?: string;
|
|
216
|
+
/** The Nexus device id that attached {@link NexusProjectLink.replicaId}. */
|
|
217
|
+
nexusDeviceId?: string;
|
|
218
|
+
/** ISO time the replica was last attached or confirmed. */
|
|
219
|
+
attachedAt?: string;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* What `cleo project link` did for this machine's copy of the project with a
|
|
223
|
+
* device credential (contract §3.6 steps 3 to 5). Holds no path or secret.
|
|
224
|
+
*/
|
|
225
|
+
export interface NexusReplicaAttachment {
|
|
226
|
+
/** The store's replica id (UUIDv7), now attached on the server. */
|
|
227
|
+
replicaId: string;
|
|
228
|
+
/** The Nexus device that holds it. */
|
|
229
|
+
deviceId: string;
|
|
230
|
+
/** The retired replica id when this link rebound the store (a copy, or a re-enrolled device). */
|
|
231
|
+
reboundFrom: string | null;
|
|
232
|
+
/** Server time the presence report was received, or `null` when sending it failed (see warnings). */
|
|
233
|
+
presenceAt: string | null;
|
|
163
234
|
}
|
|
164
235
|
/** Result of `cleo project link`. */
|
|
165
236
|
export interface NexusProjectLinkResult {
|
|
@@ -173,5 +244,22 @@ export interface NexusProjectLinkResult {
|
|
|
173
244
|
alreadyLinked: boolean;
|
|
174
245
|
/** Absolute path of the local binding file. */
|
|
175
246
|
linkPath: string;
|
|
247
|
+
/**
|
|
248
|
+
* The replica attach and presence report, with device credentials; `null`
|
|
249
|
+
* with the 9.24 session (`CLEO_NEXUS_DEVICE=0`), which cannot attach.
|
|
250
|
+
*/
|
|
251
|
+
replica: NexusReplicaAttachment | null;
|
|
252
|
+
/**
|
|
253
|
+
* Why this machine's copy was not attached, when device mode tried and
|
|
254
|
+
* failed (for example `E_NEXUS_REPLICA_COPIED`); `null` otherwise. The same
|
|
255
|
+
* text is also in {@link NexusProjectLinkResult.warnings}.
|
|
256
|
+
*/
|
|
257
|
+
attachError: {
|
|
258
|
+
code: string;
|
|
259
|
+
message: string;
|
|
260
|
+
fix: string | null;
|
|
261
|
+
} | null;
|
|
262
|
+
/** Non-fatal problems (for example, presence could not be sent). */
|
|
263
|
+
warnings: string[];
|
|
176
264
|
}
|
|
177
265
|
//# sourceMappingURL=nexus-account.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nexus-account.d.ts","sourceRoot":"","sources":["../src/nexus-account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wCAAwC;AACxC,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAEhE,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAE1C,qDAAqD;AACrD,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"nexus-account.d.ts","sourceRoot":"","sources":["../src/nexus-account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wCAAwC;AACxC,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAEhE,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAE1C,qDAAqD;AACrD,eAAO,MAAM,yBAAyB,u8BA+D5B,CAAC;AAEX,gDAAgD;AAChD,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB;;;;iBAIjC,CAAC;AAEH,wEAAwE;AACxE,eAAO,MAAM,8BAA8B;;;;;;iBAOzC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;iBAG/B,CAAC;AAEH,0CAA0C;AAC1C,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oB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EAAE,CAAC;CACpB"}
|
package/dist/nexus-account.js
CHANGED
|
@@ -60,8 +60,37 @@ export const NEXUS_ACCOUNT_ERROR_CODES = [
|
|
|
60
60
|
'E_NEXUS_BUSY',
|
|
61
61
|
/** Several accounts hold a device credential on one origin and none was named. */
|
|
62
62
|
'E_NEXUS_ACCOUNT_AMBIGUOUS',
|
|
63
|
-
/** An option that needs device credentials (`--read-only`)
|
|
63
|
+
/** An option that needs device credentials (`--read-only`) with `CLEO_NEXUS_DEVICE=0`. */
|
|
64
64
|
'E_NEXUS_DEVICE_REQUIRED',
|
|
65
|
+
/** `.cleo/nexus-link.json` is in a format this CLEO cannot update (written by a newer CLEO). */
|
|
66
|
+
'E_NEXUS_LINK_FILE_UNSUPPORTED',
|
|
67
|
+
// Cloud vault (encrypted snapshots, T12336 / T12337 / T12338).
|
|
68
|
+
/** Another device holds this stream's write lease (`--force` takes it and labels a fork). */
|
|
69
|
+
'E_NEXUS_VAULT_LEASE_HELD',
|
|
70
|
+
/** Another device pushed a newer snapshot than this machine last pushed or restored: pull first. */
|
|
71
|
+
'E_NEXUS_VAULT_BEHIND',
|
|
72
|
+
/** Local data changed since the last push or restore; pulling would overwrite it. */
|
|
73
|
+
'E_NEXUS_VAULT_LOCAL_CHANGES',
|
|
74
|
+
/** A snapshot's counts or hashes do not match its manifest; nothing was activated. */
|
|
75
|
+
'E_NEXUS_VAULT_VERIFY_FAILED',
|
|
76
|
+
/** The account encryption key could not be obtained for this device. */
|
|
77
|
+
'E_NEXUS_VAULT_KEY_UNAVAILABLE',
|
|
78
|
+
/** The project is not linked to Cleo Nexus (`cleo project link`). */
|
|
79
|
+
'E_NEXUS_VAULT_NOT_LINKED',
|
|
80
|
+
/** The cloud holds no snapshot to restore. */
|
|
81
|
+
'E_NEXUS_VAULT_EMPTY',
|
|
82
|
+
/** The server refused the snapshot (lineage or regression check). */
|
|
83
|
+
'E_NEXUS_VAULT_REFUSED',
|
|
84
|
+
/**
|
|
85
|
+
* The stream moved past what this CLEO's vault writes (T13034): it takes only checkpoint/v3
|
|
86
|
+
* snapshots (the server's `E_STREAM_VERSION`), or it holds data of a newer sync schema.
|
|
87
|
+
* Pull, restore and verify still work; nothing was written.
|
|
88
|
+
*/
|
|
89
|
+
'E_NEXUS_VAULT_STREAM_UPGRADED',
|
|
90
|
+
/** Another CLEO process is writing to the store a restore would replace. */
|
|
91
|
+
'E_NEXUS_VAULT_STORE_BUSY',
|
|
92
|
+
/** A project restore target already holds a different project. */
|
|
93
|
+
'E_NEXUS_VAULT_TARGET_OCCUPIED',
|
|
65
94
|
];
|
|
66
95
|
/** The signed-in user, as `/v1/account/me` reports it. */
|
|
67
96
|
export const nexusAccountUserSchema = z.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nexus-account.js","sourceRoot":"","sources":["../src/nexus-account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wCAAwC;AACxC,MAAM,CAAC,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAEhE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAE1C,qDAAqD;AACrD,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,yBAAyB;IACzB,uBAAuB;IACvB,yBAAyB;IACzB,kCAAkC;IAClC,oCAAoC;IACpC,6BAA6B;IAC7B,uBAAuB;IACvB,4BAA4B;IAC5B,uBAAuB;IACvB,wBAAwB;IACxB,uBAAuB;IACvB,uBAAuB;IACvB,wEAAwE;IACxE,yDAAyD;IACzD,qBAAqB;IACrB,oFAAoF;IACpF,wBAAwB;IACxB,oEAAoE;IACpE,2BAA2B;IAC3B,+DAA+D;IAC/D,wBAAwB;IACxB,iFAAiF;IACjF,gCAAgC;IAChC,4FAA4F;IAC5F,4BAA4B;IAC5B,mEAAmE;IACnE,wBAAwB;IACxB,iFAAiF;IACjF,cAAc;IACd,kFAAkF;IAClF,2BAA2B;IAC3B,6FAA6F;IAC7F,
|
|
1
|
+
{"version":3,"file":"nexus-account.js","sourceRoot":"","sources":["../src/nexus-account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wCAAwC;AACxC,MAAM,CAAC,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAEhE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAE1C,qDAAqD;AACrD,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,yBAAyB;IACzB,uBAAuB;IACvB,yBAAyB;IACzB,kCAAkC;IAClC,oCAAoC;IACpC,6BAA6B;IAC7B,uBAAuB;IACvB,4BAA4B;IAC5B,uBAAuB;IACvB,wBAAwB;IACxB,uBAAuB;IACvB,uBAAuB;IACvB,wEAAwE;IACxE,yDAAyD;IACzD,qBAAqB;IACrB,oFAAoF;IACpF,wBAAwB;IACxB,oEAAoE;IACpE,2BAA2B;IAC3B,+DAA+D;IAC/D,wBAAwB;IACxB,iFAAiF;IACjF,gCAAgC;IAChC,4FAA4F;IAC5F,4BAA4B;IAC5B,mEAAmE;IACnE,wBAAwB;IACxB,iFAAiF;IACjF,cAAc;IACd,kFAAkF;IAClF,2BAA2B;IAC3B,0FAA0F;IAC1F,yBAAyB;IACzB,gGAAgG;IAChG,+BAA+B;IAC/B,+DAA+D;IAC/D,6FAA6F;IAC7F,0BAA0B;IAC1B,oGAAoG;IACpG,sBAAsB;IACtB,qFAAqF;IACrF,6BAA6B;IAC7B,sFAAsF;IACtF,6BAA6B;IAC7B,wEAAwE;IACxE,+BAA+B;IAC/B,qEAAqE;IACrE,0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