@qontinui/shared-types 0.12.1 → 0.14.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qontinui/shared-types",
3
- "version": "0.12.1",
3
+ "version": "0.14.0",
4
4
  "description": "Shared TypeScript types for the Qontinui ecosystem",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -0,0 +1,152 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated.
4
+ * DO NOT MODIFY IT BY HAND. Regenerate with `just generate-types` or
5
+ * `qontinui-runner/src-tauri/scripts/generate_types.sh`.
6
+ */
7
+
8
+ /**
9
+ * One unit of the agent text corpus: a `(kind, name)` addressed bundle of
10
+ * text files, owned either by an organization or by the fleet-default layer.
11
+ *
12
+ * The content is **untrusted remote content** from the runner's point of
13
+ * view — it is markdown and shell text rather than compiled code, but it is
14
+ * instructions to an agent and it becomes files on a fleet device. Consumers
15
+ * fail soft (a malformed unit falls back to the next rung of the resolution
16
+ * chain and warns) and never fetch cross-org.
17
+ *
18
+ * This mirrors qontinui-web's `AgentTextUnitResponse` field for field, plus
19
+ * the two forward provenance fields Phase 5 fills in.
20
+ */
21
+ export interface AgentTextUnit {
22
+ /**
23
+ * Canonical digest over the whole [`files`](Self::files) map, from
24
+ * [`agent_text_unit_files_checksum`]. `None` on a row written before a
25
+ * checksum was computed.
26
+ *
27
+ * This is **not** [`crate::agent_commands::agent_command_checksum`]: that
28
+ * one digests a single body and is what the legacy `/agent-commands` wire
29
+ * still carries. The two deliberately disagree even for a one-entry map.
30
+ */
31
+ checksum?: string | null;
32
+ /**
33
+ * ISO 8601 (RFC 3339) creation timestamp.
34
+ */
35
+ created_at: string;
36
+ /**
37
+ * User who last authored this unit. **Attribution only** — it does not
38
+ * scope visibility; [`organization_id`](Self::organization_id) does.
39
+ */
40
+ created_by_user_id?: string | null;
41
+ /**
42
+ * Head of the version chain — the `version_number` of the
43
+ * [`AgentTextUnitVersion`] whose content this unit currently serves.
44
+ * Starts at 1 and only ever increases (a revert bumps it).
45
+ */
46
+ current_version: number;
47
+ /**
48
+ * The key of [`files`](Self::files) holding this unit's primary text,
49
+ * derived server-side from `(kind, name)` — see
50
+ * [`agent_text_unit_entrypoint`]. Read-only: it is recomputed on every
51
+ * response and ignored on write.
52
+ */
53
+ entrypoint: string;
54
+ /**
55
+ * The unit's current content: **relative path → text**. A command carries
56
+ * one entry; a skill carries `SKILL.md` plus siblings.
57
+ *
58
+ * Carried inline on the unit, matching the landed
59
+ * `AgentTextUnitResponse`. Note the cost that buys the convenience: a
60
+ * whole-corpus list is ~88 units / ~1.8 MB, and the runner fetches it on
61
+ * the spawn critical path under a 4 s budget, so a caller that only needs
62
+ * to know whether its cache is current should compare
63
+ * [`checksum`](Self::checksum) rather than re-reading these bytes.
64
+ */
65
+ files: {
66
+ [k: string]: string;
67
+ };
68
+ /**
69
+ * Unit id (UUID v4 string).
70
+ */
71
+ id: string;
72
+ /**
73
+ * Whether the harness may offer this unit as an invocable slash command.
74
+ *
75
+ * `false` means "carried by the corpus, never invocable": the
76
+ * underscore-prefixed units (`_gate-registration`, `_loop-control`) are
77
+ * copy-source specs that other units paste from, and `.claude/commands/`
78
+ * has no include mechanism, so they must be *present on disk* without
79
+ * appearing as `/_gate-registration`. Absent means `true`.
80
+ *
81
+ * Storage enforces the pairing with a CHECK (`left(name,1) <> '_' OR
82
+ * is_invocable = false`); [`validate_agent_text_unit_invocability`] is the
83
+ * same rule at this boundary.
84
+ * Always written on the wire, matching the landed `AgentTextUnitResponse`
85
+ * (which emits it unconditionally). `#[serde(default)]` covers reading an
86
+ * older payload that predates the field; the `#[schemars(default)]` twin
87
+ * is what puts `true` — rather than `null` — into the generated Python and
88
+ * TypeScript bindings, so a consumer that sees the field absent defaults
89
+ * it the same way Rust does.
90
+ */
91
+ is_invocable: boolean;
92
+ /**
93
+ * Whether this unit is visible to the whole organization rather than only
94
+ * its author. Absent means `false`.
95
+ */
96
+ is_shared: boolean;
97
+ /**
98
+ * What sort of unit this is. Open discriminator — see
99
+ * [`AgentTextUnitKind`].
100
+ */
101
+ kind: string;
102
+ /**
103
+ * The unit slug, e.g. `vet-plan` or `coord-revive`. It is the filename
104
+ * stem (single-file kinds) or the directory name (directory kinds) under
105
+ * `.claude/<subdir>/`, so it is a write-boundary value — validate it with
106
+ * [`validate_agent_text_unit_name`] before persisting.
107
+ */
108
+ name: string;
109
+ /**
110
+ * Owning organization (`auth.organizations.id`).
111
+ *
112
+ * **`None` is meaningful**: it is the *fleet-default* layer, resolved
113
+ * after an account override and before the runner's embedded default. It
114
+ * is also what an organization deletion leaves behind (`ondelete SET
115
+ * NULL`), which is why storage keys the NULL bucket with its own partial
116
+ * unique index — see the module docs.
117
+ */
118
+ organization_id?: string | null;
119
+ /**
120
+ * Which resolution layer this row was served from —
121
+ * [`AGENT_TEXT_UNIT_SOURCE_USER`] or [`AGENT_TEXT_UNIT_SOURCE_FLEET`].
122
+ * Server-derived, defaults to `user`.
123
+ *
124
+ * ⚠️ **Unrelated to [`source_path`](Self::source_path) /
125
+ * [`source_commit`](Self::source_commit) despite the shared prefix.** This
126
+ * field names the *layer the row came from*; those two name the *config
127
+ * repo the text was imported from*. Adjacent names, different concepts.
128
+ */
129
+ source: string;
130
+ /**
131
+ * Import provenance: the commit of the source repo (full 40-char SHA).
132
+ * `None` for a console-authored unit, or for an import from a dirty tree
133
+ * where no commit honestly describes the bytes.
134
+ */
135
+ source_commit?: string | null;
136
+ /**
137
+ * Import provenance: the repo-relative path this unit's text came from,
138
+ * e.g. `.claude/skills/coord-revive/`. `None` for a unit authored directly
139
+ * in the console.
140
+ *
141
+ * Recorded per unit at import so the console can show an operator whether
142
+ * a unit still matches its source. The path is **repo-relative on
143
+ * purpose** — an absolute one would pin a build machine's layout into
144
+ * account data.
145
+ */
146
+ source_path?: string | null;
147
+ /**
148
+ * ISO 8601 (RFC 3339) last-modification timestamp.
149
+ */
150
+ updated_at: string;
151
+ [k: string]: unknown;
152
+ }
@@ -0,0 +1,110 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated.
4
+ * DO NOT MODIFY IT BY HAND. Regenerate with `just generate-types` or
5
+ * `qontinui-runner/src-tauri/scripts/generate_types.sh`.
6
+ */
7
+
8
+ /**
9
+ * One embedded default as the **runner binary** ships it, on its way to the
10
+ * account so there is a baseline to diff an override against.
11
+ *
12
+ * ## Why this exists as a third layer
13
+ *
14
+ * [`AgentTextUnit`]'s resolution chain is
15
+ * `account override → fleet default → embedded default (runner binary)`, and
16
+ * the store holds rows for the first two only — the binary's copy has never
17
+ * had a row anywhere. That is the gap this type closes. A user who overrode
18
+ * `/implement-plan` can diff their versions against each other but not
19
+ * against what actually ships, and `ResetToDefaultDialog` cannot preview the
20
+ * text it is about to restore, because there is no baseline to put on the
21
+ * left-hand side.
22
+ *
23
+ * Plan `2026-08-31-runner-publishes-embedded-command-defaults`; the deferral
24
+ * it discharges is recorded in the code at qontinui-web's
25
+ * `settings/agent-commands/_components/VersionDiff.tsx`.
26
+ *
27
+ * ## What it is NOT
28
+ *
29
+ * * **Not an [`AgentTextUnit`].** There is no `id`, no version chain, and no
30
+ * `is_shared` — a published default is content plus provenance, not a
31
+ * corpus row with an edit history. It is the *input* to a row.
32
+ * * **Not fleet-scoped.** `organization_id` is deliberately absent from the
33
+ * wire: the runner publishes with the operator's own user bearer, so the
34
+ * server assigns the org from that credential. A client-supplied org — or
35
+ * the fleet layer's `organization_id IS NULL` — would let any signed-in
36
+ * user rewrite another tenant's baseline, or silently clobber an
37
+ * operator's deliberate fleet default.
38
+ * * **Not authoritative for provisioning.** The runner keeps resolving
39
+ * `fresh fetch → disk cache → embedded default`; this is a *display*
40
+ * baseline. Publishing it must never put the network on the
41
+ * out-of-the-box path.
42
+ *
43
+ * ## The checksum is the files-map digest, not the single-body one
44
+ *
45
+ * [`checksum`](Self::checksum) is [`agent_text_unit_files_checksum`] — the
46
+ * same digest [`AgentTextUnit::checksum`] and [`AgentTextUnitVersion`] carry,
47
+ * so a published default and the override it is diffed against are
48
+ * comparable. It is **not**
49
+ * [`crate::agent_commands::agent_command_checksum`], which digests a single
50
+ * body and is what the legacy `/agent-commands` wire still carries. Those two
51
+ * deliberately disagree even for a one-entry map, so a default digested with
52
+ * the wrong one would never compare equal to its override — an always-drifted
53
+ * baseline, which is strictly worse than the honest "baseline unavailable"
54
+ * state it would replace.
55
+ */
56
+ export interface AgentTextUnitDefault {
57
+ /**
58
+ * Canonical digest over [`files`](Self::files), from
59
+ * [`agent_text_unit_files_checksum`].
60
+ *
61
+ * Required, unlike [`AgentTextUnit::checksum`] — that one is optional only
62
+ * to describe rows written before a checksum was computed, whereas a
63
+ * publish is always freshly computed. The receiving store **recomputes it
64
+ * and rejects a mismatch**: a client-asserted digest is not evidence.
65
+ * [`checksum_matches`](Self::checksum_matches) is that check.
66
+ */
67
+ checksum: string;
68
+ /**
69
+ * The embedded content: **relative path → text**. A command carries one
70
+ * entry; a skill carries `SKILL.md` plus siblings. Same arity-agnostic
71
+ * shape as [`AgentTextUnit::files`].
72
+ */
73
+ files: {
74
+ [k: string]: string;
75
+ };
76
+ /**
77
+ * What sort of unit this default is. The corpus is `kind`-discriminated,
78
+ * so the default layer must be too — otherwise a command and a skill of
79
+ * the same name collapse into one baseline.
80
+ */
81
+ kind: string;
82
+ /**
83
+ * The unit slug, e.g. `vet-plan`. Must satisfy the same
84
+ * [`validate_agent_text_unit_name`] rules as an override: a default that
85
+ * could not be named as an override could never be paired with one for a
86
+ * diff, which is the only thing it is for.
87
+ */
88
+ name: string;
89
+ /**
90
+ * ISO 8601 (RFC 3339) publish timestamp, matching this module's wire
91
+ * convention for [`AgentTextUnit::updated_at`] and
92
+ * [`AgentTextUnitVersion::created_at`].
93
+ */
94
+ published_at: string;
95
+ /**
96
+ * The runner version that published this body, e.g. `"0.4.12"`.
97
+ *
98
+ * Carried so the UI can label the baseline **"published by runner
99
+ * vX.Y.Z"** rather than "the default" — an org whose devices run
100
+ * different builds has no single default, and the label must not claim
101
+ * otherwise. It is also the monotonic guard's input: the store rejects a
102
+ * publish older than the version it already holds.
103
+ *
104
+ * That guard is a **mitigation, not a fix** — a genuine downgrade still
105
+ * wins and equal versions tie-break last-writer — so neither this field
106
+ * nor the UI built on it may describe the baseline as authoritative.
107
+ */
108
+ published_by_version: string;
109
+ [k: string]: unknown;
110
+ }
@@ -0,0 +1,82 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated.
4
+ * DO NOT MODIFY IT BY HAND. Regenerate with `just generate-types` or
5
+ * `qontinui-runner/src-tauri/scripts/generate_types.sh`.
6
+ */
7
+
8
+ /**
9
+ * Failure modes for agent text units. Mirrors the tagged-enum shape of
10
+ * [`crate::apps::AppError`] and [`crate::agent_commands::AgentCommandError`],
11
+ * so the qontinui-web layer surfaces a rejected unit the same way it surfaces
12
+ * a rejected app registration.
13
+ *
14
+ * One variant per raise site in qontinui-web's `AgentTextUnitValidationError`,
15
+ * so a Rust caller can render exactly the refusal the store would give.
16
+ */
17
+ export type AgentTextUnitError =
18
+ | {
19
+ name: string;
20
+ reason: "invalid-name";
21
+ [k: string]: unknown;
22
+ }
23
+ | {
24
+ name: string;
25
+ reason: "reserved-name";
26
+ [k: string]: unknown;
27
+ }
28
+ | {
29
+ kind: string;
30
+ reason: "invalid-kind";
31
+ [k: string]: unknown;
32
+ }
33
+ | {
34
+ path: string;
35
+ reason: "invalid-file-path";
36
+ [k: string]: unknown;
37
+ }
38
+ | {
39
+ path: string;
40
+ reason: "reserved-file-path";
41
+ [k: string]: unknown;
42
+ }
43
+ | {
44
+ reason: "empty-file-set";
45
+ [k: string]: unknown;
46
+ }
47
+ | {
48
+ count: number;
49
+ max: number;
50
+ reason: "too-many-files";
51
+ [k: string]: unknown;
52
+ }
53
+ | {
54
+ path: string;
55
+ reason: "blank-file";
56
+ [k: string]: unknown;
57
+ }
58
+ | {
59
+ bytes: number;
60
+ max: number;
61
+ path: string;
62
+ reason: "file-too-large";
63
+ [k: string]: unknown;
64
+ }
65
+ | {
66
+ bytes: number;
67
+ max: number;
68
+ reason: "unit-too-large";
69
+ [k: string]: unknown;
70
+ }
71
+ | {
72
+ entrypoint: string;
73
+ kind: string;
74
+ name: string;
75
+ reason: "missing-entrypoint";
76
+ [k: string]: unknown;
77
+ }
78
+ | {
79
+ name: string;
80
+ reason: "underscore-not-invocable";
81
+ [k: string]: unknown;
82
+ };
@@ -0,0 +1,33 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated.
4
+ * DO NOT MODIFY IT BY HAND. Regenerate with `just generate-types` or
5
+ * `qontinui-runner/src-tauri/scripts/generate_types.sh`.
6
+ */
7
+
8
+ /**
9
+ * One `relative path → text` entry of a `files` map, as a standalone record.
10
+ *
11
+ * The map is the storage and wire form (it is one JSONB column, and it makes
12
+ * "no duplicate paths" structural rather than validated). This type is the
13
+ * **entry** form: what a per-file API operation addresses, what a per-file
14
+ * validation failure names, and what a provisioner iterates. Convert with
15
+ * [`from_map`](Self::from_map) / [`into_map`](Self::into_map).
16
+ */
17
+ export interface AgentTextUnitFile {
18
+ /**
19
+ * Path relative to the unit's own directory, `/`-separated, e.g.
20
+ * `SKILL.md` or `coord-revive.sh`. Validated by
21
+ * [`validate_agent_text_unit_file_path`].
22
+ */
23
+ path: string;
24
+ /**
25
+ * The file's full text. Written verbatim (modulo the provisioner's own
26
+ * line-ending handling); never given an executable bit, because scripts
27
+ * in this corpus are invoked as `bash <path>` and Windows has no exec bit
28
+ * anyway. "Account-supplied text written to disk" must not become
29
+ * "account-supplied program registered with the OS".
30
+ */
31
+ text: string;
32
+ [k: string]: unknown;
33
+ }
@@ -0,0 +1,72 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated.
4
+ * DO NOT MODIFY IT BY HAND. Regenerate with `just generate-types` or
5
+ * `qontinui-runner/src-tauri/scripts/generate_types.sh`.
6
+ */
7
+
8
+ /**
9
+ * One immutable entry in an [`AgentTextUnit`]'s append-only version chain.
10
+ *
11
+ * Rows are **only ever inserted**. An edit appends the next `version_number`;
12
+ * a revert appends a new version whose `files` are copied from an older one
13
+ * and whose [`restored_from`](Self::restored_from) names that older version.
14
+ * Nothing in the chain is updated or deleted, so the chain is the complete
15
+ * edit history and "revert" is itself a recorded edit.
16
+ */
17
+ export interface AgentTextUnitVersion {
18
+ /**
19
+ * The [`AgentTextUnit`] this version belongs to. Deleting the unit
20
+ * cascades to its versions.
21
+ */
22
+ agent_text_unit_id: string;
23
+ /**
24
+ * Free-text note describing what changed, supplied by the editor. A
25
+ * revert writes a generated one (e.g. `"Restored from version 2"`).
26
+ */
27
+ change_description?: string | null;
28
+ /**
29
+ * Content hash of [`files`](Self::files), from
30
+ * [`agent_text_unit_files_checksum`]. Equal checksums on two versions mean
31
+ * the content is identical, which is what makes the Phase 5 re-import
32
+ * idempotent — it is the field "did the text actually change?" is read
33
+ * off. `None` on a row written before a checksum was computed.
34
+ */
35
+ checksum?: string | null;
36
+ /**
37
+ * ISO 8601 (RFC 3339) creation timestamp. Versions are immutable, so
38
+ * there is deliberately no `updated_at`.
39
+ */
40
+ created_at: string;
41
+ /**
42
+ * User who authored this version. Attribution only.
43
+ */
44
+ created_by_user_id?: string | null;
45
+ /**
46
+ * The unit's whole content as of this version: **relative path → text**.
47
+ *
48
+ * Every key must satisfy [`validate_agent_text_unit_file_path`]; the map
49
+ * must be non-empty and must contain the unit's
50
+ * [`agent_text_unit_entrypoint`].
51
+ */
52
+ files: {
53
+ [k: string]: string;
54
+ };
55
+ /**
56
+ * Version-row id (UUID v4 string).
57
+ */
58
+ id: string;
59
+ /**
60
+ * Provenance for a revert: the `version_number` this version's content
61
+ * was copied from. `None` for an ordinary edit.
62
+ */
63
+ restored_from?: number | null;
64
+ /**
65
+ * Monotonic version number within this unit, starting at 1. Unique per
66
+ * `(agent_text_unit_id, version_number)`; the DB constraint — not
67
+ * application code — is what rejects a duplicate under concurrent
68
+ * appends.
69
+ */
70
+ version_number: number;
71
+ [k: string]: unknown;
72
+ }
@@ -21,6 +21,11 @@ export type { ActiveStatesResult } from './ActiveStatesResult';
21
21
  export type { AgentCommand } from './AgentCommand';
22
22
  export type { AgentCommandError } from './AgentCommandError';
23
23
  export type { AgentCommandVersion } from './AgentCommandVersion';
24
+ export type { AgentTextUnit } from './AgentTextUnit';
25
+ export type { AgentTextUnitDefault } from './AgentTextUnitDefault';
26
+ export type { AgentTextUnitError } from './AgentTextUnitError';
27
+ export type { AgentTextUnitFile } from './AgentTextUnitFile';
28
+ export type { AgentTextUnitVersion } from './AgentTextUnitVersion';
24
29
  export type { AgenticPhaseOutput } from './AgenticPhaseOutput';
25
30
  export type { AgenticStatus } from './AgenticStatus';
26
31
  export type { AiWorkflow } from './AiWorkflow';