Help us shape the future of Go! Take the 2026 Go Developer Survey

aitableprotocol

package
v1.0.66 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package aitableprotocol contains small, stable validations shared by the native AI Table commands and their shortcut adapters.

Index

Constants

View Source
const (
	DashboardGridColumnsV1     = 12
	DashboardGridColumnsV2     = 48
	RootResponsiveLayoutParent = "root-responsive-layout"
)
View Source
const MaxFieldNameUTF16Length = 150
View Source
const RecordFilterOperators = "" /* 133-byte string literal not displayed */
View Source
const RecordFiltersHelp = `记录筛选 JSON:{"operator":"and|or","operands":[{"operator":"gt","operands":["<fieldId>",5]}]};子条件也支持 {"fieldId":"<fieldId>","operator":"gt","value":5}。操作符:` + RecordFilterOperators + `;exist/un_exist 只传 fieldId;日期使用日期字符串或整数毫秒数,不接受 View relative/exact Scheme`

Variables

This section is empty.

Functions

func BindReferences added in v1.0.66

func BindReferences(value any, resources map[string]map[string]any) (any, error)

BindReferences substitutes only an entire {"$ref":"logical.property"} object, including nested object properties. Unresolved or ambiguous references stop execution; strings are literal.

func DatasourceSourceConfig

func DatasourceSourceConfig(payload map[string]any) (string, error)

DatasourceSourceConfig reads the reviewed get_datasource_config envelope. Keep the original JSON string: decoding and re-encoding an opaque stored config could lose number precision or fields unknown to this CLI version.

func ExpandChartTemplate added in v1.0.66

func ExpandChartTemplate(template, parameters map[string]any) (map[string]any, error)

ExpandChartTemplate copies a complete template then applies typed parameters. Nested objects merge, arrays replace, and chartType cannot change identity.

func FieldCapabilityReadError added in v1.0.66

func FieldCapabilityReadError(product, tool string, body map[string]any) error

FieldCapabilityReadError preserves the MCP read receipt at both the runner and helper boundaries. Scope is explicit: neither writes nor other products inherit retry advice from a similarly shaped error envelope.

func FieldGroupMutationError added in v1.0.66

func FieldGroupMutationError(product, tool string, body map[string]any) error

FieldGroupMutationError projects only reviewed stage codes. Retry guidance requires both a known pre-submission stage and an explicit boolean hint; neither raw diagnostics nor unknown outcomes authorize another write.

func IsSQLSheetKeyOperation added in v1.0.63

func IsSQLSheetKeyOperation(product, tool string) bool

IsSQLSheetKeyOperation identifies credential-management calls by product and tool.

func ParseJSONC added in v1.0.66

func ParseJSONC(raw string) (map[string]any, error)

ParseJSONC removes comments outside strings and trailing commas. It does not repair invalid JSON or change URLs, escaped quotes or comment-like text.

func ParseRecordFilters added in v1.0.64

func ParseRecordFilters(raw string) (map[string]any, error)

ParseRecordFilters validates both public spellings before constructing the wire filter. An invalid selector must never widen a bulk write.

func ProjectChartTemplates added in v1.0.66

func ProjectChartTemplates(raw string, types []string) (map[string]any, error)

ProjectChartTemplates selects exact published chart types; unknown types fail before a writer sees a partially generated configuration.

func ProjectStructuredChartTemplates added in v1.0.66

func ProjectStructuredChartTemplates(value any, types []string) (map[string]any, error)

ProjectStructuredChartTemplates shares the typed-response projection used by native and composite callers. Both accept only the same validated templates.

func ResolveDashboardRootColumns

func ResolveDashboardRootColumns(
	payload map[string]any,
	expectedBaseID, expectedDashboardID string,
	isAppMode bool,
) (int, error)

