@agent-native/core 0.225.1 → 0.226.0-nightly-20261106182619
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/actions/get-agentkit-capabilities.d.ts +12 -1
- package/dist/agent/actions/get-agentkit-capabilities.js +13 -5
- package/dist/agent/production-agent.js +14 -4
- package/dist/agentkit/capabilities.d.ts +4 -2
- package/dist/agentkit/capabilities.js +71 -18
- package/dist/app-config/experience-profiles.d.ts +4 -0
- package/dist/app-config/experience-profiles.js +7 -0
- package/dist/app-config/onboarding.d.ts +2 -0
- package/dist/app-config/onboarding.js +5 -0
- package/dist/app-config/schema.d.ts +5 -0
- package/dist/app-config/schema.js +2 -0
- package/dist/application-state/handlers.d.ts +2 -2
- package/dist/client/agent-chat.d.ts +3 -1
- package/dist/client/agent-chat.js +8 -0
- package/dist/client/agentkit-chat/transport.d.ts +2 -1
- package/dist/client/agentkit-chat/transport.js +2 -1
- package/dist/client/auth/builder-signup.d.ts +14 -0
- package/dist/client/auth/builder-signup.js +75 -0
- package/dist/client/chat/agentkit-agent-native.d.ts +4 -0
- package/dist/client/chat/agentkit-agent-native.js +25 -0
- package/dist/client/chat/composer-draft.d.ts +1 -7
- package/dist/client/chat/composer-draft.js +5 -1
- package/dist/client/chat/native-uploads.d.ts +11 -0
- package/dist/client/chat/native-uploads.js +97 -0
- package/dist/client/experience-profiles.d.ts +182 -0
- package/dist/client/experience-profiles.js +19 -0
- package/dist/client/uploads/index.d.ts +1 -1
- package/dist/client/uploads/index.js +1 -1
- package/dist/client/use-action.js +3 -0
- package/dist/collab/routes.d.ts +1 -1
- package/dist/experience-profiles/index.d.ts +13 -0
- package/dist/experience-profiles/index.js +10 -0
- package/dist/experience-profiles/server.d.ts +38 -0
- package/dist/experience-profiles/server.js +76 -0
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/framework-package-versions.json +7 -7
- package/dist/localization/workspace-integration-messages.d.ts +11 -0
- package/dist/localization/workspace-integration-messages.js +132 -0
- package/dist/mcp/screen-memory-stdio.d.ts +3 -3
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/org/index.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +5 -5
- package/dist/provider-api/actions/provider-api.d.ts +3 -3
- package/dist/provider-api/actions/provider-api.js +2 -0
- package/dist/provider-api/index.d.ts +7 -1
- package/dist/provider-api/index.js +42 -2
- package/dist/scripts/resources/read.d.ts +6 -1
- package/dist/scripts/resources/read.js +85 -8
- package/dist/secrets/routes.d.ts +2 -2
- package/dist/server/agent-chat/script-entries.js +27 -6
- package/dist/server/agent-chat-plugin.js +102 -33
- package/dist/server/agent-engine-api-key-route.d.ts +4 -4
- package/dist/server/agent-engine-ollama-models-route.d.ts +1 -1
- package/dist/server/auth.js +25 -1
- package/dist/server/better-auth-instance.d.ts +1 -0
- package/dist/server/builder-browser.d.ts +2 -0
- package/dist/server/builder-browser.js +8 -4
- package/dist/server/builder-signup-experiment.d.ts +67 -0
- package/dist/server/builder-signup-experiment.js +345 -0
- package/dist/server/core-routes-plugin.d.ts +2 -0
- package/dist/server/core-routes-plugin.js +77 -25
- package/dist/server/first-touch-route.d.ts +1 -1
- package/dist/server/google-oauth.d.ts +2 -0
- package/dist/server/google-oauth.js +5 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/shared/agent-chat-references.d.ts +2 -0
- package/dist/shared/agent-chat-references.js +8 -0
- package/dist/shared/auth-copy.d.ts +1 -0
- package/dist/shared/auth-copy.js +11 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -0
- package/dist/templates/builder-code-starter/server/lib/composer-reference-messages.ts.patch +44 -0
- package/dist/templates/builder-code-starter/server/plugins/agent-chat.ts.patch +10 -1
- package/dist/templates/chat/app/components/ChatComposerContext.tsx +31 -0
- package/dist/templates/chat/app/components/chat/ChatRouteContent.tsx +3 -0
- package/dist/templates/chat/app/components/home/HomePage.tsx +4 -2
- package/dist/templates/chat/app/components/layout/AgentInspector.tsx +2 -0
- package/dist/templates/chat/app/i18n/ar-SA.ts +7 -0
- package/dist/templates/chat/app/i18n/de-DE.ts +8 -0
- package/dist/templates/chat/app/i18n/en-US.ts +8 -0
- package/dist/templates/chat/app/i18n/es-ES.ts +8 -0
- package/dist/templates/chat/app/i18n/fr-FR.ts +8 -0
- package/dist/templates/chat/app/i18n/hi-IN.ts +7 -0
- package/dist/templates/chat/app/i18n/ja-JP.ts +8 -0
- package/dist/templates/chat/app/i18n/ko-KR.ts +8 -0
- package/dist/templates/chat/app/i18n/pt-BR.ts +8 -0
- package/dist/templates/chat/app/i18n/zh-CN.ts +7 -0
- package/dist/templates/chat/app/i18n/zh-TW.ts +7 -0
- package/dist/templates/chat/server/lib/composer-reference-messages.ts +34 -0
- package/dist/templates/chat/server/lib/composer-references.ts +60 -0
- package/dist/templates/chat/server/plugins/agent-chat.ts +13 -0
- package/docs/content/components.mdx +7 -2
- package/package.json +8 -3
- package/src/templates/builder-code-starter/server/lib/composer-reference-messages.ts.patch +44 -0
- package/src/templates/builder-code-starter/server/plugins/agent-chat.ts.patch +10 -1
- package/src/templates/chat/app/components/ChatComposerContext.tsx +31 -0
- package/src/templates/chat/app/components/chat/ChatRouteContent.tsx +3 -0
- package/src/templates/chat/app/components/home/HomePage.tsx +4 -2
- package/src/templates/chat/app/components/layout/AgentInspector.tsx +2 -0
- package/src/templates/chat/app/i18n/ar-SA.ts +7 -0
- package/src/templates/chat/app/i18n/de-DE.ts +8 -0
- package/src/templates/chat/app/i18n/en-US.ts +8 -0
- package/src/templates/chat/app/i18n/es-ES.ts +8 -0
- package/src/templates/chat/app/i18n/fr-FR.ts +8 -0
- package/src/templates/chat/app/i18n/hi-IN.ts +7 -0
- package/src/templates/chat/app/i18n/ja-JP.ts +8 -0
- package/src/templates/chat/app/i18n/ko-KR.ts +8 -0
- package/src/templates/chat/app/i18n/pt-BR.ts +8 -0
- package/src/templates/chat/app/i18n/zh-CN.ts +7 -0
- package/src/templates/chat/app/i18n/zh-TW.ts +7 -0
- package/src/templates/chat/server/lib/composer-reference-messages.ts +34 -0
- package/src/templates/chat/server/lib/composer-references.ts +60 -0
- package/src/templates/chat/server/plugins/agent-chat.ts +13 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { isPersistableAttachmentReferenceUrl } from "@agent-native/agentkit/protocol";
|
|
2
|
+
import { agentNativePath } from "../api-path.js";
|
|
3
|
+
export function fileUploadUrlForChatApi(apiUrl) {
|
|
4
|
+
return apiUrl.endsWith("/agent-chat")
|
|
5
|
+
? `${apiUrl.slice(0, -"/agent-chat".length)}/file-upload`
|
|
6
|
+
: agentNativePath("/_agent-native/file-upload");
|
|
7
|
+
}
|
|
8
|
+
export function createAgentNativeUploadRuntime(options = {}) {
|
|
9
|
+
const pending = new Map();
|
|
10
|
+
const fetcher = options.fetch ?? fetch;
|
|
11
|
+
const url = options.url ?? agentNativePath("/_agent-native/file-upload");
|
|
12
|
+
const failure = (code, status) => Object.assign(new Error(code), {
|
|
13
|
+
code,
|
|
14
|
+
retryable: code === "upload_network_error" ||
|
|
15
|
+
status === 408 ||
|
|
16
|
+
status === 429 ||
|
|
17
|
+
(status !== undefined && status >= 500),
|
|
18
|
+
...(status === undefined ? {} : { status }),
|
|
19
|
+
});
|
|
20
|
+
const operations = {
|
|
21
|
+
async createUpload({ threadId, descriptor }) {
|
|
22
|
+
if (descriptor.size > 25 * 1024 * 1024)
|
|
23
|
+
throw failure("upload_too_large", 413);
|
|
24
|
+
if (pending.size >= 100)
|
|
25
|
+
throw failure("upload_unavailable", 429);
|
|
26
|
+
const uploadId = `agent-upload-${crypto.randomUUID()}`;
|
|
27
|
+
pending.set(uploadId, { threadId });
|
|
28
|
+
return { uploadId, method: "POST", url, fields: {} };
|
|
29
|
+
},
|
|
30
|
+
async completeUpload({ threadId, uploadId }) {
|
|
31
|
+
const entry = pending.get(uploadId);
|
|
32
|
+
if (!entry || entry.threadId !== threadId || !entry.file)
|
|
33
|
+
throw failure("upload_invalid_response");
|
|
34
|
+
pending.delete(uploadId);
|
|
35
|
+
return entry.file;
|
|
36
|
+
},
|
|
37
|
+
async cancelUpload({ threadId, uploadId }) {
|
|
38
|
+
if (pending.get(uploadId)?.threadId === threadId)
|
|
39
|
+
pending.delete(uploadId);
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const upload = async (target, file, context) => {
|
|
43
|
+
const entry = pending.get(target.uploadId);
|
|
44
|
+
if (!entry || target.url !== url)
|
|
45
|
+
throw failure("upload_invalid_response");
|
|
46
|
+
if (file.size > 25 * 1024 * 1024)
|
|
47
|
+
throw failure("upload_too_large", 413);
|
|
48
|
+
const requestHeaders = new Headers(await options.headers?.(entry.threadId));
|
|
49
|
+
requestHeaders.delete("Content-Type");
|
|
50
|
+
const form = new FormData();
|
|
51
|
+
form.set("file", file.body, file.name);
|
|
52
|
+
let response;
|
|
53
|
+
try {
|
|
54
|
+
response = await fetcher(url, {
|
|
55
|
+
method: "POST",
|
|
56
|
+
headers: requestHeaders,
|
|
57
|
+
body: form,
|
|
58
|
+
...(context?.signal ? { signal: context.signal } : {}),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
catch (cause) {
|
|
62
|
+
if (context?.signal?.aborted)
|
|
63
|
+
throw cause;
|
|
64
|
+
throw Object.assign(failure("upload_network_error"), { cause });
|
|
65
|
+
}
|
|
66
|
+
if (!response.ok)
|
|
67
|
+
throw failure(response.status === 413
|
|
68
|
+
? "upload_too_large"
|
|
69
|
+
: response.status === 401 || response.status === 403
|
|
70
|
+
? "upload_session_expired"
|
|
71
|
+
: response.status === 415
|
|
72
|
+
? "upload_unsupported_type"
|
|
73
|
+
: response.status === 408 ||
|
|
74
|
+
response.status === 429 ||
|
|
75
|
+
response.status >= 500
|
|
76
|
+
? "upload_unavailable"
|
|
77
|
+
: `upload_http_${response.status}`, response.status);
|
|
78
|
+
const result = await response.json();
|
|
79
|
+
if (!result ||
|
|
80
|
+
typeof result !== "object" ||
|
|
81
|
+
!("url" in result) ||
|
|
82
|
+
!isPersistableAttachmentReferenceUrl(result.url))
|
|
83
|
+
throw failure("upload_invalid_response");
|
|
84
|
+
if (pending.get(target.uploadId) !== entry)
|
|
85
|
+
throw failure("upload_invalid_response");
|
|
86
|
+
entry.file = {
|
|
87
|
+
type: "file",
|
|
88
|
+
name: file.name,
|
|
89
|
+
mediaType: file.mediaType,
|
|
90
|
+
url: result.url,
|
|
91
|
+
...("id" in result && typeof result.id === "string"
|
|
92
|
+
? { fileId: result.id }
|
|
93
|
+
: {}),
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
return { operations, upload, dispose: () => pending.clear() };
|
|
97
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import type { ExperienceProfile, ExperienceProfileState } from "../experience-profiles/index.js";
|
|
2
|
+
export declare function useExperienceProfile(): {
|
|
3
|
+
dataUpdatedAt: number;
|
|
4
|
+
errorUpdatedAt: number;
|
|
5
|
+
failureCount: number;
|
|
6
|
+
failureReason: Error | null;
|
|
7
|
+
errorUpdateCount: number;
|
|
8
|
+
isFetched: boolean;
|
|
9
|
+
isFetchedAfterMount: boolean;
|
|
10
|
+
isFetching: boolean;
|
|
11
|
+
isInitialLoading: boolean;
|
|
12
|
+
isPaused: boolean;
|
|
13
|
+
isRefetching: boolean;
|
|
14
|
+
isStale: boolean;
|
|
15
|
+
isEnabled: boolean;
|
|
16
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<ExperienceProfileState>, Error>>;
|
|
17
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
18
|
+
promise: Promise<NoInfer<ExperienceProfileState>>;
|
|
19
|
+
data: undefined;
|
|
20
|
+
error: Error;
|
|
21
|
+
isError: true;
|
|
22
|
+
isPending: false;
|
|
23
|
+
isLoading: false;
|
|
24
|
+
isLoadingError: true;
|
|
25
|
+
isRefetchError: false;
|
|
26
|
+
isSuccess: false;
|
|
27
|
+
isPlaceholderData: false;
|
|
28
|
+
status: 'error';
|
|
29
|
+
setProfile: (profile: ExperienceProfile) => Promise<ExperienceProfileState>;
|
|
30
|
+
saving: boolean;
|
|
31
|
+
mutationError: Error | null;
|
|
32
|
+
} | {
|
|
33
|
+
dataUpdatedAt: number;
|
|
34
|
+
errorUpdatedAt: number;
|
|
35
|
+
failureCount: number;
|
|
36
|
+
failureReason: Error | null;
|
|
37
|
+
errorUpdateCount: number;
|
|
38
|
+
isFetched: boolean;
|
|
39
|
+
isFetchedAfterMount: boolean;
|
|
40
|
+
isFetching: boolean;
|
|
41
|
+
isInitialLoading: boolean;
|
|
42
|
+
isPaused: boolean;
|
|
43
|
+
isRefetching: boolean;
|
|
44
|
+
isStale: boolean;
|
|
45
|
+
isEnabled: boolean;
|
|
46
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<ExperienceProfileState>, Error>>;
|
|
47
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
48
|
+
promise: Promise<NoInfer<ExperienceProfileState>>;
|
|
49
|
+
data: undefined;
|
|
50
|
+
error: null;
|
|
51
|
+
isError: false;
|
|
52
|
+
isPending: true;
|
|
53
|
+
isLoading: true;
|
|
54
|
+
isLoadingError: false;
|
|
55
|
+
isRefetchError: false;
|
|
56
|
+
isSuccess: false;
|
|
57
|
+
isPlaceholderData: false;
|
|
58
|
+
status: 'pending';
|
|
59
|
+
setProfile: (profile: ExperienceProfile) => Promise<ExperienceProfileState>;
|
|
60
|
+
saving: boolean;
|
|
61
|
+
mutationError: Error | null;
|
|
62
|
+
} | {
|
|
63
|
+
dataUpdatedAt: number;
|
|
64
|
+
errorUpdatedAt: number;
|
|
65
|
+
failureCount: number;
|
|
66
|
+
failureReason: Error | null;
|
|
67
|
+
errorUpdateCount: number;
|
|
68
|
+
isFetched: boolean;
|
|
69
|
+
isFetchedAfterMount: boolean;
|
|
70
|
+
isFetching: boolean;
|
|
71
|
+
isLoading: boolean;
|
|
72
|
+
isInitialLoading: boolean;
|
|
73
|
+
isPaused: boolean;
|
|
74
|
+
isRefetching: boolean;
|
|
75
|
+
isStale: boolean;
|
|
76
|
+
isEnabled: boolean;
|
|
77
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<ExperienceProfileState>, Error>>;
|
|
78
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
79
|
+
promise: Promise<NoInfer<ExperienceProfileState>>;
|
|
80
|
+
data: undefined;
|
|
81
|
+
error: null;
|
|
82
|
+
isError: false;
|
|
83
|
+
isPending: true;
|
|
84
|
+
isLoadingError: false;
|
|
85
|
+
isRefetchError: false;
|
|
86
|
+
isSuccess: false;
|
|
87
|
+
isPlaceholderData: false;
|
|
88
|
+
status: 'pending';
|
|
89
|
+
setProfile: (profile: ExperienceProfile) => Promise<ExperienceProfileState>;
|
|
90
|
+
saving: boolean;
|
|
91
|
+
mutationError: Error | null;
|
|
92
|
+
} | {
|
|
93
|
+
dataUpdatedAt: number;
|
|
94
|
+
errorUpdatedAt: number;
|
|
95
|
+
failureCount: number;
|
|
96
|
+
failureReason: Error | null;
|
|
97
|
+
errorUpdateCount: number;
|
|
98
|
+
isFetched: boolean;
|
|
99
|
+
isFetchedAfterMount: boolean;
|
|
100
|
+
isFetching: boolean;
|
|
101
|
+
isInitialLoading: boolean;
|
|
102
|
+
isPaused: boolean;
|
|
103
|
+
isRefetching: boolean;
|
|
104
|
+
isStale: boolean;
|
|
105
|
+
isEnabled: boolean;
|
|
106
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<ExperienceProfileState>, Error>>;
|
|
107
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
108
|
+
promise: Promise<NoInfer<ExperienceProfileState>>;
|
|
109
|
+
data: NoInfer<ExperienceProfileState>;
|
|
110
|
+
isError: false;
|
|
111
|
+
error: null;
|
|
112
|
+
isPending: false;
|
|
113
|
+
isLoading: false;
|
|
114
|
+
isLoadingError: false;
|
|
115
|
+
isRefetchError: false;
|
|
116
|
+
isSuccess: true;
|
|
117
|
+
isPlaceholderData: true;
|
|
118
|
+
status: 'success';
|
|
119
|
+
setProfile: (profile: ExperienceProfile) => Promise<ExperienceProfileState>;
|
|
120
|
+
saving: boolean;
|
|
121
|
+
mutationError: Error | null;
|
|
122
|
+
} | {
|
|
123
|
+
dataUpdatedAt: number;
|
|
124
|
+
errorUpdatedAt: number;
|
|
125
|
+
failureCount: number;
|
|
126
|
+
failureReason: Error | null;
|
|
127
|
+
errorUpdateCount: number;
|
|
128
|
+
isFetched: boolean;
|
|
129
|
+
isFetchedAfterMount: boolean;
|
|
130
|
+
isFetching: boolean;
|
|
131
|
+
isInitialLoading: boolean;
|
|
132
|
+
isPaused: boolean;
|
|
133
|
+
isRefetching: boolean;
|
|
134
|
+
isStale: boolean;
|
|
135
|
+
isEnabled: boolean;
|
|
136
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<ExperienceProfileState>, Error>>;
|
|
137
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
138
|
+
promise: Promise<NoInfer<ExperienceProfileState>>;
|
|
139
|
+
data: NoInfer<ExperienceProfileState>;
|
|
140
|
+
error: Error;
|
|
141
|
+
isError: true;
|
|
142
|
+
isPending: false;
|
|
143
|
+
isLoading: false;
|
|
144
|
+
isLoadingError: false;
|
|
145
|
+
isRefetchError: true;
|
|
146
|
+
isSuccess: false;
|
|
147
|
+
isPlaceholderData: false;
|
|
148
|
+
status: 'error';
|
|
149
|
+
setProfile: (profile: ExperienceProfile) => Promise<ExperienceProfileState>;
|
|
150
|
+
saving: boolean;
|
|
151
|
+
mutationError: Error | null;
|
|
152
|
+
} | {
|
|
153
|
+
dataUpdatedAt: number;
|
|
154
|
+
errorUpdatedAt: number;
|
|
155
|
+
failureCount: number;
|
|
156
|
+
failureReason: Error | null;
|
|
157
|
+
errorUpdateCount: number;
|
|
158
|
+
isFetched: boolean;
|
|
159
|
+
isFetchedAfterMount: boolean;
|
|
160
|
+
isFetching: boolean;
|
|
161
|
+
isInitialLoading: boolean;
|
|
162
|
+
isPaused: boolean;
|
|
163
|
+
isRefetching: boolean;
|
|
164
|
+
isStale: boolean;
|
|
165
|
+
isEnabled: boolean;
|
|
166
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<ExperienceProfileState>, Error>>;
|
|
167
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
168
|
+
promise: Promise<NoInfer<ExperienceProfileState>>;
|
|
169
|
+
data: NoInfer<ExperienceProfileState>;
|
|
170
|
+
error: null;
|
|
171
|
+
isError: false;
|
|
172
|
+
isPending: false;
|
|
173
|
+
isLoading: false;
|
|
174
|
+
isLoadingError: false;
|
|
175
|
+
isRefetchError: false;
|
|
176
|
+
isSuccess: true;
|
|
177
|
+
isPlaceholderData: false;
|
|
178
|
+
status: 'success';
|
|
179
|
+
setProfile: (profile: ExperienceProfile) => Promise<ExperienceProfileState>;
|
|
180
|
+
saving: boolean;
|
|
181
|
+
mutationError: Error | null;
|
|
182
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
import { useActionMutation, useActionQuery } from "./use-action.js";
|
|
3
|
+
export function useExperienceProfile() {
|
|
4
|
+
const query = useActionQuery("get-experience-profile", undefined, { retry: false });
|
|
5
|
+
const mutation = useActionMutation("set-experience-profile");
|
|
6
|
+
const [saving, setSaving] = useState(false);
|
|
7
|
+
const setProfile = useCallback(async (profile) => {
|
|
8
|
+
setSaving(true);
|
|
9
|
+
try {
|
|
10
|
+
const result = await mutation.mutateAsync({ profile });
|
|
11
|
+
await query.refetch({ throwOnError: true });
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
finally {
|
|
15
|
+
setSaving(false);
|
|
16
|
+
}
|
|
17
|
+
}, [mutation.mutateAsync, query.refetch]);
|
|
18
|
+
return { ...query, setProfile, saving, mutationError: mutation.error };
|
|
19
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { uploadEditorImage, type EditorImageUploadFn, type EditorImageUploadResult, } from "./upload-editor-image.js";
|
|
2
2
|
export { useUploadResource } from "./use-upload-resource.js";
|
|
3
|
-
export { useFileUploadStatus } from "./use-file-upload-status.js";
|
|
3
|
+
export { useFileUploadStatus, readFileUploadStatus, } from "./use-file-upload-status.js";
|
|
4
4
|
export { fetchFileUploadStatus } from "../client-status-requests.js";
|
|
5
5
|
export { uploadWorkspacePrivateIcon, workspacePrivateIconLibraryUrl, workspacePrivateIconUrl, } from "./private-icon.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { uploadEditorImage, } from "./upload-editor-image.js";
|
|
2
2
|
export { useUploadResource } from "./use-upload-resource.js";
|
|
3
|
-
export { useFileUploadStatus } from "./use-file-upload-status.js";
|
|
3
|
+
export { useFileUploadStatus, readFileUploadStatus, } from "./use-file-upload-status.js";
|
|
4
4
|
export { fetchFileUploadStatus } from "../client-status-requests.js";
|
|
5
5
|
export { uploadWorkspacePrivateIcon, workspacePrivateIconLibraryUrl, workspacePrivateIconUrl, } from "./private-icon.js";
|
|
@@ -236,6 +236,9 @@ function ensureUiActionCapability(signal) {
|
|
|
236
236
|
cache: "no-store",
|
|
237
237
|
signal: controller?.signal,
|
|
238
238
|
}).then((res) => {
|
|
239
|
+
// The capability is the Set-Cookie header; an unread body keeps the
|
|
240
|
+
// request open and the page never reaches network idle.
|
|
241
|
+
res.body?.cancel().catch(() => { });
|
|
239
242
|
if (!res.ok) {
|
|
240
243
|
throw new Error("Could not establish the browser UI capability.");
|
|
241
244
|
}
|
package/dist/collab/routes.d.ts
CHANGED
|
@@ -25,9 +25,9 @@ export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import
|
|
|
25
25
|
ok: boolean;
|
|
26
26
|
}>>;
|
|
27
27
|
export declare const postCollabText: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
28
|
-
text?: undefined;
|
|
29
28
|
ok?: undefined;
|
|
30
29
|
error: string;
|
|
30
|
+
text?: undefined;
|
|
31
31
|
} | {
|
|
32
32
|
error?: undefined;
|
|
33
33
|
ok: boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FeatureFlagDefinition } from "../feature-flags/registry.js";
|
|
2
|
+
export type ExperienceProfile = "reference" | "agent-native";
|
|
3
|
+
export interface ExperienceDeviation {
|
|
4
|
+
flag: FeatureFlagDefinition;
|
|
5
|
+
enabledInAgentNative: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface ExperienceProfileState {
|
|
8
|
+
profile: ExperienceProfile;
|
|
9
|
+
savedProfile: ExperienceProfile | null;
|
|
10
|
+
referenceAvailable: boolean;
|
|
11
|
+
values: Record<string, boolean>;
|
|
12
|
+
}
|
|
13
|
+
export declare function resolveExperienceFlags(deviations: readonly ExperienceDeviation[], profile: ExperienceProfile): Record<string, boolean>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function resolveExperienceFlags(deviations, profile) {
|
|
2
|
+
const values = {};
|
|
3
|
+
for (const { flag, enabledInAgentNative } of deviations) {
|
|
4
|
+
if (Object.hasOwn(values, flag.key)) {
|
|
5
|
+
throw new Error(`Duplicate experience deviation: ${flag.key}`);
|
|
6
|
+
}
|
|
7
|
+
values[flag.key] = profile === "agent-native" && enabledInAgentNative;
|
|
8
|
+
}
|
|
9
|
+
return values;
|
|
10
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ActionRunContext } from "../action.js";
|
|
2
|
+
import { type ExperienceDeviation } from "./index.js";
|
|
3
|
+
export interface ExperienceProfileOptions {
|
|
4
|
+
appId: string;
|
|
5
|
+
deviations: readonly ExperienceDeviation[];
|
|
6
|
+
canUseReference: (ctx: ActionRunContext) => boolean | Promise<boolean>;
|
|
7
|
+
}
|
|
8
|
+
export declare function createExperienceProfileActions(options: ExperienceProfileOptions): {
|
|
9
|
+
get: import("../action.js").ActionDefinition<Record<string, never>, {
|
|
10
|
+
profile: "agent-native" | "reference";
|
|
11
|
+
savedProfile: "agent-native" | "reference" | null;
|
|
12
|
+
referenceAvailable: boolean;
|
|
13
|
+
values: Record<string, boolean>;
|
|
14
|
+
}>;
|
|
15
|
+
set: import("../action.js").ActionDefinition<{
|
|
16
|
+
profile: "agent-native" | "reference";
|
|
17
|
+
}, {
|
|
18
|
+
profile: "agent-native" | "reference";
|
|
19
|
+
savedProfile: "agent-native" | "reference" | null;
|
|
20
|
+
referenceAvailable: boolean;
|
|
21
|
+
values: Record<string, boolean>;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
24
|
+
export declare function canUseReferenceExperience(ctx: ActionRunContext): boolean;
|
|
25
|
+
export declare function createGetExperienceProfileAction(options: ExperienceProfileOptions): import("../action.js").ActionDefinition<Record<string, never>, {
|
|
26
|
+
profile: "agent-native" | "reference";
|
|
27
|
+
savedProfile: "agent-native" | "reference" | null;
|
|
28
|
+
referenceAvailable: boolean;
|
|
29
|
+
values: Record<string, boolean>;
|
|
30
|
+
}>;
|
|
31
|
+
export declare function createSetExperienceProfileAction(options: ExperienceProfileOptions): import("../action.js").ActionDefinition<{
|
|
32
|
+
profile: "agent-native" | "reference";
|
|
33
|
+
}, {
|
|
34
|
+
profile: "agent-native" | "reference";
|
|
35
|
+
savedProfile: "agent-native" | "reference" | null;
|
|
36
|
+
referenceAvailable: boolean;
|
|
37
|
+
values: Record<string, boolean>;
|
|
38
|
+
}>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineAction, fail } from "../action.js";
|
|
3
|
+
import { getAppConfig } from "../app-config/index.js";
|
|
4
|
+
import { getUserSetting, putUserSetting } from "../settings/user-settings.js";
|
|
5
|
+
import { resolveExperienceFlags } from "./index.js";
|
|
6
|
+
const profileSchema = z.enum(["reference", "agent-native"]);
|
|
7
|
+
const preferenceSchema = z.object({ profile: profileSchema });
|
|
8
|
+
const stateSchema = z.object({
|
|
9
|
+
profile: profileSchema,
|
|
10
|
+
savedProfile: profileSchema.nullable(),
|
|
11
|
+
referenceAvailable: z.boolean(),
|
|
12
|
+
values: z.record(z.string(), z.boolean()),
|
|
13
|
+
});
|
|
14
|
+
export function createExperienceProfileActions(options) {
|
|
15
|
+
if (!/^[a-zA-Z][a-zA-Z0-9._-]{0,63}$/.test(options.appId)) {
|
|
16
|
+
throw new Error("Experience profiles require a stable app id.");
|
|
17
|
+
}
|
|
18
|
+
resolveExperienceFlags(options.deviations, "reference");
|
|
19
|
+
const key = `experience-profile:${options.appId}`;
|
|
20
|
+
async function read(ctx) {
|
|
21
|
+
if (!ctx?.userEmail)
|
|
22
|
+
fail("Sign in to select an experience.", { statusCode: 401 });
|
|
23
|
+
const email = ctx.userEmail;
|
|
24
|
+
const referenceAvailable = await options.canUseReference(ctx);
|
|
25
|
+
const stored = await getUserSetting(email, key, { bypassCache: true });
|
|
26
|
+
const preference = stored === null ? null : preferenceSchema.parse(stored);
|
|
27
|
+
const savedProfile = preference?.profile ?? null;
|
|
28
|
+
// A saved choice is not a permission grant. Revocation takes effect on every read.
|
|
29
|
+
const profile = savedProfile === "reference" && referenceAvailable
|
|
30
|
+
? "reference"
|
|
31
|
+
: "agent-native";
|
|
32
|
+
return {
|
|
33
|
+
profile,
|
|
34
|
+
savedProfile,
|
|
35
|
+
referenceAvailable,
|
|
36
|
+
values: resolveExperienceFlags(options.deviations, profile),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
get: defineAction({
|
|
41
|
+
description: "Read the current user's experience profile and effective deviation flags. Reference access is checked on the server; no saved choice defaults to Agent-Native.",
|
|
42
|
+
schema: z.object({}),
|
|
43
|
+
outputSchema: stateSchema,
|
|
44
|
+
http: { method: "GET" },
|
|
45
|
+
run: async (_args, ctx) => read(ctx),
|
|
46
|
+
}),
|
|
47
|
+
set: defineAction({
|
|
48
|
+
description: "Save the current user's experience profile without changing navigation, selection, or app records. Reference requires current server authorization.",
|
|
49
|
+
schema: preferenceSchema,
|
|
50
|
+
outputSchema: stateSchema,
|
|
51
|
+
run: async ({ profile }, ctx) => {
|
|
52
|
+
if (!ctx?.userEmail)
|
|
53
|
+
fail("Sign in to select an experience.", { statusCode: 401 });
|
|
54
|
+
if (profile === "reference" && !(await options.canUseReference(ctx))) {
|
|
55
|
+
fail("Reference experience is restricted to authorized reviewers.", {
|
|
56
|
+
statusCode: 403,
|
|
57
|
+
errorCode: "reference_forbidden",
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
await putUserSetting(ctx.userEmail, key, { profile });
|
|
61
|
+
return read(ctx);
|
|
62
|
+
},
|
|
63
|
+
}),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export function canUseReferenceExperience(ctx) {
|
|
67
|
+
const email = ctx.userEmail?.trim().toLowerCase();
|
|
68
|
+
return (email !== undefined &&
|
|
69
|
+
getAppConfig().experienceProfiles.referenceEmails.some((reviewer) => reviewer.trim().toLowerCase() === email));
|
|
70
|
+
}
|
|
71
|
+
export function createGetExperienceProfileAction(options) {
|
|
72
|
+
return createExperienceProfileActions(options).get;
|
|
73
|
+
}
|
|
74
|
+
export function createSetExperienceProfileAction(options) {
|
|
75
|
+
return createExperienceProfileActions(options).set;
|
|
76
|
+
}
|
|
@@ -39,10 +39,10 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
39
39
|
url?: undefined;
|
|
40
40
|
configured?: undefined;
|
|
41
41
|
} | {
|
|
42
|
-
error?: undefined;
|
|
43
42
|
url: string;
|
|
44
43
|
id: string | undefined;
|
|
45
44
|
provider: string;
|
|
45
|
+
error?: undefined;
|
|
46
46
|
configured?: undefined;
|
|
47
47
|
} | {
|
|
48
48
|
id?: undefined;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@agent-native/agentkit": "0.
|
|
2
|
+
"@agent-native/agentkit": "0.226.0-nightly-20261106182619",
|
|
3
3
|
"@agent-native/code-agents-ui": "0.1.75",
|
|
4
|
-
"@agent-native/core": "0.
|
|
5
|
-
"@agent-native/core-corpus": "0.
|
|
4
|
+
"@agent-native/core": "0.226.0-nightly-20261106182619",
|
|
5
|
+
"@agent-native/core-corpus": "0.226.0-nightly-20261106182619",
|
|
6
6
|
"@agent-native/creative-context": "0.8.67",
|
|
7
|
-
"@agent-native/dispatch": "0.42.
|
|
7
|
+
"@agent-native/dispatch": "0.42.3-nightly-20261106182619",
|
|
8
8
|
"@agent-native/embedding": "0.2.0",
|
|
9
9
|
"@agent-native/migrate": "0.0.7",
|
|
10
10
|
"@agent-native/otel": "0.1.34",
|
|
11
11
|
"@agent-native/pinpoint": "0.1.110",
|
|
12
12
|
"@agent-native/recap-cli": "0.5.98",
|
|
13
|
-
"@agent-native/scheduling": "0.2.
|
|
13
|
+
"@agent-native/scheduling": "0.2.55-nightly-20261106182619",
|
|
14
14
|
"@agent-native/shared-app-config": "0.1.2",
|
|
15
|
-
"@agent-native/skills": "0.4.
|
|
16
|
-
"@agent-native/toolkit": "0.
|
|
15
|
+
"@agent-native/skills": "0.4.3-nightly-20261106182619",
|
|
16
|
+
"@agent-native/toolkit": "0.226.0-nightly-20261106182619"
|
|
17
17
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function workspaceIntegrationMessagesForUser(userEmail: string): Promise<{
|
|
2
|
+
limit: string;
|
|
3
|
+
invalid: string;
|
|
4
|
+
unavailable: string;
|
|
5
|
+
referenceUnknown: string;
|
|
6
|
+
referenceSignIn: string;
|
|
7
|
+
referenceUnavailable: string;
|
|
8
|
+
composerReferenceAuthentication: string;
|
|
9
|
+
composerReferenceInvalid: string;
|
|
10
|
+
composerReferenceUnavailable: string;
|
|
11
|
+
}>;
|