@stndrds/schema 1.0.0-alpha.258 → 1.0.0-alpha.260
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/{chunk-7VSOCVN7.mjs → chunk-54WDPQ6R.mjs} +2 -0
- package/dist/{chunk-44EVNHSR.js → chunk-TS3PJOMZ.js} +2 -0
- package/dist/index.d.mts +321 -28
- package/dist/index.d.ts +321 -28
- package/dist/index.js +327 -163
- package/dist/index.mjs +243 -84
- package/dist/validation/all.js +7 -7
- package/dist/validation/all.mjs +1 -1
- package/dist/validation/object/index.js +13 -13
- package/dist/validation/object/index.mjs +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3,8 +3,8 @@ export { asTenantId, asUserId, deepEqual, generateId, indexBy } from './chunk-QY
|
|
|
3
3
|
import './chunk-SP3PNHYF.mjs';
|
|
4
4
|
import { parseComputedFormula } from './chunk-UXCJ3NI4.mjs';
|
|
5
5
|
export { ComputedFormulaParseError, parseAttributeConfig, parseComputedFormula } from './chunk-UXCJ3NI4.mjs';
|
|
6
|
-
import { createObjectValidator, SchemaError, SchemaErrorCode, createAttributeValidator, ValidationError, NotFoundError, DuplicateError } from './chunk-
|
|
7
|
-
export { AccessDeniedError, AttributeInUseError, AttributeNotFoundError, ChangeTypeNotSupportedError, ConcurrentModificationError, DestructiveSyncNotAllowedError, DuplicateError, ForbiddenError, MemoryNotFoundError, MigrationTimeoutError, NotFoundError, NotImplementedError, ObjectNotFoundError, ObjectReferencedError, OrphanSystemAttributeError, ProtectedResourceError, ProtectedRoleError, RecordNotFoundError, RecordReferencedError, RepositoryError, RoleNotFoundError, SchemaError, SchemaErrorCode, SearchBackendError, StorageError, SyncCascadeError, SyncConflictError, SyncError, SystemEntityImmutableError, ValidationError, createFormAttributeValidator, isAttributeInUseError, isNotFoundError, isObjectReferencedError, isProtectedResourceError, isRecordReferencedError, isSchemaError, isValidationError, rejectUnknownAttributesOrThrow, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from './chunk-
|
|
6
|
+
import { createObjectValidator, SchemaError, SchemaErrorCode, createAttributeValidator, ValidationError, NotFoundError, DuplicateError } from './chunk-54WDPQ6R.mjs';
|
|
7
|
+
export { AccessDeniedError, AttributeInUseError, AttributeNotFoundError, ChangeTypeNotSupportedError, ConcurrentModificationError, DestructiveSyncNotAllowedError, DuplicateError, ForbiddenError, MemoryNotFoundError, MigrationTimeoutError, NotFoundError, NotImplementedError, ObjectNotFoundError, ObjectReferencedError, OrphanSystemAttributeError, ProtectedResourceError, ProtectedRoleError, RecordNotFoundError, RecordReferencedError, RepositoryError, RoleNotFoundError, SchemaError, SchemaErrorCode, SearchBackendError, StorageError, SyncCascadeError, SyncConflictError, SyncError, SystemEntityImmutableError, ValidationError, createFormAttributeValidator, isAttributeInUseError, isNotFoundError, isObjectReferencedError, isProtectedResourceError, isRecordReferencedError, isSchemaError, isValidationError, rejectUnknownAttributesOrThrow, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from './chunk-54WDPQ6R.mjs';
|
|
8
8
|
import './chunk-Q44QKLN4.mjs';
|
|
9
9
|
import './chunk-UANQJ2GH.mjs';
|
|
10
10
|
import './chunk-U36ZIBEM.mjs';
|
|
@@ -1259,36 +1259,20 @@ var DEFAULT_ROLE_PERMISSIONS = {
|
|
|
1259
1259
|
function isDefaultRole(roleName) {
|
|
1260
1260
|
return Object.values(DEFAULT_ROLES).includes(roleName);
|
|
1261
1261
|
}
|
|
1262
|
-
|
|
1263
|
-
// src/standard-schema.ts
|
|
1264
|
-
var STANDARD_SCHEMA_VENDOR = "@stndrds/schema";
|
|
1265
|
-
function createStandardSchemaProps(zodSchema) {
|
|
1266
|
-
return {
|
|
1267
|
-
version: 1,
|
|
1268
|
-
vendor: STANDARD_SCHEMA_VENDOR,
|
|
1269
|
-
validate: (value) => {
|
|
1270
|
-
const result = zodSchema.safeParse(value);
|
|
1271
|
-
if (result.success) {
|
|
1272
|
-
return { value: result.data };
|
|
1273
|
-
}
|
|
1274
|
-
return {
|
|
1275
|
-
issues: result.error.issues.map((issue) => ({
|
|
1276
|
-
message: issue.message,
|
|
1277
|
-
// Zod path segments are string | number which are valid PropertyKey
|
|
1278
|
-
// for Standard Schema v1 (no conversion needed)
|
|
1279
|
-
path: issue.path
|
|
1280
|
-
}))
|
|
1281
|
-
};
|
|
1282
|
-
}
|
|
1283
|
-
};
|
|
1284
|
-
}
|
|
1285
|
-
function isStandardSchema(obj) {
|
|
1286
|
-
return typeof obj === "object" && obj !== null && "~standard" in obj && typeof obj["~standard"] === "object" && obj["~standard"].version === 1;
|
|
1287
|
-
}
|
|
1288
1262
|
var VALID_ICONS = new Set(ICONS);
|
|
1289
1263
|
var ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
1290
1264
|
var MAX_NAME_LENGTH = 63;
|
|
1291
1265
|
var MAX_LABEL_LENGTH = 128;
|
|
1266
|
+
function assertUniqueBy(items, getKey, buildError) {
|
|
1267
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1268
|
+
for (const item of items) {
|
|
1269
|
+
const key = getKey(item);
|
|
1270
|
+
if (seen.has(key)) {
|
|
1271
|
+
throw buildError(key);
|
|
1272
|
+
}
|
|
1273
|
+
seen.add(key);
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1292
1276
|
function validateAttributeName(name) {
|
|
1293
1277
|
if (!name || name.length === 0) {
|
|
1294
1278
|
throw new Error("[AttributeBuilder] Attribute name cannot be empty");
|
|
@@ -1364,6 +1348,136 @@ function validateOptions(attributeName, options) {
|
|
|
1364
1348
|
}
|
|
1365
1349
|
}
|
|
1366
1350
|
|
|
1351
|
+
// src/builders/agent-builder.ts
|
|
1352
|
+
var DEFAULT_AGENT_EXECUTION_CONFIG = {
|
|
1353
|
+
maxConcurrentRuns: 3,
|
|
1354
|
+
retryPolicy: { maxRetries: 3, backoffMs: 1e3, backoffMultiplier: 2 },
|
|
1355
|
+
timeoutMs: 3e5
|
|
1356
|
+
};
|
|
1357
|
+
var AgentBuilder = class {
|
|
1358
|
+
constructor(config) {
|
|
1359
|
+
if (!config.name || config.name.trim().length === 0) {
|
|
1360
|
+
throw new ValidationError("Agent name is required", []);
|
|
1361
|
+
}
|
|
1362
|
+
this.bp = { name: config.name, system: true, triggers: [] };
|
|
1363
|
+
}
|
|
1364
|
+
description(value) {
|
|
1365
|
+
this.bp.description = value;
|
|
1366
|
+
return this;
|
|
1367
|
+
}
|
|
1368
|
+
icon(value) {
|
|
1369
|
+
this.bp.icon = value;
|
|
1370
|
+
return this;
|
|
1371
|
+
}
|
|
1372
|
+
systemPrompt(value) {
|
|
1373
|
+
this.bp.systemPrompt = value;
|
|
1374
|
+
return this;
|
|
1375
|
+
}
|
|
1376
|
+
model(provider, model, options) {
|
|
1377
|
+
this.bp.model = { provider, model, ...options };
|
|
1378
|
+
return this;
|
|
1379
|
+
}
|
|
1380
|
+
tools(names) {
|
|
1381
|
+
this.bp.tools = [...names];
|
|
1382
|
+
return this;
|
|
1383
|
+
}
|
|
1384
|
+
/** Cron schedule; `enabled` defaults to true. */
|
|
1385
|
+
schedule(value) {
|
|
1386
|
+
this.bp.schedule = { ...value, enabled: value.enabled ?? true };
|
|
1387
|
+
return this;
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Partial execution config, shallow-merged over the current config
|
|
1391
|
+
* (defaulting to {@link DEFAULT_AGENT_EXECUTION_CONFIG} on the first call).
|
|
1392
|
+
*
|
|
1393
|
+
* The merge is shallow at the top level only: passing a partial
|
|
1394
|
+
* `retryPolicy` REPLACES the whole `retryPolicy` object rather than
|
|
1395
|
+
* merging its individual fields. Pass a complete `retryPolicy` if you
|
|
1396
|
+
* only want to override one of its fields.
|
|
1397
|
+
*/
|
|
1398
|
+
config(value) {
|
|
1399
|
+
this.bp.config = { ...this.bp.config ?? DEFAULT_AGENT_EXECUTION_CONFIG, ...value };
|
|
1400
|
+
return this;
|
|
1401
|
+
}
|
|
1402
|
+
delegation(value) {
|
|
1403
|
+
Object.assign(this.bp, value);
|
|
1404
|
+
return this;
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Declare a trigger. `name` is the stable identity the boot sync uses to
|
|
1408
|
+
* reconcile trigger rows; `enabled` defaults to true.
|
|
1409
|
+
*/
|
|
1410
|
+
trigger(name, eventType, options) {
|
|
1411
|
+
this.bp.triggers.push({ name, eventType, ...options, enabled: options?.enabled ?? true });
|
|
1412
|
+
return this;
|
|
1413
|
+
}
|
|
1414
|
+
/**
|
|
1415
|
+
* Marks this agent as runtime-only (system: false).
|
|
1416
|
+
*
|
|
1417
|
+
* ⚠️ ADVANCED USE ONLY. In production, agents declared in code are
|
|
1418
|
+
* automatically system:true (immutable at runtime). Use .runtime() ONLY for:
|
|
1419
|
+
* - Test fixtures (`*.test.ts`, `tests/`)
|
|
1420
|
+
* - Seed data (`seeds/`)
|
|
1421
|
+
* - Dev fixtures (`fixtures/`)
|
|
1422
|
+
*
|
|
1423
|
+
* Calling .runtime() in production code creates an agent that:
|
|
1424
|
+
* - Can be modified or deleted by end users via the admin UI
|
|
1425
|
+
* - Will be picked up by `standards diff` as runtime drift
|
|
1426
|
+
*/
|
|
1427
|
+
runtime() {
|
|
1428
|
+
this.bp.system = false;
|
|
1429
|
+
return this;
|
|
1430
|
+
}
|
|
1431
|
+
build() {
|
|
1432
|
+
if (!this.bp.systemPrompt) {
|
|
1433
|
+
throw new ValidationError(`Agent "${this.bp.name}": systemPrompt is required`, []);
|
|
1434
|
+
}
|
|
1435
|
+
if (!this.bp.model) {
|
|
1436
|
+
throw new ValidationError(`Agent "${this.bp.name}": model is required`, []);
|
|
1437
|
+
}
|
|
1438
|
+
assertUniqueBy(
|
|
1439
|
+
this.bp.triggers,
|
|
1440
|
+
(t) => t.name,
|
|
1441
|
+
(name) => new ValidationError(`Agent "${this.bp.name}": duplicate trigger name "${name}"`, [])
|
|
1442
|
+
);
|
|
1443
|
+
return {
|
|
1444
|
+
...this.bp,
|
|
1445
|
+
config: this.bp.config ?? DEFAULT_AGENT_EXECUTION_CONFIG,
|
|
1446
|
+
systemPrompt: this.bp.systemPrompt,
|
|
1447
|
+
model: this.bp.model
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1451
|
+
function agent(config) {
|
|
1452
|
+
return new AgentBuilder(config);
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
// src/standard-schema.ts
|
|
1456
|
+
var STANDARD_SCHEMA_VENDOR = "@stndrds/schema";
|
|
1457
|
+
function createStandardSchemaProps(zodSchema) {
|
|
1458
|
+
return {
|
|
1459
|
+
version: 1,
|
|
1460
|
+
vendor: STANDARD_SCHEMA_VENDOR,
|
|
1461
|
+
validate: (value) => {
|
|
1462
|
+
const result = zodSchema.safeParse(value);
|
|
1463
|
+
if (result.success) {
|
|
1464
|
+
return { value: result.data };
|
|
1465
|
+
}
|
|
1466
|
+
return {
|
|
1467
|
+
issues: result.error.issues.map((issue) => ({
|
|
1468
|
+
message: issue.message,
|
|
1469
|
+
// Zod path segments are string | number which are valid PropertyKey
|
|
1470
|
+
// for Standard Schema v1 (no conversion needed)
|
|
1471
|
+
path: issue.path
|
|
1472
|
+
}))
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
};
|
|
1476
|
+
}
|
|
1477
|
+
function isStandardSchema(obj) {
|
|
1478
|
+
return typeof obj === "object" && obj !== null && "~standard" in obj && typeof obj["~standard"] === "object" && obj["~standard"].version === 1;
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1367
1481
|
// src/builders/attribute-builders.ts
|
|
1368
1482
|
function asMutableArray(arr) {
|
|
1369
1483
|
return arr;
|
|
@@ -3103,19 +3217,6 @@ var RelationGroupBuilder = class {
|
|
|
3103
3217
|
return this.data;
|
|
3104
3218
|
}
|
|
3105
3219
|
};
|
|
3106
|
-
function assertViewVersion(version) {
|
|
3107
|
-
if (version < 1) throw new Error("View version must be >= 1");
|
|
3108
|
-
}
|
|
3109
|
-
function assertUniqueBy(items, getKey, buildError) {
|
|
3110
|
-
const seen = /* @__PURE__ */ new Set();
|
|
3111
|
-
for (const item of items) {
|
|
3112
|
-
const key = getKey(item);
|
|
3113
|
-
if (seen.has(key)) {
|
|
3114
|
-
throw new Error(buildError(key));
|
|
3115
|
-
}
|
|
3116
|
-
seen.add(key);
|
|
3117
|
-
}
|
|
3118
|
-
}
|
|
3119
3220
|
function validateViewName(name, builderName, examples) {
|
|
3120
3221
|
const viewNameSchema = z.string().min(1, "View name cannot be empty").max(63, "View name is too long (max 63 characters)").regex(/^[a-z][a-z0-9-]*$/, {
|
|
3121
3222
|
message: `Invalid view name format.
|
|
@@ -3147,15 +3248,23 @@ var TableTabConfig = class {
|
|
|
3147
3248
|
return this;
|
|
3148
3249
|
}
|
|
3149
3250
|
/**
|
|
3150
|
-
* Allow creating new records
|
|
3251
|
+
* Allow creating new records.
|
|
3252
|
+
*
|
|
3253
|
+
* @param options.mode - Creation behavior when clicking "+": "redirect"
|
|
3254
|
+
* (navigate to detail), "inline" (empty row), or "peek" (instant-create a
|
|
3255
|
+
* draft and open it in the record stack side panel).
|
|
3256
|
+
* @example .create() or .create({ mode: "peek" })
|
|
3151
3257
|
*/
|
|
3152
|
-
create() {
|
|
3258
|
+
create(options) {
|
|
3153
3259
|
this.tabData.allowCreate = true;
|
|
3260
|
+
if (options?.mode) {
|
|
3261
|
+
this.tabData.createMode = options.mode;
|
|
3262
|
+
}
|
|
3154
3263
|
return this;
|
|
3155
3264
|
}
|
|
3156
3265
|
/**
|
|
3157
3266
|
* Set creation behavior when clicking "+"
|
|
3158
|
-
* @
|
|
3267
|
+
* @deprecated Use `create({ mode })` instead.
|
|
3159
3268
|
* @example .createMode("inline") or .createMode("peek")
|
|
3160
3269
|
*/
|
|
3161
3270
|
createMode(mode) {
|
|
@@ -3177,7 +3286,8 @@ var TableTabConfig = class {
|
|
|
3177
3286
|
return this;
|
|
3178
3287
|
}
|
|
3179
3288
|
/**
|
|
3180
|
-
*
|
|
3289
|
+
* Sugar for `create().edit().delete()`. Prefer the explicit methods —
|
|
3290
|
+
* creation options live on `create({ mode })`.
|
|
3181
3291
|
*/
|
|
3182
3292
|
crud() {
|
|
3183
3293
|
this.tabData.allowCreate = true;
|
|
@@ -3581,7 +3691,6 @@ var TabBuilder = class {
|
|
|
3581
3691
|
};
|
|
3582
3692
|
var DetailViewBuilder = class {
|
|
3583
3693
|
constructor(name, label) {
|
|
3584
|
-
this._version = 1;
|
|
3585
3694
|
validateViewName(name, "DetailViewBuilder", {
|
|
3586
3695
|
valid: "'detail', 'list-view', 'company-detail'",
|
|
3587
3696
|
invalid: "'Detail', 'listView', 'list_view'"
|
|
@@ -3628,17 +3737,6 @@ var DetailViewBuilder = class {
|
|
|
3628
3737
|
this.data.metadata = value;
|
|
3629
3738
|
return this;
|
|
3630
3739
|
}
|
|
3631
|
-
/**
|
|
3632
|
-
* Set the schema version for this view definition.
|
|
3633
|
-
* Increment when making breaking changes to force client updates.
|
|
3634
|
-
* @param v - Version number (must be >= 1)
|
|
3635
|
-
* @default 1
|
|
3636
|
-
*/
|
|
3637
|
-
version(v) {
|
|
3638
|
-
assertViewVersion(v);
|
|
3639
|
-
this._version = v;
|
|
3640
|
-
return this;
|
|
3641
|
-
}
|
|
3642
3740
|
/**
|
|
3643
3741
|
* Configure a side panel with flat attribute fields displayed alongside tab content.
|
|
3644
3742
|
*
|
|
@@ -3681,7 +3779,7 @@ var DetailViewBuilder = class {
|
|
|
3681
3779
|
assertUniqueBy(
|
|
3682
3780
|
this.data.tabs,
|
|
3683
3781
|
(tab) => tab.name,
|
|
3684
|
-
(name) => `[DetailViewBuilder] Duplicate tab name "${name}"`
|
|
3782
|
+
(name) => new Error(`[DetailViewBuilder] Duplicate tab name "${name}"`)
|
|
3685
3783
|
);
|
|
3686
3784
|
const config = {
|
|
3687
3785
|
tabs: this.data.tabs,
|
|
@@ -3696,8 +3794,7 @@ var DetailViewBuilder = class {
|
|
|
3696
3794
|
type: "detail",
|
|
3697
3795
|
config,
|
|
3698
3796
|
default: this.data.default,
|
|
3699
|
-
metadata: this.data.metadata
|
|
3700
|
-
schema_version: this._version
|
|
3797
|
+
metadata: this.data.metadata
|
|
3701
3798
|
};
|
|
3702
3799
|
}
|
|
3703
3800
|
};
|
|
@@ -3706,7 +3803,6 @@ function detailView(name, label) {
|
|
|
3706
3803
|
}
|
|
3707
3804
|
var ListViewBuilder = class {
|
|
3708
3805
|
constructor(name, label) {
|
|
3709
|
-
this._version = 1;
|
|
3710
3806
|
validateViewName(name, "ListViewBuilder", {
|
|
3711
3807
|
valid: "'default', 'list-view', 'active-contacts'",
|
|
3712
3808
|
invalid: "'Default', 'listView', 'list_view'"
|
|
@@ -3753,17 +3849,6 @@ var ListViewBuilder = class {
|
|
|
3753
3849
|
this.data.metadata = value;
|
|
3754
3850
|
return this;
|
|
3755
3851
|
}
|
|
3756
|
-
/**
|
|
3757
|
-
* Set the schema version for this view definition.
|
|
3758
|
-
* Increment when making breaking changes to force client updates.
|
|
3759
|
-
* @param v - Version number (must be >= 1)
|
|
3760
|
-
* @default 1
|
|
3761
|
-
*/
|
|
3762
|
-
version(v) {
|
|
3763
|
-
assertViewVersion(v);
|
|
3764
|
-
this._version = v;
|
|
3765
|
-
return this;
|
|
3766
|
-
}
|
|
3767
3852
|
/**
|
|
3768
3853
|
* Set base filters applied to ALL tabs (scoping, tenant, etc.)
|
|
3769
3854
|
* @example .baseFilter({ combinator: "and", rules: [{ attribute: "tenant", operator: "is", value: "acme" }] })
|
|
@@ -3805,7 +3890,7 @@ var ListViewBuilder = class {
|
|
|
3805
3890
|
assertUniqueBy(
|
|
3806
3891
|
this.data.tabs,
|
|
3807
3892
|
(tab) => tab.id,
|
|
3808
|
-
(id) => `[ListViewBuilder] Duplicate tab id "${id}"`
|
|
3893
|
+
(id) => new Error(`[ListViewBuilder] Duplicate tab id "${id}"`)
|
|
3809
3894
|
);
|
|
3810
3895
|
const defaultTabs = this.data.tabs.filter((t) => t.default);
|
|
3811
3896
|
if (defaultTabs.length > 1) {
|
|
@@ -3857,8 +3942,7 @@ var ListViewBuilder = class {
|
|
|
3857
3942
|
type: "list",
|
|
3858
3943
|
config,
|
|
3859
3944
|
default: this.data.default,
|
|
3860
|
-
metadata: this.data.metadata
|
|
3861
|
-
schema_version: this._version
|
|
3945
|
+
metadata: this.data.metadata
|
|
3862
3946
|
};
|
|
3863
3947
|
}
|
|
3864
3948
|
};
|
|
@@ -4699,11 +4783,45 @@ Available objects: ${this.listNames().join(", ")}`;
|
|
|
4699
4783
|
}
|
|
4700
4784
|
};
|
|
4701
4785
|
var registry = new NativeObjectRegistryClass();
|
|
4786
|
+
var SKILL_CONTENT_TEMPLATE = `## Overview
|
|
4787
|
+
|
|
4788
|
+
Describe in one or two sentences what this skill does and the outcome it produces. The agent reads this page when it uses the skill \u2014 write instructions for the agent, not documentation for people.
|
|
4789
|
+
|
|
4790
|
+
## When to use
|
|
4791
|
+
|
|
4792
|
+
List the situations or requests that should trigger this skill. Concrete phrases beat vague categories.
|
|
4793
|
+
|
|
4794
|
+
- When asked to \u2026
|
|
4795
|
+
- When a record of \u2026 needs \u2026
|
|
4796
|
+
|
|
4797
|
+
## Instructions
|
|
4798
|
+
|
|
4799
|
+
Write imperative, step-by-step directions. Name the exact objects, documents, or tools involved \u2014 the agent follows these literally.
|
|
4800
|
+
|
|
4801
|
+
1. First, \u2026
|
|
4802
|
+
2. Then, \u2026
|
|
4803
|
+
3. Finally, \u2026
|
|
4804
|
+
|
|
4805
|
+
## Examples
|
|
4806
|
+
|
|
4807
|
+
Show at least one concrete example of the skill applied well.
|
|
4808
|
+
|
|
4809
|
+
**Request:** "\u2026"
|
|
4810
|
+
|
|
4811
|
+
**Expected result:** \u2026
|
|
4812
|
+
|
|
4813
|
+
## What to avoid
|
|
4814
|
+
|
|
4815
|
+
- Never \u2026
|
|
4816
|
+
- Do not \u2026
|
|
4817
|
+
`;
|
|
4702
4818
|
var SKILL_OBJECT = object({ name: "skill", label: "Skill" }).sealed().icon("sparkles").order(Number.MAX_SAFE_INTEGER).pluralLabel("Skills").labelExpression("{{ name }}").embeddingExpression("{{ name }}\n{{ description }}\n{{ content }}").attribute(text({ name: "name", label: "Name" }).maxLength(SKILL_NAME_MAX_LENGTH).required()).attribute(
|
|
4703
|
-
text({ name: "description", label: "Description" }).multiline().maxLength(SKILL_DESCRIPTION_MAX_LENGTH).required()
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4819
|
+
text({ name: "description", label: "Description" }).multiline().maxLength(SKILL_DESCRIPTION_MAX_LENGTH).required().placeholder(
|
|
4820
|
+
'What this skill does and when to use it \u2014 e.g. "Drafts replies to customer complaints. Use when asked to answer an unhappy customer."'
|
|
4821
|
+
)
|
|
4822
|
+
).attribute(richtext({ name: "content", label: "Content" }).defaultValue(SKILL_CONTENT_TEMPLATE)).build();
|
|
4823
|
+
var SKILL_VIEW = detailView("skill-detail", "Skill").for("skill").default().sidePanel({ attributes: ["name", "description"] }).tab("content", "Content").richtext("content").titleAttribute("name").done().build();
|
|
4824
|
+
var SKILL_LIST_VIEW = listView("skill-list", "Skills").for("skill").default().tab("all", "All").table().columns("name", "description").sort("name", "asc").build();
|
|
4707
4825
|
var MEMORY_OBJECT = object({ name: "memory", label: "Memory" }).sealed().icon("database").order(Number.MAX_SAFE_INTEGER).pluralLabel("Memories").labelExpression("{{ name }}").embeddingExpression("{{ name }}\n{{ description }}\n{{ content }}").attribute(text({ name: "name", label: "Name" }).maxLength(MEMORY_NAME_MAX_LENGTH).required()).attribute(
|
|
4708
4826
|
text({ name: "description", label: "Description" }).multiline().maxLength(MEMORY_DESCRIPTION_MAX_LENGTH).required()
|
|
4709
4827
|
).attribute(text({ name: "content", label: "Content" }).multiline()).attribute(
|
|
@@ -4958,8 +5076,7 @@ function generateDefaultDetailView(object2, options = {}) {
|
|
|
4958
5076
|
object: object2.name,
|
|
4959
5077
|
type: "detail",
|
|
4960
5078
|
config,
|
|
4961
|
-
default: true
|
|
4962
|
-
schema_version: 1
|
|
5079
|
+
default: true
|
|
4963
5080
|
};
|
|
4964
5081
|
}
|
|
4965
5082
|
function generateDefaultListView(object2, options = {}) {
|
|
@@ -4986,8 +5103,7 @@ function generateDefaultListView(object2, options = {}) {
|
|
|
4986
5103
|
object: object2.name,
|
|
4987
5104
|
type: "list",
|
|
4988
5105
|
config,
|
|
4989
|
-
default: true
|
|
4990
|
-
schema_version: 1
|
|
5106
|
+
default: true
|
|
4991
5107
|
};
|
|
4992
5108
|
}
|
|
4993
5109
|
|
|
@@ -7079,4 +7195,47 @@ var CONNECTOR_CALLBACK_PARAM = {
|
|
|
7079
7195
|
provider: "connector_provider"
|
|
7080
7196
|
};
|
|
7081
7197
|
|
|
7082
|
-
|
|
7198
|
+
// src/utils/canonical-json.ts
|
|
7199
|
+
function canonicalStringify(value) {
|
|
7200
|
+
const seen = /* @__PURE__ */ new Set();
|
|
7201
|
+
function encode(v) {
|
|
7202
|
+
if (v === null) return "null";
|
|
7203
|
+
switch (typeof v) {
|
|
7204
|
+
case "string":
|
|
7205
|
+
case "number":
|
|
7206
|
+
case "boolean":
|
|
7207
|
+
return JSON.stringify(v);
|
|
7208
|
+
case "undefined":
|
|
7209
|
+
return void 0;
|
|
7210
|
+
case "object":
|
|
7211
|
+
break;
|
|
7212
|
+
default:
|
|
7213
|
+
throw new ValidationError(`Cannot canonicalize value of type ${typeof v}`, []);
|
|
7214
|
+
}
|
|
7215
|
+
const obj = v;
|
|
7216
|
+
if (seen.has(obj)) throw new ValidationError("Cannot canonicalize circular structure", []);
|
|
7217
|
+
seen.add(obj);
|
|
7218
|
+
try {
|
|
7219
|
+
if (Array.isArray(obj)) return `[${obj.map((e) => encode(e) ?? "null").join(",")}]`;
|
|
7220
|
+
const entries = Object.entries(obj).map(([k, val]) => [k, encode(val)]).filter((pair) => pair[1] !== void 0).sort(([a], [b]) => a < b ? -1 : 1);
|
|
7221
|
+
return `{${entries.map(([k, val]) => `${JSON.stringify(k)}:${val}`).join(",")}}`;
|
|
7222
|
+
} finally {
|
|
7223
|
+
seen.delete(obj);
|
|
7224
|
+
}
|
|
7225
|
+
}
|
|
7226
|
+
return encode(value) ?? "null";
|
|
7227
|
+
}
|
|
7228
|
+
|
|
7229
|
+
// src/utils/view-sync-payload.ts
|
|
7230
|
+
function viewSyncPayload(view) {
|
|
7231
|
+
return {
|
|
7232
|
+
label: view.label,
|
|
7233
|
+
description: view.description ?? null,
|
|
7234
|
+
icon: view.icon ?? null,
|
|
7235
|
+
config: view.config,
|
|
7236
|
+
default: view.default ?? false,
|
|
7237
|
+
metadata: view.metadata ?? null
|
|
7238
|
+
};
|
|
7239
|
+
}
|
|
7240
|
+
|
|
7241
|
+
export { ALLOWED_PROPERTY_TYPES, ALL_ACTIONS, ALL_SYSTEM_RESOURCES, ATTRIBUTE_FILTER_OPERATORS, AUDIT_ACTIONS, AUDIT_RESOURCE_TYPES, AUTOFILL_ELIGIBLE_TYPES, ActivityTabConfig, AgentBuilder, BEHAVIOR_PROPERTIES, BROWSER_PREVIEW_STATUSES, COMPUTED_FUNCTIONS, COMPUTED_FUNCTION_METADATA, COMPUTED_FUNCTION_NAMES, CONNECTOR_CALLBACK_PARAM, ComputedFormulaCompileError, CustomTabConfig, DB_COLUMN_FIELDS, DEFAULT_AGENT_EXECUTION_CONFIG, DEFAULT_ROLES, DEFAULT_ROLE_DESCRIPTIONS, DEFAULT_ROLE_LABELS, DEFAULT_ROLE_PERMISSIONS, DOCUMENT_SYSTEM_ATTRIBUTES, DetailViewBuilder, DocumentsTabConfig, EMPTY_VALUE_PLACEHOLDER, EmailsTabConfig, FORM_FORBIDDEN_ATTRIBUTE_TYPES, FlagRegistry, FlagService, FormBuilder, FormRegistry, FormRowBuilder, FormStepBuilder, GroupBuilder, IDENTITY_PROPERTIES, LIVE_EVENT_TYPES, LIVE_STREAM_START_CURSOR, ListViewBuilder, ListViewTabConfigBuilder, MAX_PRESET_DEPTH, MEMORY_LIST_VIEW, MEMORY_OBJECT, MEMORY_VIEW, NOTIFICATION_INBOX_STATES, NOTIFICATION_KINDS, NOTIFICATION_PRIORITIES, NOTIFICATION_SENSITIVITIES, NOTIFICATION_TYPES_V1, NOTIFICATION_TYPE_AGENT_QUESTION_REQUESTED, NOTIFICATION_TYPE_AGENT_SESSION_COMPLETED, NOTIFICATION_TYPE_AGENT_SESSION_FAILED, NOTIFICATION_TYPE_AGENT_SESSION_TIMEOUT, NOTIFICATION_TYPE_AGENT_SESSION_WAITING_HUMAN, NOTIFICATION_TYPE_AGENT_TASK_ASSIGNED, NOTIFICATION_WORK_STATES, NO_VALUE_OPERATORS, NoopGeocodingAdapter, OPERATORS_BY_TYPE, OPERATOR_SPECS, ObjectBuilder, PRESENTATION_PROPERTIES, QUALIFIED_SEPARATOR, RELATION_TARGET_ANY, RESERVED_ATTRIBUTE_NAMES, RESERVED_OBJECT_NAMES, RelationGroupBuilder, RichtextTabConfig, SKILL_LIST_VIEW, SKILL_OBJECT, SKILL_VIEW, STANDARD_SCHEMA_VENDOR, SYSTEM_ATTRIBUTES, SYSTEM_ATTRIBUTE_I18N_KEYS, SYSTEM_FIELD_NAMES, SYSTEM_RESOURCES, SYSTEM_RESOURCE_LABELS, TabBuilder, TableTabConfig, USER_STATUSES, accessLevelToActions, actionsToAccessLevel, agent, applyPipes, applyRelationProps, assertAcyclicComputedDependencies, assertLiveStreamCursor, booleanFlag, buildPropertySchema, buildQualifiedAttribute, canonicalStringify, checkbox, compareLiveStreamCursors, compileComputedFormula, compileRollupAttribute, createFlagRegistry, createFlagService, createStandardSchemaProps, currency, currentActor, date, dateValueStart, detailView, document, evaluateComputedAst, evaluateComputedFormula, evaluateComputedFormulaWithResult, evaluateFilterState, extractAttributeNames, extractValueRefs, flagRegistry, form, formRegistry, formatAttributeValue, formatComputedResult, formatLocationValue, formula, generateDefaultDetailView, generateDefaultListView, getActiveTab, getAttributeCapabilities, getAttributeFilterOperators, getErrorMessage, getLiveProtocolPayloadChannel, getOperatorPolarity, getRollupFilterOperators2 as getRollupFilterOperators, getSlotFieldTargets, getSystemAttributeI18nKey, getSystemAttributeList, getUserDisplayName, group, hasOptions, inferInverseCardinality, inferRollupReturnType, isAttributeFilterable, isAttributeGroupable, isAttributeKanbanGroupable, isAttributeSearchable, isAttributeSortable2 as isAttributeSortable, isBilateralRelation, isComputedFunctionName, isDateRangeValue, isDefaultRole, isDetailView, isDocumentAttribute, isDynamicValue, isEmptyObject, isFieldGroup, isFormDefinition, isFormFieldsRow, isFormFreeFieldRef, isFormHeadingRow, isFormSeparatorRow, isFormSlotFieldRef, isFormTextRow, isLabelExpression, isListView, isLiveErrorPayload, isLiveEventEnvelope, isLiveEventPayload, isLiveEventPayloadForType, isLiveEventType, isLiveGapPayload, isLiveReplayCompletePayload, isLiveStreamCursor, isManagedSystemAttribute, isNoValueOperator, isNotEmpty, isPlainRecord, isRelationGroup, isStandardSchema, isUniversalRelation, jsonFlag, listView, liveChannelKey, location, matchesMime, multiselect, normalizeDateValue, normalizeForEdgeRpc, now, number, numberFlag, object, parseLiveChannelKey, parseLiveSubscribePayload, parseLiveUnsubscribePayload, parseQualifiedAttribute, phone, registry, relation, relationGroup, renderLabelExpression, resetViewToDefault, resolvePropertyDefinitions, richtext, rollup, rollupToFormulaExpression, select, status, stringFlag, text, toMultiValueOperator, toUndefinedIfEmpty, today, user, validateAttributeName, validateQualifiedRule, viewRegistry, viewSyncPayload };
|
package/dist/validation/all.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require('../chunk-PGERPYDR.js');
|
|
4
4
|
var chunkL4U5QEQL_js = require('../chunk-L4U5QEQL.js');
|
|
5
|
-
var
|
|
5
|
+
var chunkTS3PJOMZ_js = require('../chunk-TS3PJOMZ.js');
|
|
6
6
|
require('../chunk-SI34M4IC.js');
|
|
7
7
|
require('../chunk-YIP5FJ5H.js');
|
|
8
8
|
require('../chunk-QAF3HNKQ.js');
|
|
@@ -26,27 +26,27 @@ Object.defineProperty(exports, "parseAttributeConfig", {
|
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "createFormAttributeValidator", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkTS3PJOMZ_js.createFormAttributeValidator; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "rejectUnknownAttributesOrThrow", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkTS3PJOMZ_js.rejectUnknownAttributesOrThrow; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "validateDraft", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkTS3PJOMZ_js.validateDraft; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "validateDraftOrThrow", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkTS3PJOMZ_js.validateDraftOrThrow; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "validateObject", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkTS3PJOMZ_js.validateObject; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "validateObjectOrThrow", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkTS3PJOMZ_js.validateObjectOrThrow; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "DEFAULT_VALIDATION_MESSAGES", {
|
|
52
52
|
enumerable: true,
|
package/dist/validation/all.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../chunk-SP3PNHYF.mjs';
|
|
2
2
|
export { parseAttributeConfig } from '../chunk-UXCJ3NI4.mjs';
|
|
3
|
-
export { createFormAttributeValidator, rejectUnknownAttributesOrThrow, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from '../chunk-
|
|
3
|
+
export { createFormAttributeValidator, rejectUnknownAttributesOrThrow, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from '../chunk-54WDPQ6R.mjs';
|
|
4
4
|
import '../chunk-Q44QKLN4.mjs';
|
|
5
5
|
import '../chunk-UANQJ2GH.mjs';
|
|
6
6
|
import '../chunk-U36ZIBEM.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkTS3PJOMZ_js = require('../../chunk-TS3PJOMZ.js');
|
|
4
4
|
require('../../chunk-SI34M4IC.js');
|
|
5
5
|
require('../../chunk-YIP5FJ5H.js');
|
|
6
6
|
require('../../chunk-QAF3HNKQ.js');
|
|
@@ -20,49 +20,49 @@ require('../../chunk-YKWSHBT5.js');
|
|
|
20
20
|
|
|
21
21
|
Object.defineProperty(exports, "createAttributeValidator", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkTS3PJOMZ_js.createAttributeValidator; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "createDraftValidator", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkTS3PJOMZ_js.createDraftValidator; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "createFormAttributeValidator", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkTS3PJOMZ_js.createFormAttributeValidator; }
|
|
32
32
|
});
|
|
33
33
|
Object.defineProperty(exports, "createObjectValidator", {
|
|
34
34
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkTS3PJOMZ_js.createObjectValidator; }
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "getMissingRequiredAttributes", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkTS3PJOMZ_js.getMissingRequiredAttributes; }
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(exports, "isRecordComplete", {
|
|
42
42
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkTS3PJOMZ_js.isRecordComplete; }
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports, "rejectUnknownAttributesOrThrow", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkTS3PJOMZ_js.rejectUnknownAttributesOrThrow; }
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "validateAttribute", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkTS3PJOMZ_js.validateAttribute; }
|
|
52
52
|
});
|
|
53
53
|
Object.defineProperty(exports, "validateDraft", {
|
|
54
54
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkTS3PJOMZ_js.validateDraft; }
|
|
56
56
|
});
|
|
57
57
|
Object.defineProperty(exports, "validateDraftOrThrow", {
|
|
58
58
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkTS3PJOMZ_js.validateDraftOrThrow; }
|
|
60
60
|
});
|
|
61
61
|
Object.defineProperty(exports, "validateObject", {
|
|
62
62
|
enumerable: true,
|
|
63
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkTS3PJOMZ_js.validateObject; }
|
|
64
64
|
});
|
|
65
65
|
Object.defineProperty(exports, "validateObjectOrThrow", {
|
|
66
66
|
enumerable: true,
|
|
67
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkTS3PJOMZ_js.validateObjectOrThrow; }
|
|
68
68
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createAttributeValidator, createDraftValidator, createFormAttributeValidator, createObjectValidator, getMissingRequiredAttributes, isRecordComplete, rejectUnknownAttributesOrThrow, validateAttribute, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from '../../chunk-
|
|
1
|
+
export { createAttributeValidator, createDraftValidator, createFormAttributeValidator, createObjectValidator, getMissingRequiredAttributes, isRecordComplete, rejectUnknownAttributesOrThrow, validateAttribute, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from '../../chunk-54WDPQ6R.mjs';
|
|
2
2
|
import '../../chunk-Q44QKLN4.mjs';
|
|
3
3
|
import '../../chunk-UANQJ2GH.mjs';
|
|
4
4
|
import '../../chunk-U36ZIBEM.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stndrds/schema",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.260",
|
|
4
4
|
"description": "Standard schema definitions and utilities",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"@standard-schema/spec": "^1.1.0",
|
|
116
116
|
"libphonenumber-js": "^1.12.31",
|
|
117
117
|
"zod": "^4.2.1",
|
|
118
|
-
"@stndrds/constants": "1.0.0-alpha.
|
|
118
|
+
"@stndrds/constants": "1.0.0-alpha.260"
|
|
119
119
|
},
|
|
120
120
|
"devDependencies": {
|
|
121
121
|
"@types/node": "^25.0.3",
|