@agent-native/core 0.207.1 → 0.207.2-nightly-20261013011333
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/agent/production-agent.js +2 -0
- package/dist/cli/design-connect.d.ts +6 -0
- package/dist/cli/design-connect.js +880 -9
- package/dist/client/action-query-cache.d.ts +3 -1
- package/dist/client/action-query-cache.js +628 -161
- package/dist/client/action-query-cache.session-test-fixture.d.ts +49 -0
- package/dist/client/action-query-cache.session-test-fixture.js +151 -0
- package/dist/client/action-query-cache.test-fixtures.d.ts +2 -0
- package/dist/client/action-query-cache.test-fixtures.js +56 -0
- package/dist/client/motion-text.css +3 -0
- package/dist/client/motion-text.d.ts +38 -0
- package/dist/client/motion-text.js +551 -0
- package/dist/client/org/hooks.d.ts +3 -1
- package/dist/client/org/hooks.js +8 -2
- package/dist/client/route-chunk-recovery.d.ts +2 -0
- package/dist/client/route-chunk-recovery.js +11 -0
- package/dist/client/use-action.d.ts +10 -2
- package/dist/client/use-action.js +81 -12
- package/dist/client/use-settings-shortcut.js +8 -3
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/extensions/fetch-tool.js +8 -2
- package/dist/extensions/routes.js +7 -3
- package/dist/extensions/web-content.js +17 -2
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/jobs/actions/manage-recurring-job.d.ts +1 -1
- package/dist/mcp/build-server.js +5 -0
- package/dist/observability/routes.d.ts +4 -4
- package/dist/progress/routes.d.ts +1 -1
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/secrets/routes.d.ts +5 -5
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/agent-engine-default-model-route.d.ts +2 -2
- package/dist/server/agent-engine-ollama-models-route.d.ts +1 -1
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/server/visual-edit-bridge-capability.d.ts +26 -0
- package/dist/server/visual-edit-bridge-capability.js +233 -0
- package/dist/shared/motion-easing.d.ts +6 -0
- package/dist/shared/motion-easing.js +109 -0
- package/dist/shared/motion-source-node-id.d.ts +3 -0
- package/dist/shared/motion-source-node-id.js +12 -0
- package/dist/sharing/actions/list-resource-shares.d.ts +1 -1
- package/dist/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +35 -36
- package/dist/triggers/actions/manage-automation.d.ts +5 -5
- package/dist/vite/client.js +2 -0
- package/dist/vite/motion-source-provenance-plugin.d.ts +3 -0
- package/dist/vite/motion-source-provenance-plugin.js +339 -0
- package/package.json +14 -5
- package/src/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +35 -36
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { PersistedClient } from "@tanstack/query-persist-client-core";
|
|
2
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { type ComponentType, type ReactNode } from "react";
|
|
4
|
+
import type { AuthSessionResponse } from "../server/auth.js";
|
|
5
|
+
import type { ActionQueryCacheStorage } from "./action-query-cache.js";
|
|
6
|
+
export type Gate = ComponentType<{
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}>;
|
|
9
|
+
export type SessionUser = AuthSessionResponse;
|
|
10
|
+
export type ProbeRender = {
|
|
11
|
+
title: string | undefined;
|
|
12
|
+
status: string;
|
|
13
|
+
userId: string | undefined;
|
|
14
|
+
firstRead: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare const ALICE: SessionUser;
|
|
17
|
+
export declare const BOB: SessionUser;
|
|
18
|
+
export declare function sessionResponse(user: SessionUser): Response;
|
|
19
|
+
export declare function transientSessionFailure(): Response;
|
|
20
|
+
export declare function designsResponse(title: string): Response;
|
|
21
|
+
export declare function memoryStorage(): {
|
|
22
|
+
records: Map<string, PersistedClient>;
|
|
23
|
+
storage: ActionQueryCacheStorage;
|
|
24
|
+
};
|
|
25
|
+
export declare function stubFetch(options: {
|
|
26
|
+
onSession: (request: number) => Promise<Response> | Response;
|
|
27
|
+
onAction: (request: number) => Promise<Response> | Response;
|
|
28
|
+
}): {
|
|
29
|
+
calls: {
|
|
30
|
+
kind: "session" | "action";
|
|
31
|
+
path: string;
|
|
32
|
+
}[];
|
|
33
|
+
sessionCount: () => number;
|
|
34
|
+
actionCount: () => number;
|
|
35
|
+
};
|
|
36
|
+
export declare function StatusProbe({ onStatus, }: {
|
|
37
|
+
onStatus: (value: {
|
|
38
|
+
status: string;
|
|
39
|
+
userId: string | undefined;
|
|
40
|
+
}) => void;
|
|
41
|
+
}): null;
|
|
42
|
+
export declare function mountProbe(GateComponent: Gate, queryClient: QueryClient, onRender: (value: ProbeRender) => void, onStatus?: (value: {
|
|
43
|
+
status: string;
|
|
44
|
+
userId: string | undefined;
|
|
45
|
+
}) => void): Promise<HTMLDivElement>;
|
|
46
|
+
export declare function settle(ms?: number): Promise<void>;
|
|
47
|
+
export declare function waitUntil(predicate: () => boolean, timeoutMs?: number): Promise<boolean>;
|
|
48
|
+
export declare function unmountAll(): Promise<void>;
|
|
49
|
+
export { QueryClient };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
3
|
+
import { act } from "react";
|
|
4
|
+
import { createRoot } from "react-dom/client";
|
|
5
|
+
import { vi } from "vitest";
|
|
6
|
+
import { useActionQuery } from "./use-action.js";
|
|
7
|
+
import { isSessionFromFirstRead, useSession } from "./use-session.js";
|
|
8
|
+
const roots = [];
|
|
9
|
+
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
|
|
10
|
+
let restoreLocalStorage;
|
|
11
|
+
function installLocalStorageForTest() {
|
|
12
|
+
if (restoreLocalStorage)
|
|
13
|
+
return;
|
|
14
|
+
const descriptor = Object.getOwnPropertyDescriptor(window, "localStorage");
|
|
15
|
+
Object.defineProperty(window, "localStorage", {
|
|
16
|
+
configurable: true,
|
|
17
|
+
value: {
|
|
18
|
+
length: 0,
|
|
19
|
+
setItem: () => { },
|
|
20
|
+
getItem: () => null,
|
|
21
|
+
removeItem: () => { },
|
|
22
|
+
clear: () => { },
|
|
23
|
+
key: () => null,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
restoreLocalStorage = () => {
|
|
27
|
+
if (descriptor)
|
|
28
|
+
Object.defineProperty(window, "localStorage", descriptor);
|
|
29
|
+
else
|
|
30
|
+
Reflect.deleteProperty(window, "localStorage");
|
|
31
|
+
restoreLocalStorage = undefined;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export const ALICE = {
|
|
35
|
+
email: "alice@example.com",
|
|
36
|
+
userId: "user-alice",
|
|
37
|
+
orgId: "org-1",
|
|
38
|
+
testIdentity: false,
|
|
39
|
+
};
|
|
40
|
+
export const BOB = {
|
|
41
|
+
email: "bob@example.com",
|
|
42
|
+
userId: "user-bob",
|
|
43
|
+
orgId: "org-1",
|
|
44
|
+
testIdentity: false,
|
|
45
|
+
};
|
|
46
|
+
export function sessionResponse(user) {
|
|
47
|
+
return new Response(JSON.stringify(user), {
|
|
48
|
+
status: 200,
|
|
49
|
+
headers: { "Content-Type": "application/json" },
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export function transientSessionFailure() {
|
|
53
|
+
return new Response("temporarily unavailable", { status: 503 });
|
|
54
|
+
}
|
|
55
|
+
export function designsResponse(title) {
|
|
56
|
+
return new Response(JSON.stringify({ designs: [{ title }] }), {
|
|
57
|
+
status: 200,
|
|
58
|
+
headers: {
|
|
59
|
+
"Content-Type": "application/json",
|
|
60
|
+
"X-Agent-Native-Browser-Persist": "allow",
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export function memoryStorage() {
|
|
65
|
+
const records = new Map();
|
|
66
|
+
const storage = {
|
|
67
|
+
get: async (key) => records.get(key),
|
|
68
|
+
set: async (key, value) => {
|
|
69
|
+
records.set(key, value);
|
|
70
|
+
},
|
|
71
|
+
del: async (key) => {
|
|
72
|
+
records.delete(key);
|
|
73
|
+
},
|
|
74
|
+
keys: async () => [...records.keys()],
|
|
75
|
+
clear: async () => {
|
|
76
|
+
records.clear();
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
return { records, storage };
|
|
80
|
+
}
|
|
81
|
+
export function stubFetch(options) {
|
|
82
|
+
let sessionRequests = 0;
|
|
83
|
+
let actionRequests = 0;
|
|
84
|
+
const calls = [];
|
|
85
|
+
vi.stubGlobal("fetch", vi.fn(async (input) => {
|
|
86
|
+
const raw = typeof input === "object" && "url" in input
|
|
87
|
+
? String(input.url)
|
|
88
|
+
: String(input);
|
|
89
|
+
const url = new URL(raw, window.location.href);
|
|
90
|
+
calls.push({ kind: "session", path: url.pathname });
|
|
91
|
+
if (url.pathname.endsWith("/_agent-native/auth/session")) {
|
|
92
|
+
sessionRequests += 1;
|
|
93
|
+
calls[calls.length - 1].kind = "session";
|
|
94
|
+
return options.onSession(sessionRequests);
|
|
95
|
+
}
|
|
96
|
+
if (url.pathname.includes("/_agent-native/actions/")) {
|
|
97
|
+
actionRequests += 1;
|
|
98
|
+
calls[calls.length - 1].kind = "action";
|
|
99
|
+
return options.onAction(actionRequests);
|
|
100
|
+
}
|
|
101
|
+
throw new Error(`Unexpected fetch in private probe: ${url.pathname}`);
|
|
102
|
+
}));
|
|
103
|
+
return {
|
|
104
|
+
calls,
|
|
105
|
+
sessionCount: () => sessionRequests,
|
|
106
|
+
actionCount: () => actionRequests,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function DesignsProbe({ onRender, }) {
|
|
110
|
+
const { status, session } = useSession();
|
|
111
|
+
const query = useActionQuery("list-designs");
|
|
112
|
+
const title = query.data?.designs[0]?.title;
|
|
113
|
+
onRender({
|
|
114
|
+
title,
|
|
115
|
+
status,
|
|
116
|
+
userId: session?.userId,
|
|
117
|
+
firstRead: isSessionFromFirstRead(),
|
|
118
|
+
});
|
|
119
|
+
return _jsx("span", { "data-result": true, children: title ?? "pending" });
|
|
120
|
+
}
|
|
121
|
+
export function StatusProbe({ onStatus, }) {
|
|
122
|
+
const { status, session } = useSession();
|
|
123
|
+
onStatus({ status, userId: session?.userId });
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
export async function mountProbe(GateComponent, queryClient, onRender, onStatus) {
|
|
127
|
+
installLocalStorageForTest();
|
|
128
|
+
const container = document.createElement("div");
|
|
129
|
+
document.body.appendChild(container);
|
|
130
|
+
const root = createRoot(container);
|
|
131
|
+
roots.push({ root, container });
|
|
132
|
+
await act(async () => root.render(_jsxs(QueryClientProvider, { client: queryClient, children: [onStatus ? _jsx(StatusProbe, { onStatus: onStatus }) : null, _jsx(GateComponent, { children: _jsx(DesignsProbe, { onRender: onRender }) })] })));
|
|
133
|
+
return container;
|
|
134
|
+
}
|
|
135
|
+
export async function settle(ms = 20) {
|
|
136
|
+
await act(async () => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
137
|
+
}
|
|
138
|
+
export async function waitUntil(predicate, timeoutMs = 4_000) {
|
|
139
|
+
const deadline = Date.now() + timeoutMs;
|
|
140
|
+
while (!predicate() && Date.now() < deadline)
|
|
141
|
+
await settle(20);
|
|
142
|
+
return predicate();
|
|
143
|
+
}
|
|
144
|
+
export async function unmountAll() {
|
|
145
|
+
for (const { root, container } of roots.splice(0)) {
|
|
146
|
+
await act(async () => root.unmount());
|
|
147
|
+
container.remove();
|
|
148
|
+
}
|
|
149
|
+
restoreLocalStorage?.();
|
|
150
|
+
}
|
|
151
|
+
export { QueryClient };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { beforeEach } from "vitest";
|
|
2
|
+
const epochKey = "agent-native.action-query-cache.epoch";
|
|
3
|
+
const values = new Map();
|
|
4
|
+
const localStorageShim = {
|
|
5
|
+
get length() {
|
|
6
|
+
return values.size;
|
|
7
|
+
},
|
|
8
|
+
key(index) {
|
|
9
|
+
return [...values.keys()][index] ?? null;
|
|
10
|
+
},
|
|
11
|
+
getItem(key) {
|
|
12
|
+
return values.get(key) ?? null;
|
|
13
|
+
},
|
|
14
|
+
setItem(key, value) {
|
|
15
|
+
values.set(key, value);
|
|
16
|
+
},
|
|
17
|
+
removeItem(key) {
|
|
18
|
+
values.delete(key);
|
|
19
|
+
},
|
|
20
|
+
clear() {
|
|
21
|
+
values.clear();
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
values.clear();
|
|
26
|
+
values.set(epochKey, TEST_CACHE_EPOCH);
|
|
27
|
+
const global = globalThis;
|
|
28
|
+
if (!global.window) {
|
|
29
|
+
Object.defineProperty(globalThis, "window", {
|
|
30
|
+
configurable: true,
|
|
31
|
+
value: { localStorage: localStorageShim },
|
|
32
|
+
});
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
Object.defineProperty(global.window, "localStorage", {
|
|
36
|
+
configurable: true,
|
|
37
|
+
value: localStorageShim,
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
export const TEST_CACHE_EPOCH = "cache-test-epoch";
|
|
41
|
+
const CURRENT_CACHE_BUSTER = "action-query-cache-v1";
|
|
42
|
+
const CACHE_EPOCH_KEY = "agent-native.action-query-cache.epoch";
|
|
43
|
+
function currentTestEpoch() {
|
|
44
|
+
try {
|
|
45
|
+
return window.localStorage.getItem(CACHE_EPOCH_KEY) ?? TEST_CACHE_EPOCH;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return TEST_CACHE_EPOCH;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export function cacheBuster(buster = CURRENT_CACHE_BUSTER) {
|
|
52
|
+
if (buster === CURRENT_CACHE_BUSTER) {
|
|
53
|
+
return `${CURRENT_CACHE_BUSTER}:${currentTestEpoch()}`;
|
|
54
|
+
}
|
|
55
|
+
return buster;
|
|
56
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode, type Ref } from "react";
|
|
2
|
+
import "./motion-text.css";
|
|
3
|
+
export type MotionTextUnit = "character" | "word" | "line" | "paragraph";
|
|
4
|
+
export type MotionTextDirection = "forward" | "reverse";
|
|
5
|
+
export type MotionTextProperty = "opacity" | "translate" | "scale" | "rotate" | "filter";
|
|
6
|
+
export type MotionTextPlaybackMode = "loop" | "once" | "ping-pong";
|
|
7
|
+
export interface MotionTextKeyframe {
|
|
8
|
+
t: number;
|
|
9
|
+
value: string;
|
|
10
|
+
ease?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MotionTextAnimation {
|
|
13
|
+
targetNodeId: string;
|
|
14
|
+
unit: MotionTextUnit;
|
|
15
|
+
direction: MotionTextDirection;
|
|
16
|
+
staggerMs: number;
|
|
17
|
+
delayMs?: number;
|
|
18
|
+
property: MotionTextProperty;
|
|
19
|
+
durationMs: number;
|
|
20
|
+
keyframes: MotionTextKeyframe[];
|
|
21
|
+
}
|
|
22
|
+
export interface AgentNativeMotionTextProps {
|
|
23
|
+
animation?: MotionTextAnimation;
|
|
24
|
+
animations?: MotionTextAnimation[];
|
|
25
|
+
playbackMode?: MotionTextPlaybackMode;
|
|
26
|
+
children: ReactElement;
|
|
27
|
+
}
|
|
28
|
+
type MotionTextHostProps = Record<string, unknown> & {
|
|
29
|
+
children?: ReactNode;
|
|
30
|
+
ref?: Ref<HTMLElement>;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Applies static text property animations to a single intrinsic JSX host element.
|
|
34
|
+
* Importing this entry includes the package stylesheet; the same asset is
|
|
35
|
+
* available as `@agent-native/core/client/motion-text.css` for CSS-only setups.
|
|
36
|
+
*/
|
|
37
|
+
export declare function AgentNativeMotionText({ animation, animations: animationList, playbackMode, children, }: AgentNativeMotionTextProps): ReactElement<MotionTextHostProps, string | import("react").JSXElementConstructor<any>>;
|
|
38
|
+
export {};
|