ResolveDashboardRootColumns selects the root Dashboard grid using the public MCP protocol. The read response must identify the requested Base/Dashboard before either application-mode context or stored metadata can select a grid. Ordinary Dashboards require the original schemaVersion JSON type to be verified so a numeric 2 cannot be confused with the legacy string "2".

func SQLSheetKeyCallError added in v1.0.63

func SQLSheetKeyCallError(tool string, err error) error

SQLSheetKeyCallError preserves known local failures and safe business codes.

func SQLSheetKeyFailure added in v1.0.63

func SQLSheetKeyFailure(tool, code string) error

SQLSheetKeyFailure projects known error codes to messages safe for output and audit.

func SQLSheetKeyProfileError added in v1.0.63

func SQLSheetKeyProfileError() error

SQLSheetKeyProfileError reports the single-identity command contract.

func SQLSheetKeyResponseError added in v1.0.63

func SQLSheetKeyResponseError(tool string, body map[string]any, isError bool) error

SQLSheetKeyResponseError classifies the business envelope before runtime audit is emitted. Successful gateway responses may represent an absent business error as null or {}.

func UTF16Length

func UTF16Length(value string) int

UTF16Length matches Java String.length and the Notable Core protocol.

func ValidateClientToken

func ValidateClientToken(value string) error

ValidateClientToken accepts the UUID v4 form used by idempotent record creates.

func ValidateDashboardPersistentMetadata

func ValidateDashboardPersistentMetadata(flag string, value map[string]any) error

ValidateDashboardPersistentMetadata rejects read-only protocol evidence from Dashboard/Chart write objects. isAppMode belongs to caller context and schemaVersion belongs to storage metadata; neither may be persisted by CLI adapters or shortcuts.

func ValidateFieldName

func ValidateFieldName(value string) error

ValidateFieldName applies the public AI Table field-name contract.

func ValidateRootChartLayout

func ValidateRootChartLayout(layout map[string]any, totalColumns int) error

ValidateRootChartLayout validates the writable x/y/w/h geometry against a trusted root grid width. Child containers and Tabs have independent column systems that the public Dashboard response does not expose, so they fail closed instead of inheriting the root 12/48-column rule.

Types

type LayoutIssue added in v1.0.66

type LayoutIssue struct {
	ChartID string `json:"chartId"`
	OtherID string `json:"otherId,omitempty"`
	Code    string `json:"code"`
	Message string `json:"message"`
}

func CompareRootLayout added in v1.0.66

func CompareRootLayout(actual, expected []map[string]any, columns int) ([]LayoutIssue, error)

CompareRootLayout compares the complete declared design by ID and geometry. Intended overlaps may match a design even when the separate overlap check fails.

func DiagnoseRootLayout added in v1.0.66

func DiagnoseRootLayout(items []map[string]any, columns int) []LayoutIssue

DiagnoseRootLayout checks geometry and declared minW/minH in the current snapshot. It never claims component readability or guesses child grid widths.

type LayoutRegion added in v1.0.66

type LayoutRegion struct {
	ID       string   `json:"id"`
	X        int      `json:"x"`
	Y        int      `json:"y"`
	W        int      `json:"w"`
	H        int      `json:"h"`
	ChartIDs []string `json:"chartIds,omitempty"`
}

LayoutRegion requires the union of the selected cards to cover this rectangle. Empty ChartIDs selects all cards. Coordinates always use the root grid.

type LayoutRegionResult added in v1.0.66

type LayoutRegionResult struct {
	ID               string `json:"id"`
	Covered          bool   `json:"covered"`
	UncoveredColumns []int  `json:"uncoveredColumns"`
}

func CheckLayoutRegions added in v1.0.66

func CheckLayoutRegions(items []map[string]any, regions []LayoutRegion, columns int) ([]LayoutRegionResult, error)

CheckLayoutRegions verifies coverage by interval union in each grid column. It never sums overlapping areas, multiplies unbounded heights, or treats a region's bounding box as proof of coverage. Only valid root cards contribute.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL