@arbidocs/client 0.4.78 → 0.4.79

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/index.d.cts CHANGED
@@ -3379,6 +3379,28 @@ interface paths {
3379
3379
  patch?: never;
3380
3380
  trace?: never;
3381
3381
  };
3382
+ '/v1/databases/links': {
3383
+ parameters: {
3384
+ query?: never;
3385
+ header?: never;
3386
+ path?: never;
3387
+ cookie?: never;
3388
+ };
3389
+ /**
3390
+ * List Document Links
3391
+ * @description Where a document is linked: the rows (and document columns) of databases that link it.
3392
+ *
3393
+ * Databases of this workspace and of public workspaces; links the caller cannot read are left out.
3394
+ */
3395
+ get: operations['list_database_document_links'];
3396
+ put?: never;
3397
+ post?: never;
3398
+ delete?: never;
3399
+ options?: never;
3400
+ head?: never;
3401
+ patch?: never;
3402
+ trace?: never;
3403
+ };
3382
3404
  '/v1/databases/{database_id}': {
3383
3405
  parameters: {
3384
3406
  query?: never;
@@ -3446,6 +3468,28 @@ interface paths {
3446
3468
  patch: operations['update_database_row'];
3447
3469
  trace?: never;
3448
3470
  };
3471
+ '/v1/databases/{database_id}/aggregate': {
3472
+ parameters: {
3473
+ query?: never;
3474
+ header?: never;
3475
+ path?: never;
3476
+ cookie?: never;
3477
+ };
3478
+ get?: never;
3479
+ put?: never;
3480
+ /**
3481
+ * Aggregate Database
3482
+ * @description Group the rows and measure each group: the labels and series a chart or a metric tile draws.
3483
+ *
3484
+ * Runs over every row (decrypted on the server), so totals are exact however large the database is.
3485
+ */
3486
+ post: operations['aggregate_database'];
3487
+ delete?: never;
3488
+ options?: never;
3489
+ head?: never;
3490
+ patch?: never;
3491
+ trace?: never;
3492
+ };
3449
3493
  '/v1/databases/{database_id}/rows/delete': {
3450
3494
  parameters: {
3451
3495
  query?: never;
@@ -7002,11 +7046,11 @@ interface components {
7002
7046
  */
7003
7047
  AGENT_MAX_SUBAGENT_SPAWNS: number;
7004
7048
  /**
7005
- * Agent History Char Threshold
7006
- * @description Char threshold for conversation history injected into the agent context. Below: verbatim user/assistant pairs. Above: summarized by SummariseLLM.
7007
- * @default 8000
7049
+ * Agent History Token Budget
7050
+ * @description Token budget for prior turns injected into the agent context. The newest messages that fit are passed verbatim; only older ones beyond it are summarised by SummariseLLM, with a notice telling the agent to read them via read_conversation.
7051
+ * @default 48000
7008
7052
  */
7009
- AGENT_HISTORY_CHAR_THRESHOLD: number;
7053
+ AGENT_HISTORY_TOKEN_BUDGET: number;
7010
7054
  /**
7011
7055
  * Agent System Prompt
7012
7056
  * @description System prompt for the agent. Dynamic context is appended automatically.
@@ -7248,7 +7292,7 @@ interface components {
7248
7292
  * "AGENT_MAX_TOTAL_TOOL_CALLS": 80,
7249
7293
  * "AGENT_MAX_RUN_TOKENS": 1500000,
7250
7294
  * "AGENT_MAX_SUBAGENT_SPAWNS": 4,
7251
- * "AGENT_HISTORY_CHAR_THRESHOLD": 8000,
7295
+ * "AGENT_HISTORY_TOKEN_BUDGET": 48000,
7252
7296
  * "AGENT_SYSTEM_PROMPT": "Answer any question the user asks. You have access to workspace documents — use them when relevant. When no documents are relevant, answer from your own knowledge. Always provide a helpful answer.\n\nWhen using documents, retrieve actual document content — do not rely on metadata or headings alone. Cross-check information across sources. Not all assertions in sources are factual — some are arguments by a party. Attribute claims to their source where parties disagree.\n\nDOCUMENT INDEX:\nThe \"Workspace Documents\" table in your system prompt lists every document with its Id, Title, Date, and Pages. The Subject field is a brief navigation label only — it does not contain enough information to answer questions about a document's content. Use this table directly when the user asks to list, catalogue, or tabulate documents — do NOT call any tools for that. Only use tools when you need to read or search document content.\n\nREADING TOOL RESULTS:\nEvery retrieval result opens with a CAPTION line naming the call that produced it, what it contains, and what it does not (for example \"FULL CONTENT … complete verbatim text, all 10 pages\" or \"DIGEST … verbatim page text is NOT part of this result\"). The caption also tells you when you already retrieved that material earlier in this turn. Read it before choosing your next call — it is the record of what you already hold.\n\nDOCUMENT STRATEGY, in order:\n1. Listing or cataloguing documents: use the document index already in your prompt — no tool calls needed.\n2. Getting oriented in a document you have not read: call get_table_of_contents FIRST. It is cheap, returns the heading structure with page references, and tells you which pages actually matter. Do this before any read_document on a document longer than a few pages, rather than reading blind and then discovering the structure.\n3. Specific questions across several documents: search_inside_documents to locate the passages, then read_document on the pages it points to.\n4. Reading a document: read_document with page ranges for the sections you need, or with no ranges to load the complete text. A read with no ranges returns the WHOLE document — once you have it there is nothing further to retrieve from that document. Do not read it again, do not re-read ranges out of it, and do not ask for its outline afterwards.\n5. Prefer digest=true from the outset. It is the normal retrieval mode: findings with citations, compact context. Decide against it only when the task needs the exact words — translation, quotation, close reading of style or drafting. Choosing digest=false IS that decision, and it is final for that document: digest is a way of retrieving, not a way of processing text you already hold, so once you have loaded a document in full a digest of it is refused. Reason over the text you have.\n6. Open-ended investigative queries (\"find interesting things\", \"what's notable\", \"what stands out\", \"explore X\", \"what should I know about\", \"any findings\", \"anything unusual\", \"key insights\"): ALWAYS call search_inside_documents with multiple diverse queries covering different aspects of the documents before answering. The document index is never sufficient for investigative answers — you must retrieve actual content.\n7. Never search for meta-queries like \"summary\", \"overview\", or \"all documents\" — search for the actual subject matter.\n\nFORMATTING:\n- Start your answer directly with the content.\n- Use markdown: headings, bold, bullet points, numbered lists\n- Main conclusion first, followed by supporting points\n- Bullet points for lists of discrete items\n- Numbering for sequential steps or prioritized items\n- Bold text for critical conclusions or decision points\n\nTOOL CALLING:\n- Your job is to gather the context the question needs, then answer. Do not give a final answer while there is relevant context you have not yet retrieved — but material already in your context counts as retrieved, and fetching it a second time is not progress. If the question touches a workspace document, always check the source — never answer from a past turn's reply alone.\n- Always invoke tools using the tool-calling mechanism. Say what a call is doing in its `focus` argument.\n\nEFFICIENCY:\n1. Before each step, review the results of prior steps. Adapt your approach based on what you learned — if a call was rejected or returned poor results, adjust your strategy.\n2. Call multiple tools in parallel when a query has several aspects.\n3. NEVER repeat a tool call with the same arguments, and never re-retrieve material you already hold — the caption on each result tells you what that is.\n4. Use targeted queries and narrow page ranges per retrieval call.\n5. Stop when you have sufficient evidence — do not over-research."
7253
7297
  * }
7254
7298
  */
@@ -7409,7 +7453,7 @@ interface components {
7409
7453
  * "API_TYPE": "remote",
7410
7454
  * "ENABLE_THINKING": false,
7411
7455
  * "MODEL_NAME": "Fast",
7412
- * "SYSTEM_INSTRUCTION": "You are a context selector. Given a user's query, conversation history, and a table of available documents, determine the user's goal and select relevant context.\n\n## Instructions\n\n1. **goal**: 1-2 concise sentences describing the user's intent AND your filtering rationale. Explain what documents are needed and why. Examples:\n - \"The user is greeting the assistant. No documents are needed.\"\n - \"The user wants to find force majeure clauses. Only the three contracts are relevant, so I will keep only those.\"\n - \"The user wants a full timeline of the case. Most documents are relevant, so I will drop only the unrelated procedural orders.\"\n\n2. **doc_filter_mode** and **doc_ids**: Select which documents the agent needs.\n - `\"keep\"` mode: `doc_ids` lists the ONLY docs to keep. Everything else is dropped.\n - `\"drop\"` mode: `doc_ids` lists the ONLY docs to drop. Everything else is kept.\n - Pick whichever mode produces the **shorter `doc_ids` list**.\n - Doc IDs are in the **Id** column of the Available Documents table (e.g. `\"doc-abc12345\"`). Copy them **exactly** from the table — do not invent, guess, or modify IDs.\n\n | Scenario | doc_filter_mode | doc_ids |\n |----------|----------------|---------|\n | Need ALL docs | `\"drop\"` | `[]` |\n | Need NO docs | `\"keep\"` | `[]` |\n | Need 3 of 100 docs | `\"keep\"` | `[\"id1\",\"id2\",\"id3\"]` |\n | Drop 3 of 100 docs | `\"drop\"` | `[\"id1\",\"id2\",\"id3\"]` |\n\n3. **chat_range_start** and **chat_range_end**: 0-based inclusive range of earlier history messages that provide relevant context. The last 3 messages are always included automatically. Set both to -1 if no earlier history is needed.\n\n## Rules\n\n- **Never repeat a doc ID.** Each ID must appear at most once.\n- Before writing `doc_ids`, count how many you would keep vs drop, then pick the shorter list.\n- Greetings or meta-questions about the assistant (e.g. \"hello\", \"who are you?\", \"what can you do?\"): the agent does NOT need any documents → `\"keep\"` with `[]`.\n- Ambiguous references like \"the document\" or \"this contract\" without specifying which: keep all → `\"drop\"` with `[]`.\n- For follow-up questions, include history messages that establish the topic.\n- Always return valid JSON matching the schema.",
7456
+ * "SYSTEM_INSTRUCTION": "You are a context selector. Given a user's query, conversation history, and a table of available documents, determine the user's goal and select relevant context.\n\n## Instructions\n\n1. **goal**: 1-2 concise sentences describing the user's intent AND your filtering rationale. Explain what documents are needed and why. Examples:\n - \"The user is greeting the assistant. No documents are needed.\"\n - \"The user wants to find force majeure clauses. Only the three contracts are relevant, so I will keep only those.\"\n - \"The user wants a full timeline of the case. Most documents are relevant, so I will drop only the unrelated procedural orders.\"\n - The agent that reads the goal does not see the history indices: refer to an earlier message by what it is (\"the investigation report in the previous answer\"), never by its [N] index.\n\n2. **doc_filter_mode** and **doc_ids**: Select which documents the agent needs.\n - `\"keep\"` mode: `doc_ids` lists the ONLY docs to keep. Everything else is dropped.\n - `\"drop\"` mode: `doc_ids` lists the ONLY docs to drop. Everything else is kept.\n - Pick whichever mode produces the **shorter `doc_ids` list**.\n - Doc IDs are in the **Id** column of the Available Documents table (e.g. `\"doc-abc12345\"`). Copy them **exactly** from the table — do not invent, guess, or modify IDs.\n\n | Scenario | doc_filter_mode | doc_ids |\n |----------|----------------|---------|\n | Need ALL docs | `\"drop\"` | `[]` |\n | Need NO docs | `\"keep\"` | `[]` |\n | Need 3 of 100 docs | `\"keep\"` | `[\"id1\",\"id2\",\"id3\"]` |\n | Drop 3 of 100 docs | `\"drop\"` | `[\"id1\",\"id2\",\"id3\"]` |\n\n3. **chat_range_start** and **chat_range_end**: 0-based inclusive range of earlier history messages that provide relevant context. The last 3 messages are always included automatically. Set both to -1 if no earlier history is needed.\n\n## Rules\n\n- **Never repeat a doc ID.** Each ID must appear at most once.\n- Before writing `doc_ids`, count how many you would keep vs drop, then pick the shorter list.\n- Greetings or meta-questions about the assistant (e.g. \"hello\", \"who are you?\", \"what can you do?\"): the agent does NOT need any documents → `\"keep\"` with `[]`.\n- Ambiguous references like \"the document\" or \"this contract\" without specifying which: keep all → `\"drop\"` with `[]`.\n- For follow-up questions, include history messages that establish the topic.\n- Always return valid JSON matching the schema.",
7413
7457
  * "TEMPERATURE": 0,
7414
7458
  * "MAX_TOKENS": 0
7415
7459
  * }
@@ -10569,7 +10613,70 @@ interface components {
10569
10613
  [key: string]: components['schemas']['ModelGroupUsage'];
10570
10614
  };
10571
10615
  };
10572
- /** DatabaseColumn */
10616
+ /**
10617
+ * DatabaseAggregateRequest
10618
+ * @description Group a database's rows and measure each group — the numbers a chart or a metric tile draws.
10619
+ *
10620
+ * ``group_by`` (any column; a ``date`` column is bucketed by ``time_bucket``; a document, relation or lookup
10621
+ * column puts a row in each of its values' groups) gives the labels; ``split_by`` adds one series per value
10622
+ * (stacked charts). With neither, one group: ``All``.
10623
+ */
10624
+ DatabaseAggregateRequest: {
10625
+ /**
10626
+ * Group By
10627
+ * @description Column id or name; a row counts in each group of a multi-valued column
10628
+ */
10629
+ group_by?: string | null;
10630
+ /**
10631
+ * Split By
10632
+ * @description Column id or name: one series per value
10633
+ */
10634
+ split_by?: string | null;
10635
+ /**
10636
+ * Time Bucket
10637
+ * @default month
10638
+ * @enum {string}
10639
+ */
10640
+ time_bucket: 'day' | 'week' | 'month' | 'quarter' | 'year';
10641
+ measure?: components['schemas']['DatabaseMeasure'];
10642
+ /**
10643
+ * Q
10644
+ * @description Text in any cell
10645
+ */
10646
+ q?: string | null;
10647
+ /** Filters */
10648
+ filters?: components['schemas']['DatabaseFilter'][];
10649
+ /**
10650
+ * Limit
10651
+ * @description Most groups (by measure) returned
10652
+ * @default 50
10653
+ */
10654
+ limit: number;
10655
+ };
10656
+ /**
10657
+ * DatabaseAggregateResult
10658
+ * @description ``labels[i]`` is group ``keys[i]``; each series has one value per label (``None``: no rows).
10659
+ */
10660
+ DatabaseAggregateResult: {
10661
+ /** Keys */
10662
+ keys: string[];
10663
+ /** Labels */
10664
+ labels: string[];
10665
+ /** Series */
10666
+ series: components['schemas']['DatabaseSeries'][];
10667
+ /** Total Rows */
10668
+ total_rows: number;
10669
+ /**
10670
+ * Truncated
10671
+ * @default false
10672
+ */
10673
+ truncated: boolean;
10674
+ };
10675
+ /**
10676
+ * DatabaseColumn
10677
+ * @description A column: a typed field (:class:`~src.models.fields.FieldDefinition`), plus what a relation, lookup or
10678
+ * rollup column needs (column references are ids).
10679
+ */
10573
10680
  DatabaseColumn: {
10574
10681
  /** Id */
10575
10682
  id: string;
@@ -10579,13 +10686,21 @@ interface components {
10579
10686
  * Type
10580
10687
  * @enum {string}
10581
10688
  */
10582
- type: 'text' | 'number' | 'date' | 'checkbox' | 'select';
10689
+ type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person' | 'document' | 'relation' | 'lookup' | 'rollup';
10583
10690
  /** Options */
10584
10691
  options?: string[] | null;
10692
+ relation?: components['schemas']['DatabaseRelation'] | null;
10693
+ lookup?: components['schemas']['DatabaseLookup'] | null;
10694
+ rollup?: components['schemas']['DatabaseRollup'] | null;
10585
10695
  };
10586
10696
  /**
10587
10697
  * DatabaseColumnWrite
10588
10698
  * @description A column. Give ``id`` to keep an existing column (its type cannot change); omit it to add one.
10699
+ *
10700
+ * ``person`` cells hold a workspace member's id; ``document`` cells a list of document ids of this workspace
10701
+ * (``doc-…``); ``relation`` cells a list of row ids of the target database (``dbr-…``). A ``relation``
10702
+ * column needs ``relation``, a ``lookup`` ``lookup`` and a ``rollup`` ``rollup``; lookups and rollups are
10703
+ * computed, never written. A relation's target cannot change once added.
10589
10704
  */
10590
10705
  DatabaseColumnWrite: {
10591
10706
  /** Id */
@@ -10597,9 +10712,12 @@ interface components {
10597
10712
  * @default text
10598
10713
  * @enum {string}
10599
10714
  */
10600
- type: 'text' | 'number' | 'date' | 'checkbox' | 'select';
10715
+ type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person' | 'document' | 'relation' | 'lookup' | 'rollup';
10601
10716
  /** Options */
10602
10717
  options?: string[] | null;
10718
+ relation?: components['schemas']['DatabaseRelationWrite'] | null;
10719
+ lookup?: components['schemas']['DatabaseLookup'] | null;
10720
+ rollup?: components['schemas']['DatabaseRollup'] | null;
10603
10721
  };
10604
10722
  /** DatabaseCreate */
10605
10723
  DatabaseCreate: {
@@ -10610,6 +10728,44 @@ interface components {
10610
10728
  /** Columns */
10611
10729
  columns?: components['schemas']['DatabaseColumnWrite'][];
10612
10730
  };
10731
+ /**
10732
+ * DatabaseDocumentLink
10733
+ * @description Where a document is linked: a row of a database, in one of its document columns (``row_title`` is the
10734
+ * row's first column).
10735
+ */
10736
+ DatabaseDocumentLink: {
10737
+ /** Database Id */
10738
+ database_id: string;
10739
+ /** Database Name */
10740
+ database_name: string;
10741
+ /** Row Id */
10742
+ row_id: string;
10743
+ /** Row Title */
10744
+ row_title?: string | null;
10745
+ /** Column Id */
10746
+ column_id: string;
10747
+ /** Column Name */
10748
+ column_name: string;
10749
+ };
10750
+ /**
10751
+ * DatabaseFilter
10752
+ * @description Keep rows whose cell in ``column`` satisfies ``op`` ``value`` (compared in the column's type).
10753
+ */
10754
+ DatabaseFilter: {
10755
+ /**
10756
+ * Column
10757
+ * @description Column id or name
10758
+ */
10759
+ column: string;
10760
+ /**
10761
+ * Op
10762
+ * @default eq
10763
+ * @enum {string}
10764
+ */
10765
+ op: 'eq' | 'neq' | 'contains' | 'gt' | 'gte' | 'lt' | 'lte' | 'empty' | 'not_empty';
10766
+ /** Value */
10767
+ value?: unknown;
10768
+ };
10613
10769
  /** DatabaseImportResult */
10614
10770
  DatabaseImportResult: {
10615
10771
  database: components['schemas']['DatabaseRead'];
@@ -10618,6 +10774,40 @@ interface components {
10618
10774
  /** Added Columns */
10619
10775
  added_columns?: string[];
10620
10776
  };
10777
+ /**
10778
+ * DatabaseLookup
10779
+ * @description Show ``column`` of the rows linked through the ``relation`` column of this database.
10780
+ */
10781
+ DatabaseLookup: {
10782
+ /**
10783
+ * Relation
10784
+ * @description Relation column of this database (id or name)
10785
+ */
10786
+ relation: string;
10787
+ /**
10788
+ * Column
10789
+ * @description Column of the target database (id or name)
10790
+ */
10791
+ column: string;
10792
+ };
10793
+ /**
10794
+ * DatabaseMeasure
10795
+ * @description What each group shows: ``count`` rows (or, with ``column``, non-empty cells of it), or ``sum`` / ``avg``
10796
+ * / ``min`` / ``max`` of a number column.
10797
+ */
10798
+ DatabaseMeasure: {
10799
+ /**
10800
+ * Op
10801
+ * @default count
10802
+ * @enum {string}
10803
+ */
10804
+ op: 'count' | 'sum' | 'avg' | 'min' | 'max';
10805
+ /**
10806
+ * Column
10807
+ * @description Column id or name
10808
+ */
10809
+ column?: string | null;
10810
+ };
10621
10811
  /** DatabaseRead */
10622
10812
  DatabaseRead: {
10623
10813
  /** Id */
@@ -10653,6 +10843,71 @@ interface components {
10653
10843
  */
10654
10844
  updated_at: string;
10655
10845
  };
10846
+ /**
10847
+ * DatabaseRelation
10848
+ * @description A relation column's target: rows of ``database_id`` (this workspace; may be this database).
10849
+ *
10850
+ * ``two_way`` adds a paired column to the target that shows the same links from the other side; the server
10851
+ * sets ``pair_column_id`` on both. ``reverse`` marks the paired column (the links are stored under its pair).
10852
+ */
10853
+ DatabaseRelation: {
10854
+ /** Database Id */
10855
+ database_id: string;
10856
+ /**
10857
+ * Two Way
10858
+ * @default false
10859
+ */
10860
+ two_way: boolean;
10861
+ /** Pair Column Id */
10862
+ pair_column_id?: string | null;
10863
+ /**
10864
+ * Reverse
10865
+ * @default false
10866
+ */
10867
+ reverse: boolean;
10868
+ };
10869
+ /** DatabaseRelationWrite */
10870
+ DatabaseRelationWrite: {
10871
+ /**
10872
+ * Database Id
10873
+ * @description The target database (this workspace)
10874
+ */
10875
+ database_id: string;
10876
+ /**
10877
+ * Two Way
10878
+ * @description Also add a paired column to the target
10879
+ * @default false
10880
+ */
10881
+ two_way: boolean;
10882
+ /**
10883
+ * Pair Name
10884
+ * @description Name of the paired column (default: this database's name)
10885
+ */
10886
+ pair_name?: string | null;
10887
+ };
10888
+ /**
10889
+ * DatabaseRollup
10890
+ * @description Measure the rows linked through ``relation``: ``count`` them, or ``sum``/``avg``/``min``/``max`` a
10891
+ * number ``column`` of them.
10892
+ */
10893
+ DatabaseRollup: {
10894
+ /**
10895
+ * Relation
10896
+ * @description Relation column of this database (id or name)
10897
+ */
10898
+ relation: string;
10899
+ /**
10900
+ * Column
10901
+ * @description Number column of the target (not for count)
10902
+ */
10903
+ column?: string | null;
10904
+ /**
10905
+ * Op
10906
+ * @default count
10907
+ * @enum {string}
10908
+ */
10909
+ op: 'count' | 'sum' | 'avg' | 'min' | 'max';
10910
+ };
10656
10911
  /** DatabaseRowPage */
10657
10912
  DatabaseRowPage: {
10658
10913
  /** Rows */
@@ -10660,7 +10915,11 @@ interface components {
10660
10915
  /** Total */
10661
10916
  total: number;
10662
10917
  };
10663
- /** DatabaseRowRead */
10918
+ /**
10919
+ * DatabaseRowRead
10920
+ * @description A row: cell values keyed by column id. ``document`` and ``relation`` cells are lists of ids, a ``lookup``
10921
+ * a list of values, a ``rollup`` a number. ``titles`` names every document and related row it links.
10922
+ */
10664
10923
  DatabaseRowRead: {
10665
10924
  /** Id */
10666
10925
  id: string;
@@ -10668,6 +10927,10 @@ interface components {
10668
10927
  values: {
10669
10928
  [key: string]: unknown;
10670
10929
  };
10930
+ /** Titles */
10931
+ titles?: {
10932
+ [key: string]: string;
10933
+ };
10671
10934
  /**
10672
10935
  * Created At
10673
10936
  * Format: date-time
@@ -10681,7 +10944,10 @@ interface components {
10681
10944
  };
10682
10945
  /**
10683
10946
  * DatabaseRowWrite
10684
- * @description Cell values keyed by column id (``col-…``) or column name.
10947
+ * @description Cell values keyed by column id or column name; ``null`` empties a cell.
10948
+ *
10949
+ * A ``document`` or ``relation`` cell takes an id or a list of them (``doc-…`` / ``dbr-…``), replacing the
10950
+ * cell's links; on a two-way relation either side can be written.
10685
10951
  */
10686
10952
  DatabaseRowWrite: {
10687
10953
  /** Values */
@@ -10699,6 +10965,15 @@ interface components {
10699
10965
  /** Ids */
10700
10966
  ids: string[];
10701
10967
  };
10968
+ /** DatabaseSeries */
10969
+ DatabaseSeries: {
10970
+ /** Key */
10971
+ key: string;
10972
+ /** Label */
10973
+ label: string;
10974
+ /** Values */
10975
+ values: (number | null)[];
10976
+ };
10702
10977
  /** DatabaseUpdate */
10703
10978
  DatabaseUpdate: {
10704
10979
  /** Name */
@@ -11960,7 +12235,7 @@ interface components {
11960
12235
  * @default text
11961
12236
  * @enum {string}
11962
12237
  */
11963
- type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person';
12238
+ type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person' | 'document' | 'relation' | 'lookup' | 'rollup';
11964
12239
  /** Options */
11965
12240
  options?: string[] | null;
11966
12241
  };
@@ -11978,7 +12253,7 @@ interface components {
11978
12253
  * @default text
11979
12254
  * @enum {string}
11980
12255
  */
11981
- type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person';
12256
+ type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person' | 'document' | 'relation' | 'lookup' | 'rollup';
11982
12257
  /** Options */
11983
12258
  options?: string[] | null;
11984
12259
  };
@@ -12098,6 +12373,7 @@ interface components {
12098
12373
  * - "The user is greeting the assistant. No documents are needed."
12099
12374
  * - "The user wants to find force majeure clauses. Only the three contracts are relevant, so I will keep only those."
12100
12375
  * - "The user wants a full timeline of the case. Most documents are relevant, so I will drop only the unrelated procedural orders."
12376
+ * - The agent that reads the goal does not see the history indices: refer to an earlier message by what it is ("the investigation report in the previous answer"), never by its [N] index.
12101
12377
  *
12102
12378
  * 2. **doc_filter_mode** and **doc_ids**: Select which documents the agent needs.
12103
12379
  * - `"keep"` mode: `doc_ids` lists the ONLY docs to keep. Everything else is dropped.
@@ -17760,7 +18036,7 @@ interface components {
17760
18036
  * Type
17761
18037
  * @enum {string}
17762
18038
  */
17763
- type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person';
18039
+ type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person' | 'document' | 'relation' | 'lookup' | 'rollup';
17764
18040
  /** Options */
17765
18041
  options?: string[] | null;
17766
18042
  /** Tag Ext Id */
@@ -24963,6 +25239,38 @@ interface operations {
24963
25239
  };
24964
25240
  };
24965
25241
  };
25242
+ list_database_document_links: {
25243
+ parameters: {
25244
+ query: {
25245
+ /** @description The document (doc-…) */
25246
+ doc_id: string;
25247
+ };
25248
+ header?: never;
25249
+ path?: never;
25250
+ cookie?: never;
25251
+ };
25252
+ requestBody?: never;
25253
+ responses: {
25254
+ /** @description Successful Response */
25255
+ 200: {
25256
+ headers: {
25257
+ [name: string]: unknown;
25258
+ };
25259
+ content: {
25260
+ 'application/json': components['schemas']['DatabaseDocumentLink'][];
25261
+ };
25262
+ };
25263
+ /** @description Validation Error */
25264
+ 422: {
25265
+ headers: {
25266
+ [name: string]: unknown;
25267
+ };
25268
+ content: {
25269
+ 'application/json': components['schemas']['HTTPValidationError'];
25270
+ };
25271
+ };
25272
+ };
25273
+ };
24966
25274
  get_database: {
24967
25275
  parameters: {
24968
25276
  query?: never;
@@ -25168,6 +25476,41 @@ interface operations {
25168
25476
  };
25169
25477
  };
25170
25478
  };
25479
+ aggregate_database: {
25480
+ parameters: {
25481
+ query?: never;
25482
+ header?: never;
25483
+ path: {
25484
+ database_id: string;
25485
+ };
25486
+ cookie?: never;
25487
+ };
25488
+ requestBody: {
25489
+ content: {
25490
+ 'application/json': components['schemas']['DatabaseAggregateRequest'];
25491
+ };
25492
+ };
25493
+ responses: {
25494
+ /** @description Successful Response */
25495
+ 200: {
25496
+ headers: {
25497
+ [name: string]: unknown;
25498
+ };
25499
+ content: {
25500
+ 'application/json': components['schemas']['DatabaseAggregateResult'];
25501
+ };
25502
+ };
25503
+ /** @description Validation Error */
25504
+ 422: {
25505
+ headers: {
25506
+ [name: string]: unknown;
25507
+ };
25508
+ content: {
25509
+ 'application/json': components['schemas']['HTTPValidationError'];
25510
+ };
25511
+ };
25512
+ };
25513
+ };
25171
25514
  delete_database_rows: {
25172
25515
  parameters: {
25173
25516
  query?: never;
package/dist/index.d.ts CHANGED
@@ -3379,6 +3379,28 @@ interface paths {
3379
3379
  patch?: never;
3380
3380
  trace?: never;
3381
3381
  };
3382
+ '/v1/databases/links': {
3383
+ parameters: {
3384
+ query?: never;
3385
+ header?: never;
3386
+ path?: never;
3387
+ cookie?: never;
3388
+ };
3389
+ /**
3390
+ * List Document Links
3391
+ * @description Where a document is linked: the rows (and document columns) of databases that link it.
3392
+ *
3393
+ * Databases of this workspace and of public workspaces; links the caller cannot read are left out.
3394
+ */
3395
+ get: operations['list_database_document_links'];
3396
+ put?: never;
3397
+ post?: never;
3398
+ delete?: never;
3399
+ options?: never;
3400
+ head?: never;
3401
+ patch?: never;
3402
+ trace?: never;
3403
+ };
3382
3404
  '/v1/databases/{database_id}': {
3383
3405
  parameters: {
3384
3406
  query?: never;
@@ -3446,6 +3468,28 @@ interface paths {
3446
3468
  patch: operations['update_database_row'];
3447
3469
  trace?: never;
3448
3470
  };
3471
+ '/v1/databases/{database_id}/aggregate': {
3472
+ parameters: {
3473
+ query?: never;
3474
+ header?: never;
3475
+ path?: never;
3476
+ cookie?: never;
3477
+ };
3478
+ get?: never;
3479
+ put?: never;
3480
+ /**
3481
+ * Aggregate Database
3482
+ * @description Group the rows and measure each group: the labels and series a chart or a metric tile draws.
3483
+ *
3484
+ * Runs over every row (decrypted on the server), so totals are exact however large the database is.
3485
+ */
3486
+ post: operations['aggregate_database'];
3487
+ delete?: never;
3488
+ options?: never;
3489
+ head?: never;
3490
+ patch?: never;
3491
+ trace?: never;
3492
+ };
3449
3493
  '/v1/databases/{database_id}/rows/delete': {
3450
3494
  parameters: {
3451
3495
  query?: never;
@@ -7002,11 +7046,11 @@ interface components {
7002
7046
  */
7003
7047
  AGENT_MAX_SUBAGENT_SPAWNS: number;
7004
7048
  /**
7005
- * Agent History Char Threshold
7006
- * @description Char threshold for conversation history injected into the agent context. Below: verbatim user/assistant pairs. Above: summarized by SummariseLLM.
7007
- * @default 8000
7049
+ * Agent History Token Budget
7050
+ * @description Token budget for prior turns injected into the agent context. The newest messages that fit are passed verbatim; only older ones beyond it are summarised by SummariseLLM, with a notice telling the agent to read them via read_conversation.
7051
+ * @default 48000
7008
7052
  */
7009
- AGENT_HISTORY_CHAR_THRESHOLD: number;
7053
+ AGENT_HISTORY_TOKEN_BUDGET: number;
7010
7054
  /**
7011
7055
  * Agent System Prompt
7012
7056
  * @description System prompt for the agent. Dynamic context is appended automatically.
@@ -7248,7 +7292,7 @@ interface components {
7248
7292
  * "AGENT_MAX_TOTAL_TOOL_CALLS": 80,
7249
7293
  * "AGENT_MAX_RUN_TOKENS": 1500000,
7250
7294
  * "AGENT_MAX_SUBAGENT_SPAWNS": 4,
7251
- * "AGENT_HISTORY_CHAR_THRESHOLD": 8000,
7295
+ * "AGENT_HISTORY_TOKEN_BUDGET": 48000,
7252
7296
  * "AGENT_SYSTEM_PROMPT": "Answer any question the user asks. You have access to workspace documents — use them when relevant. When no documents are relevant, answer from your own knowledge. Always provide a helpful answer.\n\nWhen using documents, retrieve actual document content — do not rely on metadata or headings alone. Cross-check information across sources. Not all assertions in sources are factual — some are arguments by a party. Attribute claims to their source where parties disagree.\n\nDOCUMENT INDEX:\nThe \"Workspace Documents\" table in your system prompt lists every document with its Id, Title, Date, and Pages. The Subject field is a brief navigation label only — it does not contain enough information to answer questions about a document's content. Use this table directly when the user asks to list, catalogue, or tabulate documents — do NOT call any tools for that. Only use tools when you need to read or search document content.\n\nREADING TOOL RESULTS:\nEvery retrieval result opens with a CAPTION line naming the call that produced it, what it contains, and what it does not (for example \"FULL CONTENT … complete verbatim text, all 10 pages\" or \"DIGEST … verbatim page text is NOT part of this result\"). The caption also tells you when you already retrieved that material earlier in this turn. Read it before choosing your next call — it is the record of what you already hold.\n\nDOCUMENT STRATEGY, in order:\n1. Listing or cataloguing documents: use the document index already in your prompt — no tool calls needed.\n2. Getting oriented in a document you have not read: call get_table_of_contents FIRST. It is cheap, returns the heading structure with page references, and tells you which pages actually matter. Do this before any read_document on a document longer than a few pages, rather than reading blind and then discovering the structure.\n3. Specific questions across several documents: search_inside_documents to locate the passages, then read_document on the pages it points to.\n4. Reading a document: read_document with page ranges for the sections you need, or with no ranges to load the complete text. A read with no ranges returns the WHOLE document — once you have it there is nothing further to retrieve from that document. Do not read it again, do not re-read ranges out of it, and do not ask for its outline afterwards.\n5. Prefer digest=true from the outset. It is the normal retrieval mode: findings with citations, compact context. Decide against it only when the task needs the exact words — translation, quotation, close reading of style or drafting. Choosing digest=false IS that decision, and it is final for that document: digest is a way of retrieving, not a way of processing text you already hold, so once you have loaded a document in full a digest of it is refused. Reason over the text you have.\n6. Open-ended investigative queries (\"find interesting things\", \"what's notable\", \"what stands out\", \"explore X\", \"what should I know about\", \"any findings\", \"anything unusual\", \"key insights\"): ALWAYS call search_inside_documents with multiple diverse queries covering different aspects of the documents before answering. The document index is never sufficient for investigative answers — you must retrieve actual content.\n7. Never search for meta-queries like \"summary\", \"overview\", or \"all documents\" — search for the actual subject matter.\n\nFORMATTING:\n- Start your answer directly with the content.\n- Use markdown: headings, bold, bullet points, numbered lists\n- Main conclusion first, followed by supporting points\n- Bullet points for lists of discrete items\n- Numbering for sequential steps or prioritized items\n- Bold text for critical conclusions or decision points\n\nTOOL CALLING:\n- Your job is to gather the context the question needs, then answer. Do not give a final answer while there is relevant context you have not yet retrieved — but material already in your context counts as retrieved, and fetching it a second time is not progress. If the question touches a workspace document, always check the source — never answer from a past turn's reply alone.\n- Always invoke tools using the tool-calling mechanism. Say what a call is doing in its `focus` argument.\n\nEFFICIENCY:\n1. Before each step, review the results of prior steps. Adapt your approach based on what you learned — if a call was rejected or returned poor results, adjust your strategy.\n2. Call multiple tools in parallel when a query has several aspects.\n3. NEVER repeat a tool call with the same arguments, and never re-retrieve material you already hold — the caption on each result tells you what that is.\n4. Use targeted queries and narrow page ranges per retrieval call.\n5. Stop when you have sufficient evidence — do not over-research."
7253
7297
  * }
7254
7298
  */
@@ -7409,7 +7453,7 @@ interface components {
7409
7453
  * "API_TYPE": "remote",
7410
7454
  * "ENABLE_THINKING": false,
7411
7455
  * "MODEL_NAME": "Fast",
7412
- * "SYSTEM_INSTRUCTION": "You are a context selector. Given a user's query, conversation history, and a table of available documents, determine the user's goal and select relevant context.\n\n## Instructions\n\n1. **goal**: 1-2 concise sentences describing the user's intent AND your filtering rationale. Explain what documents are needed and why. Examples:\n - \"The user is greeting the assistant. No documents are needed.\"\n - \"The user wants to find force majeure clauses. Only the three contracts are relevant, so I will keep only those.\"\n - \"The user wants a full timeline of the case. Most documents are relevant, so I will drop only the unrelated procedural orders.\"\n\n2. **doc_filter_mode** and **doc_ids**: Select which documents the agent needs.\n - `\"keep\"` mode: `doc_ids` lists the ONLY docs to keep. Everything else is dropped.\n - `\"drop\"` mode: `doc_ids` lists the ONLY docs to drop. Everything else is kept.\n - Pick whichever mode produces the **shorter `doc_ids` list**.\n - Doc IDs are in the **Id** column of the Available Documents table (e.g. `\"doc-abc12345\"`). Copy them **exactly** from the table — do not invent, guess, or modify IDs.\n\n | Scenario | doc_filter_mode | doc_ids |\n |----------|----------------|---------|\n | Need ALL docs | `\"drop\"` | `[]` |\n | Need NO docs | `\"keep\"` | `[]` |\n | Need 3 of 100 docs | `\"keep\"` | `[\"id1\",\"id2\",\"id3\"]` |\n | Drop 3 of 100 docs | `\"drop\"` | `[\"id1\",\"id2\",\"id3\"]` |\n\n3. **chat_range_start** and **chat_range_end**: 0-based inclusive range of earlier history messages that provide relevant context. The last 3 messages are always included automatically. Set both to -1 if no earlier history is needed.\n\n## Rules\n\n- **Never repeat a doc ID.** Each ID must appear at most once.\n- Before writing `doc_ids`, count how many you would keep vs drop, then pick the shorter list.\n- Greetings or meta-questions about the assistant (e.g. \"hello\", \"who are you?\", \"what can you do?\"): the agent does NOT need any documents → `\"keep\"` with `[]`.\n- Ambiguous references like \"the document\" or \"this contract\" without specifying which: keep all → `\"drop\"` with `[]`.\n- For follow-up questions, include history messages that establish the topic.\n- Always return valid JSON matching the schema.",
7456
+ * "SYSTEM_INSTRUCTION": "You are a context selector. Given a user's query, conversation history, and a table of available documents, determine the user's goal and select relevant context.\n\n## Instructions\n\n1. **goal**: 1-2 concise sentences describing the user's intent AND your filtering rationale. Explain what documents are needed and why. Examples:\n - \"The user is greeting the assistant. No documents are needed.\"\n - \"The user wants to find force majeure clauses. Only the three contracts are relevant, so I will keep only those.\"\n - \"The user wants a full timeline of the case. Most documents are relevant, so I will drop only the unrelated procedural orders.\"\n - The agent that reads the goal does not see the history indices: refer to an earlier message by what it is (\"the investigation report in the previous answer\"), never by its [N] index.\n\n2. **doc_filter_mode** and **doc_ids**: Select which documents the agent needs.\n - `\"keep\"` mode: `doc_ids` lists the ONLY docs to keep. Everything else is dropped.\n - `\"drop\"` mode: `doc_ids` lists the ONLY docs to drop. Everything else is kept.\n - Pick whichever mode produces the **shorter `doc_ids` list**.\n - Doc IDs are in the **Id** column of the Available Documents table (e.g. `\"doc-abc12345\"`). Copy them **exactly** from the table — do not invent, guess, or modify IDs.\n\n | Scenario | doc_filter_mode | doc_ids |\n |----------|----------------|---------|\n | Need ALL docs | `\"drop\"` | `[]` |\n | Need NO docs | `\"keep\"` | `[]` |\n | Need 3 of 100 docs | `\"keep\"` | `[\"id1\",\"id2\",\"id3\"]` |\n | Drop 3 of 100 docs | `\"drop\"` | `[\"id1\",\"id2\",\"id3\"]` |\n\n3. **chat_range_start** and **chat_range_end**: 0-based inclusive range of earlier history messages that provide relevant context. The last 3 messages are always included automatically. Set both to -1 if no earlier history is needed.\n\n## Rules\n\n- **Never repeat a doc ID.** Each ID must appear at most once.\n- Before writing `doc_ids`, count how many you would keep vs drop, then pick the shorter list.\n- Greetings or meta-questions about the assistant (e.g. \"hello\", \"who are you?\", \"what can you do?\"): the agent does NOT need any documents → `\"keep\"` with `[]`.\n- Ambiguous references like \"the document\" or \"this contract\" without specifying which: keep all → `\"drop\"` with `[]`.\n- For follow-up questions, include history messages that establish the topic.\n- Always return valid JSON matching the schema.",
7413
7457
  * "TEMPERATURE": 0,
7414
7458
  * "MAX_TOKENS": 0
7415
7459
  * }
@@ -10569,7 +10613,70 @@ interface components {
10569
10613
  [key: string]: components['schemas']['ModelGroupUsage'];
10570
10614
  };
10571
10615
  };
10572
- /** DatabaseColumn */
10616
+ /**
10617
+ * DatabaseAggregateRequest
10618
+ * @description Group a database's rows and measure each group — the numbers a chart or a metric tile draws.
10619
+ *
10620
+ * ``group_by`` (any column; a ``date`` column is bucketed by ``time_bucket``; a document, relation or lookup
10621
+ * column puts a row in each of its values' groups) gives the labels; ``split_by`` adds one series per value
10622
+ * (stacked charts). With neither, one group: ``All``.
10623
+ */
10624
+ DatabaseAggregateRequest: {
10625
+ /**
10626
+ * Group By
10627
+ * @description Column id or name; a row counts in each group of a multi-valued column
10628
+ */
10629
+ group_by?: string | null;
10630
+ /**
10631
+ * Split By
10632
+ * @description Column id or name: one series per value
10633
+ */
10634
+ split_by?: string | null;
10635
+ /**
10636
+ * Time Bucket
10637
+ * @default month
10638
+ * @enum {string}
10639
+ */
10640
+ time_bucket: 'day' | 'week' | 'month' | 'quarter' | 'year';
10641
+ measure?: components['schemas']['DatabaseMeasure'];
10642
+ /**
10643
+ * Q
10644
+ * @description Text in any cell
10645
+ */
10646
+ q?: string | null;
10647
+ /** Filters */
10648
+ filters?: components['schemas']['DatabaseFilter'][];
10649
+ /**
10650
+ * Limit
10651
+ * @description Most groups (by measure) returned
10652
+ * @default 50
10653
+ */
10654
+ limit: number;
10655
+ };
10656
+ /**
10657
+ * DatabaseAggregateResult
10658
+ * @description ``labels[i]`` is group ``keys[i]``; each series has one value per label (``None``: no rows).
10659
+ */
10660
+ DatabaseAggregateResult: {
10661
+ /** Keys */
10662
+ keys: string[];
10663
+ /** Labels */
10664
+ labels: string[];
10665
+ /** Series */
10666
+ series: components['schemas']['DatabaseSeries'][];
10667
+ /** Total Rows */
10668
+ total_rows: number;
10669
+ /**
10670
+ * Truncated
10671
+ * @default false
10672
+ */
10673
+ truncated: boolean;
10674
+ };
10675
+ /**
10676
+ * DatabaseColumn
10677
+ * @description A column: a typed field (:class:`~src.models.fields.FieldDefinition`), plus what a relation, lookup or
10678
+ * rollup column needs (column references are ids).
10679
+ */
10573
10680
  DatabaseColumn: {
10574
10681
  /** Id */
10575
10682
  id: string;
@@ -10579,13 +10686,21 @@ interface components {
10579
10686
  * Type
10580
10687
  * @enum {string}
10581
10688
  */
10582
- type: 'text' | 'number' | 'date' | 'checkbox' | 'select';
10689
+ type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person' | 'document' | 'relation' | 'lookup' | 'rollup';
10583
10690
  /** Options */
10584
10691
  options?: string[] | null;
10692
+ relation?: components['schemas']['DatabaseRelation'] | null;
10693
+ lookup?: components['schemas']['DatabaseLookup'] | null;
10694
+ rollup?: components['schemas']['DatabaseRollup'] | null;
10585
10695
  };
10586
10696
  /**
10587
10697
  * DatabaseColumnWrite
10588
10698
  * @description A column. Give ``id`` to keep an existing column (its type cannot change); omit it to add one.
10699
+ *
10700
+ * ``person`` cells hold a workspace member's id; ``document`` cells a list of document ids of this workspace
10701
+ * (``doc-…``); ``relation`` cells a list of row ids of the target database (``dbr-…``). A ``relation``
10702
+ * column needs ``relation``, a ``lookup`` ``lookup`` and a ``rollup`` ``rollup``; lookups and rollups are
10703
+ * computed, never written. A relation's target cannot change once added.
10589
10704
  */
10590
10705
  DatabaseColumnWrite: {
10591
10706
  /** Id */
@@ -10597,9 +10712,12 @@ interface components {
10597
10712
  * @default text
10598
10713
  * @enum {string}
10599
10714
  */
10600
- type: 'text' | 'number' | 'date' | 'checkbox' | 'select';
10715
+ type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person' | 'document' | 'relation' | 'lookup' | 'rollup';
10601
10716
  /** Options */
10602
10717
  options?: string[] | null;
10718
+ relation?: components['schemas']['DatabaseRelationWrite'] | null;
10719
+ lookup?: components['schemas']['DatabaseLookup'] | null;
10720
+ rollup?: components['schemas']['DatabaseRollup'] | null;
10603
10721
  };
10604
10722
  /** DatabaseCreate */
10605
10723
  DatabaseCreate: {
@@ -10610,6 +10728,44 @@ interface components {
10610
10728
  /** Columns */
10611
10729
  columns?: components['schemas']['DatabaseColumnWrite'][];
10612
10730
  };
10731
+ /**
10732
+ * DatabaseDocumentLink
10733
+ * @description Where a document is linked: a row of a database, in one of its document columns (``row_title`` is the
10734
+ * row's first column).
10735
+ */
10736
+ DatabaseDocumentLink: {
10737
+ /** Database Id */
10738
+ database_id: string;
10739
+ /** Database Name */
10740
+ database_name: string;
10741
+ /** Row Id */
10742
+ row_id: string;
10743
+ /** Row Title */
10744
+ row_title?: string | null;
10745
+ /** Column Id */
10746
+ column_id: string;
10747
+ /** Column Name */
10748
+ column_name: string;
10749
+ };
10750
+ /**
10751
+ * DatabaseFilter
10752
+ * @description Keep rows whose cell in ``column`` satisfies ``op`` ``value`` (compared in the column's type).
10753
+ */
10754
+ DatabaseFilter: {
10755
+ /**
10756
+ * Column
10757
+ * @description Column id or name
10758
+ */
10759
+ column: string;
10760
+ /**
10761
+ * Op
10762
+ * @default eq
10763
+ * @enum {string}
10764
+ */
10765
+ op: 'eq' | 'neq' | 'contains' | 'gt' | 'gte' | 'lt' | 'lte' | 'empty' | 'not_empty';
10766
+ /** Value */
10767
+ value?: unknown;
10768
+ };
10613
10769
  /** DatabaseImportResult */
10614
10770
  DatabaseImportResult: {
10615
10771
  database: components['schemas']['DatabaseRead'];
@@ -10618,6 +10774,40 @@ interface components {
10618
10774
  /** Added Columns */
10619
10775
  added_columns?: string[];
10620
10776
  };
10777
+ /**
10778
+ * DatabaseLookup
10779
+ * @description Show ``column`` of the rows linked through the ``relation`` column of this database.
10780
+ */
10781
+ DatabaseLookup: {
10782
+ /**
10783
+ * Relation
10784
+ * @description Relation column of this database (id or name)
10785
+ */
10786
+ relation: string;
10787
+ /**
10788
+ * Column
10789
+ * @description Column of the target database (id or name)
10790
+ */
10791
+ column: string;
10792
+ };
10793
+ /**
10794
+ * DatabaseMeasure
10795
+ * @description What each group shows: ``count`` rows (or, with ``column``, non-empty cells of it), or ``sum`` / ``avg``
10796
+ * / ``min`` / ``max`` of a number column.
10797
+ */
10798
+ DatabaseMeasure: {
10799
+ /**
10800
+ * Op
10801
+ * @default count
10802
+ * @enum {string}
10803
+ */
10804
+ op: 'count' | 'sum' | 'avg' | 'min' | 'max';
10805
+ /**
10806
+ * Column
10807
+ * @description Column id or name
10808
+ */
10809
+ column?: string | null;
10810
+ };
10621
10811
  /** DatabaseRead */
10622
10812
  DatabaseRead: {
10623
10813
  /** Id */
@@ -10653,6 +10843,71 @@ interface components {
10653
10843
  */
10654
10844
  updated_at: string;
10655
10845
  };
10846
+ /**
10847
+ * DatabaseRelation
10848
+ * @description A relation column's target: rows of ``database_id`` (this workspace; may be this database).
10849
+ *
10850
+ * ``two_way`` adds a paired column to the target that shows the same links from the other side; the server
10851
+ * sets ``pair_column_id`` on both. ``reverse`` marks the paired column (the links are stored under its pair).
10852
+ */
10853
+ DatabaseRelation: {
10854
+ /** Database Id */
10855
+ database_id: string;
10856
+ /**
10857
+ * Two Way
10858
+ * @default false
10859
+ */
10860
+ two_way: boolean;
10861
+ /** Pair Column Id */
10862
+ pair_column_id?: string | null;
10863
+ /**
10864
+ * Reverse
10865
+ * @default false
10866
+ */
10867
+ reverse: boolean;
10868
+ };
10869
+ /** DatabaseRelationWrite */
10870
+ DatabaseRelationWrite: {
10871
+ /**
10872
+ * Database Id
10873
+ * @description The target database (this workspace)
10874
+ */
10875
+ database_id: string;
10876
+ /**
10877
+ * Two Way
10878
+ * @description Also add a paired column to the target
10879
+ * @default false
10880
+ */
10881
+ two_way: boolean;
10882
+ /**
10883
+ * Pair Name
10884
+ * @description Name of the paired column (default: this database's name)
10885
+ */
10886
+ pair_name?: string | null;
10887
+ };
10888
+ /**
10889
+ * DatabaseRollup
10890
+ * @description Measure the rows linked through ``relation``: ``count`` them, or ``sum``/``avg``/``min``/``max`` a
10891
+ * number ``column`` of them.
10892
+ */
10893
+ DatabaseRollup: {
10894
+ /**
10895
+ * Relation
10896
+ * @description Relation column of this database (id or name)
10897
+ */
10898
+ relation: string;
10899
+ /**
10900
+ * Column
10901
+ * @description Number column of the target (not for count)
10902
+ */
10903
+ column?: string | null;
10904
+ /**
10905
+ * Op
10906
+ * @default count
10907
+ * @enum {string}
10908
+ */
10909
+ op: 'count' | 'sum' | 'avg' | 'min' | 'max';
10910
+ };
10656
10911
  /** DatabaseRowPage */
10657
10912
  DatabaseRowPage: {
10658
10913
  /** Rows */
@@ -10660,7 +10915,11 @@ interface components {
10660
10915
  /** Total */
10661
10916
  total: number;
10662
10917
  };
10663
- /** DatabaseRowRead */
10918
+ /**
10919
+ * DatabaseRowRead
10920
+ * @description A row: cell values keyed by column id. ``document`` and ``relation`` cells are lists of ids, a ``lookup``
10921
+ * a list of values, a ``rollup`` a number. ``titles`` names every document and related row it links.
10922
+ */
10664
10923
  DatabaseRowRead: {
10665
10924
  /** Id */
10666
10925
  id: string;
@@ -10668,6 +10927,10 @@ interface components {
10668
10927
  values: {
10669
10928
  [key: string]: unknown;
10670
10929
  };
10930
+ /** Titles */
10931
+ titles?: {
10932
+ [key: string]: string;
10933
+ };
10671
10934
  /**
10672
10935
  * Created At
10673
10936
  * Format: date-time
@@ -10681,7 +10944,10 @@ interface components {
10681
10944
  };
10682
10945
  /**
10683
10946
  * DatabaseRowWrite
10684
- * @description Cell values keyed by column id (``col-…``) or column name.
10947
+ * @description Cell values keyed by column id or column name; ``null`` empties a cell.
10948
+ *
10949
+ * A ``document`` or ``relation`` cell takes an id or a list of them (``doc-…`` / ``dbr-…``), replacing the
10950
+ * cell's links; on a two-way relation either side can be written.
10685
10951
  */
10686
10952
  DatabaseRowWrite: {
10687
10953
  /** Values */
@@ -10699,6 +10965,15 @@ interface components {
10699
10965
  /** Ids */
10700
10966
  ids: string[];
10701
10967
  };
10968
+ /** DatabaseSeries */
10969
+ DatabaseSeries: {
10970
+ /** Key */
10971
+ key: string;
10972
+ /** Label */
10973
+ label: string;
10974
+ /** Values */
10975
+ values: (number | null)[];
10976
+ };
10702
10977
  /** DatabaseUpdate */
10703
10978
  DatabaseUpdate: {
10704
10979
  /** Name */
@@ -11960,7 +12235,7 @@ interface components {
11960
12235
  * @default text
11961
12236
  * @enum {string}
11962
12237
  */
11963
- type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person';
12238
+ type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person' | 'document' | 'relation' | 'lookup' | 'rollup';
11964
12239
  /** Options */
11965
12240
  options?: string[] | null;
11966
12241
  };
@@ -11978,7 +12253,7 @@ interface components {
11978
12253
  * @default text
11979
12254
  * @enum {string}
11980
12255
  */
11981
- type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person';
12256
+ type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person' | 'document' | 'relation' | 'lookup' | 'rollup';
11982
12257
  /** Options */
11983
12258
  options?: string[] | null;
11984
12259
  };
@@ -12098,6 +12373,7 @@ interface components {
12098
12373
  * - "The user is greeting the assistant. No documents are needed."
12099
12374
  * - "The user wants to find force majeure clauses. Only the three contracts are relevant, so I will keep only those."
12100
12375
  * - "The user wants a full timeline of the case. Most documents are relevant, so I will drop only the unrelated procedural orders."
12376
+ * - The agent that reads the goal does not see the history indices: refer to an earlier message by what it is ("the investigation report in the previous answer"), never by its [N] index.
12101
12377
  *
12102
12378
  * 2. **doc_filter_mode** and **doc_ids**: Select which documents the agent needs.
12103
12379
  * - `"keep"` mode: `doc_ids` lists the ONLY docs to keep. Everything else is dropped.
@@ -17760,7 +18036,7 @@ interface components {
17760
18036
  * Type
17761
18037
  * @enum {string}
17762
18038
  */
17763
- type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person';
18039
+ type: 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person' | 'document' | 'relation' | 'lookup' | 'rollup';
17764
18040
  /** Options */
17765
18041
  options?: string[] | null;
17766
18042
  /** Tag Ext Id */
@@ -24963,6 +25239,38 @@ interface operations {
24963
25239
  };
24964
25240
  };
24965
25241
  };
25242
+ list_database_document_links: {
25243
+ parameters: {
25244
+ query: {
25245
+ /** @description The document (doc-…) */
25246
+ doc_id: string;
25247
+ };
25248
+ header?: never;
25249
+ path?: never;
25250
+ cookie?: never;
25251
+ };
25252
+ requestBody?: never;
25253
+ responses: {
25254
+ /** @description Successful Response */
25255
+ 200: {
25256
+ headers: {
25257
+ [name: string]: unknown;
25258
+ };
25259
+ content: {
25260
+ 'application/json': components['schemas']['DatabaseDocumentLink'][];
25261
+ };
25262
+ };
25263
+ /** @description Validation Error */
25264
+ 422: {
25265
+ headers: {
25266
+ [name: string]: unknown;
25267
+ };
25268
+ content: {
25269
+ 'application/json': components['schemas']['HTTPValidationError'];
25270
+ };
25271
+ };
25272
+ };
25273
+ };
24966
25274
  get_database: {
24967
25275
  parameters: {
24968
25276
  query?: never;
@@ -25168,6 +25476,41 @@ interface operations {
25168
25476
  };
25169
25477
  };
25170
25478
  };
25479
+ aggregate_database: {
25480
+ parameters: {
25481
+ query?: never;
25482
+ header?: never;
25483
+ path: {
25484
+ database_id: string;
25485
+ };
25486
+ cookie?: never;
25487
+ };
25488
+ requestBody: {
25489
+ content: {
25490
+ 'application/json': components['schemas']['DatabaseAggregateRequest'];
25491
+ };
25492
+ };
25493
+ responses: {
25494
+ /** @description Successful Response */
25495
+ 200: {
25496
+ headers: {
25497
+ [name: string]: unknown;
25498
+ };
25499
+ content: {
25500
+ 'application/json': components['schemas']['DatabaseAggregateResult'];
25501
+ };
25502
+ };
25503
+ /** @description Validation Error */
25504
+ 422: {
25505
+ headers: {
25506
+ [name: string]: unknown;
25507
+ };
25508
+ content: {
25509
+ 'application/json': components['schemas']['HTTPValidationError'];
25510
+ };
25511
+ };
25512
+ };
25513
+ };
25171
25514
  delete_database_rows: {
25172
25515
  parameters: {
25173
25516
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbidocs/client",
3
- "version": "0.4.78",
3
+ "version": "0.4.79",
4
4
  "description": "TypeScript SDK for the ARBI API — zero-knowledge auth, E2E encryption, and type-safe REST client",
5
5
  "type": "module",
6
6
  "sideEffects": false,