@agent-native/core 0.232.0 → 0.233.0-nightly-20261124004026
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/a2a/handlers.js +60 -1
- package/dist/a2a/server.js +9 -0
- package/dist/action-call-classification.d.ts +9 -0
- package/dist/action-call-classification.js +18 -0
- package/dist/action-conformance.d.ts +81 -0
- package/dist/action-conformance.js +392 -0
- package/dist/action.d.ts +18 -0
- package/dist/action.js +68 -5
- package/dist/agent/execution-fence.d.ts +3 -1
- package/dist/agent/execution-fence.js +13 -2
- package/dist/agent/production-agent.d.ts +3 -0
- package/dist/agent/production-agent.js +301 -145
- package/dist/agent/run-store.js +11 -0
- package/dist/agent/thread-data-builder.d.ts +2 -0
- package/dist/agent/thread-data-builder.js +5 -1
- package/dist/app-config/schema.d.ts +24 -1
- package/dist/application-state/handlers.d.ts +1 -1
- package/dist/application-state/navigate-write-guard.d.ts +4 -1
- package/dist/application-state/navigate-write-guard.js +15 -1
- package/dist/cli/design-connect.js +5 -1
- package/dist/cli/matched-check.d.ts +1 -0
- package/dist/cli/matched-check.js +76 -0
- package/dist/client/agent-chat/index.d.ts +1 -1
- package/dist/client/agent-chat/index.js +1 -1
- package/dist/client/analytics/index.d.ts +1 -1
- package/dist/client/analytics.d.ts +13 -1
- package/dist/client/analytics.js +5 -2
- package/dist/client/application-state.d.ts +11 -0
- package/dist/client/application-state.js +219 -23
- package/dist/client/chat/agentkit-agent-native.js +52 -11
- package/dist/client/chat/agentkit-protocol.js +23 -2
- package/dist/client/chat-first-state.d.ts +6 -0
- package/dist/client/chat-first-state.js +36 -1
- package/dist/client/feature-flags/use-feature-flag.js +14 -6
- package/dist/client/navigation/index.d.ts +2 -0
- package/dist/client/navigation/index.js +2 -0
- package/dist/client/route-state.js +60 -18
- package/dist/client/screen-settled.d.ts +71 -1
- package/dist/client/screen-settled.js +221 -3
- package/dist/client/sse-event-processor.d.ts +1 -0
- package/dist/client/sse-event-processor.js +89 -10
- package/dist/client/theme.d.ts +6 -0
- package/dist/client/theme.js +7 -1
- package/dist/client/use-action.js +32 -10
- package/dist/client/use-session.js +36 -18
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/db/client.js +2 -2
- package/dist/db/errors.d.ts +2 -0
- package/dist/db/errors.js +38 -6
- package/dist/feature-flags/actions/get-feature-flags.js +9 -2
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/framework-package-versions.json +8 -8
- package/dist/ingestion/index.d.ts +1 -0
- package/dist/ingestion/index.js +1 -0
- package/dist/ingestion/matched-capture.d.ts +173 -0
- package/dist/ingestion/matched-capture.js +574 -0
- package/dist/ingestion/pptx.d.ts +1 -0
- package/dist/ingestion/pptx.js +4 -2
- package/dist/labs/store.d.ts +3 -1
- package/dist/labs/store.js +8 -4
- package/dist/manifest/index.d.ts +142 -3
- package/dist/manifest/index.js +249 -19
- package/dist/mcp/build-server.d.ts +2 -0
- package/dist/mcp/build-server.js +8 -1
- package/dist/mcp/server.js +3 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/metrics.d.ts +2 -0
- package/dist/observability/metrics.js +7 -0
- package/dist/org/index.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +10 -10
- package/dist/provider-api/actions/provider-api.d.ts +14 -14
- package/dist/server/action-routes.js +9 -0
- package/dist/server/agent-chat/prompt-resources.js +107 -83
- package/dist/server/agent-run-context.d.ts +3 -0
- package/dist/server/agent-run-context.js +7 -0
- package/dist/server/builder-oauth.d.ts +1 -0
- package/dist/server/builder-oauth.js +40 -2
- package/dist/server/filesystem-action-entry.js +5 -0
- package/dist/server/first-touch-route.d.ts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +2 -2
- package/dist/server/open-route.js +10 -4
- package/dist/server/poll.d.ts +3 -0
- package/dist/server/poll.js +74 -14
- package/dist/server/request-context.d.ts +16 -6
- package/dist/server/request-context.js +4 -0
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/shared/analytics-events.d.ts +7 -0
- package/dist/shared/viewport-mode.d.ts +2 -0
- package/dist/shared/viewport-mode.js +9 -0
- package/dist/templates/chat/.agents/skills/actions/SKILL.md +1 -0
- package/dist/templates/chat/.agents/skills/build-an-app/SKILL.md +38 -17
- package/dist/templates/chat/.agents/skills/shadcn-ui/SKILL.md +3 -2
- package/dist/templates/default/.agents/skills/actions/SKILL.md +1 -0
- package/dist/templates/default/.agents/skills/build-an-app/SKILL.md +38 -17
- package/dist/templates/default/.agents/skills/shadcn-ui/SKILL.md +3 -2
- package/dist/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +3 -2
- package/dist/templates/headless/.agents/skills/actions/SKILL.md +1 -0
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +1 -0
- package/dist/templates/workspace-core/.agents/skills/build-an-app/SKILL.md +38 -17
- package/dist/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +3 -2
- package/dist/testing.d.ts +1 -0
- package/dist/testing.js +1 -0
- package/dist/tracking/action-lifecycle.d.ts +2 -0
- package/dist/tracking/action-lifecycle.js +16 -5
- package/docs/content/actions-defining.mdx +7 -0
- package/docs/content/custom-design-system.mdx +4 -2
- package/package.json +3 -3
- package/src/templates/chat/.agents/skills/actions/SKILL.md +1 -0
- package/src/templates/chat/.agents/skills/build-an-app/SKILL.md +38 -17
- package/src/templates/chat/.agents/skills/shadcn-ui/SKILL.md +3 -2
- package/src/templates/default/.agents/skills/actions/SKILL.md +1 -0
- package/src/templates/default/.agents/skills/build-an-app/SKILL.md +38 -17
- package/src/templates/default/.agents/skills/shadcn-ui/SKILL.md +3 -2
- package/src/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +3 -2
- package/src/templates/headless/.agents/skills/actions/SKILL.md +1 -0
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +1 -0
- package/src/templates/workspace-core/.agents/skills/build-an-app/SKILL.md +38 -17
- package/src/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +3 -2
package/dist/server/poll.js
CHANGED
|
@@ -11,6 +11,7 @@ import { retainRequestDbPoolScope } from "../db/request-pool-context.js";
|
|
|
11
11
|
import { defineStore } from "../db/store-registry.js";
|
|
12
12
|
import { EXTENSION_CHANGE_MARKER_KEY, parseExtensionChangeMarker, } from "../extensions/change-marker.js";
|
|
13
13
|
import { registerRecurringSweepHandler, } from "../jobs/sweep-hooks.js";
|
|
14
|
+
import { recordUnreadableSyncEvent } from "../observability/metrics.js";
|
|
14
15
|
import { REALTIME_REGISTRATION_SETTING_KEY } from "../realtime-registration-key.js";
|
|
15
16
|
import { getSettingsEmitter } from "../settings/store.js";
|
|
16
17
|
import { getHttpRequestTelemetryId } from "./http-response-telemetry.js";
|
|
@@ -384,6 +385,11 @@ function unreadableSignals(entries) {
|
|
|
384
385
|
const types = [...new Set(entries.map((entry) => entry.type))];
|
|
385
386
|
return types.length ? { unreadable: types.map((type) => ({ type })) } : {};
|
|
386
387
|
}
|
|
388
|
+
function recordUnreadableEntries(entries) {
|
|
389
|
+
for (const entry of entries) {
|
|
390
|
+
recordUnreadableSyncEvent(entry.cause);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
387
393
|
const defaultResolveAccess = async (resourceType, resourceId, ctx) => {
|
|
388
394
|
const { getShareableResource } = await import("../sharing/registry.js");
|
|
389
395
|
if (!getShareableResource(resourceType))
|
|
@@ -811,10 +817,16 @@ export class AppSyncState {
|
|
|
811
817
|
this.accessTimeouts.delete(key);
|
|
812
818
|
}
|
|
813
819
|
}
|
|
814
|
-
setAccessCache(key, allowed, now) {
|
|
820
|
+
setAccessCache(key, allowed, now, unreadableCause) {
|
|
815
821
|
this.accessTimeouts.delete(key);
|
|
816
822
|
this.accessCache.delete(key);
|
|
817
|
-
this.accessCache.set(key, {
|
|
823
|
+
this.accessCache.set(key, {
|
|
824
|
+
allowed,
|
|
825
|
+
checkedAt: now,
|
|
826
|
+
...(allowed === "unreadable"
|
|
827
|
+
? { unreadableCause: unreadableCause ?? "threw" }
|
|
828
|
+
: {}),
|
|
829
|
+
});
|
|
818
830
|
if (this.accessCache.size > ACCESS_CACHE_MAX) {
|
|
819
831
|
const overflow = this.accessCache.size - ACCESS_CACHE_MAX;
|
|
820
832
|
let removed = 0;
|
|
@@ -825,6 +837,13 @@ export class AppSyncState {
|
|
|
825
837
|
}
|
|
826
838
|
}
|
|
827
839
|
}
|
|
840
|
+
unreadableCauseForEvent(event, userEmail, orgId) {
|
|
841
|
+
if (event.resourceType && event.resourceId) {
|
|
842
|
+
const key = accessCacheKey(userEmail.trim().toLowerCase(), orgId, event.resourceType, event.resourceId);
|
|
843
|
+
return this.accessCache.get(key)?.unreadableCause ?? "threw";
|
|
844
|
+
}
|
|
845
|
+
return "threw";
|
|
846
|
+
}
|
|
828
847
|
scheduleAccessCheck(key, resourceType, resourceId, userEmail, orgId) {
|
|
829
848
|
if (this.accessInFlight.has(key))
|
|
830
849
|
return;
|
|
@@ -836,6 +855,7 @@ export class AppSyncState {
|
|
|
836
855
|
const epoch = this.accessInvalidationEpoch.get(resourceKey) ?? 0;
|
|
837
856
|
const work = retainRequestDbPoolScope(Promise.resolve().then(async () => {
|
|
838
857
|
let allowed;
|
|
858
|
+
let unreadableCause;
|
|
839
859
|
try {
|
|
840
860
|
const result = await this.resolveAccessFn(resourceType, resourceId, {
|
|
841
861
|
userEmail,
|
|
@@ -846,13 +866,14 @@ export class AppSyncState {
|
|
|
846
866
|
catch (error) {
|
|
847
867
|
logUnreadable(resourceType, resourceId, "threw", error);
|
|
848
868
|
allowed = "unreadable";
|
|
869
|
+
unreadableCause = "threw";
|
|
849
870
|
}
|
|
850
871
|
if ((this.accessInvalidationEpoch.get(resourceKey) ?? 0) !== epoch) {
|
|
851
872
|
return;
|
|
852
873
|
}
|
|
853
874
|
if (this.accessInFlight.get(key) !== check)
|
|
854
875
|
return;
|
|
855
|
-
this.setAccessCache(key, allowed, Date.now());
|
|
876
|
+
this.setAccessCache(key, allowed, Date.now(), unreadableCause);
|
|
856
877
|
}));
|
|
857
878
|
this.countRunningAccessWork(1, work);
|
|
858
879
|
const check = this.trackAccessCheck([key], work);
|
|
@@ -917,14 +938,14 @@ export class AppSyncState {
|
|
|
917
938
|
resourceId,
|
|
918
939
|
this.accessInvalidationEpoch.get(accessResourceKey(resourceType, resourceId)) ?? 0,
|
|
919
940
|
]));
|
|
920
|
-
const cacheUnlessInvalidated = (resourceId, allowed) => {
|
|
941
|
+
const cacheUnlessInvalidated = (resourceId, allowed, unreadableCause) => {
|
|
921
942
|
const key = keys.get(resourceId);
|
|
922
943
|
const epoch = this.accessInvalidationEpoch.get(accessResourceKey(resourceType, resourceId)) ?? 0;
|
|
923
944
|
if (!key || epoch !== epochs.get(resourceId))
|
|
924
945
|
return;
|
|
925
946
|
if (this.accessInFlight.get(key) !== check)
|
|
926
947
|
return;
|
|
927
|
-
this.setAccessCache(key, allowed, Date.now());
|
|
948
|
+
this.setAccessCache(key, allowed, Date.now(), unreadableCause);
|
|
928
949
|
this.endAccessCheck(key, check);
|
|
929
950
|
};
|
|
930
951
|
const ids = [...keys.keys()];
|
|
@@ -967,6 +988,7 @@ export class AppSyncState {
|
|
|
967
988
|
return;
|
|
968
989
|
await Promise.all(retried.map(async (id) => {
|
|
969
990
|
let allowed;
|
|
991
|
+
let unreadableCause;
|
|
970
992
|
try {
|
|
971
993
|
const result = await resolveMany(resourceType, [id], {
|
|
972
994
|
userEmail,
|
|
@@ -977,8 +999,9 @@ export class AppSyncState {
|
|
|
977
999
|
catch (error) {
|
|
978
1000
|
logUnreadable(resourceType, id, "threw", error);
|
|
979
1001
|
allowed = "unreadable";
|
|
1002
|
+
unreadableCause = "threw";
|
|
980
1003
|
}
|
|
981
|
-
cacheUnlessInvalidated(id, allowed);
|
|
1004
|
+
cacheUnlessInvalidated(id, allowed, unreadableCause);
|
|
982
1005
|
}));
|
|
983
1006
|
}
|
|
984
1007
|
};
|
|
@@ -1021,7 +1044,7 @@ export class AppSyncState {
|
|
|
1021
1044
|
if (missed >= ACCESS_CHECK_TIMEOUTS_MAX) {
|
|
1022
1045
|
const [, , resourceType, ...resourceId] = key.split("|");
|
|
1023
1046
|
logUnreadable(resourceType, resourceId.join("|"), "timeout");
|
|
1024
|
-
this.setAccessCache(key, "unreadable", Date.now());
|
|
1047
|
+
this.setAccessCache(key, "unreadable", Date.now(), "timeout");
|
|
1025
1048
|
return;
|
|
1026
1049
|
}
|
|
1027
1050
|
this.accessTimeouts.set(key, missed);
|
|
@@ -1349,6 +1372,7 @@ export class AppSyncState {
|
|
|
1349
1372
|
const entry = {
|
|
1350
1373
|
cursor: cursorForEvent(event),
|
|
1351
1374
|
type: "access-unavailable",
|
|
1375
|
+
cause: this.unreadableCauseForEvent(event, userEmail, orgId),
|
|
1352
1376
|
};
|
|
1353
1377
|
unreadable.push(entry);
|
|
1354
1378
|
accessRead?.unreadableCursors.push(entry);
|
|
@@ -1365,6 +1389,8 @@ export class AppSyncState {
|
|
|
1365
1389
|
if (check)
|
|
1366
1390
|
accessRead?.blockedOn.add(check);
|
|
1367
1391
|
version = Math.max(since, event.version - 1);
|
|
1392
|
+
if (!accessRead)
|
|
1393
|
+
recordUnreadableEntries(unreadable);
|
|
1368
1394
|
return {
|
|
1369
1395
|
version,
|
|
1370
1396
|
events,
|
|
@@ -1378,6 +1404,8 @@ export class AppSyncState {
|
|
|
1378
1404
|
}
|
|
1379
1405
|
lastCursor = cursorForEvent(event);
|
|
1380
1406
|
}
|
|
1407
|
+
if (!accessRead)
|
|
1408
|
+
recordUnreadableEntries(unreadable);
|
|
1381
1409
|
return {
|
|
1382
1410
|
version,
|
|
1383
1411
|
events,
|
|
@@ -1460,6 +1488,7 @@ export class AppSyncState {
|
|
|
1460
1488
|
const entry = {
|
|
1461
1489
|
cursor: rowCursor ?? { version: rawVersion, id: "" },
|
|
1462
1490
|
type: "unknown-scope",
|
|
1491
|
+
cause: "missing-event",
|
|
1463
1492
|
};
|
|
1464
1493
|
unreadable.push(entry);
|
|
1465
1494
|
accessRead?.unreadableCursors.push(entry);
|
|
@@ -1490,6 +1519,7 @@ export class AppSyncState {
|
|
|
1490
1519
|
const entry = {
|
|
1491
1520
|
cursor: rowCursor ?? { version: rawVersion, id: "" },
|
|
1492
1521
|
type: "access-unavailable",
|
|
1522
|
+
cause: this.unreadableCauseForEvent(event, userEmail, orgId),
|
|
1493
1523
|
};
|
|
1494
1524
|
unreadable.push(entry);
|
|
1495
1525
|
accessRead?.unreadableCursors.push(entry);
|
|
@@ -1507,6 +1537,8 @@ export class AppSyncState {
|
|
|
1507
1537
|
const check = this.runningAccessCheck(event, userEmail, orgId);
|
|
1508
1538
|
if (check)
|
|
1509
1539
|
accessRead?.blockedOn.add(check);
|
|
1540
|
+
if (!accessRead)
|
|
1541
|
+
recordUnreadableEntries(unreadable);
|
|
1510
1542
|
return {
|
|
1511
1543
|
version: Math.max(since, event.version - 1),
|
|
1512
1544
|
events,
|
|
@@ -1523,6 +1555,8 @@ export class AppSyncState {
|
|
|
1523
1555
|
}
|
|
1524
1556
|
if (rows.length >= DURABLE_READ_LIMIT) {
|
|
1525
1557
|
if (cursor) {
|
|
1558
|
+
if (!accessRead)
|
|
1559
|
+
recordUnreadableEntries(unreadable);
|
|
1526
1560
|
return {
|
|
1527
1561
|
version: Math.max(since, lastDurableVersion),
|
|
1528
1562
|
events,
|
|
@@ -1533,13 +1567,18 @@ export class AppSyncState {
|
|
|
1533
1567
|
}
|
|
1534
1568
|
if (overflowVersion === lastDurableVersion) {
|
|
1535
1569
|
const boundaryVersion = lastDurableVersion;
|
|
1570
|
+
const boundedUnreadable = unreadable.filter((entry) => entry.cursor.version < boundaryVersion);
|
|
1571
|
+
if (!accessRead)
|
|
1572
|
+
recordUnreadableEntries(boundedUnreadable);
|
|
1536
1573
|
return {
|
|
1537
1574
|
version: Math.max(since, boundaryVersion - 1),
|
|
1538
1575
|
events: events.filter((event) => event.version < boundaryVersion),
|
|
1539
|
-
...unreadableSignals(
|
|
1576
|
+
...unreadableSignals(boundedUnreadable),
|
|
1540
1577
|
cursorLimited: true,
|
|
1541
1578
|
};
|
|
1542
1579
|
}
|
|
1580
|
+
if (!accessRead)
|
|
1581
|
+
recordUnreadableEntries(unreadable);
|
|
1543
1582
|
return {
|
|
1544
1583
|
version: Math.max(since, lastDurableVersion),
|
|
1545
1584
|
events,
|
|
@@ -1547,6 +1586,8 @@ export class AppSyncState {
|
|
|
1547
1586
|
cursorLimited: true,
|
|
1548
1587
|
};
|
|
1549
1588
|
}
|
|
1589
|
+
if (!accessRead)
|
|
1590
|
+
recordUnreadableEntries(unreadable);
|
|
1550
1591
|
return {
|
|
1551
1592
|
version,
|
|
1552
1593
|
events,
|
|
@@ -1576,6 +1617,7 @@ export class AppSyncState {
|
|
|
1576
1617
|
// Only an unresolved access check is worth waiting for; a row-limit
|
|
1577
1618
|
// truncation (also `cursorLimited`) is not blocked on one.
|
|
1578
1619
|
if (!first.accessPending) {
|
|
1620
|
+
recordUnreadableEntries(accessRead.unreadableCursors);
|
|
1579
1621
|
const { accessPending: _pending, ...result } = first;
|
|
1580
1622
|
return result;
|
|
1581
1623
|
}
|
|
@@ -1585,7 +1627,9 @@ export class AppSyncState {
|
|
|
1585
1627
|
if (accessRead.blockedOn.size > 0) {
|
|
1586
1628
|
await this.waitForAccessChecks(accessRead.blockedOn, ACCESS_CHECK_WAIT_MS);
|
|
1587
1629
|
}
|
|
1630
|
+
accessRead.unreadableCursors = [];
|
|
1588
1631
|
const { accessPending: _pending, ...result } = await this.readCombinedChangesSinceForUser(since, userEmail, orgId, useDurableEvents, cursor, accessRead);
|
|
1632
|
+
recordUnreadableEntries(accessRead.unreadableCursors);
|
|
1589
1633
|
return result;
|
|
1590
1634
|
}
|
|
1591
1635
|
async readCombinedChangesSinceForUser(since, userEmail, orgId, useDurableEvents, cursor, accessRead) {
|
|
@@ -1606,13 +1650,17 @@ export class AppSyncState {
|
|
|
1606
1650
|
const memory = this.getChangesSinceForUser(since, userEmail, orgId, cursor, memoryRead);
|
|
1607
1651
|
if (!useDurableEvents) {
|
|
1608
1652
|
blockOn(memoryRead);
|
|
1653
|
+
accessRead.unreadableCursors = memoryRead.unreadableCursors;
|
|
1609
1654
|
return memory;
|
|
1610
1655
|
}
|
|
1611
1656
|
const durable = await this.getDurableChangesSinceForUser(since, userEmail, orgId, cursor, durableRead);
|
|
1612
|
-
const
|
|
1613
|
-
|
|
1657
|
+
const unreadableByKey = new Map();
|
|
1658
|
+
for (const entry of [
|
|
1614
1659
|
...durableRead.unreadableCursors,
|
|
1615
|
-
|
|
1660
|
+
...memoryRead.unreadableCursors,
|
|
1661
|
+
]) {
|
|
1662
|
+
unreadableByKey.set(`${entry.cursor.version}\0${entry.cursor.id}`, entry);
|
|
1663
|
+
}
|
|
1616
1664
|
const sources = [
|
|
1617
1665
|
{ result: memory, read: memoryRead },
|
|
1618
1666
|
{ result: durable, read: durableRead },
|
|
@@ -1632,6 +1680,13 @@ export class AppSyncState {
|
|
|
1632
1680
|
]), event);
|
|
1633
1681
|
}
|
|
1634
1682
|
const events = Array.from(byIdentity.values()).sort((a, b) => compareSyncCursors(cursorForEvent(a), cursorForEvent(b)));
|
|
1683
|
+
const deliveredCursors = new Set(events.map((event) => {
|
|
1684
|
+
const cursor = cursorForEvent(event);
|
|
1685
|
+
return `${cursor.version}\0${cursor.id}`;
|
|
1686
|
+
}));
|
|
1687
|
+
const unreadable = Array.from(unreadableByKey.entries())
|
|
1688
|
+
.filter(([key]) => !deliveredCursors.has(key))
|
|
1689
|
+
.map(([, entry]) => entry);
|
|
1635
1690
|
if (cursor) {
|
|
1636
1691
|
const limitedCursors = [memory, durable]
|
|
1637
1692
|
.filter((result) => result.cursorLimited)
|
|
@@ -1644,11 +1699,13 @@ export class AppSyncState {
|
|
|
1644
1699
|
compareSyncCursors(decodeSyncCursor(result.cursor) ?? cursor, boundary) <= 0);
|
|
1645
1700
|
for (const { read } of pending)
|
|
1646
1701
|
blockOn(read);
|
|
1702
|
+
const boundedUnreadable = unreadable.filter((entry) => compareSyncCursors(entry.cursor, boundary) <= 0);
|
|
1703
|
+
accessRead.unreadableCursors = boundedUnreadable;
|
|
1647
1704
|
return {
|
|
1648
1705
|
version: boundary.version,
|
|
1649
1706
|
cursor: encodeSyncCursor(boundary),
|
|
1650
1707
|
cursorLimited: true,
|
|
1651
|
-
...unreadableSignals(
|
|
1708
|
+
...unreadableSignals(boundedUnreadable),
|
|
1652
1709
|
...(pending.length > 0 ? { accessPending: true } : {}),
|
|
1653
1710
|
events: events.filter((event) => compareSyncCursors(cursorForEvent(event), boundary) <= 0),
|
|
1654
1711
|
};
|
|
@@ -1661,6 +1718,7 @@ export class AppSyncState {
|
|
|
1661
1718
|
]
|
|
1662
1719
|
.filter((value) => !!value)
|
|
1663
1720
|
.reduce((maximum, value) => compareSyncCursors(value, maximum) > 0 ? value : maximum, cursor);
|
|
1721
|
+
accessRead.unreadableCursors = unreadable;
|
|
1664
1722
|
return {
|
|
1665
1723
|
version: Math.max(memory.version, durable.version, since),
|
|
1666
1724
|
events,
|
|
@@ -1676,6 +1734,9 @@ export class AppSyncState {
|
|
|
1676
1734
|
const pending = sources.filter(({ result }) => result.accessPending && result.version <= Math.min(...limitedVersions));
|
|
1677
1735
|
for (const { read } of pending)
|
|
1678
1736
|
blockOn(read);
|
|
1737
|
+
const boundedUnreadable = unreadable.filter((entry) => !limitedVersions.length ||
|
|
1738
|
+
entry.cursor.version <= Math.min(...limitedVersions));
|
|
1739
|
+
accessRead.unreadableCursors = boundedUnreadable;
|
|
1679
1740
|
return {
|
|
1680
1741
|
version: limitedVersions.length > 0
|
|
1681
1742
|
? Math.min(...limitedVersions)
|
|
@@ -1683,8 +1744,7 @@ export class AppSyncState {
|
|
|
1683
1744
|
events: limitedVersions.length > 0
|
|
1684
1745
|
? events.filter((event) => event.version <= Math.min(...limitedVersions))
|
|
1685
1746
|
: events,
|
|
1686
|
-
...unreadableSignals(
|
|
1687
|
-
entry.cursor.version <= Math.min(...limitedVersions))),
|
|
1747
|
+
...unreadableSignals(boundedUnreadable),
|
|
1688
1748
|
...(limitedVersions.length > 0 ? { cursorLimited: true } : {}),
|
|
1689
1749
|
...(pending.length > 0 ? { accessPending: true } : {}),
|
|
1690
1750
|
};
|
|
@@ -3,7 +3,9 @@ import type { TrackingEventScope } from "../observability/tracing.js";
|
|
|
3
3
|
import type { ContextStatus } from "../shared/context-status.js";
|
|
4
4
|
import type { FirstRunBuilderCreditsV2RequestAssignment } from "../shared/first-run-builder-credits-experiment.js";
|
|
5
5
|
import type { ReasoningEffort } from "../shared/reasoning-effort.js";
|
|
6
|
+
import { normalizeViewportMode, type ViewportMode } from "../shared/viewport-mode.js";
|
|
6
7
|
import type { SignupAttributionContext } from "./attribution.js";
|
|
8
|
+
export { normalizeViewportMode, type ViewportMode };
|
|
7
9
|
/**
|
|
8
10
|
* The tab a request from no browser tab acts on for tab-scoped app state:
|
|
9
11
|
* a tab explicitly requested by `x-agent-native-browser-tab`, the tab of this
|
|
@@ -31,13 +33,17 @@ export interface RequestRunContext {
|
|
|
31
33
|
/** The browser tab the request came from. */
|
|
32
34
|
browserTabId?: string;
|
|
33
35
|
/**
|
|
34
|
-
* For an MCP
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* else's.
|
|
36
|
+
* For an MCP or A2A call from no tab: the tab whose tab-scoped app state
|
|
37
|
+
* (navigation, navigate commands, selection) the call reads and writes.
|
|
38
|
+
* Unlike `browserTabId`, it doesn't make the call that tab's own, so the tab
|
|
39
|
+
* still sees the call's changes as someone else's.
|
|
39
40
|
*/
|
|
40
41
|
browserTabTarget?: BrowserTabTargetSlot;
|
|
42
|
+
/**
|
|
43
|
+
* Whether a cross-app request is acting on the visible foreground viewport
|
|
44
|
+
* or running a background lookup that must not hijack foreground navigation.
|
|
45
|
+
*/
|
|
46
|
+
viewportMode?: ViewportMode;
|
|
41
47
|
chatScope?: {
|
|
42
48
|
type: string;
|
|
43
49
|
id: string;
|
|
@@ -106,6 +112,11 @@ export interface RequestRunContext {
|
|
|
106
112
|
export interface RequestContext {
|
|
107
113
|
/** Set by the action HTTP boundary after cookie-session and UI-capability proof. */
|
|
108
114
|
provenUiRequest?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Set by the action HTTP boundary when the app's own page sent the request,
|
|
117
|
+
* proven or not. For analytics labels only; it never authorizes anything.
|
|
118
|
+
*/
|
|
119
|
+
appPageRequest?: boolean;
|
|
109
120
|
/**
|
|
110
121
|
* The id the server stamps on this request's response, so a failure captured
|
|
111
122
|
* anywhere in the request names the id the person sees on screen.
|
|
@@ -313,4 +324,3 @@ export declare function getCredentialContext(): {
|
|
|
313
324
|
} | null;
|
|
314
325
|
export declare function getRequestRunContext(): RequestRunContext | undefined;
|
|
315
326
|
export declare function ensureRequestRunContext(): RequestRunContext | undefined;
|
|
316
|
-
export {};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { registerViewportModeProbe } from "../application-state/navigate-write-guard.js";
|
|
1
2
|
import { registerBackgroundWorkerProbe } from "../provider-api/interactive-scope.js";
|
|
3
|
+
import { normalizeViewportMode, } from "../shared/viewport-mode.js";
|
|
4
|
+
export { normalizeViewportMode };
|
|
2
5
|
class StackAsyncLocalStorage {
|
|
3
6
|
stack = [];
|
|
4
7
|
getStore() {
|
|
@@ -426,3 +429,4 @@ export function ensureRequestRunContext() {
|
|
|
426
429
|
return store.run;
|
|
427
430
|
}
|
|
428
431
|
registerBackgroundWorkerProbe(() => getRequestRunContext()?.isBackgroundWorker === true);
|
|
432
|
+
registerViewportModeProbe(() => getRequestRunContext()?.viewportMode);
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* typed JSON-in / JSON-out).
|
|
18
18
|
*/
|
|
19
19
|
export declare function createTranscribeVoiceHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
20
|
-
text?: undefined;
|
|
21
20
|
error: string;
|
|
21
|
+
text?: undefined;
|
|
22
22
|
} | {
|
|
23
23
|
error?: undefined;
|
|
24
24
|
text: string;
|
|
@@ -14,6 +14,13 @@ export declare const AGENT_NATIVE_ACTION_EVENTS: {
|
|
|
14
14
|
readonly completed: "action_completed";
|
|
15
15
|
readonly failed: "action_failed";
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* `action_kind` on the action events: `"write"` for a call someone asked for,
|
|
19
|
+
* `"read"` for a call its action's `planMode` declares a read, and
|
|
20
|
+
* `"automatic"` for a write the app makes on its own (see `automatic` on
|
|
21
|
+
* `defineAction`). Product-use counts keep `"write"` only.
|
|
22
|
+
*/
|
|
23
|
+
export type AgentNativeActionKind = "write" | "read" | "automatic";
|
|
17
24
|
/** Ephemeral join key shared by legacy and canonical records for one event. */
|
|
18
25
|
export declare const TRACKING_EVENT_ALIAS_ID_PROPERTY = "event_alias_id";
|
|
19
26
|
export type AgentNativeLifecycleEventName = (typeof AGENT_NATIVE_LIFECYCLE_EVENTS)[keyof typeof AGENT_NATIVE_LIFECYCLE_EVENTS];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function normalizeViewportMode(value) {
|
|
2
|
+
if (typeof value !== "string")
|
|
3
|
+
return undefined;
|
|
4
|
+
const normalized = value.trim().toLowerCase();
|
|
5
|
+
if (normalized === "foreground" || normalized === "background") {
|
|
6
|
+
return normalized;
|
|
7
|
+
}
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
@@ -217,6 +217,7 @@ Everything else — CRUD, settings, search, list/detail reads, auth state, anyth
|
|
|
217
217
|
- **Do** validate inputs before the first write. A rejection raised before any write the framework can see is "nothing saved", so the agent can fix its request and retry. Don't reorder code just to add labels. See *Failed Writes*.
|
|
218
218
|
- **Do** render `actionErrorMessage(error) ?? yourCopy` in UI, never bare `error.message`. The message keeps an `Action <name> failed:` prefix that belongs in a console, so a toast built from it reads "Action update-brand-kit failed: That name is taken." The helper returns only what the action wrote, and `undefined` when nothing did (network drop, proxy HTML page), which is why the fallback is not optional.
|
|
219
219
|
- **Do** pass a real `errorCode` when the agent should branch on the failure rather than re-read it. Codes other than the default `action_failed` are appended to the tool result as `(errorCode: not_found)`, on both the in-app agent and MCP. `details` follow as an `Error details: {...}` JSON line, and as `structuredContent.error` over MCP, capped at 2,000 characters, so keep them to what the agent acts on next: ids, limits, field names. The status never reaches either.
|
|
220
|
+
- **Do** set `automatic: true` on a write the app makes with no user gesture behind it: on load, on mount, on a timer, or experiment and usage bookkeeping. Its action events then say `action_kind: "automatic"` instead of `"write"`, so it is not counted as product use. Only a call from the app's own UI can be automatic; a call from an agent, an MCP client, or the CLI stays `"write"`. When only some UI calls are automatic, pass a predicate of the input and the call's context instead (a background sync that is automatic unless a refresh button forces it). A call the action's `planMode` declares a read already says `"read"`. Never set `readOnly` on a write to keep it out of analytics.
|
|
220
221
|
- **Don't** re-export actions as REST — `/_agent-native/actions/:name` is already the REST surface; duplicating it under `/api/*` hides the operation from agents.
|
|
221
222
|
- **Don't** reach for provider integrations, `authorize`, `needsApproval`, or `_agentImages` without checking `references/` first — each has sharp edges covered there, not here.
|
|
222
223
|
|
|
@@ -25,17 +25,23 @@ order and decisions; use the edit-point reference for the scaffold you have.
|
|
|
25
25
|
|
|
26
26
|
## 1. Orient
|
|
27
27
|
|
|
28
|
-
Read `AGENTS.md`, `DESIGN.md` if present, and `app-quality-bar`.
|
|
29
|
-
|
|
28
|
+
Read `AGENTS.md`, `DESIGN.md` if present, `product-judgment`, and `app-quality-bar`.
|
|
29
|
+
Run `product-judgment` Step 0 before writing code: grep `packages/core` and
|
|
30
|
+
`@agent-native/toolkit/craft` (plus `agent-native-toolkit` kits) so you reuse
|
|
31
|
+
existing primitives instead of rebuilding state boundaries, shortcut managers,
|
|
32
|
+
destructive dialogs, or optimistic hooks. Inspect the closest existing screen or
|
|
33
|
+
action and the files you will edit. Use the bundled docs/source commands in
|
|
30
34
|
`AGENTS.md` only to answer a concrete API question; do not web-research
|
|
31
35
|
framework APIs.
|
|
32
36
|
|
|
33
37
|
## 2. Decide
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
Run `product-judgment` Steps 1–2 before writing code: choose one or two
|
|
40
|
+
interaction patterns, write or update `DESIGN.md` as the single required design
|
|
41
|
+
contract with the 6-Axis Judgment Card and 3-Option Decision Block (chosen and
|
|
42
|
+
rejected UX options), and register `app.manifest.ts` with real screens,
|
|
43
|
+
entities, `viewPolicy`, and `suggestableCapabilities`. Choose these six things
|
|
44
|
+
before writing code:
|
|
39
45
|
|
|
40
46
|
1. **Slice**: the one workflow that proves the app. For a booking app: create a
|
|
41
47
|
booking, reject an overlap, cancel, weekly grid per room. Name what you are
|
|
@@ -119,16 +125,26 @@ The access table, the concurrency pattern, and the security rules are in
|
|
|
119
125
|
- Load and write data with `useActionQuery` and `useActionMutation` from
|
|
120
126
|
`@agent-native/core/client/hooks`. No `fetch`, and no `/api/*` routes for app
|
|
121
127
|
data. Those routes are only for uploads, webhooks, OAuth callbacks, and streaming.
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
`
|
|
128
|
+
- Use `@agent-native/toolkit/craft` primitives by default:
|
|
129
|
+
- `ResourceStateBoundary` for every async surface (requires a layout-matched
|
|
130
|
+
`skeleton`, an actionable `empty` CTA, and an `error` retry path — never a
|
|
131
|
+
spinner, bare `"Loading…"`, or dead-end `"Could not load"` screen).
|
|
132
|
+
- `useOptimisticAction` (or `onMutate` + `setQueryData` with `onError`
|
|
133
|
+
rollback and `toast.error(actionErrorMessage(error) ?? "<fallback>")`) so
|
|
134
|
+
writes acknowledge in `<100ms` and show a pending state within `<400ms`.
|
|
135
|
+
- `SafeDestructiveAction` for destructive verbs: instant optimistic action +
|
|
136
|
+
undo affordance when reversible, accessible `AlertDialog` confirmation when
|
|
137
|
+
irreversible — never `window.confirm`, `alert`, or `prompt`.
|
|
138
|
+
- `useCommandRegistry` for portable `Mod` (`Cmd`/`Ctrl`) shortcuts, `j`/`k`,
|
|
139
|
+
`Esc`, and `?` shortcut help that automatically ignore editable inputs.
|
|
140
|
+
- Style with semantic tokens from `@agent-native/toolkit/styles.css` (which
|
|
141
|
+
bundles `craft-tokens.css`: `--success`/`--warning`/`--info`, `--surface-0..3`,
|
|
142
|
+
`--density-*`, `--dur-instant`/`--dur-fast`/`--dur-panel`, `tabular-nums`, and
|
|
143
|
+
`640px` chat-companion `@container` utilities).
|
|
127
144
|
- Import controls from `@/components/ui/*`. When one is missing (dialog,
|
|
128
145
|
select, skeleton, alert-dialog), add a one-line re-export like `button.tsx`:
|
|
129
146
|
`export * from "@agent-native/toolkit/ui/dialog";`.
|
|
130
|
-
- Use Tabler icons only.
|
|
131
|
-
`alert`, or `prompt`.
|
|
147
|
+
- Use Tabler icons only.
|
|
132
148
|
- Don't add a page title that repeats the nav item, a subtitle under a title,
|
|
133
149
|
or a stats strip. The data is the page. For visual direction, see `frontend-design`.
|
|
134
150
|
- Follow the app's existing localization pattern for user-facing copy.
|
|
@@ -175,10 +191,13 @@ made from a stale view. See `real-time-sync`.
|
|
|
175
191
|
message; read back the saved state through the matching list/get action.
|
|
176
192
|
The CLI prints the failure message, not its structured `errorCode`, so also
|
|
177
193
|
verify any code-specific behavior in the action contract or browser.
|
|
178
|
-
4.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
review
|
|
194
|
+
4. Run the `$0` static craft audit (`pnpm tsx scripts/guard-craft-slop.ts <app-dir>`)
|
|
195
|
+
and review the 5 Human-Team Lenses from `product-judgment` before capturing
|
|
196
|
+
screenshots. Then apply the canonical 12-row visual rubric and capture loop
|
|
197
|
+
from `skills/turn-into-app/references/review-loop.md` and
|
|
198
|
+
`app-quality-bar/visual-review.md`. Give the screenshots, rubric, and brief to
|
|
199
|
+
a blind reviewer and use the lower score per row. Fix and recapture until the
|
|
200
|
+
review passes (mean >= 4.0, every row >= 3, zero automatic fails).
|
|
182
201
|
5. Run the 60-second automated Playwright walkthrough from `app-quality-bar`.
|
|
183
202
|
Cover empty, populated, split pane at 520 px or narrower, and error
|
|
184
203
|
recovery. Click every navigation item, create and edit, reload and verify
|
|
@@ -197,6 +216,8 @@ check you didn't run.
|
|
|
197
216
|
|
|
198
217
|
## Related
|
|
199
218
|
|
|
219
|
+
- `product-judgment`: 5-step pre-flight (primitive inventory, 6-Axis Judgment
|
|
220
|
+
Card, 3-Option Decision Block, 5 Human-Team Lenses, and escalation boundary).
|
|
200
221
|
- `adding-a-feature`: the feature checklist for each later feature in this app.
|
|
201
222
|
- `frontend-design`, `actions`, `sharing`, `real-time-sync`, and `security`:
|
|
202
223
|
go deeper on one area when the references aren't enough.
|
|
@@ -52,8 +52,9 @@ presentation seam.
|
|
|
52
52
|
|
|
53
53
|
Use the app's existing field components and validation pattern. Associate
|
|
54
54
|
errors with their inputs and expose invalid state to assistive technology.
|
|
55
|
-
Icon-only actions need an accessible name and a usable focus target. Use
|
|
56
|
-
|
|
55
|
+
Icon-only actions need an accessible name and a usable focus target. Use Tabler
|
|
56
|
+
Icons (`@tabler/icons-react`) for UI icons, except in Design, which uses Radix
|
|
57
|
+
Icons (`@radix-ui/react-icons`).
|
|
57
58
|
|
|
58
59
|
Do not recreate menus, popovers, dialogs, or confirmations with absolute
|
|
59
60
|
positioning and custom click-outside handlers. Never use browser `alert`,
|
|
@@ -217,6 +217,7 @@ Everything else — CRUD, settings, search, list/detail reads, auth state, anyth
|
|
|
217
217
|
- **Do** validate inputs before the first write. A rejection raised before any write the framework can see is "nothing saved", so the agent can fix its request and retry. Don't reorder code just to add labels. See *Failed Writes*.
|
|
218
218
|
- **Do** render `actionErrorMessage(error) ?? yourCopy` in UI, never bare `error.message`. The message keeps an `Action <name> failed:` prefix that belongs in a console, so a toast built from it reads "Action update-brand-kit failed: That name is taken." The helper returns only what the action wrote, and `undefined` when nothing did (network drop, proxy HTML page), which is why the fallback is not optional.
|
|
219
219
|
- **Do** pass a real `errorCode` when the agent should branch on the failure rather than re-read it. Codes other than the default `action_failed` are appended to the tool result as `(errorCode: not_found)`, on both the in-app agent and MCP. `details` follow as an `Error details: {...}` JSON line, and as `structuredContent.error` over MCP, capped at 2,000 characters, so keep them to what the agent acts on next: ids, limits, field names. The status never reaches either.
|
|
220
|
+
- **Do** set `automatic: true` on a write the app makes with no user gesture behind it: on load, on mount, on a timer, or experiment and usage bookkeeping. Its action events then say `action_kind: "automatic"` instead of `"write"`, so it is not counted as product use. Only a call from the app's own UI can be automatic; a call from an agent, an MCP client, or the CLI stays `"write"`. When only some UI calls are automatic, pass a predicate of the input and the call's context instead (a background sync that is automatic unless a refresh button forces it). A call the action's `planMode` declares a read already says `"read"`. Never set `readOnly` on a write to keep it out of analytics.
|
|
220
221
|
- **Don't** re-export actions as REST — `/_agent-native/actions/:name` is already the REST surface; duplicating it under `/api/*` hides the operation from agents.
|
|
221
222
|
- **Don't** reach for provider integrations, `authorize`, `needsApproval`, or `_agentImages` without checking `references/` first — each has sharp edges covered there, not here.
|
|
222
223
|
|
|
@@ -25,17 +25,23 @@ order and decisions; use the edit-point reference for the scaffold you have.
|
|
|
25
25
|
|
|
26
26
|
## 1. Orient
|
|
27
27
|
|
|
28
|
-
Read `AGENTS.md`, `DESIGN.md` if present, and `app-quality-bar`.
|
|
29
|
-
|
|
28
|
+
Read `AGENTS.md`, `DESIGN.md` if present, `product-judgment`, and `app-quality-bar`.
|
|
29
|
+
Run `product-judgment` Step 0 before writing code: grep `packages/core` and
|
|
30
|
+
`@agent-native/toolkit/craft` (plus `agent-native-toolkit` kits) so you reuse
|
|
31
|
+
existing primitives instead of rebuilding state boundaries, shortcut managers,
|
|
32
|
+
destructive dialogs, or optimistic hooks. Inspect the closest existing screen or
|
|
33
|
+
action and the files you will edit. Use the bundled docs/source commands in
|
|
30
34
|
`AGENTS.md` only to answer a concrete API question; do not web-research
|
|
31
35
|
framework APIs.
|
|
32
36
|
|
|
33
37
|
## 2. Decide
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
Run `product-judgment` Steps 1–2 before writing code: choose one or two
|
|
40
|
+
interaction patterns, write or update `DESIGN.md` as the single required design
|
|
41
|
+
contract with the 6-Axis Judgment Card and 3-Option Decision Block (chosen and
|
|
42
|
+
rejected UX options), and register `app.manifest.ts` with real screens,
|
|
43
|
+
entities, `viewPolicy`, and `suggestableCapabilities`. Choose these six things
|
|
44
|
+
before writing code:
|
|
39
45
|
|
|
40
46
|
1. **Slice**: the one workflow that proves the app. For a booking app: create a
|
|
41
47
|
booking, reject an overlap, cancel, weekly grid per room. Name what you are
|
|
@@ -119,16 +125,26 @@ The access table, the concurrency pattern, and the security rules are in
|
|
|
119
125
|
- Load and write data with `useActionQuery` and `useActionMutation` from
|
|
120
126
|
`@agent-native/core/client/hooks`. No `fetch`, and no `/api/*` routes for app
|
|
121
127
|
data. Those routes are only for uploads, webhooks, OAuth callbacks, and streaming.
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
`
|
|
128
|
+
- Use `@agent-native/toolkit/craft` primitives by default:
|
|
129
|
+
- `ResourceStateBoundary` for every async surface (requires a layout-matched
|
|
130
|
+
`skeleton`, an actionable `empty` CTA, and an `error` retry path — never a
|
|
131
|
+
spinner, bare `"Loading…"`, or dead-end `"Could not load"` screen).
|
|
132
|
+
- `useOptimisticAction` (or `onMutate` + `setQueryData` with `onError`
|
|
133
|
+
rollback and `toast.error(actionErrorMessage(error) ?? "<fallback>")`) so
|
|
134
|
+
writes acknowledge in `<100ms` and show a pending state within `<400ms`.
|
|
135
|
+
- `SafeDestructiveAction` for destructive verbs: instant optimistic action +
|
|
136
|
+
undo affordance when reversible, accessible `AlertDialog` confirmation when
|
|
137
|
+
irreversible — never `window.confirm`, `alert`, or `prompt`.
|
|
138
|
+
- `useCommandRegistry` for portable `Mod` (`Cmd`/`Ctrl`) shortcuts, `j`/`k`,
|
|
139
|
+
`Esc`, and `?` shortcut help that automatically ignore editable inputs.
|
|
140
|
+
- Style with semantic tokens from `@agent-native/toolkit/styles.css` (which
|
|
141
|
+
bundles `craft-tokens.css`: `--success`/`--warning`/`--info`, `--surface-0..3`,
|
|
142
|
+
`--density-*`, `--dur-instant`/`--dur-fast`/`--dur-panel`, `tabular-nums`, and
|
|
143
|
+
`640px` chat-companion `@container` utilities).
|
|
127
144
|
- Import controls from `@/components/ui/*`. When one is missing (dialog,
|
|
128
145
|
select, skeleton, alert-dialog), add a one-line re-export like `button.tsx`:
|
|
129
146
|
`export * from "@agent-native/toolkit/ui/dialog";`.
|
|
130
|
-
- Use Tabler icons only.
|
|
131
|
-
`alert`, or `prompt`.
|
|
147
|
+
- Use Tabler icons only.
|
|
132
148
|
- Don't add a page title that repeats the nav item, a subtitle under a title,
|
|
133
149
|
or a stats strip. The data is the page. For visual direction, see `frontend-design`.
|
|
134
150
|
- Follow the app's existing localization pattern for user-facing copy.
|
|
@@ -175,10 +191,13 @@ made from a stale view. See `real-time-sync`.
|
|
|
175
191
|
message; read back the saved state through the matching list/get action.
|
|
176
192
|
The CLI prints the failure message, not its structured `errorCode`, so also
|
|
177
193
|
verify any code-specific behavior in the action contract or browser.
|
|
178
|
-
4.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
review
|
|
194
|
+
4. Run the `$0` static craft audit (`pnpm tsx scripts/guard-craft-slop.ts <app-dir>`)
|
|
195
|
+
and review the 5 Human-Team Lenses from `product-judgment` before capturing
|
|
196
|
+
screenshots. Then apply the canonical 12-row visual rubric and capture loop
|
|
197
|
+
from `skills/turn-into-app/references/review-loop.md` and
|
|
198
|
+
`app-quality-bar/visual-review.md`. Give the screenshots, rubric, and brief to
|
|
199
|
+
a blind reviewer and use the lower score per row. Fix and recapture until the
|
|
200
|
+
review passes (mean >= 4.0, every row >= 3, zero automatic fails).
|
|
182
201
|
5. Run the 60-second automated Playwright walkthrough from `app-quality-bar`.
|
|
183
202
|
Cover empty, populated, split pane at 520 px or narrower, and error
|
|
184
203
|
recovery. Click every navigation item, create and edit, reload and verify
|
|
@@ -197,6 +216,8 @@ check you didn't run.
|
|
|
197
216
|
|
|
198
217
|
## Related
|
|
199
218
|
|
|
219
|
+
- `product-judgment`: 5-step pre-flight (primitive inventory, 6-Axis Judgment
|
|
220
|
+
Card, 3-Option Decision Block, 5 Human-Team Lenses, and escalation boundary).
|
|
200
221
|
- `adding-a-feature`: the feature checklist for each later feature in this app.
|
|
201
222
|
- `frontend-design`, `actions`, `sharing`, `real-time-sync`, and `security`:
|
|
202
223
|
go deeper on one area when the references aren't enough.
|
|
@@ -52,8 +52,9 @@ presentation seam.
|
|
|
52
52
|
|
|
53
53
|
Use the app's existing field components and validation pattern. Associate
|
|
54
54
|
errors with their inputs and expose invalid state to assistive technology.
|
|
55
|
-
Icon-only actions need an accessible name and a usable focus target. Use
|
|
56
|
-
|
|
55
|
+
Icon-only actions need an accessible name and a usable focus target. Use Tabler
|
|
56
|
+
Icons (`@tabler/icons-react`) for UI icons, except in Design, which uses Radix
|
|
57
|
+
Icons (`@radix-ui/react-icons`).
|
|
57
58
|
|
|
58
59
|
Do not recreate menus, popovers, dialogs, or confirmations with absolute
|
|
59
60
|
positioning and custom click-outside handlers. Never use browser `alert`,
|