@proteos/sdk 0.54.1 → 0.56.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.
@@ -1456,12 +1456,15 @@ type LogicalOperator = 'and' | 'or';
1456
1456
  * Comparison operator for a single filter element. Mirrors
1457
1457
  * `ComparisonOperator` in `packages/go/model/comparison-operator.go`.
1458
1458
  */
1459
- type ComparisonOperator = 'eq' | 'gt' | 'lt' | 'gte' | 'lte' | 'ne' | 'in' | 'not_in' | 'contains' | 'starts_with' | 'ends_with' | 'empty' | 'not_empty';
1459
+ type ComparisonOperator = 'eq' | 'gt' | 'lt' | 'gte' | 'lte' | 'ne' | 'in' | 'not_in' | 'contains' | 'not_contains' | 'contains_all' | 'starts_with' | 'ends_with' | 'empty' | 'not_empty';
1460
1460
  /**
1461
1461
  * Single filter element (atomic predicate).
1462
1462
  *
1463
- * `value` is a string at the wire level — pipe-joined for `in` / `not_in`,
1464
- * ignored for `empty` / `not_empty`. This matches the data-service URL query
1463
+ * `value` is a string at the wire level — pipe-joined for the list operators
1464
+ * `in` / `not_in` / `contains_all`, ignored for `empty` / `not_empty`. On array
1465
+ * attributes the membership operators are set tests: `contains` = has the
1466
+ * value, `not_contains` = does not have it, `in` = has any of, `not_in` = has
1467
+ * none of, `contains_all` = has all of. This matches the data-service URL query
1465
1468
  * convention so the same predicate flows through both the GET-with-filters
1466
1469
  * path and the layout `visible_when` JSONB path without a translation layer.
1467
1470
  */
@@ -1481,15 +1484,15 @@ interface FilterGroup {
1481
1484
  declare const FilterElementSchema: z.ZodObject<{
1482
1485
  field: z.ZodString;
1483
1486
  value: z.ZodString;
1484
- operator: z.ZodEnum<["eq", "gt", "lt", "gte", "lte", "ne", "in", "not_in", "contains", "starts_with", "ends_with", "empty", "not_empty"]>;
1487
+ operator: z.ZodEnum<["eq", "gt", "lt", "gte", "lte", "ne", "in", "not_in", "contains", "not_contains", "contains_all", "starts_with", "ends_with", "empty", "not_empty"]>;
1485
1488
  }, "strip", z.ZodTypeAny, {
1486
1489
  value: string;
1487
1490
  field: string;
1488
- operator: "eq" | "gt" | "lt" | "gte" | "lte" | "ne" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | "empty" | "not_empty";
1491
+ operator: "eq" | "gt" | "lt" | "gte" | "lte" | "ne" | "in" | "not_in" | "contains" | "not_contains" | "contains_all" | "starts_with" | "ends_with" | "empty" | "not_empty";
1489
1492
  }, {
1490
1493
  value: string;
1491
1494
  field: string;
1492
- operator: "eq" | "gt" | "lt" | "gte" | "lte" | "ne" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | "empty" | "not_empty";
1495
+ operator: "eq" | "gt" | "lt" | "gte" | "lte" | "ne" | "in" | "not_in" | "contains" | "not_contains" | "contains_all" | "starts_with" | "ends_with" | "empty" | "not_empty";
1493
1496
  }>;
1494
1497
  declare const FilterGroupSchema: z.ZodType<FilterGroup>;
1495
1498
 
@@ -1997,6 +2000,28 @@ declare const PageLayoutSchema: z.ZodObject<{
1997
2000
  } | undefined;
1998
2001
  }>;
1999
2002
 
2003
+ /**
2004
+ * The virtual column that stands for a record's rendered title — the entity's
2005
+ * Liquid `title_template` evaluated against the row. Lists show it, and the
2006
+ * records query sorts and filters on it when the template is "simple". No
2007
+ * attribute backs it, so the name is reserved: the backend rejects an
2008
+ * attribute called `record_title` (mirror of `metamodel.RecordTitleField`).
2009
+ */
2010
+ declare const RECORD_TITLE_FIELD = "record_title";
2011
+ /** True when `name` is taken by a virtual column and unavailable to attributes. */
2012
+ declare function isReservedAttributeName(name: string): boolean;
2013
+ /**
2014
+ * A simple template is literal text plus `{{ attribute }}` references and
2015
+ * nothing else — no filters (`| upcase`), no tags (`{% if %}`), no dotted
2016
+ * references. Only those compile to SQL, so only those make `record_title`
2017
+ * sortable and filterable. Mirror of the Go `titletemplate.ParseSimple`
2018
+ * grammar; the backend stays the authority and answers 400 when the two
2019
+ * ever disagree.
2020
+ */
2021
+ declare function isTitleQueryable(template: string | undefined): boolean;
2022
+ /** The attributes a simple template references, in order of first use; `[]` otherwise. */
2023
+ declare function titleTemplateVariables(template: string | undefined): string[];
2024
+
2000
2025
  /**
2001
2026
  * Client for the Proteos Metadata Service API.
2002
2027
  * Provides access to all metadata management services.
@@ -5743,4 +5768,4 @@ declare function isCurrentUserDefault(value: unknown): value is CurrentUserDefau
5743
5768
  /** Only the identity-valued attribute types can carry the sentinel. */
5744
5769
  declare function acceptsCurrentUserDefault(type: AttributeType): boolean;
5745
5770
 
