@mulmoclaude/core 0.1.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/assets/helps/billing-clients-worklog.md +215 -0
- package/assets/helps/billing-invoice.md +458 -0
- package/assets/helps/business.md +104 -0
- package/assets/helps/collection-skills.md +810 -0
- package/assets/helps/custom-view.md +433 -0
- package/assets/helps/feeds.md +114 -0
- package/assets/helps/gemini.md +57 -0
- package/assets/helps/github.md +23 -0
- package/assets/helps/guide.md +61 -0
- package/assets/helps/index.md +89 -0
- package/assets/helps/lessons-collection.md +400 -0
- package/assets/helps/mulmoscript.md +249 -0
- package/assets/helps/portfolio-tracker.md +211 -0
- package/assets/helps/presentation-deck.md +828 -0
- package/assets/helps/presenthtml.md +89 -0
- package/assets/helps/sandbox.md +97 -0
- package/assets/helps/spreadsheet.md +43 -0
- package/assets/helps/storyteller.md +101 -0
- package/assets/helps/telegram.md +136 -0
- package/assets/helps/todo-collection.md +140 -0
- package/assets/helps/vocabulary.md +109 -0
- package/assets/helps/wiki.md +168 -0
- package/assets/skills-preset/mc-cooking-coach/SKILL.md +217 -0
- package/assets/skills-preset/mc-library/SKILL.md +188 -0
- package/assets/skills-preset/mc-manage-automations/SKILL.md +119 -0
- package/assets/skills-preset/mc-manage-skills/SKILL.md +141 -0
- package/assets/skills-preset/mc-wiki-deep-lint/SKILL.md +108 -0
- package/assets/skills-preset/mc-wiki-health-check/SKILL.md +61 -0
- package/assets/skills-preset/mc-wiki-ingest/SKILL.md +182 -0
- package/assets/skills-preset/mc-wiki-promote/SKILL.md +175 -0
- package/assets/skills-preset/mc-zenn/SKILL.md +136 -0
- package/dist/chunk-CKQMccvm.cjs +28 -0
- package/dist/collection/core/actionVisible.d.ts +34 -0
- package/dist/collection/core/calendarGrid.d.ts +120 -0
- package/dist/collection/core/deriveAll.d.ts +38 -0
- package/dist/collection/core/derivedFormula.d.ts +18 -0
- package/dist/collection/core/draft.d.ts +18 -0
- package/dist/collection/core/enumColors.d.ts +33 -0
- package/dist/collection/core/errorMessage.d.ts +4 -0
- package/dist/collection/core/itemLabel.d.ts +12 -0
- package/dist/collection/core/presentCollection.d.ts +13 -0
- package/dist/collection/core/promptSafety.d.ts +1 -0
- package/dist/collection/core/schema.d.ts +355 -0
- package/dist/collection/core/shortHexId.d.ts +8 -0
- package/dist/collection/core/sortItems.d.ts +29 -0
- package/dist/collection/core/uiTypes.d.ts +106 -0
- package/dist/collection/index.cjs +793 -0
- package/dist/collection/index.cjs.map +1 -0
- package/dist/collection/index.d.ts +14 -0
- package/dist/collection/index.js +740 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/paths.cjs +44 -0
- package/dist/collection/paths.cjs.map +1 -0
- package/dist/collection/paths.js +41 -0
- package/dist/collection/paths.js.map +1 -0
- package/dist/collection/server/atomic.d.ts +1 -0
- package/dist/collection/server/delete.d.ts +38 -0
- package/dist/collection/server/derive.d.ts +8 -0
- package/dist/collection/server/discoveredCollection.d.ts +18 -0
- package/dist/collection/server/discovery.d.ts +227 -0
- package/dist/collection/server/host.d.ts +77 -0
- package/dist/collection/server/index.cjs +1721 -0
- package/dist/collection/server/index.cjs.map +1 -0
- package/dist/collection/server/index.d.ts +11 -0
- package/dist/collection/server/index.js +1671 -0
- package/dist/collection/server/index.js.map +1 -0
- package/dist/collection/server/io.d.ts +114 -0
- package/dist/collection/server/paths.d.ts +52 -0
- package/dist/collection/server/spawn.d.ts +55 -0
- package/dist/collection/server/templatePath.d.ts +25 -0
- package/dist/collection/server/util.d.ts +3 -0
- package/dist/collection/server/validate.d.ts +19 -0
- package/dist/collection/server/views.d.ts +20 -0
- package/dist/deriveAll-C15OpM3K.cjs +399 -0
- package/dist/deriveAll-C15OpM3K.cjs.map +1 -0
- package/dist/deriveAll-C6BYnpBL.js +364 -0
- package/dist/deriveAll-C6BYnpBL.js.map +1 -0
- package/dist/file-change/index.cjs +72 -0
- package/dist/file-change/index.cjs.map +1 -0
- package/dist/file-change/index.d.ts +43 -0
- package/dist/file-change/index.js +66 -0
- package/dist/file-change/index.js.map +1 -0
- package/dist/notifier/engine.d.ts +72 -0
- package/dist/notifier/index.cjs +484 -0
- package/dist/notifier/index.cjs.map +1 -0
- package/dist/notifier/index.d.ts +3 -0
- package/dist/notifier/index.js +464 -0
- package/dist/notifier/index.js.map +1 -0
- package/dist/notifier/store.d.ts +18 -0
- package/dist/notifier/types.d.ts +118 -0
- package/dist/notifier/validate.d.ts +17 -0
- package/dist/scheduler/adapter.d.ts +48 -0
- package/dist/scheduler/index.cjs +352 -0
- package/dist/scheduler/index.cjs.map +1 -0
- package/dist/scheduler/index.d.ts +2 -0
- package/dist/scheduler/index.js +343 -0
- package/dist/scheduler/index.js.map +1 -0
- package/dist/scheduler/task-manager.d.ts +51 -0
- package/dist/whisper/client.cjs +241 -0
- package/dist/whisper/client.cjs.map +1 -0
- package/dist/whisper/client.d.ts +35 -0
- package/dist/whisper/client.js +239 -0
- package/dist/whisper/client.js.map +1 -0
- package/dist/whisper/ffmpeg.d.ts +6 -0
- package/dist/whisper/index.cjs +433 -0
- package/dist/whisper/index.cjs.map +1 -0
- package/dist/whisper/index.d.ts +5 -0
- package/dist/whisper/index.js +425 -0
- package/dist/whisper/index.js.map +1 -0
- package/dist/whisper/internal.d.ts +11 -0
- package/dist/whisper/models.d.ts +49 -0
- package/dist/whisper/sidecar.d.ts +8 -0
- package/dist/whisper/whisper.d.ts +28 -0
- package/dist/workspace-setup/assets.d.ts +10 -0
- package/dist/workspace-setup/index.d.ts +3 -0
- package/dist/workspace-setup/index.js +556 -0
- package/dist/workspace-setup/index.js.map +1 -0
- package/dist/workspace-setup/slug.d.ts +6 -0
- package/dist/workspace-setup/slug.js +13 -0
- package/dist/workspace-setup/slug.js.map +1 -0
- package/dist/workspace-setup/sync.d.ts +94 -0
- package/package.json +95 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FormulaContext } from './derivedFormula';
|
|
2
|
+
/** Minimal field shape the derive loop needs — accepts both the client
|
|
3
|
+
* FieldSpec and the server CollectionFieldSpec. */
|
|
4
|
+
export interface DerivableFieldSpec {
|
|
5
|
+
type: string;
|
|
6
|
+
/** When type === "ref": slug of the target collection. */
|
|
7
|
+
to?: string;
|
|
8
|
+
/** When type === "derived": formula evaluated against the record. */
|
|
9
|
+
formula?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Minimal schema shape: just the ordered field map. */
|
|
12
|
+
export interface DerivableSchema {
|
|
13
|
+
fields: Record<string, DerivableFieldSpec>;
|
|
14
|
+
}
|
|
15
|
+
export type DerivableRecord = Record<string, unknown>;
|
|
16
|
+
/** Per-target-collection cache of loaded referenced records:
|
|
17
|
+
* target collection slug → item slug → full record. Mirrors the
|
|
18
|
+
* client's `RefRecordCache` / the server's enrichment loader. */
|
|
19
|
+
export type DeriveRefRecords = Record<string, Record<string, DerivableRecord>>;
|
|
20
|
+
/** Map each `ref` field's stored slug to its loaded target record (or
|
|
21
|
+
* null when dangling / not loaded), keyed by the LOCAL field name —
|
|
22
|
+
* the shape `evaluateDerived` reads for `<field>.<col>` derefs. */
|
|
23
|
+
export declare function resolveRowRefs(schema: DerivableSchema, record: DerivableRecord, refRecords: DeriveRefRecords): NonNullable<FormulaContext["refs"]>;
|
|
24
|
+
/** Evaluate every `derived` field against `base`, saturating so a
|
|
25
|
+
* derived field can read another derived field computed in an earlier
|
|
26
|
+
* pass (`subtotal → tax → total` converges in ≤ field-count passes).
|
|
27
|
+
* Cycles can't loop forever — passes are bounded by the number of
|
|
28
|
+
* derived fields and the loop breaks as soon as a pass changes
|
|
29
|
+
* nothing. Failed formulas stay ABSENT (the UI renders them as
|
|
30
|
+
* em-dash). Returns a copy; `base` is never mutated.
|
|
31
|
+
*
|
|
32
|
+
* Derived keys already present in `base` are stripped before
|
|
33
|
+
* evaluation: computed output is host-truth, never persisted-input
|
|
34
|
+
* fallback. A record JSON can carry a stale (or forged) derived value
|
|
35
|
+
* — raw Write/Edit, legacy data — and without the strip, a failing
|
|
36
|
+
* formula would silently surface that value as if the host computed
|
|
37
|
+
* it. */
|
|
38
|
+
export declare function deriveAll(schema: DerivableSchema, base: DerivableRecord, refRecords: DeriveRefRecords): DerivableRecord;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface FormulaContext {
|
|
2
|
+
/** The record being evaluated. For derived fields in the form,
|
|
3
|
+
* this is the live draft (text + table both converted via the
|
|
4
|
+
* same `draftToRecord` pipeline). For the main table cell,
|
|
5
|
+
* this is the persisted item. */
|
|
6
|
+
record: Record<string, unknown>;
|
|
7
|
+
/** Resolved ref-target records for THIS row, keyed by the local
|
|
8
|
+
* `ref` field name. The caller (which has the schema + the linked
|
|
9
|
+
* collection's items loaded) maps each ref field's stored slug to
|
|
10
|
+
* the full target record and passes it here, so a `<field>.<col>`
|
|
11
|
+
* formula can read a numeric column off the referenced record
|
|
12
|
+
* (e.g. `shares * ticker.price`). A missing key or `null` value
|
|
13
|
+
* (unknown field / dangling slug) makes that deref evaluate to
|
|
14
|
+
* NaN → the whole formula returns `null` → em-dash, consistent
|
|
15
|
+
* with every other failure mode. Absent ⇒ no refs available. */
|
|
16
|
+
refs?: Record<string, Record<string, unknown> | null>;
|
|
17
|
+
}
|
|
18
|
+
export declare function evaluateDerived(formula: string, ctx: FormulaContext): number | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CollectionFieldSpec as FieldSpec, CollectionItem, CollectionSchema } from './schema';
|
|
2
|
+
import { EditState, TableRowDraft } from './uiTypes';
|
|
3
|
+
/** A fresh, empty row draft for a `table` field's sub-schema. */
|
|
4
|
+
export declare function emptyRow(subFields: Record<string, FieldSpec>): TableRowDraft;
|
|
5
|
+
/** Build a row draft from an existing persisted row. */
|
|
6
|
+
export declare function rowFromItem(item: Record<string, unknown>, subFields: Record<string, FieldSpec>): TableRowDraft;
|
|
7
|
+
/** Convert a full edit draft to the record to persist. */
|
|
8
|
+
export declare function draftToRecord(state: EditState, schema: CollectionSchema): CollectionItem;
|
|
9
|
+
/** Normalise a raw inline-edit input (table-cell checkbox/select) to its
|
|
10
|
+
* persisted form. Mirrors `draftToRecord`'s boolean strictness; an empty
|
|
11
|
+
* enum selection (the placeholder option) clears the field via `undefined`. */
|
|
12
|
+
export declare function coerceInlineValue(field: FieldSpec, raw: boolean | string): unknown;
|
|
13
|
+
/** Build the full record to PUT for a single-cell inline edit, without
|
|
14
|
+
* mutating `item`. A `undefined` value omits the key (enum cleared),
|
|
15
|
+
* matching `draftToRecord`'s omission semantics. */
|
|
16
|
+
export declare function buildUpdatedRecord(item: CollectionItem, key: string, value: unknown): CollectionItem;
|
|
17
|
+
/** Human-readable label of the first missing required field, or null. */
|
|
18
|
+
export declare function firstMissingRequiredField(draft: EditState, schema: CollectionSchema): string | null;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CollectionSchema } from './schema';
|
|
2
|
+
export interface EnumColorClasses {
|
|
3
|
+
/** Stat-card style: border + fill + text + hover. */
|
|
4
|
+
card: string;
|
|
5
|
+
/** Small status dot (kanban column header). */
|
|
6
|
+
dot: string;
|
|
7
|
+
/** Pill / badge / inline `<select>` fill + text (no border width). */
|
|
8
|
+
badge: string;
|
|
9
|
+
/** Border colour, paired with a `border` width class by the caller. */
|
|
10
|
+
border: string;
|
|
11
|
+
}
|
|
12
|
+
/** Neutral styling for the empty / Uncategorized bucket — never a palette
|
|
13
|
+
* colour, so an unset or unknown value reads grey across every surface. */
|
|
14
|
+
export declare const ENUM_NEUTRAL: EnumColorClasses;
|
|
15
|
+
/** The urgent notification colour (red), matching the bell's `urgent`
|
|
16
|
+
* severity. The first value a schema's `notifyWhen` flags reads this. */
|
|
17
|
+
export declare const ENUM_ALERT: EnumColorClasses;
|
|
18
|
+
/** The nudge notification colour (amber), matching the bell's `nudge`
|
|
19
|
+
* severity. Flagged `notifyWhen` values after the first read this. */
|
|
20
|
+
export declare const ENUM_NUDGE: EnumColorClasses;
|
|
21
|
+
/** Classes for the enum value at `index` in its field's `values` array. A
|
|
22
|
+
* negative index (value unset or not among the declared values) reads
|
|
23
|
+
* neutral. */
|
|
24
|
+
export declare function enumColorClasses(index: number): EnumColorClasses;
|
|
25
|
+
/** Index of `value` within an enum field's declared `values`, or -1 when the
|
|
26
|
+
* value is empty / unknown (→ neutral). */
|
|
27
|
+
export declare function enumValueIndex(values: readonly string[] | undefined, value: unknown): number;
|
|
28
|
+
/** Resolve a value's colour for enum field `fieldKey`:
|
|
29
|
+
* - Notification enum (`notifyWhen` targets it): the first flagged value (in
|
|
30
|
+
* `notifyWhen.in` order, the most urgent) reads notification red, the rest
|
|
31
|
+
* amber, and every non-flagged value neutral grey.
|
|
32
|
+
* - Any other enum: the standard palette by the value's declared index. */
|
|
33
|
+
export declare function resolveEnumColor(schema: CollectionSchema, fieldKey: string, value: unknown): EnumColorClasses;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Normalise an unknown thrown value to a display string. The view layer's host
|
|
2
|
+
* capabilities already return normalised `{ ok: false, error }` results, so this
|
|
3
|
+
* only backs the defensive `catch` around an unexpected throw. */
|
|
4
|
+
export declare function errorMessage(err: unknown): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CollectionItem, CollectionSchema } from './schema';
|
|
2
|
+
/** Which field labels a record: the schema's explicit `displayField`, else the
|
|
3
|
+
* first non-primary text-like field (so a collection without a displayField
|
|
4
|
+
* shows e.g. the title rather than the opaque primaryKey), else null → the
|
|
5
|
+
* caller falls back to the primary-key value. */
|
|
6
|
+
export declare function labelFieldFor(schema: CollectionSchema): string | null;
|
|
7
|
+
/** A record's primary-key value as a string. */
|
|
8
|
+
export declare function itemIdOf(item: CollectionItem, schema: CollectionSchema): string;
|
|
9
|
+
/** A record's display label: the resolved `labelField` value, else the
|
|
10
|
+
* primary key. Pass the result of `labelFieldFor(schema)` as `labelField`
|
|
11
|
+
* (compute it once per render rather than per item). */
|
|
12
|
+
export declare function itemLabelOf(item: CollectionItem, schema: CollectionSchema, labelField: string | null): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ToolContext, ToolDefinition, ToolResult } from 'gui-chat-protocol';
|
|
2
|
+
export declare const TOOL_NAME = "presentCollection";
|
|
3
|
+
/** Render payload carried in the tool result's `data` field; the View mounts
|
|
4
|
+
* off these. Same shape as the tool args. */
|
|
5
|
+
export interface PresentCollectionData {
|
|
6
|
+
/** Slug of the collection to display (e.g. "clients", "invoices"). */
|
|
7
|
+
collectionSlug: string;
|
|
8
|
+
/** Optional primary-key value of a single item to open on mount. */
|
|
9
|
+
itemId?: string;
|
|
10
|
+
}
|
|
11
|
+
export type PresentCollectionArgs = PresentCollectionData;
|
|
12
|
+
export declare const TOOL_DEFINITION: ToolDefinition;
|
|
13
|
+
export declare const executePresentCollection: (_context: ToolContext, args: PresentCollectionArgs) => Promise<ToolResult<PresentCollectionData, PresentCollectionData>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function defangForPrompt(value: string): string;
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/** Minimal "this collection is a feed" descriptor carried on the schema.
|
|
2
|
+
* Deliberately narrow — the canonical collection contract stays
|
|
3
|
+
* independent of the host's feeds subsystem. The host's richer retrieval
|
|
4
|
+
* spec (`IngestSpec` in `server/workspace/feeds/ingestTypes.ts`)
|
|
5
|
+
* `extends CollectionIngest`, so feed code reads the extra fields by
|
|
6
|
+
* typing feed schemas with that subtype; collection rendering only needs
|
|
7
|
+
* these three + the presence check. */
|
|
8
|
+
export interface CollectionIngest {
|
|
9
|
+
kind: string;
|
|
10
|
+
url: string;
|
|
11
|
+
schedule: string;
|
|
12
|
+
}
|
|
13
|
+
/** Retriever kinds a Feed's `ingest.kind` may declare. The host's feeds engine
|
|
14
|
+
* dispatches on these; they live here (with the schema contract) so the schema
|
|
15
|
+
* validator can enforce them. The host re-exports these from
|
|
16
|
+
* `server/workspace/feeds/ingestTypes.ts`. */
|
|
17
|
+
export declare const INGEST_KINDS: readonly ["rss", "atom", "http-json"];
|
|
18
|
+
export type IngestKind = (typeof INGEST_KINDS)[number];
|
|
19
|
+
/** Refresh cadences a Feed's `ingest.schedule` may declare. */
|
|
20
|
+
export declare const FEED_SCHEDULES: readonly ["hourly", "daily", "weekly", "on-demand"];
|
|
21
|
+
export type FeedSchedule = (typeof FEED_SCHEDULES)[number];
|
|
22
|
+
export type CollectionFieldType = "string" | "text" | "email" | "number" | "date" | "datetime" | "boolean" | "markdown" | "ref" | "money" | "enum" | "table" | "derived" | "embed" | "image" | "file" | "toggle";
|
|
23
|
+
export type CollectionSource = "user" | "project" | "feed";
|
|
24
|
+
/** Recurrence unit for a `spawn.every` advance. */
|
|
25
|
+
export type CollectionRecurUnit = "day" | "week" | "month" | "year";
|
|
26
|
+
/** How a `spawn` advances the source item's `triggerField` date to
|
|
27
|
+
* produce the successor's. All arithmetic is done on the civil
|
|
28
|
+
* (year, month, day) triple — never by adding milliseconds — so month
|
|
29
|
+
* lengths and leap years are handled correctly. */
|
|
30
|
+
export interface CollectionEvery {
|
|
31
|
+
unit: CollectionRecurUnit;
|
|
32
|
+
/** Number of `unit`s to advance (≥ 1). `interval: 3` + `unit: "month"`
|
|
33
|
+
* = quarterly; `interval: 1` + `unit: "year"` = annual. */
|
|
34
|
+
interval: number;
|
|
35
|
+
/** Day-of-month anchor for `month`/`year` units. The CANONICAL day —
|
|
36
|
+
* read from the rule, never re-derived from the prior concrete date,
|
|
37
|
+
* so "31st of every month" yields 31 → 28/29 → 31 → 30 … with no
|
|
38
|
+
* drift (it is clamped per-month at compute time, not stored
|
|
39
|
+
* clamped). `"last"` always means the last day of the target month.
|
|
40
|
+
* Omitted ⇒ preserve the source date's day (safe for days ≤ 28).
|
|
41
|
+
* Ignored for `day`/`week` units. */
|
|
42
|
+
dayOfMonth?: number | "last";
|
|
43
|
+
}
|
|
44
|
+
/** Field-driven recurrence: the advance interval is selected PER RECORD by
|
|
45
|
+
* the value of an `enum` field (`fromField`), looked up in `map`. Lets one
|
|
46
|
+
* collection mix daily / weekly / monthly obligations in a single list — the
|
|
47
|
+
* host reads `record[fromField]`, finds the matching `CollectionEvery`, and
|
|
48
|
+
* advances by it. `fromField` must point at a top-level `enum` field whose
|
|
49
|
+
* `values` the `map` keys exactly cover (validated at discovery), and must
|
|
50
|
+
* itself be carried/`set` onto the successor so the chain keeps recurring. */
|
|
51
|
+
export interface CollectionEveryFieldDriven {
|
|
52
|
+
/** Top-level `enum` field whose value selects the interval. */
|
|
53
|
+
fromField: string;
|
|
54
|
+
/** Interval per enum value. Keys exactly cover `fromField`'s `values`;
|
|
55
|
+
* each value is a literal {@link CollectionEvery}. */
|
|
56
|
+
map: Record<string, CollectionEvery>;
|
|
57
|
+
}
|
|
58
|
+
/** The `every` of a `spawn`: either a single literal interval applied to
|
|
59
|
+
* every record, or a per-record interval selected by an `enum` field. The
|
|
60
|
+
* literal arm is what `advanceTriggerDate` consumes — the field-driven arm
|
|
61
|
+
* is resolved down to one of its `map` values before the date math runs. */
|
|
62
|
+
export type CollectionSpawnEvery = CollectionEvery | CollectionEveryFieldDriven;
|
|
63
|
+
/** Narrowing guard: true when `every` is the field-driven arm. */
|
|
64
|
+
export declare function isFieldDrivenEvery(every: CollectionSpawnEvery): every is CollectionEveryFieldDriven;
|
|
65
|
+
/** Host-driven recurrence: when a record satisfies `when`, the host
|
|
66
|
+
* creates the next record with a forward-advanced `triggerField` date.
|
|
67
|
+
* The successor's id and contents are a pure function of (source
|
|
68
|
+
* record, this rule); creation is create-if-absent, so the mechanism
|
|
69
|
+
* stays convergent — observing the predicate N times writes one
|
|
70
|
+
* successor. Requires the schema to declare `triggerField`. */
|
|
71
|
+
export interface CollectionSpawn {
|
|
72
|
+
/** Predicate that fires the spawn (a `CollectionWhen`). Defaults to
|
|
73
|
+
* "`completionField` value ∈ `completionDoneValues`" (i.e. spawn the
|
|
74
|
+
* next instance when this one is done). */
|
|
75
|
+
when?: CollectionWhen;
|
|
76
|
+
/** How to advance `triggerField` from the source to the successor —
|
|
77
|
+
* either a single literal interval or a per-record, field-driven map. */
|
|
78
|
+
every: CollectionSpawnEvery;
|
|
79
|
+
/** Record fields copied verbatim onto the successor. Fields not listed
|
|
80
|
+
* here, not in `set`, and not the trigger / primary keys start
|
|
81
|
+
* blank. */
|
|
82
|
+
carry?: string[];
|
|
83
|
+
/** Fields forced to fixed values on the successor (typically resetting
|
|
84
|
+
* the status field to its pending value). */
|
|
85
|
+
set?: Record<string, unknown>;
|
|
86
|
+
}
|
|
87
|
+
/** The kind of work an action kicks off. v1 ships only `"chat"` —
|
|
88
|
+
* start a new chat in a role with a templated seed prompt. The enum
|
|
89
|
+
* reserves room for a future `"mutate"` (status transitions) without
|
|
90
|
+
* another schema-shape change. */
|
|
91
|
+
export type CollectionActionKind = "chat";
|
|
92
|
+
/** Optional visibility predicate: the target (an action button or a
|
|
93
|
+
* field) renders only when the open record's `field` (stringified) is
|
|
94
|
+
* one of `in`. Generic and domain-free — the host evaluates it against
|
|
95
|
+
* the record with no knowledge of what the field means. Absent ⇒
|
|
96
|
+
* always shown. */
|
|
97
|
+
export interface CollectionWhen {
|
|
98
|
+
/** Top-level record field key whose value gates visibility. */
|
|
99
|
+
field: string;
|
|
100
|
+
/** Allowed values; the target shows when `String(record[field])` is
|
|
101
|
+
* one of these. Non-empty. */
|
|
102
|
+
in: string[];
|
|
103
|
+
}
|
|
104
|
+
/** @deprecated Name retained for back-compat; use {@link CollectionWhen}.
|
|
105
|
+
* Both actions and fields share the same predicate shape. */
|
|
106
|
+
export type CollectionActionWhen = CollectionWhen;
|
|
107
|
+
/** What a custom view's capability token is allowed to do against the
|
|
108
|
+
* collection's data endpoint. `read` returns enriched records (getItems
|
|
109
|
+
* semantics); `write` validates-and-stores rows (putItems semantics).
|
|
110
|
+
* There is deliberately no `delete` — a view can never do more than the
|
|
111
|
+
* agent's own `manageCollection` tool. */
|
|
112
|
+
export type CollectionViewCapability = "read" | "write";
|
|
113
|
+
/** A custom (LLM-authored) HTML view for a collection. The host renders
|
|
114
|
+
* `file` in a sandboxed iframe over the collection's records; the view
|
|
115
|
+
* reaches its data only through a slug- and capability-scoped token (see
|
|
116
|
+
* `server/api/auth/viewToken.ts`). Pure data — the host holds no
|
|
117
|
+
* view-specific code; meaning lives in the HTML file + this registration. */
|
|
118
|
+
export interface CollectionCustomView {
|
|
119
|
+
/** Stable id; the view-mode selector key (`custom:<id>`) and the
|
|
120
|
+
* capability-token clamp key. Must be a valid slug. */
|
|
121
|
+
id: string;
|
|
122
|
+
/** Button label in the view-mode selector (author-authored, like field
|
|
123
|
+
* labels — not run through i18n). */
|
|
124
|
+
label: string;
|
|
125
|
+
/** Optional Material-icon name for the selector button. */
|
|
126
|
+
icon?: string;
|
|
127
|
+
/** Skill-relative path to the HTML file under `views/` (e.g.
|
|
128
|
+
* `views/year.html`). Path-safe, must end in `.html`. */
|
|
129
|
+
file: string;
|
|
130
|
+
/** What the view may do with the data endpoint. Defaults to `["read"]`
|
|
131
|
+
* (least privilege); declare `["read","write"]` only for views that
|
|
132
|
+
* edit records. The mint endpoint clamps any requested caps to this. */
|
|
133
|
+
capabilities?: CollectionViewCapability[];
|
|
134
|
+
}
|
|
135
|
+
/** A schema-declared, per-record action rendered as a button in the
|
|
136
|
+
* read-only detail view. Pure UI/behaviour directive — never stored,
|
|
137
|
+
* never validated against record data. All domain specifics (label,
|
|
138
|
+
* role, template) live here in the schema / skill folder, so the host
|
|
139
|
+
* stays generic. */
|
|
140
|
+
export interface CollectionAction {
|
|
141
|
+
/** Stable id (used in the dispatch route + testids). */
|
|
142
|
+
id: string;
|
|
143
|
+
/** Button text (English, like field labels). */
|
|
144
|
+
label: string;
|
|
145
|
+
/** Material-icon name shown on the button. */
|
|
146
|
+
icon?: string;
|
|
147
|
+
/** What the action does. v1: `"chat"`. */
|
|
148
|
+
kind: CollectionActionKind;
|
|
149
|
+
/** `kind: "chat"`: the role id the new chat runs in. */
|
|
150
|
+
role: string;
|
|
151
|
+
/** `kind: "chat"`: skill-relative path to the template file whose
|
|
152
|
+
* text becomes the seed prompt body (e.g. `templates/invoice.md`). */
|
|
153
|
+
template: string;
|
|
154
|
+
/** Optional visibility predicate; the button renders only when the
|
|
155
|
+
* open record matches (see CollectionWhen). Absent ⇒ always
|
|
156
|
+
* shown. */
|
|
157
|
+
when?: CollectionWhen;
|
|
158
|
+
}
|
|
159
|
+
export interface CollectionFieldSpec {
|
|
160
|
+
type: CollectionFieldType;
|
|
161
|
+
label: string;
|
|
162
|
+
/** True for the field whose value is the record's filename (no
|
|
163
|
+
* separate auto-id). Exactly one field per schema may set this. */
|
|
164
|
+
primary?: boolean;
|
|
165
|
+
required?: boolean;
|
|
166
|
+
/** When `type === "ref"` or `type === "embed"`: the slug of the
|
|
167
|
+
* target collection. For `ref` the record stores the target
|
|
168
|
+
* item's primary-key slug and the host renders a clickable link
|
|
169
|
+
* + dropdown picker. For `embed` the host pulls a *fixed* record
|
|
170
|
+
* (see `id`) from the target and renders its fields read-only in
|
|
171
|
+
* the detail view. Required for both; ignored on every other
|
|
172
|
+
* type. */
|
|
173
|
+
to?: string;
|
|
174
|
+
/** When `type === "embed"`: the primary-key value of the fixed
|
|
175
|
+
* record to pull from the `to` collection (e.g. `me` for the
|
|
176
|
+
* singleton mc-profile). Nothing is stored on this record — the
|
|
177
|
+
* embed is a display-only directive resolved at render time, so
|
|
178
|
+
* it never appears in the list table or the edit form. Required
|
|
179
|
+
* when type is `embed`; ignored on every other type. */
|
|
180
|
+
id?: string;
|
|
181
|
+
/** When `type === "money"` (or `type === "derived"` with
|
|
182
|
+
* `display: "money"`): a literal ISO 4217 currency code passed to
|
|
183
|
+
* `Intl.NumberFormat` for display — fixed for every record. The
|
|
184
|
+
* stored value is always a plain decimal number; currency is
|
|
185
|
+
* presentation only. Mutually substitutable with `currencyField`:
|
|
186
|
+
* a money field must declare at least one of the two. */
|
|
187
|
+
currency?: string;
|
|
188
|
+
/** When `type === "money"` (or `type === "derived"` with
|
|
189
|
+
* `display: "money"`): the name of a sibling record field whose
|
|
190
|
+
* value holds the ISO 4217 code, letting currency vary per record
|
|
191
|
+
* (e.g. an invoice's `currency` enum). The renderer reads
|
|
192
|
+
* `record[currencyField]` and falls back to the literal `currency`
|
|
193
|
+
* (then "USD") when the field is absent or empty. Resolved against
|
|
194
|
+
* the top-level record even for money sub-fields inside a table. */
|
|
195
|
+
currencyField?: string;
|
|
196
|
+
/** When `type === "enum"`: the closed set of allowed string
|
|
197
|
+
* values. The form renders a `<select>` populated from this
|
|
198
|
+
* list; storage is a plain string. Required when type is
|
|
199
|
+
* `enum`; ignored on every other type. */
|
|
200
|
+
values?: readonly string[];
|
|
201
|
+
/** When `type === "table"`: the sub-schema for each row (a flat
|
|
202
|
+
* record of non-table / non-derived field specs). Required when
|
|
203
|
+
* type is `table`. v0 disallows nested tables and derived
|
|
204
|
+
* columns to keep the editor + evaluator simple. */
|
|
205
|
+
of?: Record<string, CollectionFieldSpec>;
|
|
206
|
+
/** When `type === "derived"`: a tiny expression evaluated against
|
|
207
|
+
* the record. Supports `+ - * /`, parens, identifier refs to
|
|
208
|
+
* top-level fields, `sum(tableField[].col)`, and
|
|
209
|
+
* `sum(tableField[].col * tableField[].col)`. See
|
|
210
|
+
* `src/utils/collections/derivedFormula.ts`. Required when type
|
|
211
|
+
* is `derived`. */
|
|
212
|
+
formula?: string;
|
|
213
|
+
/** When `type === "derived"`: an inner field type the computed
|
|
214
|
+
* value should be rendered as (e.g. `"money"` so $1,234.56 is
|
|
215
|
+
* formatted). Defaults to `"number"`. */
|
|
216
|
+
display?: CollectionFieldType;
|
|
217
|
+
/** Optional visibility predicate: this field renders only when the
|
|
218
|
+
* record matches (e.g. hide a `rating` field until `visited` is
|
|
219
|
+
* `true` via `{ field: "visited", in: ["true"] }`). Applies to the
|
|
220
|
+
* list cell (blank when hidden), the edit form (hidden live as the
|
|
221
|
+
* gating field changes), and the detail view. Purely presentational
|
|
222
|
+
* — a hidden field's stored value is never cleared. `when.field`
|
|
223
|
+
* must name another top-level field. Absent ⇒ always shown. Only
|
|
224
|
+
* honoured on top-level fields, not inside a `table`'s `of`. */
|
|
225
|
+
when?: CollectionWhen;
|
|
226
|
+
/** When `type === "toggle"`: the name of the top-level `enum` field this
|
|
227
|
+
* checkbox projects. The toggle stores nothing itself — it reads and
|
|
228
|
+
* writes this field. Required when type is `toggle`; ignored otherwise.
|
|
229
|
+
* Must name a real `enum` field. */
|
|
230
|
+
field?: string;
|
|
231
|
+
/** When `type === "toggle"`: the enum value that means "checked". The
|
|
232
|
+
* box is checked when the projected `field` equals this; checking writes
|
|
233
|
+
* it. Required when type is `toggle`; must be one of the enum's `values`. */
|
|
234
|
+
onValue?: string;
|
|
235
|
+
/** When `type === "toggle"`: the enum value written when the box is
|
|
236
|
+
* unchecked. Required when type is `toggle`; must be one of the enum's
|
|
237
|
+
* `values`. */
|
|
238
|
+
offValue?: string;
|
|
239
|
+
}
|
|
240
|
+
export interface CollectionSchema {
|
|
241
|
+
/** Human-facing collection name (sidebar, header). */
|
|
242
|
+
title: string;
|
|
243
|
+
/** Material-icon name shown next to the title. */
|
|
244
|
+
icon: string;
|
|
245
|
+
/** Workspace-relative folder holding one-JSON-per-record. Validated
|
|
246
|
+
* to live under the workspace root at load time. */
|
|
247
|
+
dataPath: string;
|
|
248
|
+
/** Field name whose value doubles as the record's filename. */
|
|
249
|
+
primaryKey: string;
|
|
250
|
+
/** When set, the collection is a singleton: at most one record,
|
|
251
|
+
* whose primary key is fixed to this value (e.g. `me` for the
|
|
252
|
+
* business profile). The host pre-fills + locks the create form's
|
|
253
|
+
* primary key and hides Add once the record exists. */
|
|
254
|
+
singleton?: string;
|
|
255
|
+
/** Ordered map: insertion order = column order in the table view. */
|
|
256
|
+
fields: Record<string, CollectionFieldSpec>;
|
|
257
|
+
/** Optional per-record actions rendered as buttons in the detail
|
|
258
|
+
* view (e.g. "Generate PDF"). Order = button order. */
|
|
259
|
+
actions?: CollectionAction[];
|
|
260
|
+
/** Optional collection-level actions rendered as buttons in the
|
|
261
|
+
* collection header (e.g. "Extend the course"). Unlike `actions`,
|
|
262
|
+
* these carry no record context: the seed prompt injects a compact
|
|
263
|
+
* progress summary of every record instead. The `when` predicate is
|
|
264
|
+
* not evaluated (there is no record to gate on). Order = button order. */
|
|
265
|
+
collectionActions?: CollectionAction[];
|
|
266
|
+
/** Name of the field whose value marks an item as "done". When set,
|
|
267
|
+
* a notification fires on item create (unless the item is born done)
|
|
268
|
+
* and clears when the field's value transitions into
|
|
269
|
+
* `completionDoneValues`. Must name a real field in `fields`. */
|
|
270
|
+
completionField?: string;
|
|
271
|
+
/** The set of values for `completionField` that count as "done"
|
|
272
|
+
* (e.g. `["Done"]` for a todo status field, `["paid"]` for an
|
|
273
|
+
* invoice). Non-empty. Compared as strings. */
|
|
274
|
+
completionDoneValues?: readonly string[];
|
|
275
|
+
/** Name of the field whose value is shown as the human-readable
|
|
276
|
+
* label in a completion notification's title (e.g. a `name` field,
|
|
277
|
+
* so the bell reads `Contacts: Jane Doe` instead of the opaque
|
|
278
|
+
* primaryKey). Must name a real field in `fields`. When unset — or
|
|
279
|
+
* when the record's value for it is empty — the title falls back to
|
|
280
|
+
* the record's primaryKey value. Display-only; never stored. */
|
|
281
|
+
displayField?: string;
|
|
282
|
+
/** Name of a `date` field that gates this item's completion
|
|
283
|
+
* notification: the bell is suppressed until the clock reaches that
|
|
284
|
+
* date (compared at day-granularity in the server's local timezone),
|
|
285
|
+
* instead of firing on create. Requires `completionField` /
|
|
286
|
+
* `completionDoneValues` (the bell still clears via the done value).
|
|
287
|
+
* Must name a real `date` field. Absent ⇒ fire on create, as before. */
|
|
288
|
+
triggerField?: string;
|
|
289
|
+
/** Lead time in whole days: fire the bell this many days BEFORE
|
|
290
|
+
* `triggerField` (so `10` shows the reminder 10 days early). The lead
|
|
291
|
+
* is applied at fire time, not stored, so it composes with `spawn` —
|
|
292
|
+
* every recurred cycle fires the same number of days before its own
|
|
293
|
+
* trigger. Non-negative integer; requires `triggerField`. Default 0
|
|
294
|
+
* (fire on the trigger date). */
|
|
295
|
+
triggerLeadDays?: number;
|
|
296
|
+
/** Host-driven recurrence. When set, requires `triggerField`. See
|
|
297
|
+
* {@link CollectionSpawn}. */
|
|
298
|
+
spawn?: CollectionSpawn;
|
|
299
|
+
/** Name of a `date` field that anchors the optional calendar view: a
|
|
300
|
+
* month grid where each record lands on the day cell matching this
|
|
301
|
+
* field's value. When unset, the calendar toggle still appears if the
|
|
302
|
+
* schema has any `date` field (the first one, in declaration order, is
|
|
303
|
+
* used by default and is switchable in-view). Set this to pin a specific
|
|
304
|
+
* anchor. Must name a real `date` field. */
|
|
305
|
+
calendarField?: string;
|
|
306
|
+
/** Name of a second `date` field marking the END of a multi-day span on
|
|
307
|
+
* the calendar: the record renders from `calendarField` through this
|
|
308
|
+
* date inclusive. Requires `calendarField`. Must name a real `date`
|
|
309
|
+
* field. Absent ⇒ single-day placement. */
|
|
310
|
+
calendarEndField?: string;
|
|
311
|
+
/** Name of a string field holding a free-form time or time-range
|
|
312
|
+
* (e.g. "14:00-17:00", "17:00-", "16:30") that places records on the
|
|
313
|
+
* calendar's day (time-allocation) view. Consulted only when the calendar
|
|
314
|
+
* date fields are date-only. Requires `calendarField`. */
|
|
315
|
+
calendarTimeField?: string;
|
|
316
|
+
/** Name of an `enum` field that groups records into columns on the
|
|
317
|
+
* optional Kanban board: each record lands in the column matching its
|
|
318
|
+
* value, with empty/unknown values collected in an "Uncategorized"
|
|
319
|
+
* column. When unset, the Kanban toggle still appears if the schema has
|
|
320
|
+
* any `enum` field (the first one, in declaration order, is used by
|
|
321
|
+
* default and is switchable in-view). Set this to pin a specific group
|
|
322
|
+
* field. Must name a real `enum` field. */
|
|
323
|
+
kanbanField?: string;
|
|
324
|
+
/** Optional custom (LLM-authored) HTML views, each rendered in a
|
|
325
|
+
* sandboxed iframe over the records. Absent ⇒ only the built-in
|
|
326
|
+
* field-derived views (table / calendar / kanban / dashboard). See
|
|
327
|
+
* {@link CollectionCustomView}. */
|
|
328
|
+
views?: CollectionCustomView[];
|
|
329
|
+
/** Optional predicate that gates the completion bell: when set, the bell
|
|
330
|
+
* fires only for records whose `String(record[notifyWhen.field])` is one
|
|
331
|
+
* of `notifyWhen.in` (e.g. notify only `high`/`urgent` priority todos).
|
|
332
|
+
* Reuses the `when` predicate shape. Requires `completionField` — it
|
|
333
|
+
* narrows that bell rather than introducing a second one. The bell still
|
|
334
|
+
* clears on done / delete / when the predicate stops matching. Absent ⇒
|
|
335
|
+
* notify for every open record (the prior behaviour). `notifyWhen.field`
|
|
336
|
+
* must name a real top-level field. */
|
|
337
|
+
notifyWhen?: CollectionWhen;
|
|
338
|
+
/** Optional declarative retrieval config. When present, this collection
|
|
339
|
+
* is a "Feed": the host periodically fetches `ingest.url`, maps the
|
|
340
|
+
* response into records, and upserts them by `primaryKey`. Only feeds
|
|
341
|
+
* discovered from the `<workspace>/feeds/` registry carry this; skill
|
|
342
|
+
* collections omit it. The host's feeds subsystem narrows this to its
|
|
343
|
+
* richer `IngestSpec` (which `extends CollectionIngest`). */
|
|
344
|
+
ingest?: CollectionIngest;
|
|
345
|
+
}
|
|
346
|
+
export interface CollectionSummary {
|
|
347
|
+
slug: string;
|
|
348
|
+
title: string;
|
|
349
|
+
icon: string;
|
|
350
|
+
source: CollectionSource;
|
|
351
|
+
}
|
|
352
|
+
export interface CollectionDetail extends CollectionSummary {
|
|
353
|
+
schema: CollectionSchema;
|
|
354
|
+
}
|
|
355
|
+
export type CollectionItem = Record<string, unknown>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 8-char hex id — short, slug-safe, and editable. Produces the same id *shape*
|
|
3
|
+
* as the server's `generateItemId()` (8 hex chars) so a UI-created collection
|
|
4
|
+
* record looks like one the server would have generated for a form submitted
|
|
5
|
+
* with a blank primary key. The source of randomness differs (UUID-derived here
|
|
6
|
+
* vs `randomBytes` on the server); only the shape is intentionally shared.
|
|
7
|
+
*/
|
|
8
|
+
export declare function shortHexId(): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CollectionItem, CollectionFieldSpec } from './schema';
|
|
2
|
+
export type SortDirection = "asc" | "desc";
|
|
3
|
+
export interface SortState {
|
|
4
|
+
/** Field key of the single active sort column. */
|
|
5
|
+
field: string;
|
|
6
|
+
direction: SortDirection;
|
|
7
|
+
}
|
|
8
|
+
/** A row's comparable value for the active field. Exactly one of `num` /
|
|
9
|
+
* `str` is set when not empty; `empty` rows always sort last. */
|
|
10
|
+
export interface SortValue {
|
|
11
|
+
empty: boolean;
|
|
12
|
+
num?: number;
|
|
13
|
+
str?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function isSortableField(field: CollectionFieldSpec): boolean;
|
|
16
|
+
/** Cycle one column's state: none → asc → desc → none. */
|
|
17
|
+
export declare function nextSortDirection(current: SortDirection | null): SortDirection | null;
|
|
18
|
+
export declare function numericSortValue(raw: unknown): SortValue;
|
|
19
|
+
export declare function stringSortValue(raw: unknown): SortValue;
|
|
20
|
+
export declare function dateSortValue(raw: unknown): SortValue;
|
|
21
|
+
/** Enum sorts by the value's index in the declared `values` list. A value
|
|
22
|
+
* outside the list (or unset) is treated as empty → last. */
|
|
23
|
+
export declare function enumSortValue(values: readonly string[] | undefined, raw: unknown): SortValue;
|
|
24
|
+
/** Boolean / toggle: false < true, never empty (unset reads as false). */
|
|
25
|
+
export declare function boolSortValue(checked: boolean): SortValue;
|
|
26
|
+
export declare function compareSortValues(left: SortValue, right: SortValue): number;
|
|
27
|
+
/** Stable sort of `items` by `valueOf`. Empties always last; ties hold
|
|
28
|
+
* source order. Returns a new array (does not mutate `items`). */
|
|
29
|
+
export declare function sortItems(items: readonly CollectionItem[], direction: SortDirection, valueOf: (item: CollectionItem) => SortValue): CollectionItem[];
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { CollectionDetail, CollectionItem, CollectionSchema, CollectionSummary } from './schema';
|
|
2
|
+
/** A record file the server couldn't load or that violates the schema —
|
|
3
|
+
* silently skipped at read time (mirror of the server `RecordIssue`). */
|
|
4
|
+
export interface CollectionRecordIssue {
|
|
5
|
+
/** Record filename, e.g. `lesson-003.json`. */
|
|
6
|
+
file: string;
|
|
7
|
+
/** Human-readable problem, written to be actionable by the LLM. */
|
|
8
|
+
problem: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CollectionDetailResponse {
|
|
11
|
+
collection: CollectionDetail;
|
|
12
|
+
items: CollectionItem[];
|
|
13
|
+
/** Record files that failed validation; drives the in-view Repair prompt. */
|
|
14
|
+
issues?: CollectionRecordIssue[];
|
|
15
|
+
}
|
|
16
|
+
export interface ItemMutationResponse {
|
|
17
|
+
itemId: string;
|
|
18
|
+
item: CollectionItem;
|
|
19
|
+
}
|
|
20
|
+
/** One row of a `table`-typed field, in draft form. */
|
|
21
|
+
export interface TableRowDraft {
|
|
22
|
+
text: Record<string, string>;
|
|
23
|
+
bool: Record<string, boolean>;
|
|
24
|
+
boolOriginallyPresent: Record<string, boolean>;
|
|
25
|
+
boolTouched: Record<string, boolean>;
|
|
26
|
+
}
|
|
27
|
+
export interface EditState {
|
|
28
|
+
mode: "create" | "edit";
|
|
29
|
+
text: Record<string, string>;
|
|
30
|
+
bool: Record<string, boolean>;
|
|
31
|
+
boolOriginallyPresent: Record<string, boolean>;
|
|
32
|
+
boolTouched: Record<string, boolean>;
|
|
33
|
+
table: Record<string, TableRowDraft[]>;
|
|
34
|
+
/** For edit mode: the original item id pinned to the URL. */
|
|
35
|
+
originalId: string | null;
|
|
36
|
+
}
|
|
37
|
+
/** Per-target-collection cache: an item's primary-key slug → display label. */
|
|
38
|
+
export type RefDisplayMap = Record<string, string>;
|
|
39
|
+
export type RefCache = Record<string, RefDisplayMap>;
|
|
40
|
+
/** Per-target-collection cache of full referenced records, for `<field>.<col>`
|
|
41
|
+
* derefs in derived formulas. */
|
|
42
|
+
export type RefRecordMap = Record<string, CollectionItem>;
|
|
43
|
+
export type RefRecordCache = Record<string, RefRecordMap>;
|
|
44
|
+
/** Per-target cache for `embed` fields: the target collection's schema + items. */
|
|
45
|
+
export interface EmbedTargetData {
|
|
46
|
+
schema: CollectionSchema;
|
|
47
|
+
items: CollectionItem[];
|
|
48
|
+
}
|
|
49
|
+
export type EmbedCache = Record<string, EmbedTargetData>;
|
|
50
|
+
/** Option shown in a `ref` field's `<select>` dropdown. */
|
|
51
|
+
export interface RefOption {
|
|
52
|
+
slug: string;
|
|
53
|
+
display: string;
|
|
54
|
+
}
|
|
55
|
+
export interface EmbedRow {
|
|
56
|
+
/** Sub-field key (used for `:key` + testids). */
|
|
57
|
+
key: string;
|
|
58
|
+
label: string;
|
|
59
|
+
/** Sub-field type — the renderer branches on "boolean" / "markdown". */
|
|
60
|
+
type: string;
|
|
61
|
+
/** Raw value, used only for the boolean check / em-dash. */
|
|
62
|
+
value: unknown;
|
|
63
|
+
/** Pre-formatted string for every non-boolean render path. */
|
|
64
|
+
display: string;
|
|
65
|
+
}
|
|
66
|
+
export interface EmbedView {
|
|
67
|
+
/** False when the target collection has no record with the embed's `id`
|
|
68
|
+
* (or the target couldn't be loaded) — the renderer shows a "missing"
|
|
69
|
+
* message + a link to create it. */
|
|
70
|
+
found: boolean;
|
|
71
|
+
rows: EmbedRow[];
|
|
72
|
+
/** Target collection slug, for the "create it" link + message. */
|
|
73
|
+
targetSlug: string;
|
|
74
|
+
/** The fixed record id the embed points at, for the message. */
|
|
75
|
+
recordId: string;
|
|
76
|
+
}
|
|
77
|
+
/** Active-notification severity for a record, used to accent flagged cards
|
|
78
|
+
* (kanban left-stripe, etc.). The host computes these from its notifier and
|
|
79
|
+
* passes them in; this is the structural type the view layer accepts. The host's
|
|
80
|
+
* own `NotifierSeverity` is the identical union, so its maps pass through. */
|
|
81
|
+
export type CollectionNotifySeverity = "info" | "nudge" | "urgent";
|
|
82
|
+
/** Response of the collections list endpoint (`API_ROUTES.collections.list`). */
|
|
83
|
+
export interface CollectionsListResponse {
|
|
84
|
+
collections: CollectionSummary[];
|
|
85
|
+
}
|
|
86
|
+
/** A row in the feeds index — a data-source collection from the workspace's
|
|
87
|
+
* `feeds/` registry. */
|
|
88
|
+
export interface FeedSummary {
|
|
89
|
+
slug: string;
|
|
90
|
+
title: string;
|
|
91
|
+
icon: string;
|
|
92
|
+
kind: string;
|
|
93
|
+
schedule: string;
|
|
94
|
+
lastFetchedAt: string | null;
|
|
95
|
+
}
|
|
96
|
+
/** Response of the feeds list endpoint (`API_ROUTES.feeds.list`). */
|
|
97
|
+
export interface FeedsListResponse {
|
|
98
|
+
feeds: FeedSummary[];
|
|
99
|
+
}
|
|
100
|
+
/** The `{slug,title,icon}` triple the index pages reconcile pinned shortcuts
|
|
101
|
+
* against (prune dead slugs, refresh stale labels). */
|
|
102
|
+
export interface CollectionShortcutInfo {
|
|
103
|
+
slug: string;
|
|
104
|
+
title: string;
|
|
105
|
+
icon: string;
|
|
106
|
+
}
|