@agent-native/core 0.161.23 → 0.162.0
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/corpus/README.md +1 -1
- package/corpus/templates/analytics/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +18 -2
- package/corpus/templates/assets/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/brain/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/calendar/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/calendar/server/handlers/google-auth.ts +1 -8
- package/corpus/templates/chat/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/clips/app/components/recorder/pre-record-panel.tsx +88 -35
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +36 -1
- package/corpus/templates/clips/app/i18n/en-US.ts +4 -3
- package/corpus/templates/clips/desktop/src/app.tsx +30 -40
- package/corpus/templates/clips/desktop/src/components/MicOffConfirmation.tsx +47 -0
- package/corpus/templates/clips/desktop/src/styles.css +110 -0
- package/corpus/templates/clips/desktop/src-tauri/src/whisper_speech.rs +114 -7
- package/corpus/templates/clips/shared/recording-capture.ts +18 -13
- package/corpus/templates/content/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +3 -5
- package/corpus/templates/content/app/components/editor/DocumentToolbar.tsx +0 -3
- package/corpus/templates/content/app/components/editor/NotionConflictBanner.tsx +0 -4
- package/corpus/templates/content/app/components/editor/NotionSyncBar.tsx +4 -1
- package/corpus/templates/content/app/hooks/use-notion.ts +17 -15
- package/corpus/templates/crm/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/design/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/dispatch/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/factory/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/forms/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/macros/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/mail/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +18 -3
- package/corpus/templates/mail/server/handlers/google-auth.ts +1 -8
- package/corpus/templates/plan/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/slides/.agents/skills/create-deck/SKILL.md +4 -0
- package/corpus/templates/slides/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/slides/actions/_await-fit-check.ts +30 -5
- package/corpus/templates/slides/actions/add-slide.ts +6 -2
- package/corpus/templates/slides/actions/create-deck.ts +2 -1
- package/corpus/templates/slides/app/lib/create-deck-generation.ts +1 -0
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +34 -1
- package/corpus/templates/slides/app/routes/p.$id.tsx +3 -1
- package/corpus/templates/slides/changelog/2026-08-18-generated-slides-preserve-speaker-notes.md +6 -0
- package/corpus/templates/slides/server/handlers/assets.ts +23 -12
- package/corpus/templates/slides/server/handlers/design-system-decode-job-status.ts +15 -6
- package/corpus/templates/slides/server/handlers/design-system-upload-start.ts +15 -6
- package/corpus/templates/slides/server/handlers/index-design-system-sources.ts +34 -19
- package/corpus/templates/slides/server/handlers/share.ts +1 -1
- package/corpus/templates/slides/server/plugins/agent-chat.ts +1 -1
- package/corpus/templates/slides/server/routes/api/deck-agent-context.json.get.ts +1 -1
- package/corpus/templates/slides/server/routes/api/exports/[filename].get.ts +9 -3
- package/corpus/templates/slides/server/routes/api/exports/google-slides.post.ts +12 -5
- package/corpus/templates/slides/server/routes/api/exports/html.post.ts +9 -7
- package/corpus/templates/slides/server/routes/api/exports/pptx.post.ts +9 -7
- package/corpus/templates/slides/shared/api.ts +7 -1
- package/corpus/templates/tasks/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/dist/agent/engine/translate-anthropic.js +27 -2
- package/dist/agent/production-agent.d.ts +2 -2
- package/dist/agent/production-agent.js +16 -8
- package/dist/agent/thread-data-builder.d.ts +1 -0
- package/dist/agent/thread-data-builder.js +6 -4
- package/dist/agent/tool-approval-store.d.ts +10 -1
- package/dist/agent/tool-approval-store.js +19 -2
- package/dist/agent/types.d.ts +9 -0
- package/dist/client/AssistantChat.js +14 -6
- package/dist/client/EnvironmentBadge.d.ts +15 -0
- package/dist/client/EnvironmentBadge.js +79 -0
- package/dist/client/MultiTabAssistantChat.js +73 -17
- package/dist/client/agent-chat-adapter.js +11 -1
- package/dist/client/api-path.js +14 -1
- package/dist/client/app-providers.js +2 -1
- package/dist/client/chat/tool-call-display.d.ts +12 -2
- package/dist/client/chat/tool-call-display.js +17 -7
- package/dist/client/chat/widgets/WorkspaceFileWidget.js +1 -1
- package/dist/client/chat/widgets/builtin-tool-renderers.d.ts +6 -0
- package/dist/client/chat/widgets/builtin-tool-renderers.js +19 -0
- package/dist/client/onboarding/FirstRunOnboarding.js +46 -32
- package/dist/client/onboarding/use-onboarding.d.ts +8 -1
- package/dist/client/onboarding/use-onboarding.js +22 -7
- package/dist/client/session-replay.js +58 -15
- package/dist/client/settings/SettingsTabsPage.js +19 -6
- package/dist/client/sse-event-processor.d.ts +7 -0
- package/dist/client/sse-event-processor.js +4 -1
- package/dist/client/ui/index.d.ts +1 -0
- package/dist/client/ui/index.js +1 -0
- package/dist/client/use-action.js +26 -0
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/config.d.ts +15 -0
- package/dist/config.js +53 -0
- package/dist/extensions/fetch-tool.js +8 -2
- package/dist/mcp/embed-app.js +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +13 -13
- package/dist/provider-api/actions/provider-api.d.ts +11 -11
- package/dist/provider-api/index.d.ts +10 -0
- package/dist/provider-api/index.js +45 -9
- package/dist/server/auth.js +10 -3
- package/dist/server/poll.js +7 -3
- package/dist/server/sentry.d.ts +1 -1
- package/dist/templates/chat/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/dist/templates/default/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/dist/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/dist/vite/client.d.ts +5 -0
- package/dist/vite/client.js +64 -2
- package/dist/workspace-files/actions.d.ts +1 -8
- package/dist/workspace-files/actions.js +5 -21
- package/dist/workspace-files/index.d.ts +1 -1
- package/dist/workspace-files/index.js +1 -1
- package/dist/workspace-files/store.d.ts +18 -0
- package/dist/workspace-files/store.js +24 -3
- package/package.json +3 -3
- package/src/templates/chat/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/src/templates/default/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/src/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +1 -1
package/dist/vite/client.js
CHANGED
|
@@ -7,7 +7,7 @@ import { renderDesignSystemThemeCss, } from "@agent-native/toolkit/design-system
|
|
|
7
7
|
import { loadEnv, } from "vite";
|
|
8
8
|
import { mergePendingChangelog, parsePendingEntry, } from "../changelog/parse.js";
|
|
9
9
|
import { getViteDevRecoveryScript } from "../client/vite-dev-recovery-script.js";
|
|
10
|
-
import { mergeAgentNativeConfigs, resolveAgentNativeConfig, } from "../config.js";
|
|
10
|
+
import { inferAgentNativeDeploymentEnvironment, mergeAgentNativeConfigs, resolveAgentNativeConfig, } from "../config.js";
|
|
11
11
|
import { writeAgentNativeNitroPresetMarker } from "../deploy/nitro-preset.js";
|
|
12
12
|
import { findWorkspaceRoot } from "../scripts/utils.js";
|
|
13
13
|
import { verifyEmbedSessionToken } from "../server/embed-session.js";
|
|
@@ -1432,6 +1432,41 @@ function baseRedirectGuard() {
|
|
|
1432
1432
|
},
|
|
1433
1433
|
};
|
|
1434
1434
|
}
|
|
1435
|
+
/**
|
|
1436
|
+
* Force Nitro's dev middleware to treat extension-bearing framework endpoints
|
|
1437
|
+
* as dynamic so they reach the h3 server instead of Vite's static pipeline.
|
|
1438
|
+
*
|
|
1439
|
+
* Nitro's Vite dev middleware routes paths with asset-like extensions through
|
|
1440
|
+
* Vite unless a Nitro route matches them. Framework endpoints are registered
|
|
1441
|
+
* as h3 middleware, so mounted `/_agent-native/*` and `/.well-known/*` paths
|
|
1442
|
+
* can otherwise become dev-only 404s before reaching the framework handler.
|
|
1443
|
+
*/
|
|
1444
|
+
function frameworkDevDynamicForwarder() {
|
|
1445
|
+
return {
|
|
1446
|
+
name: "agent-native-framework-dev-dynamic-forwarder",
|
|
1447
|
+
apply: "serve",
|
|
1448
|
+
configureServer(server) {
|
|
1449
|
+
server.middlewares.use((req, _res, next) => {
|
|
1450
|
+
const url = req.url;
|
|
1451
|
+
if (url && isFrameworkDynamicDevPath(url, server.config.base)) {
|
|
1452
|
+
const accept = req.headers["accept"];
|
|
1453
|
+
if (typeof accept !== "string" || !/\btext\/html\b/.test(accept)) {
|
|
1454
|
+
req.headers["accept"] = accept
|
|
1455
|
+
? `text/html,${accept}`
|
|
1456
|
+
: "text/html";
|
|
1457
|
+
}
|
|
1458
|
+
// Embed-start uses document/iframe to select its transplant response.
|
|
1459
|
+
// Only supply the classifier hint when the browser did not provide a
|
|
1460
|
+
// destination; never overwrite the request's original intent.
|
|
1461
|
+
if (req.headers["sec-fetch-dest"] === undefined) {
|
|
1462
|
+
req.headers["sec-fetch-dest"] = "empty";
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
next();
|
|
1466
|
+
});
|
|
1467
|
+
},
|
|
1468
|
+
};
|
|
1469
|
+
}
|
|
1435
1470
|
const VITE_RUNTIME_PATH_PREFIXES = [
|
|
1436
1471
|
"/@fs/",
|
|
1437
1472
|
"/@id/",
|
|
@@ -1872,6 +1907,23 @@ export function isFrameworkDevPath(reqUrl, base) {
|
|
|
1872
1907
|
return (pathname === `${normalizedBase}/_agent-native` ||
|
|
1873
1908
|
pathname.startsWith(`${normalizedBase}/_agent-native/`));
|
|
1874
1909
|
}
|
|
1910
|
+
/**
|
|
1911
|
+
* Framework-owned dynamic dev paths whose responses are served by the h3 app:
|
|
1912
|
+
* the `/_agent-native/*` API surface plus framework `/.well-known/*` documents.
|
|
1913
|
+
*/
|
|
1914
|
+
export function isFrameworkDynamicDevPath(reqUrl, base) {
|
|
1915
|
+
if (isFrameworkDevPath(reqUrl, base))
|
|
1916
|
+
return true;
|
|
1917
|
+
const pathname = devPathname(reqUrl);
|
|
1918
|
+
if (pathname.startsWith("/.well-known/"))
|
|
1919
|
+
return true;
|
|
1920
|
+
if (base && base !== "/") {
|
|
1921
|
+
const normalizedBase = base.endsWith("/") ? base.slice(0, -1) : base;
|
|
1922
|
+
if (pathname.startsWith(`${normalizedBase}/.well-known/`))
|
|
1923
|
+
return true;
|
|
1924
|
+
}
|
|
1925
|
+
return false;
|
|
1926
|
+
}
|
|
1875
1927
|
/**
|
|
1876
1928
|
* Work around a Rolldown bug where Nitro passes service entries as objects
|
|
1877
1929
|
* ({index: "path"}) but Rolldown expects strings. This plugin normalizes
|
|
@@ -2679,6 +2731,7 @@ function createAgentNativePlugins(options, { command, includeReactTransform, use
|
|
|
2679
2731
|
fullReloadOnOptimizeDep504(),
|
|
2680
2732
|
embedDevFrameHeaders(),
|
|
2681
2733
|
baseRedirectGuard(),
|
|
2734
|
+
frameworkDevDynamicForwarder(),
|
|
2682
2735
|
portExposer(),
|
|
2683
2736
|
nitroStartupGate(),
|
|
2684
2737
|
reactRouterVirtualInvalidationMirrorPlugin(),
|
|
@@ -2755,6 +2808,15 @@ function createAgentNativeConfig(options = {}, command, userConfig = {}, mode =
|
|
|
2755
2808
|
const appConfig = resolveAgentNativeConfig(mergeAgentNativeConfigs(readAgentNativeJsonConfig(cwd), projectConfigInput
|
|
2756
2809
|
? resolveAgentNativeConfig(projectConfigInput, configContext)
|
|
2757
2810
|
: {}), configContext);
|
|
2811
|
+
const inferredDeploymentEnvironment = appConfig.deployment?.environment ??
|
|
2812
|
+
inferAgentNativeDeploymentEnvironment(process.env, mode);
|
|
2813
|
+
const resolvedAppConfig = appConfig.deployment?.environment === undefined &&
|
|
2814
|
+
inferredDeploymentEnvironment !== undefined
|
|
2815
|
+
? {
|
|
2816
|
+
...appConfig,
|
|
2817
|
+
deployment: { environment: inferredDeploymentEnvironment },
|
|
2818
|
+
}
|
|
2819
|
+
: appConfig;
|
|
2758
2820
|
const buildId = process.env.DEPLOY_ID?.trim() ||
|
|
2759
2821
|
process.env.COMMIT_REF?.trim() ||
|
|
2760
2822
|
process.env.VERCEL_GIT_COMMIT_SHA?.trim() ||
|
|
@@ -2844,7 +2906,7 @@ function createAgentNativeConfig(options = {}, command, userConfig = {}, mode =
|
|
|
2844
2906
|
...(options.define ?? {}),
|
|
2845
2907
|
__AGENT_NATIVE_BUILD_ID__: JSON.stringify(buildId),
|
|
2846
2908
|
__AGENT_NATIVE_CLIENT_COMPATIBILITY_VERSION__: JSON.stringify(options.clientCompatibilityVersion?.trim() || ""),
|
|
2847
|
-
__AGENT_NATIVE_APP_CONFIG__: JSON.stringify(
|
|
2909
|
+
__AGENT_NATIVE_APP_CONFIG__: JSON.stringify(resolvedAppConfig),
|
|
2848
2910
|
__AGENT_NATIVE_BUILD_GA_MEASUREMENT_ID__: JSON.stringify(process.env.GA_MEASUREMENT_ID?.trim() || ""),
|
|
2849
2911
|
"process.env.AGENT_NATIVE_BUILD_GA_MEASUREMENT_ID": JSON.stringify(process.env.GA_MEASUREMENT_ID?.trim() || ""),
|
|
2850
2912
|
// The release migration owner is configured at build time. Netlify's
|
|
@@ -14,14 +14,7 @@ export type WorkspaceFileActionResult = z.infer<typeof workspaceFileResultSchema
|
|
|
14
14
|
export declare const showWorkspaceFileAction: import("../action.js").ActionDefinition<{
|
|
15
15
|
path: string;
|
|
16
16
|
}, {
|
|
17
|
-
file:
|
|
18
|
-
resourceId: string;
|
|
19
|
-
path: string;
|
|
20
|
-
name: string;
|
|
21
|
-
contentType: string;
|
|
22
|
-
sizeBytes: number;
|
|
23
|
-
updatedAt: string;
|
|
24
|
-
};
|
|
17
|
+
file: import("./store.js").WorkspaceFileCard;
|
|
25
18
|
}>;
|
|
26
19
|
export declare function createWorkspaceFileActionEntries(): Record<string, ActionEntry>;
|
|
27
20
|
export {};
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { ACTION_CHAT_UI_WORKSPACE_FILE_RENDERER } from "../action-ui.js";
|
|
3
3
|
import { defineAction } from "../action.js";
|
|
4
4
|
import { getRequestOrgId, getRequestUserEmail, } from "../server/request-context.js";
|
|
5
|
-
import { getWorkspaceFileMeta } from "./store.js";
|
|
5
|
+
import { getWorkspaceFileMeta, toWorkspaceFileCard, } from "./store.js";
|
|
6
6
|
const workspaceFileResultSchema = z.object({
|
|
7
7
|
file: z.object({
|
|
8
8
|
resourceId: z.string().min(1),
|
|
@@ -22,13 +22,6 @@ function currentWorkspaceScope() {
|
|
|
22
22
|
return { scope: "user", scopeId: userEmail };
|
|
23
23
|
throw new Error("show-workspace-file requires an authenticated request context.");
|
|
24
24
|
}
|
|
25
|
-
function fileName(path) {
|
|
26
|
-
return path.split("/").at(-1) || path;
|
|
27
|
-
}
|
|
28
|
-
function isTextWorkspaceFile(contentType) {
|
|
29
|
-
const mimeType = contentType.split(";")[0].trim().toLowerCase();
|
|
30
|
-
return mimeType.startsWith("text/") || mimeType === "application/json";
|
|
31
|
-
}
|
|
32
25
|
export const showWorkspaceFileAction = defineAction({
|
|
33
26
|
description: "Render a workspace file as a downloadable card in chat. Call this after writing a user-requested export or other durable file with workspaceWrite; a file export is not complete until this action succeeds and the download card appears. The path must exactly match an existing file in the current organization or personal workspace.",
|
|
34
27
|
schema: z.object({
|
|
@@ -52,19 +45,10 @@ export const showWorkspaceFileAction = defineAction({
|
|
|
52
45
|
if (!file) {
|
|
53
46
|
throw new Error(`Workspace file not found: "${path}"`);
|
|
54
47
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
file: {
|
|
60
|
-
resourceId: file.id,
|
|
61
|
-
path: file.path,
|
|
62
|
-
name: fileName(file.path),
|
|
63
|
-
contentType: file.contentType,
|
|
64
|
-
sizeBytes: file.sizeBytes,
|
|
65
|
-
updatedAt: file.updatedAt,
|
|
66
|
-
},
|
|
67
|
-
};
|
|
48
|
+
// The card only ever renders name/size/type + a download link — it never
|
|
49
|
+
// inlines file content — so every content type, binary included, is safe
|
|
50
|
+
// to show here.
|
|
51
|
+
return { file: toWorkspaceFileCard(file) };
|
|
68
52
|
},
|
|
69
53
|
});
|
|
70
54
|
export function createWorkspaceFileActionEntries() {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { writeWorkspaceFile, appendWorkspaceFile, readWorkspaceFile, getWorkspaceFileMeta, listWorkspaceFiles, deleteWorkspaceFile, grepWorkspaceFiles, validatePath, MAX_FILE_BYTES, MAX_SCOPE_BYTES, SAVE_TO_FILE_MAX_BYTES, type WorkspaceFilesScope, type WorkspaceFile, type WorkspaceFileMeta, } from "./store.js";
|
|
1
|
+
export { writeWorkspaceFile, appendWorkspaceFile, readWorkspaceFile, getWorkspaceFileMeta, listWorkspaceFiles, deleteWorkspaceFile, grepWorkspaceFiles, validatePath, isScratchWorkspacePath, fileNameFromPath, toWorkspaceFileCard, MAX_FILE_BYTES, MAX_SCOPE_BYTES, SAVE_TO_FILE_MAX_BYTES, type WorkspaceFilesScope, type WorkspaceFile, type WorkspaceFileMeta, type WorkspaceFileCard, } from "./store.js";
|
|
2
2
|
export { createWorkspaceFilesTool } from "./tool.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { writeWorkspaceFile, appendWorkspaceFile, readWorkspaceFile, getWorkspaceFileMeta, listWorkspaceFiles, deleteWorkspaceFile, grepWorkspaceFiles, validatePath, MAX_FILE_BYTES, MAX_SCOPE_BYTES, SAVE_TO_FILE_MAX_BYTES, } from "./store.js";
|
|
1
|
+
export { writeWorkspaceFile, appendWorkspaceFile, readWorkspaceFile, getWorkspaceFileMeta, listWorkspaceFiles, deleteWorkspaceFile, grepWorkspaceFiles, validatePath, isScratchWorkspacePath, fileNameFromPath, toWorkspaceFileCard, MAX_FILE_BYTES, MAX_SCOPE_BYTES, SAVE_TO_FILE_MAX_BYTES, } from "./store.js";
|
|
2
2
|
export { createWorkspaceFilesTool } from "./tool.js";
|
|
@@ -20,6 +20,8 @@ export interface WorkspaceFilesScope {
|
|
|
20
20
|
scope: "user" | "org";
|
|
21
21
|
scopeId: string;
|
|
22
22
|
}
|
|
23
|
+
/** True for `scratch/...` paths — hidden agent staging, never durable. */
|
|
24
|
+
export declare function isScratchWorkspacePath(path: string): boolean;
|
|
23
25
|
/**
|
|
24
26
|
* Validate a workspace file path.
|
|
25
27
|
* - Non-empty, no leading slash, no ".." components, no null bytes.
|
|
@@ -44,6 +46,22 @@ export interface WorkspaceFileMeta {
|
|
|
44
46
|
createdAt: string;
|
|
45
47
|
updatedAt: string;
|
|
46
48
|
}
|
|
49
|
+
/** Display name for a workspace path — the last path segment. */
|
|
50
|
+
export declare function fileNameFromPath(path: string): string;
|
|
51
|
+
export interface WorkspaceFileCard {
|
|
52
|
+
resourceId: string;
|
|
53
|
+
path: string;
|
|
54
|
+
name: string;
|
|
55
|
+
contentType: string;
|
|
56
|
+
sizeBytes: number;
|
|
57
|
+
updatedAt: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Shape any workspace-file creator can spread into its own tool result as
|
|
61
|
+
* `{ file: toWorkspaceFileCard(meta) }` to get a download card in chat —
|
|
62
|
+
* the chat renderer matches on this shape alone, no per-caller wiring needed.
|
|
63
|
+
*/
|
|
64
|
+
export declare function toWorkspaceFileCard(meta: WorkspaceFileMeta): WorkspaceFileCard;
|
|
47
65
|
/**
|
|
48
66
|
* Write (create or overwrite) a workspace file.
|
|
49
67
|
* Enforces per-file limits for the compatibility API; persistence is handled by
|
|
@@ -23,10 +23,12 @@ export const SAVE_TO_FILE_MAX_BYTES = 20 * 1024 * 1024; // 20 MB
|
|
|
23
23
|
function ownerForScope(scope) {
|
|
24
24
|
return scope.scope === "org" ? SHARED_OWNER : scope.scopeId;
|
|
25
25
|
}
|
|
26
|
+
/** True for `scratch/...` paths — hidden agent staging, never durable. */
|
|
27
|
+
export function isScratchWorkspacePath(path) {
|
|
28
|
+
return path === "scratch" || path.startsWith("scratch/");
|
|
29
|
+
}
|
|
26
30
|
function visibilityForPath(path) {
|
|
27
|
-
return path
|
|
28
|
-
? "agent_scratch"
|
|
29
|
-
: "workspace";
|
|
31
|
+
return isScratchWorkspacePath(path) ? "agent_scratch" : "workspace";
|
|
30
32
|
}
|
|
31
33
|
function workspaceFileMetadata(scope) {
|
|
32
34
|
return {
|
|
@@ -55,6 +57,25 @@ export function validatePath(path) {
|
|
|
55
57
|
}
|
|
56
58
|
return null;
|
|
57
59
|
}
|
|
60
|
+
/** Display name for a workspace path — the last path segment. */
|
|
61
|
+
export function fileNameFromPath(path) {
|
|
62
|
+
return path.split("/").at(-1) || path;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Shape any workspace-file creator can spread into its own tool result as
|
|
66
|
+
* `{ file: toWorkspaceFileCard(meta) }` to get a download card in chat —
|
|
67
|
+
* the chat renderer matches on this shape alone, no per-caller wiring needed.
|
|
68
|
+
*/
|
|
69
|
+
export function toWorkspaceFileCard(meta) {
|
|
70
|
+
return {
|
|
71
|
+
resourceId: meta.id,
|
|
72
|
+
path: meta.path,
|
|
73
|
+
name: fileNameFromPath(meta.path),
|
|
74
|
+
contentType: meta.contentType,
|
|
75
|
+
sizeBytes: meta.sizeBytes,
|
|
76
|
+
updatedAt: meta.updatedAt,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
58
79
|
// ---------------------------------------------------------------------------
|
|
59
80
|
// Store operations
|
|
60
81
|
// ---------------------------------------------------------------------------
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.162.0",
|
|
4
4
|
"description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -427,8 +427,8 @@
|
|
|
427
427
|
"y-protocols": "^1.0.7",
|
|
428
428
|
"yjs": "^13.6.32",
|
|
429
429
|
"zod": "^4.3.6",
|
|
430
|
-
"@agent-native/recap-cli": "0.5.
|
|
431
|
-
"@agent-native/toolkit": "^0.16.
|
|
430
|
+
"@agent-native/recap-cli": "0.5.5",
|
|
431
|
+
"@agent-native/toolkit": "^0.16.5"
|
|
432
432
|
},
|
|
433
433
|
"devDependencies": {
|
|
434
434
|
"@ai-sdk/anthropic": "^3.0.71",
|
|
@@ -50,7 +50,7 @@ The agent modifies data in SQL, but the UI runs in the browser. SSE bridges same
|
|
|
50
50
|
|
|
51
51
|
For list/sidebar queries, use the same pattern — pass the counter into the queryKey of every list query you want to keep fresh.
|
|
52
52
|
|
|
53
|
-
4. **Fallback** polling calls `/_agent-native/poll?since=N`. It
|
|
53
|
+
4. **Fallback** polling calls `/_agent-native/poll?since=N`. It polls every 2 seconds only while an agent run is in flight; otherwise it idles at 60 seconds whether or not SSE is connected (`SSE_FALLBACK_INTERVAL_MS` and `IDLE_POLL_INTERVAL_MS`, both 60 s). A hidden tab polls no faster than every 10 seconds (`HIDDEN_POLL_INTERVAL_MS`). Polling is the universal serverless fallback: new framework writes are read from the durable `sync_events` log, while the older DB timestamp scan remains as a slower safety net for direct SQL writes and older processes.
|
|
54
54
|
|
|
55
55
|
5. When the agent writes to the database, the version increments, SSE/polling detects it, and React Query refetches the affected queries.
|
|
56
56
|
|
|
@@ -50,7 +50,7 @@ The agent modifies data in SQL, but the UI runs in the browser. SSE bridges same
|
|
|
50
50
|
|
|
51
51
|
For list/sidebar queries, use the same pattern — pass the counter into the queryKey of every list query you want to keep fresh.
|
|
52
52
|
|
|
53
|
-
4. **Fallback** polling calls `/_agent-native/poll?since=N`. It
|
|
53
|
+
4. **Fallback** polling calls `/_agent-native/poll?since=N`. It polls every 2 seconds only while an agent run is in flight; otherwise it idles at 60 seconds whether or not SSE is connected (`SSE_FALLBACK_INTERVAL_MS` and `IDLE_POLL_INTERVAL_MS`, both 60 s). A hidden tab polls no faster than every 10 seconds (`HIDDEN_POLL_INTERVAL_MS`). Polling is the universal serverless fallback: new framework writes are read from the durable `sync_events` log, while the older DB timestamp scan remains as a slower safety net for direct SQL writes and older processes.
|
|
54
54
|
|
|
55
55
|
5. When the agent writes to the database, the version increments, SSE/polling detects it, and React Query refetches the affected queries.
|
|
56
56
|
|
|
@@ -50,7 +50,7 @@ The agent modifies data in SQL, but the UI runs in the browser. SSE bridges same
|
|
|
50
50
|
|
|
51
51
|
For list/sidebar queries, use the same pattern — pass the counter into the queryKey of every list query you want to keep fresh.
|
|
52
52
|
|
|
53
|
-
4. **Fallback** polling calls `/_agent-native/poll?since=N`. It
|
|
53
|
+
4. **Fallback** polling calls `/_agent-native/poll?since=N`. It polls every 2 seconds only while an agent run is in flight; otherwise it idles at 60 seconds whether or not SSE is connected (`SSE_FALLBACK_INTERVAL_MS` and `IDLE_POLL_INTERVAL_MS`, both 60 s). A hidden tab polls no faster than every 10 seconds (`HIDDEN_POLL_INTERVAL_MS`). Polling is the universal serverless fallback: new framework writes are read from the durable `sync_events` log, while the older DB timestamp scan remains as a slower safety net for direct SQL writes and older processes.
|
|
54
54
|
|
|
55
55
|
5. When the agent writes to the database, the version increments, SSE/polling detects it, and React Query refetches the affected queries.
|
|
56
56
|
|