5746
- export { CurrencyAttributeMetaSchema as $, type AuditFields as A, type ComponentService as B, CURRENT_USER_DEFAULT as C, type ContactAddressAttributeKind as D, type ContactAddressAttributeMeta as E, type FileRef as F, ContactAddressAttributeMetaSchema as G, type ContactBindingDuplicatePolicy as H, type CreateAppConfigurationRequest as I, type CreateAppRequest as J, type CreateComponentRequest as K, type ListOptions as L, type CreateDesignReferenceRequest as M, type CreateEntityExtensionRequest as N, type CreateEntityRequest as O, PageIterator as P, type CreateListExtensionRequest as Q, type ResponseMeta as R, type CreateListRequest as S, type CreateListViewRequest as T, type UserRef as U, type CreateMenuConfigurationExtensionRequest as V, type CreateMenuConfigurationRequest as W, type CreatePageExtensionRequest as X, type CreatePageRequest as Y, type CreateVariableRequest as Z, type CurrencyAttributeMeta as _, type Attribute as a, type MenuConfigurationExtensionPlacement as a$, type CurrencySymbolSide as a0, type CurrencyValue as a1, type CurrentUserDefault as a2, DEFAULT_OPTIONS as a3, DEFAULT_PAGE_SIZE as a4, DONE as a5, type DeployModuleRequest as a6, type DesignReference as a7, type DesignReferenceContent as a8, DesignReferenceSchema as a9, type ListDesignReferencesOptions as aA, type ListEntitiesOptions as aB, type ListEntityExtensionsOptions as aC, type ListExtension as aD, type ListExtensionColumnPlacement as aE, ListExtensionColumnPlacementSchema as aF, ListExtensionSchema as aG, type ListExtensionService as aH, type ListFn as aI, type ListListExtensionsOptions as aJ, type ListListViewsOptions as aK, type ListListsOptions as aL, type ListMenuConfigurationExtensionsOptions as aM, type ListMenuConfigurationsOptions as aN, type ListModulesOptions as aO, type ListPageExtensionsOptions as aP, type ListPagesOptions as aQ, ListSchema as aR, type ListService as aS, type ListVariablesOptions as aT, type ListView as aU, ListViewSchema as aV, type ListViewService as aW, type LogicalOperator as aX, MENU_CONFIGURATION_EXTENSION_ANCHOR_ITEMS as aY, type MenuConfiguration as aZ, type MenuConfigurationExtension as a_, type DesignReferenceService as aa, type Done as ab, type Entity as ac, type EntityContactBinding as ad, EntityContactBindingSchema as ae, type EntityExtension as af, EntityExtensionSchema as ag, type EntityExtensionService as ah, EntitySchema as ai, type EntityService as aj, type EntityWithSchema as ak, EntityWithSchemaSchema as al, type EnumAttributeMeta as am, type EnumValue as an, type ExtensionPosition as ao, ExtensionPositionSchema as ap, type FileAttributeMeta as aq, FileRefSchema as ar, type FilterElement as as, FilterElementSchema as at, type FilterGroup as au, FilterGroupSchema as av, type List as aw, type ListAppConfigurationsOptions as ax, type ListAppsOptions as ay, type ListComponentsOptions as az, type ListResult as b, type UserType as b$, MenuConfigurationExtensionPlacementSchema as b0, type MenuConfigurationExtensionPosition as b1, MenuConfigurationExtensionPositionSchema as b2, MenuConfigurationExtensionSchema as b3, type MenuConfigurationExtensionService as b4, MenuConfigurationSchema as b5, type MenuConfigurationService as b6, type MenuItem as b7, MenuItemSchema as b8, MenuItemType as b9, type PublicPageComponent as bA, type PublicPageResponse as bB, type RelationAttributeMeta as bC, RelationAttributeMetaSchema as bD, type RequestOptions as bE, type ResolvedClientOptions as bF, ResponseMetaSchema as bG, type SortConfig as bH, SortConfigSchema as bI, type SortDirection as bJ, type Timestamps as bK, type TokenProvider as bL, type UpdateAppConfigurationRequest as bM, type UpdateAppRequest as bN, type UpdateComponentRequest as bO, type UpdateDesignReferenceRequest as bP, type UpdateEntityExtensionRequest as bQ, type UpdateEntityRequest as bR, type UpdateListExtensionRequest as bS, type UpdateListRequest as bT, type UpdateListViewRequest as bU, type UpdateMenuConfigurationExtensionRequest as bV, type UpdateMenuConfigurationRequest as bW, type UpdatePageExtensionRequest as bX, type UpdatePageRequest as bY, type UpdateVariableRequest as bZ, UserRefSchema as b_, MetaClient as ba, type MetaListOptions as bb, type Module as bc, ModuleSchema as bd, type ModuleService as be, type ModuleStatus as bf, type OnDeleteAction as bg, OnDeleteActionSchema as bh, PAGE_EXTENSION_ANCHOR_MAIN as bi, PAGE_EXTENSION_ANCHOR_SIDE_PANEL as bj, PLATFORM_ATTRIBUTE_NAMES as bk, PLATFORM_USER_ID as bl, type Page as bm, type PageAction as bn, type PageActionKind as bo, PageActionSchema as bp, type PageExtension as bq, type PageExtensionPlacement as br, PageExtensionPlacementSchema as bs, PageExtensionSchema as bt, type PageExtensionService as bu, type PageLayout as bv, PageLayoutSchema as bw, PageSchema as bx, type PageService as by, type PageType as bz, ProteosClient as c, SizeValueSchema as c$, type Variable as c0, VariableSchema as c1, type VariableService as c2, acceptsCurrentUserDefault as c3, allCurrencyCodes as c4, createIterator as c5, createListResultSchema as c6, currencyLabel as c7, currencySymbol as c8, currencySymbolSide as c9, type LayoutAlign as cA, type LayoutElement as cB, LayoutElementSchema as cC, LayoutElementType as cD, type LayoutGap as cE, type LayoutJustify as cF, type LayoutTab as cG, LayoutTabSchema as cH, type ListElement as cI, type NumberAttributeMeta as cJ, type ObjectAttributeMeta as cK, PAGE_BACKGROUND_TOKENS as cL, type PageBackgroundToken as cM, type PageLayoutSidePanel as cN, PageLayoutSidePanelSchema as cO, type PageStyle as cP, PageStyleSchema as cQ, type PrincipalAttributeMeta as cR, type PrincipalType as cS, type RecordFilterElement as cT, type RelatedListElement as cU, type RelatedRecordElement as cV, type ResponsiveSizing as cW, type RowElement as cX, type SchedulingPickerElement as cY, type SectionElement as cZ, type SizeValue as c_, formatAmount as ca, formatMoney as cb, isCurrentUserDefault as cc, isPlatformAttributeName as cd, localeNumberSeparators as ce, parseAmount as cf, parseContactAddressMeta as cg, parseCurrencyMeta as ch, parseFileMeta as ci, parseRelationMeta as cj, platformAttributes as ck, resolveOptions as cl, type AttributeForLookup as cm, type AttributeMeta as cn, BUILT_IN_CONTROLS as co, type BuiltInControlSlug as cp, type CardElement as cq, type ColumnElement as cr, type CommonProps as cs, type ComponentElement as ct, type ControlBucket as cu, type DatetimeAttributeMeta as cv, type DatetimeFormat as cw, type DividerElement as cx, type FieldElement as cy, FileAttributeMetaSchema as cz, type PrincipalRef as d, type SizingProps as d0, type StringAttributeMeta as d1, type StringFormat as d2, type TabsElement as d3, type TextElement as d4, type TextVariant as d5, type UserAttributeMeta as d6, UserAttributeMetaSchema as d7, type WorkflowTriggerElement as d8, isBuiltInControl as d9, lookupCompatibleControls as da, lookupControls as db, lookupPrimaryControl as dc, parsePrincipalMeta as dd, parseUserMeta as de, type PublicAccessOperation as e, type App as f, type AppConfiguration as g, AppConfigurationSchema as h, type AppConfigurationService as i, type AppHome as j, AppHomeSchema as k, type AppHomeType as l, AppSchema as m, type AppService as n, type ArrayAttributeMeta as o, type AttributeAccessRule as p, type AttributeRestrictions as q, AttributeSchema as r, type AttributeType as s, AuditFieldsSchema as t, type ClientOptions as u, type Column as v, ColumnSchema as w, type ComparisonOperator as x, type Component as y, ComponentSchema as z };
5771
+ export { CurrencyAttributeMetaSchema as $, type AuditFields as A, type ComponentService as B, CURRENT_USER_DEFAULT as C, type ContactAddressAttributeKind as D, type ContactAddressAttributeMeta as E, type FileRef as F, ContactAddressAttributeMetaSchema as G, type ContactBindingDuplicatePolicy as H, type CreateAppConfigurationRequest as I, type CreateAppRequest as J, type CreateComponentRequest as K, type ListOptions as L, type CreateDesignReferenceRequest as M, type CreateEntityExtensionRequest as N, type CreateEntityRequest as O, PageIterator as P, type CreateListExtensionRequest as Q, type ResponseMeta as R, type CreateListRequest as S, type CreateListViewRequest as T, type UserRef as U, type CreateMenuConfigurationExtensionRequest as V, type CreateMenuConfigurationRequest as W, type CreatePageExtensionRequest as X, type CreatePageRequest as Y, type CreateVariableRequest as Z, type CurrencyAttributeMeta as _, type Attribute as a, type MenuConfigurationExtensionPlacement as a$, type CurrencySymbolSide as a0, type CurrencyValue as a1, type CurrentUserDefault as a2, DEFAULT_OPTIONS as a3, DEFAULT_PAGE_SIZE as a4, DONE as a5, type DeployModuleRequest as a6, type DesignReference as a7, type DesignReferenceContent as a8, DesignReferenceSchema as a9, type ListDesignReferencesOptions as aA, type ListEntitiesOptions as aB, type ListEntityExtensionsOptions as aC, type ListExtension as aD, type ListExtensionColumnPlacement as aE, ListExtensionColumnPlacementSchema as aF, ListExtensionSchema as aG, type ListExtensionService as aH, type ListFn as aI, type ListListExtensionsOptions as aJ, type ListListViewsOptions as aK, type ListListsOptions as aL, type ListMenuConfigurationExtensionsOptions as aM, type ListMenuConfigurationsOptions as aN, type ListModulesOptions as aO, type ListPageExtensionsOptions as aP, type ListPagesOptions as aQ, ListSchema as aR, type ListService as aS, type ListVariablesOptions as aT, type ListView as aU, ListViewSchema as aV, type ListViewService as aW, type LogicalOperator as aX, MENU_CONFIGURATION_EXTENSION_ANCHOR_ITEMS as aY, type MenuConfiguration as aZ, type MenuConfigurationExtension as a_, type DesignReferenceService as aa, type Done as ab, type Entity as ac, type EntityContactBinding as ad, EntityContactBindingSchema as ae, type EntityExtension as af, EntityExtensionSchema as ag, type EntityExtensionService as ah, EntitySchema as ai, type EntityService as aj, type EntityWithSchema as ak, EntityWithSchemaSchema as al, type EnumAttributeMeta as am, type EnumValue as an, type ExtensionPosition as ao, ExtensionPositionSchema as ap, type FileAttributeMeta as aq, FileRefSchema as ar, type FilterElement as as, FilterElementSchema as at, type FilterGroup as au, FilterGroupSchema as av, type List as aw, type ListAppConfigurationsOptions as ax, type ListAppsOptions as ay, type ListComponentsOptions as az, type ListResult as b, type UserType as b$, MenuConfigurationExtensionPlacementSchema as b0, type MenuConfigurationExtensionPosition as b1, MenuConfigurationExtensionPositionSchema as b2, MenuConfigurationExtensionSchema as b3, type MenuConfigurationExtensionService as b4, MenuConfigurationSchema as b5, type MenuConfigurationService as b6, type MenuItem as b7, MenuItemSchema as b8, MenuItemType as b9, type PublicPageComponent as bA, type PublicPageResponse as bB, type RelationAttributeMeta as bC, RelationAttributeMetaSchema as bD, type RequestOptions as bE, type ResolvedClientOptions as bF, ResponseMetaSchema as bG, type SortConfig as bH, SortConfigSchema as bI, type SortDirection as bJ, type Timestamps as bK, type TokenProvider as bL, type UpdateAppConfigurationRequest as bM, type UpdateAppRequest as bN, type UpdateComponentRequest as bO, type UpdateDesignReferenceRequest as bP, type UpdateEntityExtensionRequest as bQ, type UpdateEntityRequest as bR, type UpdateListExtensionRequest as bS, type UpdateListRequest as bT, type UpdateListViewRequest as bU, type UpdateMenuConfigurationExtensionRequest as bV, type UpdateMenuConfigurationRequest as bW, type UpdatePageExtensionRequest as bX, type UpdatePageRequest as bY, type UpdateVariableRequest as bZ, UserRefSchema as b_, MetaClient as ba, type MetaListOptions as bb, type Module as bc, ModuleSchema as bd, type ModuleService as be, type ModuleStatus as bf, type OnDeleteAction as bg, OnDeleteActionSchema as bh, PAGE_EXTENSION_ANCHOR_MAIN as bi, PAGE_EXTENSION_ANCHOR_SIDE_PANEL as bj, PLATFORM_ATTRIBUTE_NAMES as bk, PLATFORM_USER_ID as bl, type Page as bm, type PageAction as bn, type PageActionKind as bo, PageActionSchema as bp, type PageExtension as bq, type PageExtensionPlacement as br, PageExtensionPlacementSchema as bs, PageExtensionSchema as bt, type PageExtensionService as bu, type PageLayout as bv, PageLayoutSchema as bw, PageSchema as bx, type PageService as by, type PageType as bz, ProteosClient as c, type SizeValue as c$, type Variable as c0, VariableSchema as c1, type VariableService as c2, acceptsCurrentUserDefault as c3, allCurrencyCodes as c4, createIterator as c5, createListResultSchema as c6, currencyLabel as c7, currencySymbol as c8, currencySymbolSide as c9, type LayoutAlign as cA, type LayoutElement as cB, LayoutElementSchema as cC, LayoutElementType as cD, type LayoutGap as cE, type LayoutJustify as cF, type LayoutTab as cG, LayoutTabSchema as cH, type ListElement as cI, type NumberAttributeMeta as cJ, type ObjectAttributeMeta as cK, PAGE_BACKGROUND_TOKENS as cL, type PageBackgroundToken as cM, type PageLayoutSidePanel as cN, PageLayoutSidePanelSchema as cO, type PageStyle as cP, PageStyleSchema as cQ, type PrincipalAttributeMeta as cR, type PrincipalType as cS, RECORD_TITLE_FIELD as cT, type RecordFilterElement as cU, type RelatedListElement as cV, type RelatedRecordElement as cW, type ResponsiveSizing as cX, type RowElement as cY, type SchedulingPickerElement as cZ, type SectionElement as c_, formatAmount as ca, formatMoney as cb, isCurrentUserDefault as cc, isPlatformAttributeName as cd, localeNumberSeparators as ce, parseAmount as cf, parseContactAddressMeta as cg, parseCurrencyMeta as ch, parseFileMeta as ci, parseRelationMeta as cj, platformAttributes as ck, resolveOptions as cl, type AttributeForLookup as cm, type AttributeMeta as cn, BUILT_IN_CONTROLS as co, type BuiltInControlSlug as cp, type CardElement as cq, type ColumnElement as cr, type CommonProps as cs, type ComponentElement as ct, type ControlBucket as cu, type DatetimeAttributeMeta as cv, type DatetimeFormat as cw, type DividerElement as cx, type FieldElement as cy, FileAttributeMetaSchema as cz, type PrincipalRef as d, SizeValueSchema as d0, type SizingProps as d1, type StringAttributeMeta as d2, type StringFormat as d3, type TabsElement as d4, type TextElement as d5, type TextVariant as d6, type UserAttributeMeta as d7, UserAttributeMetaSchema as d8, type WorkflowTriggerElement as d9, isBuiltInControl as da, isReservedAttributeName as db, isTitleQueryable as dc, lookupCompatibleControls as dd, lookupControls as de, lookupPrimaryControl as df, parsePrincipalMeta as dg, parseUserMeta as dh, titleTemplateVariables as di, type PublicAccessOperation as e, type App as f, type AppConfiguration as g, AppConfigurationSchema as h, type AppConfigurationService as i, type AppHome as j, AppHomeSchema as k, type AppHomeType as l, AppSchema as m, type AppService as n, type ArrayAttributeMeta as o, type AttributeAccessRule as p, type AttributeRestrictions as q, AttributeSchema as r, type AttributeType as s, AuditFieldsSchema as t, type ClientOptions as u, type Column as v, ColumnSchema as w, type ComparisonOperator as x, type Component as y, ComponentSchema as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proteos/sdk",
3
- "version": "0.54.1",
3
+ "version": "0.56.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "TypeScript SDK for the Proteos platform",
6
6
  "repository": {
@@ -66,8 +66,8 @@
66
66
  "tsup": "^8.3.0",
67
67
  "typescript": "^5.7.0",
68
68
  "vitest": "^3.0.0",
69
- "@proteos/biome-config": "0.0.0",
70
- "@proteos/tsconfig": "0.0.0"
69
+ "@proteos/tsconfig": "0.0.0",
70
+ "@proteos/biome-config": "0.0.0"
71
71
  },
72
72
  "scripts": {
73
73
  "build": "tsup",
@@ -1,6 +1,7 @@
1
1
  import type { ProteosClient } from '../client.js'
2
2
  import { type AgentService, AgentServiceImpl } from './agents.js'
3
3
  import { type McpServerService, McpServerServiceImpl } from './mcp-servers.js'
4
+ import { type ModelService, ModelServiceImpl } from './models.js'
4
5
  import { type PromptService, PromptServiceImpl } from './prompts.js'
5
6
  import { type SessionService, SessionServiceImpl } from './sessions.js'
6
7
  import { type SkillService, SkillServiceImpl } from './skills.js'
@@ -12,7 +13,8 @@ import { type ToolsetService, ToolsetServiceImpl } from './toolsets.js'
12
13
  *
13
14
  * Manages the AI-agent configuration domain: Agents, Prompts (versioned),
14
15
  * Skills (versioned bundles), Tools, and MCP Servers — all org-scoped and keyed
15
- * by an immutable kebab-case `key`.
16
+ * by an immutable kebab-case `key` — plus the stateless model calls
17
+ * (`models.generate`, `models.decide`) and chat sessions.
16
18
  *
17
19
  * @example
18
20
  * ```ts
@@ -23,6 +25,15 @@ import { type ToolsetService, ToolsetServiceImpl } from './toolsets.js'
23
25
  *
24
26
  * const agents = await agent.agents.list().all();
25
27
  * const prompt = await agent.prompts.get('revenue-brief');
28
+ *
29
+ * const { answers } = await agent.models.decide({
30
+ * state: { message: 'My card was charged twice!' },
31
+ * questions: {
32
+ * refund_requested: { type: 'boolean', instructions: 'Does the customer ask for money back?' },
33
+ * topic: { type: 'choice', instructions: 'Topic?', criteria: { billing: 'charges', other: 'else' } },
34
+ * },
35
+ * });
36
+ * if (answers.topic.confidence > 0.8) route(answers.topic.choice);
26
37
  * ```
27
38
  */
28
39
  export class AgentClient {
@@ -38,6 +49,8 @@ export class AgentClient {
38
49
  readonly toolsets: ToolsetService
39
50
  /** Service for managing MCP server registrations. */
40
51
  readonly mcpServers: McpServerService
52
+ /** Service for stateless model calls: `generate` (one message out) and `decide` (calibrated typed answers). */
53
+ readonly models: ModelService
41
54
  /** Service for managing chat sessions (conversations + event log + stream). */
42
55
  readonly sessions: SessionService
43
56
 
@@ -53,6 +66,7 @@ export class AgentClient {
53
66
  this.tools = new ToolServiceImpl(client)
54
67
  this.toolsets = new ToolsetServiceImpl(client)
55
68
  this.mcpServers = new McpServerServiceImpl(client)
69
+ this.models = new ModelServiceImpl(client)
56
70
  this.sessions = new SessionServiceImpl(client)
57
71
  }
58
72
  }
@@ -60,6 +74,28 @@ export class AgentClient {
60
74
  // Re-export service interfaces
61
75
  export type { AgentService } from './agents.js'
62
76
  export type { McpServerService } from './mcp-servers.js'
77
+ // Re-export model-call types (generate + decide)
78
+ export type {
79
+ BooleanAnswer,
80
+ BooleanCriteria,
81
+ BooleanQuestion,
82
+ ChoiceAnswer,
83
+ ChoiceQuestion,
84
+ DecideRequest,
85
+ DecisionAnswer,
86
+ DecisionAnswerFor,
87
+ DecisionQuestion,
88
+ DecisionQuestions,
89
+ DecisionQuestionType,
90
+ DecisionResult,
91
+ GenerateRequest,
92
+ GenerationResult,
93
+ ModelStopReason,
94
+ ScoreAnswer,
95
+ ScoreQuestion,
96
+ StructuredText,
97
+ } from './model-types.js'
98
+ export type { ModelService } from './models.js'
63
99
  export type { PromptService } from './prompts.js'
64
100
  // Re-export session types
65
101
  export type {
@@ -110,12 +146,14 @@ export type {
110
146
  CreateMcpServerRequest,
111
147
  CreatePromptRequest,
112
148
  CreateToolRequest,
149
+ CreateToolsetRequest,
113
150
  DependentAgent,
114
151
  DependentSyncResult,
115
152
  ListAgentsOptions,
116
153
  ListMcpServersOptions,
117
154
  ListPromptsOptions,
118
155
  ListSkillsOptions,
156
+ ListToolsetsOptions,
119
157
  ListToolsOptions,
120
158
  McpBinding,
121
159
  McpConnectionState,
@@ -125,25 +163,23 @@ export type {
125
163
  McpServerOAuth,
126
164
  McpToolSummary,
127
165
  ModelConfig,
166
+ PlatformBinding,
128
167
  Prompt,
129
168
  PromptVersion,
169
+ QueryBinding,
130
170
  Skill,
131
171
  SkillBundle,
132
172
  SkillVersion,
133
173
  StartMcpOAuthResponse,
134
- PlatformBinding,
135
- QueryBinding,
136
174
  Tool,
137
175
  ToolBinding,
138
176
  ToolKind,
139
177
  Toolset,
140
178
  ToolsetKind,
141
179
  ToolsetToolSummary,
142
- CreateToolsetRequest,
143
- UpdateToolsetRequest,
144
- ListToolsetsOptions,
145
180
  UpdateAgentRequest,
146
181
  UpdateMcpServerRequest,
147
182
  UpdatePromptRequest,
148
183
  UpdateToolRequest,
184
+ UpdateToolsetRequest,
149
185
  } from './types.js'
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Types for the stateless model endpoints of the Proteos Agent Service API —
3
+ * `POST /agents/v1/models/generate` and `POST /agents/v1/models/decide`.
4
+ *
5
+ * Hand-written mirror of the Go models in `go.proteos.ai/model/agent`
6
+ * (`generation.go`, `decision.go` + `api/generation-requests.go`,
7
+ * `api/decision-requests.go`). Field names match the snake_case wire format
8
+ * exactly, including enum values.
9
+ */
10
+
11
+ import type { ContentBlock, ModelUsage, TextBlock } from './session-types.js'
12
+ import type { ModelConfig } from './types.js'
13
+
14
+ // ---------------------------------------------------------------------------
15
+ // Generation (one message out)
16
+ // ---------------------------------------------------------------------------
17
+
18
+ /**
19
+ * Why the model stopped generating. An open string so a new provider reason
20
+ * never breaks decoding; the key distinction is `end_turn` (complete) vs
21
+ * `max_tokens` (truncated).
22
+ */
23
+ export type ModelStopReason = 'end_turn' | 'max_tokens' | 'stop_sequence' | (string & {})
24
+
25
+ /**
26
+ * Body of `POST /agents/v1/models/generate` — a single, stateless model call:
27
+ * content blocks in, one assistant message out. No event log, no tools, no
28
+ * multi-turn state.
29
+ */
30
+ export interface GenerateRequest {
31
+ /** Model id + sampling knobs. Omitted (or an empty `model_id`) resolves to the service default. */
32
+ model?: Partial<ModelConfig>
33
+ /** Optional system prompt steering the response. */
34
+ system?: string
35
+ /** The message body the model answers — text and file blocks (a file-only body is valid). */
36
+ content: ContentBlock[]
37
+ /**
38
+ * JSON Schema of the structured reply. When set, generation is forced through a
39
+ * schema-constrained tool and the structured value comes back as `output`.
40
+ */
41
+ output_schema?: Record<string, unknown>
42
+ }
43
+
44
+ /** The assistant's reply to a {@link GenerateRequest}. */
45
+ export interface GenerationResult {
46
+ /** The returned text blocks (usually empty on a schema-constrained call). */
47
+ content: TextBlock[]
48
+ stop_reason?: ModelStopReason
49
+ /** The model that produced the reply (resolved id). */
50
+ model_id: string
51
+ usage: ModelUsage
52
+ /** The structured value of a schema-constrained generation; absent otherwise. */
53
+ output?: unknown
54
+ }
55
+
56
+ // ---------------------------------------------------------------------------
57
+ // Decisions (typed, calibrated answers out — no prose)
58
+ // ---------------------------------------------------------------------------
59
+
60
+ /**
61
+ * The text shape a decision provider reads: a string, a JSON object, or an
62
+ * array — never `null`, a number, or a boolean. Carries the state under
63
+ * judgment, a question's instructions, every criteria description, and the
64
+ * legend echoed back on a score. Structure passes through verbatim, so
65
+ * instructions can be structured guidance (named fields such as `what` /
66
+ * `not_for` / `examples`, backtick paths into the state like
67
+ * `` `ticket.messages[0].text` ``).
68
+ */
69
+ export type StructuredText = string | Record<string, unknown> | unknown[]
70
+
71
+ /** Discriminates a {@link DecisionQuestion} and its {@link DecisionAnswer}. */
72
+ export type DecisionQuestionType = 'boolean' | 'choice' | 'score'
73
+
74
+ /** Describes the two outcomes of a {@link BooleanQuestion}. */
75
+ export interface BooleanCriteria {
76
+ true: StructuredText
77
+ false: StructuredText
78
+ }
79
+
80
+ /**
81
+ * "Is this statement true?" — answered with the calibrated probability that it
82
+ * is. `criteria` optionally spells out what makes the statement hold (true) or
83
+ * not (false) when the boundary is subtle.
84
+ */
85
+ export interface BooleanQuestion {
86
+ type: 'boolean'
87
+ instructions: StructuredText
88
+ criteria?: BooleanCriteria
89
+ }
90
+
91
+ /**
92
+ * "Which one of these?" — `criteria` maps each option name to its description;
93
+ * options are unordered. Option-count limits are the provider's.
94
+ */
95
+ export interface ChoiceQuestion<Option extends string = string> {
96
+ type: 'choice'
97
+ instructions: StructuredText
98
+ criteria: Record<Option, StructuredText>
99
+ }
100
+
101
+ /**
102
+ * "Where on this scale?" — `criteria` is the ordered list of level
103
+ * descriptions; the level number is the position (0-based). Every level must
104
+ * be described. Level-count limits are the provider's.
105
+ */
106
+ export interface ScoreQuestion {
107
+ type: 'score'
108
+ instructions: StructuredText
109
+ criteria: StructuredText[]
110
+ }
111
+
112
+ /** One atomic question over the shared state, discriminated by `type`. */
113
+ export type DecisionQuestion = BooleanQuestion | ChoiceQuestion | ScoreQuestion
114
+
115
+ /** Caller-keyed questions; answers come back under the same keys. */
116
+ export type DecisionQuestions = Record<string, DecisionQuestion>
117
+
118
+ /**
119
+ * Body of `POST /agents/v1/models/decide` — one text-only state and a map of
120
+ * atomic questions answered in parallel with calibrated probabilities.
121
+ *
122
+ * Only `model.model_id` is meaningful for a decision; the sampling knobs of
123
+ * {@link ModelConfig} are rejected with `invalid_decision_request`.
124
+ */
125
+ export interface DecideRequest<Questions extends DecisionQuestions = DecisionQuestions> {
126
+ model?: Partial<Pick<ModelConfig, 'model_id'>>
127
+ state: StructuredText
128
+ questions: Questions
129
+ }
130
+
131
+ /**
132
+ * Answer to a {@link BooleanQuestion}: `probability` is P(true); `boolean` is
133
+ * the argmax (probability > 0.5); `confidence` is |2p − 1|.
134
+ */
135
+ export interface BooleanAnswer {
136
+ type: 'boolean'
137
+ boolean: boolean
138
+ probability: number
139
+ confidence: number
140
+ }
141
+
142
+ /**
143
+ * Answer to a {@link ChoiceQuestion}: `choice` is the highest-probability
144
+ * option; `probabilities` is the full distribution keyed by option name.
145
+ */
146
+ export interface ChoiceAnswer<Option extends string = string> {
147
+ type: 'choice'
148
+ choice: Option
149
+ probabilities: Record<Option, number>
150
+ confidence: number
151
+ }
152
+
153
+ /**
154
+ * Answer to a {@link ScoreQuestion}: `score` is the probability-weighted mean
155
+ * of the level numbers (so it can fall between levels); `legend` echoes the
156
+ * level descriptions and `probabilities` the distribution, both indexed by
157
+ * level.
158
+ */
159
+ export interface ScoreAnswer {
160
+ type: 'score'
161
+ score: number
162
+ legend: StructuredText[]
163
+ probabilities: number[]
164
+ confidence: number
165
+ }
166
+
167
+ /**
168
+ * The calibrated answer to one question, discriminated by `type`. Every
169
+ * variant carries `confidence` = (n·peak − 1)/(n − 1) over its distribution,
170
+ * so gating code can threshold without switching on the type.
171
+ */
172
+ export type DecisionAnswer = BooleanAnswer | ChoiceAnswer | ScoreAnswer
173
+
174
+ /** The answer type a given question produces (drives typed `answers`). */
175
+ export type DecisionAnswerFor<Question extends DecisionQuestion> = Question extends BooleanQuestion
176
+ ? BooleanAnswer
177
+ : Question extends ChoiceQuestion<infer Option>
178
+ ? ChoiceAnswer<Option>
179
+ : Question extends ScoreQuestion
180
+ ? ScoreAnswer
181
+ : never
182
+
183
+ /**
184
+ * The provider's reply to a {@link DecideRequest}: one answer per question key
185
+ * (typed from the questions you sent), the model that produced them, and token
186
+ * usage.
187
+ */
188
+ export interface DecisionResult<Questions extends DecisionQuestions = DecisionQuestions> {
189
+ /** The model that produced the answers (resolved id, e.g. `jev-1.13.0`). */
190
+ model_id: string
191
+ answers: { [Key in keyof Questions]: DecisionAnswerFor<Questions[Key]> }
192
+ usage: ModelUsage
193
+ }
@@ -0,0 +1,67 @@
1
+ import type { ProteosClient } from '../client.js'
2
+ import type {
3
+ DecideRequest,
4
+ DecisionQuestions,
5
+ DecisionResult,
6
+ GenerateRequest,
7
+ GenerationResult,
8
+ } from './model-types.js'
9
+
10
+ const MODELS_BASE_PATH = '/agents/v1/models'
11
+
12
+ /**
13
+ * Service for the stateless model calls — one request in, one reply out, no
14
+ * session, no event log:
15
+ *
16
+ * - `generate` — free text or schema-constrained structured output from an LLM.
17
+ * - `decide` — calibrated typed answers (boolean | choice | score) with
18
+ * probabilities and confidence, for snap judgments inside code paths
19
+ * (routing, triage, classification, gates). No prose comes back; compose the
20
+ * answers in code and threshold on `confidence`.
21
+ *
22
+ * Both need the `agent-sessions:write` permission.
23
+ */
24
+ export interface ModelService {
25
+ /**
26
+ * Runs a single model call and returns the assistant message.
27
+ * @throws {ProteosError} 400 `invalid_generation_request` / `unsupported_file_type` /
28
+ * `model_provider_rejected_request`; 429 `model_provider_rate_limited`;
29
+ * 502 `model_provider_failed`.
30
+ */
31
+ generate(request: GenerateRequest): Promise<GenerationResult>
32
+ /**
33
+ * Answers typed questions about a text state with calibrated probabilities.
34
+ * `answers` is typed from the `questions` you pass, so
35
+ * `result.answers.topic.choice` narrows to the option names you declared.
36
+ *
37
+ * Semantic limits (option / level counts, empty questions, unknown model ids)
38
+ * are the provider's and surface as `decision_provider_rejected_request` with
39
+ * its message.
40
+ * @throws {ProteosError} 400 `invalid_decision_request` (shape) /
41
+ * `decision_provider_rejected_request` (provider rule); 429
42
+ * `decision_provider_rate_limited`; 502 `decision_provider_failed` /
43
+ * `decision_provider_invalid_response`; 503 `decision_provider_unavailable`
44
+ * when the provider key is not configured.
45
+ */
46
+ decide<Questions extends DecisionQuestions>(
47
+ request: DecideRequest<Questions>,
48
+ ): Promise<DecisionResult<Questions>>
49
+ }
50
+
51
+ export class ModelServiceImpl implements ModelService {
52
+ constructor(private readonly client: ProteosClient) {}
53
+
54
+ async generate(request: GenerateRequest): Promise<GenerationResult> {
55
+ return this.client.request<GenerationResult>('POST', `${MODELS_BASE_PATH}/generate`, request)
56
+ }
57
+
58
+ async decide<Questions extends DecisionQuestions>(
59
+ request: DecideRequest<Questions>,
60
+ ): Promise<DecisionResult<Questions>> {
61
+ return this.client.request<DecisionResult<Questions>>(
62
+ 'POST',
63
+ `${MODELS_BASE_PATH}/decide`,
64
+ request,
65
+ )
66
+ }
67
+ }
package/src/data/types.ts CHANGED
@@ -16,14 +16,17 @@ export type RecordData = Record<string, any>
16
16
  *
17
17
  * Arbitrary filter keys pass through as query params. Supported operators
18
18
  * (via bracket syntax) include `[eq]`, `[ne]`, `[gt]`, `[gte]`, `[lt]`,
19
- * `[lte]`, `[in]` (pipe-separated), `[not_in]`, `[contains]`, `[starts_with]`,
20
- * `[ends_with]`, `[empty]`, `[not_empty]`. Missing operator defaults to `[eq]`.
19
+ * `[lte]`, `[in]` (pipe-separated), `[not_in]`, `[contains]`, `[not_contains]`,
20
+ * `[contains_all]` (pipe-separated, arrays only), `[starts_with]`, `[ends_with]`,
21
+ * `[empty]`, `[not_empty]`. Missing operator defaults to `[eq]`. On array
22
+ * attributes contains / not_contains / in / not_in / contains_all are
23
+ * set-membership tests (has / does not have / has any of / has none of / has all of).
21
24
  * A filter key may reach one hop through a relation attribute with a dotted
22
25
  * path (`"company_id.name[contains]": "acme"`).
23
26
  *
24
27
  * For nested AND/OR trees, pass a filter group (the same wire dialect as
25
28
  * `List.filters` / `visible_when`: `{logical_operator, elements: [{field,
26
- * operator, value}], groups}`, string values, pipe-joined for in/not_in)
29
+ * operator, value}], groups}`, string values, pipe-joined for in/not_in/contains_all)
27
30
  * JSON-encoded under the reserved `_filter` key:
28
31
  * `{ _filter: JSON.stringify(group) }`. The server ANDs it with any flat
29
32
  * filter params.
package/src/index.ts CHANGED
@@ -34,7 +34,7 @@
34
34
  * @packageDocumentation
35
35
  */
36
36
 
37
- // Agent client (agent-service: agents, prompts, skills, tools, mcp-servers, sessions)
37
+ // Agent client (agent-service: agents, prompts, skills, tools, mcp-servers, models, sessions)
38
38
  export type {
39
39
  ActionBinding,
40
40
  Agent,
@@ -43,6 +43,11 @@ export type {
43
43
  AgentResourceListOptions,
44
44
  AgentService,
45
45
  AppendEventRequest,
46
+ BooleanAnswer,
47
+ BooleanCriteria,
48
+ BooleanQuestion,
49
+ ChoiceAnswer,
50
+ ChoiceQuestion,
46
51
  ClientEventType,
47
52
  ClientToolSchema,
48
53
  ContentBlock,
@@ -53,12 +58,21 @@ export type {
53
58
  CreateSessionRequest,
54
59
  CreateToolRequest,
55
60
  CreateToolsetRequest,
61
+ DecideRequest,
62
+ DecisionAnswer,
63
+ DecisionAnswerFor,
64
+ DecisionQuestion,
65
+ DecisionQuestions,
66
+ DecisionQuestionType,
67
+ DecisionResult,
56
68
  DependentAgent,
57
69
  DependentSyncResult,
58
70
  EmptyPayload,
59
71
  ErrorPayload,
60
72
  EventType,
61
73
  FileBlock,
74
+ GenerateRequest,
75
+ GenerationResult,
62
76
  ListAgentsOptions,
63
77
  ListMcpServersOptions,
64
78
  ListPromptsOptions,
@@ -77,6 +91,8 @@ export type {
77
91
  ModelConfig,
78
92
  ModelRequestEndPayload,
79
93
  ModelRequestStartPayload,
94
+ ModelService,
95
+ ModelStopReason,
80
96
  ModelUsage,
81
97
  PlatformBinding,
82
98
  Prompt,
@@ -85,6 +101,8 @@ export type {
85
101
  QueryBinding,
86
102
  ReasoningPayload,
87
103
  ResultBlock,
104
+ ScoreAnswer,
105
+ ScoreQuestion,
88
106
  Session,
89
107
  SessionEvent,
90
108
  SessionEventEnvelope,
@@ -100,6 +118,7 @@ export type {
100
118
  SkillVersion,
101
119
  StartMcpOAuthResponse,
102
120
  StopReason,
121
+ StructuredText,
103
122
  TextBlock,
104
123
  Tool,
105
124
  ToolBinding,
@@ -19,6 +19,8 @@ export type ComparisonOperator =
19
19
  | 'in'
20
20
  | 'not_in'
21
21
  | 'contains'
22
+ | 'not_contains'
23
+ | 'contains_all'
22
24
  | 'starts_with'
23
25
  | 'ends_with'
24
26
  | 'empty'
@@ -27,8 +29,11 @@ export type ComparisonOperator =
27
29
  /**
28
30
  * Single filter element (atomic predicate).
29
31
  *
30
- * `value` is a string at the wire level — pipe-joined for `in` / `not_in`,
31
- * ignored for `empty` / `not_empty`. This matches the data-service URL query
32
+ * `value` is a string at the wire level — pipe-joined for the list operators
33
+ * `in` / `not_in` / `contains_all`, ignored for `empty` / `not_empty`. On array
34
+ * attributes the membership operators are set tests: `contains` = has the
35
+ * value, `not_contains` = does not have it, `in` = has any of, `not_in` = has
36
+ * none of, `contains_all` = has all of. This matches the data-service URL query
32
37
  * convention so the same predicate flows through both the GET-with-filters
33
38
  * path and the layout `visible_when` JSONB path without a translation layer.
34
39
  */
@@ -60,6 +65,8 @@ export const FilterElementSchema = z.object({
60
65
  'in',
61
66
  'not_in',
62
67
  'contains',
68
+ 'not_contains',
69
+ 'contains_all',
63
70
  'starts_with',
64
71
  'ends_with',
65
72
  'empty',
package/src/meta/index.ts CHANGED
@@ -164,6 +164,12 @@ export type { MenuConfigurationService } from './menu-configurations.js'
164
164
  export type { ModuleService } from './modules.js'
165
165
  export type { PageExtensionService } from './page-extensions.js'
166
166
  export type { PageService } from './pages.js'
167
+ export {
168
+ isReservedAttributeName,
169
+ isTitleQueryable,
170
+ RECORD_TITLE_FIELD,
171
+ titleTemplateVariables,
172
+ } from './record-title.js'
167
173
  // Re-export types
168
174
  export type {
169
175
  // App types