@agent-native/core 0.209.2 → 0.209.3-nightly-20261016212700
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-claims.js +5 -5
- package/dist/agent/context-xray/plugin.js +2 -6
- package/dist/agent/context-xray/schema-store.d.ts +1 -0
- package/dist/agent/context-xray/schema-store.js +7 -0
- package/dist/agent/harness/store.js +3 -0
- package/dist/agent/observational-memory/plugin.js +2 -6
- package/dist/agent/observational-memory/store.js +3 -0
- package/dist/agent/run-store.js +3 -0
- package/dist/agent/tool-approval-store.js +4 -0
- package/dist/automation/index.d.ts +1 -1
- package/dist/chat-threads/store.js +3 -0
- package/dist/client/action-query-cache-context.d.ts +1 -0
- package/dist/client/action-query-cache-context.js +2 -0
- package/dist/client/action-query-cache.d.ts +1 -1
- package/dist/client/action-query-cache.js +34 -15
- package/dist/client/motion-text.css +8 -0
- package/dist/client/motion-text.d.ts +6 -0
- package/dist/client/motion-text.js +154 -29
- package/dist/client/use-action.js +18 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/db/migrations.d.ts +1 -0
- package/dist/db/migrations.js +1 -1
- package/dist/db/runtime-facts.d.ts +7 -0
- package/dist/db/runtime-facts.js +18 -0
- package/dist/db/schema-catalog.js +4 -1
- package/dist/db/store-ledger.test-helpers.d.ts +5 -0
- package/dist/db/store-ledger.test-helpers.js +19 -0
- package/dist/db/store-registry.d.ts +34 -0
- package/dist/db/store-registry.generated.js +13 -0
- package/dist/db/store-registry.js +288 -46
- package/dist/db/versioned-store-migrations.d.ts +14 -0
- package/dist/db/versioned-store-migrations.js +37 -0
- package/dist/db/widen-columns.js +5 -2
- package/dist/extensions/html-shell.js +67 -0
- package/dist/integrations/remote-devices-store.js +3 -0
- package/dist/jobs/run-history.d.ts +3 -2
- package/dist/jobs/run-history.js +5 -5
- package/dist/jobs/scheduler-health.d.ts +3 -2
- package/dist/jobs/scheduler-health.js +5 -5
- package/dist/mcp/build-server.d.ts +3 -0
- package/dist/mcp/build-server.js +24 -7
- package/dist/mcp/server.js +40 -9
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/oauth-tokens/store.js +3 -0
- package/dist/observability/routes.d.ts +4 -4
- package/dist/observability/store.js +4 -0
- package/dist/org/auto-join-domain.js +23 -15
- package/dist/org/context.d.ts +12 -0
- package/dist/org/context.js +27 -19
- package/dist/org/handlers.js +31 -13
- package/dist/org/index.d.ts +2 -1
- package/dist/org/index.js +1 -0
- package/dist/org/plugin.js +2 -4
- package/dist/org/schema-store.d.ts +1 -0
- package/dist/org/schema-store.js +13 -0
- package/dist/provider-api/actions/custom-provider-registration.d.ts +8 -8
- package/dist/provider-api/actions/provider-api.d.ts +9 -9
- package/dist/resources/store.js +5 -2
- package/dist/server/agent-access.js +2 -6
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/agent-engine-default-model-route.d.ts +1 -1
- package/dist/server/auth-plugin.js +2 -6
- package/dist/server/auth.js +22 -2
- package/dist/server/better-auth-migrations.d.ts +4 -2
- package/dist/server/better-auth-migrations.js +18 -6
- package/dist/server/identity-sso-store.js +3 -0
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/release-migrations.d.ts +1 -1
- package/dist/server/release-migrations.js +3 -65
- package/dist/server/release-schema.js +10 -2
- package/dist/server/short-lived-token.d.ts +3 -2
- package/dist/server/short-lived-token.js +3 -2
- package/dist/triggers/actions/manage-automation.d.ts +3 -3
- package/dist/triggers/event-queue.d.ts +4 -2
- package/dist/triggers/event-queue.js +38 -38
- package/dist/usage/alerts-store.js +3 -0
- package/dist/workspace-connections/groups.js +4 -0
- package/dist/workspace-connections/store.js +3 -0
- package/package.json +3 -3
package/dist/a2a-claims.js
CHANGED
|
@@ -13,9 +13,8 @@ export async function verifyA2ATokenWithClaims(token, event) {
|
|
|
13
13
|
: [];
|
|
14
14
|
if (audiences.length === 0 || audiences.some((value) => !value.trim()))
|
|
15
15
|
return null;
|
|
16
|
+
const hasClaimedOrgId = Object.prototype.hasOwnProperty.call(raw, "org_id");
|
|
16
17
|
const claimedOrgId = typeof raw.org_id === "string" ? raw.org_id.trim() : "";
|
|
17
|
-
// Global-secret verification can resolve an ID-only claim locally; require
|
|
18
|
-
// the signed domain too so the ID alone cannot choose the authorization scope.
|
|
19
18
|
const claimedOrgDomain = typeof raw.org_domain === "string"
|
|
20
19
|
? raw.org_domain.trim().toLowerCase()
|
|
21
20
|
: "";
|
|
@@ -26,11 +25,12 @@ export async function verifyA2ATokenWithClaims(token, event) {
|
|
|
26
25
|
: [];
|
|
27
26
|
const issuer = typeof raw.iss === "string" ? raw.iss.trim() : "";
|
|
28
27
|
const orgDomain = identity.orgDomain?.trim().toLowerCase() ?? "";
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
// Independently hosted apps resolve their own organization ID from this verified domain.
|
|
29
|
+
const organizationScopeMatches = Boolean(orgId &&
|
|
31
30
|
claimedOrgDomain &&
|
|
32
31
|
claimedOrgDomain === orgDomain &&
|
|
33
|
-
|
|
32
|
+
(!hasClaimedOrgId || claimedOrgId === orgId));
|
|
33
|
+
return organizationScopeMatches && jti
|
|
34
34
|
? {
|
|
35
35
|
email: identity.email,
|
|
36
36
|
orgId,
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { runMigrations } from "../../db/migrations.js";
|
|
2
1
|
import { awaitBootstrap, markDefaultPluginProvided, } from "../../server/framework-request-handler.js";
|
|
3
|
-
import {
|
|
2
|
+
import { contextXrayStore } from "./schema-store.js";
|
|
4
3
|
export function createContextXrayPlugin() {
|
|
5
|
-
const migrate = runMigrations(CONTEXT_XRAY_MIGRATIONS, {
|
|
6
|
-
table: "_context_xray_migrations",
|
|
7
|
-
});
|
|
8
4
|
return async (nitroApp) => {
|
|
9
5
|
markDefaultPluginProvided(nitroApp, "context-xray");
|
|
10
6
|
await awaitBootstrap(nitroApp);
|
|
11
|
-
await
|
|
7
|
+
await contextXrayStore.ready();
|
|
12
8
|
};
|
|
13
9
|
}
|
|
14
10
|
export const defaultContextXrayPlugin = createContextXrayPlugin();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const contextXrayStore: import("../../db/store-registry.js").Store;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { defineStore } from "../../db/store-registry.js";
|
|
2
|
+
import { fromMigrationEntries } from "../../db/versioned-store-migrations.js";
|
|
3
|
+
import { CONTEXT_XRAY_MIGRATIONS } from "./migrations.js";
|
|
4
|
+
export const contextXrayStore = defineStore({
|
|
5
|
+
id: "context_xray",
|
|
6
|
+
migrations: fromMigrationEntries("_context_xray_migrations", CONTEXT_XRAY_MIGRATIONS, { ranAtBoot: true }),
|
|
7
|
+
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { getDbExec } from "../../db/client.js";
|
|
2
2
|
import { ensureColumnExists, ensureIndexExists, ensureTableExists, } from "../../db/ddl-guard.js";
|
|
3
3
|
import { defineStore } from "../../db/store-registry.js";
|
|
4
|
+
import { fromMigrationEntries } from "../../db/versioned-store-migrations.js";
|
|
5
|
+
import { AGENT_HARNESS_SESSION_MIGRATIONS, AGENT_HARNESS_SESSION_MIGRATIONS_TABLE, } from "./migrations.js";
|
|
4
6
|
export class AgentHarnessSessionConflictError extends Error {
|
|
5
7
|
constructor(sessionId) {
|
|
6
8
|
super(`Harness session ${sessionId} changed concurrently; retry the operation.`);
|
|
@@ -58,6 +60,7 @@ export const agentHarnessSessionsStore = defineStore({
|
|
|
58
60
|
await ensureIndexExists("idx_agent_harness_sessions_owner", `CREATE INDEX IF NOT EXISTS idx_agent_harness_sessions_owner ON agent_harness_sessions(owner_email, updated_at)`);
|
|
59
61
|
},
|
|
60
62
|
},
|
|
63
|
+
...fromMigrationEntries(AGENT_HARNESS_SESSION_MIGRATIONS_TABLE, AGENT_HARNESS_SESSION_MIGRATIONS),
|
|
61
64
|
],
|
|
62
65
|
});
|
|
63
66
|
export function ensureAgentHarnessSessionTables() {
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { runMigrations } from "../../db/migrations.js";
|
|
2
1
|
import { awaitBootstrap, markDefaultPluginProvided, } from "../../server/framework-request-handler.js";
|
|
3
|
-
import {
|
|
2
|
+
import { observationalMemoryStore } from "./store.js";
|
|
4
3
|
export function createObservationalMemoryPlugin() {
|
|
5
|
-
const migrate = runMigrations(OBSERVATIONAL_MEMORY_MIGRATIONS, {
|
|
6
|
-
table: "_observational_memory_migrations",
|
|
7
|
-
});
|
|
8
4
|
return async (nitroApp) => {
|
|
9
5
|
markDefaultPluginProvided(nitroApp, "observational-memory");
|
|
10
6
|
await awaitBootstrap(nitroApp);
|
|
11
|
-
await
|
|
7
|
+
await observationalMemoryStore.ready();
|
|
12
8
|
};
|
|
13
9
|
}
|
|
14
10
|
export const defaultObservationalMemoryPlugin = createObservationalMemoryPlugin();
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
import { getDbExec } from "../../db/client.js";
|
|
15
15
|
import { ensureTableExists, ensureIndexExists } from "../../db/ddl-guard.js";
|
|
16
16
|
import { defineStore } from "../../db/store-registry.js";
|
|
17
|
+
import { fromMigrationEntries } from "../../db/versioned-store-migrations.js";
|
|
17
18
|
import { widenIntColumnsToBigInt } from "../../db/widen-columns.js";
|
|
19
|
+
import { OBSERVATIONAL_MEMORY_MIGRATIONS } from "./migrations.js";
|
|
18
20
|
export const observationalMemoryStore = defineStore({
|
|
19
21
|
id: "observational_memory",
|
|
20
22
|
migrations: [
|
|
@@ -53,6 +55,7 @@ export const observationalMemoryStore = defineStore({
|
|
|
53
55
|
]);
|
|
54
56
|
},
|
|
55
57
|
},
|
|
58
|
+
...fromMigrationEntries("_observational_memory_migrations", OBSERVATIONAL_MEMORY_MIGRATIONS, { ranAtBoot: true }),
|
|
56
59
|
],
|
|
57
60
|
});
|
|
58
61
|
export function ensureTable() {
|
package/dist/agent/run-store.js
CHANGED
|
@@ -3,6 +3,7 @@ import { isArtifactReceipt, } from "../artifacts/detect.js";
|
|
|
3
3
|
import { getDbExec } from "../db/client.js";
|
|
4
4
|
import { ensureColumnExists, ensureTableExists } from "../db/ddl-guard.js";
|
|
5
5
|
import { defineStore } from "../db/store-registry.js";
|
|
6
|
+
import { fromMigrationEntries } from "../db/versioned-store-migrations.js";
|
|
6
7
|
import { widenIntColumnsToBigInt } from "../db/widen-columns.js";
|
|
7
8
|
import { automationRecoveryMessagesForLocale } from "../localization/automation-recovery-messages.js";
|
|
8
9
|
import { lockAndAssertServicePrincipalMayStartRun, prepareServicePrincipalRunStart, recordServicePrincipalDenial, } from "../org/service-principal-guard.js";
|
|
@@ -13,6 +14,7 @@ import { approvalKeyForHistory } from "./approval-key.js";
|
|
|
13
14
|
import { admitAutoContinue, admitManualContinue, } from "./auto-continue.js";
|
|
14
15
|
import { AGENT_CHAT_RECOVERY_OF_RUN_FIELD } from "./durable-background.js";
|
|
15
16
|
import { LLM_MISSING_CREDENTIALS_ERROR_CODE, LLM_MISSING_CREDENTIALS_MESSAGE, } from "./engine/credential-errors.js";
|
|
17
|
+
import { AGENT_RUN_MIGRATIONS, AGENT_RUN_MIGRATIONS_TABLE, } from "./run-migrations.js";
|
|
16
18
|
import { isConsistentToolCallInputFingerprint, isUnavailableToolCallInput, toolCallInputFingerprint, } from "./tool-call-journal.js";
|
|
17
19
|
import { CONTINUATION_REASONS, isContinuationTerminalReason } from "./types.js";
|
|
18
20
|
export const RUN_STALE_MS = 15_000;
|
|
@@ -266,6 +268,7 @@ export const agentRunsStore = defineStore({
|
|
|
266
268
|
await widenIntColumnsToBigInt("agent_tool_ledger", ["completed_at"]);
|
|
267
269
|
},
|
|
268
270
|
},
|
|
271
|
+
...fromMigrationEntries(AGENT_RUN_MIGRATIONS_TABLE, AGENT_RUN_MIGRATIONS),
|
|
269
272
|
],
|
|
270
273
|
});
|
|
271
274
|
export function ensureRunTables() {
|
|
@@ -2,7 +2,9 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
2
2
|
import { getDbExec } from "../db/client.js";
|
|
3
3
|
import { ensureColumnExists, ensureIndexExists, ensureTableExists, } from "../db/ddl-guard.js";
|
|
4
4
|
import { defineStore } from "../db/store-registry.js";
|
|
5
|
+
import { fromMigrationEntries } from "../db/versioned-store-migrations.js";
|
|
5
6
|
import { hashAgentToolApprovalKey } from "./approval-key.js";
|
|
7
|
+
import { AGENT_TOOL_APPROVAL_MIGRATIONS, AGENT_TOOL_APPROVAL_MIGRATIONS_TABLE, } from "./tool-approval-migrations.js";
|
|
6
8
|
import { AGENT_TOOL_APPROVAL_INDEX_SQL, AGENT_TOOL_APPROVAL_LOGICAL_INDEX_SQL, AGENT_TOOL_APPROVAL_POLICY_INDEX_SQL, AGENT_TOOL_APPROVAL_POLICY_REVISION_COLUMN_SQL, AGENT_TOOL_APPROVAL_POLICY_TABLE_SQL, AGENT_TOOL_APPROVAL_RECOVERY_INDEX_SQL, AGENT_TOOL_APPROVAL_REVISION_COLUMN_SQL, AGENT_TOOL_APPROVAL_TABLE_SQL, } from "./tool-approval-migrations.js";
|
|
7
9
|
export { hashAgentToolApprovalKey } from "./approval-key.js";
|
|
8
10
|
const APPROVAL_TTL_MS = 60 * 60_000;
|
|
@@ -25,6 +27,7 @@ export const agentToolApprovalsStore = defineStore({
|
|
|
25
27
|
await ensureColumnExists("agent_tool_approvals", "tool_revision", AGENT_TOOL_APPROVAL_REVISION_COLUMN_SQL);
|
|
26
28
|
},
|
|
27
29
|
},
|
|
30
|
+
...fromMigrationEntries(AGENT_TOOL_APPROVAL_MIGRATIONS_TABLE, AGENT_TOOL_APPROVAL_MIGRATIONS.filter((entry) => entry.version <= 3)),
|
|
28
31
|
],
|
|
29
32
|
});
|
|
30
33
|
export function ensureAgentToolApprovalTable() {
|
|
@@ -46,6 +49,7 @@ export const agentToolApprovalPoliciesStore = defineStore({
|
|
|
46
49
|
await ensureColumnExists("agent_tool_approval_policies", "tool_revision", AGENT_TOOL_APPROVAL_POLICY_REVISION_COLUMN_SQL);
|
|
47
50
|
},
|
|
48
51
|
},
|
|
52
|
+
...fromMigrationEntries(AGENT_TOOL_APPROVAL_MIGRATIONS_TABLE, AGENT_TOOL_APPROVAL_MIGRATIONS.filter((entry) => entry.version === 4)),
|
|
49
53
|
],
|
|
50
54
|
});
|
|
51
55
|
export function ensureAgentToolApprovalPolicyTable() {
|
|
@@ -139,8 +139,8 @@ export declare function createAutomationCallbackHandler(runtime: AutomationRunti
|
|
|
139
139
|
duplicate?: undefined;
|
|
140
140
|
eventId?: undefined;
|
|
141
141
|
} | {
|
|
142
|
+
error?: undefined;
|
|
142
143
|
accepted: boolean;
|
|
143
144
|
duplicate: boolean;
|
|
144
145
|
eventId: string;
|
|
145
|
-
error?: undefined;
|
|
146
146
|
}>;
|
|
@@ -7,6 +7,7 @@ import { getDbExec } from "../db/client.js";
|
|
|
7
7
|
import { createGetDb } from "../db/create-get-db.js";
|
|
8
8
|
import { ensureColumnExists, ensureIndexExists, ensureTableExists, } from "../db/ddl-guard.js";
|
|
9
9
|
import { defineStore } from "../db/store-registry.js";
|
|
10
|
+
import { fromMigrationEntries } from "../db/versioned-store-migrations.js";
|
|
10
11
|
import { widenIntColumnsToBigInt } from "../db/widen-columns.js";
|
|
11
12
|
import { getRequestOrgId } from "../server/request-context.js";
|
|
12
13
|
import { assertNoInlineImageBytes, stripInlineBytes, } from "../shared/inline-bytes.js";
|
|
@@ -14,6 +15,7 @@ import { resolveAccess } from "../sharing/access.js";
|
|
|
14
15
|
import { registerShareableResource } from "../sharing/registry.js";
|
|
15
16
|
import { roleSatisfies } from "../sharing/schema.js";
|
|
16
17
|
import { emitChatThreadChange } from "./emitter.js";
|
|
18
|
+
import { CHAT_THREAD_SCHEMA_MIGRATIONS, CHAT_THREAD_SCHEMA_MIGRATIONS_TABLE, } from "./schema-migrations.js";
|
|
17
19
|
import { chatThreads, chatThreadShares, CHAT_THREAD_SHARES_CREATE_SQL, CHAT_THREAD_SHARES_RESOURCE_INDEX_SQL, } from "./schema.js";
|
|
18
20
|
/**
|
|
19
21
|
* Per-thread async mutex. Read-modify-write on the `thread_data` JSON blob
|
|
@@ -155,6 +157,7 @@ export const chatThreadsStore = defineStore({
|
|
|
155
157
|
await ensureIndexExists("chat_thread_shares_resource_idx", CHAT_THREAD_SHARES_RESOURCE_INDEX_SQL);
|
|
156
158
|
},
|
|
157
159
|
},
|
|
160
|
+
...fromMigrationEntries(CHAT_THREAD_SCHEMA_MIGRATIONS_TABLE, CHAT_THREAD_SCHEMA_MIGRATIONS, { data: [3] }),
|
|
158
161
|
],
|
|
159
162
|
});
|
|
160
163
|
function ensureTable() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const trustedActionQueryCacheBindingPendingContext: import("react").Context<boolean>;
|
|
@@ -27,7 +27,7 @@ export declare function bindActionQueryCache(client: QueryClient, scope: string,
|
|
|
27
27
|
}): Promise<void>;
|
|
28
28
|
/** Sign-out: stop, drop this document's results, and delete every stored
|
|
29
29
|
* record. */
|
|
30
|
-
export declare function clearActionQueryCache(): Promise<void>;
|
|
30
|
+
export declare function clearActionQueryCache(client?: QueryClient): Promise<void>;
|
|
31
31
|
/**
|
|
32
32
|
* Holds action queries until the session's cached results are in the client,
|
|
33
33
|
* so a revisit paints them instead of a skeleton. With a signed-out session it
|
|
@@ -2,8 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { persistQueryClient, } from "@tanstack/query-persist-client-core";
|
|
3
3
|
import { IsRestoringProvider, useQueryClient, } from "@tanstack/react-query";
|
|
4
4
|
import { clear as clearStore, createStore, del as deleteEntry, get as getEntry, keys as listKeys, set as setEntry, } from "idb-keyval";
|
|
5
|
-
import { useEffect, useMemo, useState } from "react";
|
|
5
|
+
import { useEffect, useLayoutEffect, useMemo, useState, } from "react";
|
|
6
6
|
import { actionErrorStatus } from "./action-failure-circuit.js";
|
|
7
|
+
import { trustedActionQueryCacheBindingPendingContext } from "./action-query-cache-context.js";
|
|
7
8
|
import { clientBuildId } from "./build-compatibility.js";
|
|
8
9
|
import { getAccessDeniedActionQueryBinding, isBrowserPersistableActionQueryForBinding, markRestoredBrowserPersistableActionQuery, registerActionQueryCacheRevoker, revokeBrowserPersistableActionQuery, setActionQueryCacheBindingToken, } from "./use-action.js";
|
|
9
10
|
import { isSessionFromFirstRead, useSession } from "./use-session.js";
|
|
@@ -221,9 +222,11 @@ async function waitForStorageClearWithinBound(timeoutMs = INITIAL_CLEAR_TIMEOUT_
|
|
|
221
222
|
clearTimeout(timer);
|
|
222
223
|
}
|
|
223
224
|
}
|
|
224
|
-
function releaseWithoutCache(client, attempt) {
|
|
225
|
+
function releaseWithoutCache(client, attempt, trustPrebindResults) {
|
|
225
226
|
closeBinding();
|
|
226
|
-
|
|
227
|
+
if (!trustPrebindResults) {
|
|
228
|
+
client.removeQueries({ queryKey: ACTION_QUERY_KEY });
|
|
229
|
+
}
|
|
227
230
|
registerActionQueryCacheRevoker(client, () => {
|
|
228
231
|
if (attempt !== bindAttemptGeneration || binding !== undefined) {
|
|
229
232
|
return;
|
|
@@ -436,7 +439,7 @@ function trackRevokedScopeDelete(scope, deletion) {
|
|
|
436
439
|
}
|
|
437
440
|
/** Stops persisting and drops this document's action results. Storage is
|
|
438
441
|
* untouched. */
|
|
439
|
-
function closeBinding() {
|
|
442
|
+
function closeBinding(preserveActionQueries = false) {
|
|
440
443
|
bindingGeneration += 1;
|
|
441
444
|
const closing = binding;
|
|
442
445
|
binding = undefined;
|
|
@@ -453,7 +456,7 @@ function closeBinding() {
|
|
|
453
456
|
if (isAccessDeniedActionQuery(query)) {
|
|
454
457
|
clearAccessDeniedActionQueryData(query);
|
|
455
458
|
}
|
|
456
|
-
else {
|
|
459
|
+
else if (!preserveActionQueries) {
|
|
457
460
|
closing.client.removeQueries({ queryKey: query.queryKey, exact: true });
|
|
458
461
|
}
|
|
459
462
|
}
|
|
@@ -505,11 +508,12 @@ async function waitForRestore(restored, timeoutMs = RESTORE_TIMEOUT_MS) {
|
|
|
505
508
|
*/
|
|
506
509
|
export async function bindActionQueryCache(client, scope, options = {}) {
|
|
507
510
|
const attempt = ++bindAttemptGeneration;
|
|
511
|
+
const trustPrebindResults = options.trustPrebindResults === true;
|
|
508
512
|
const bindDeadline = Date.now() + BIND_WAIT_BUDGET_MS;
|
|
509
513
|
const remainingBindBudget = () => Math.max(0, bindDeadline - Date.now());
|
|
510
514
|
let cacheSafety = readCacheSafetyState(true);
|
|
511
515
|
if (!cacheSafety) {
|
|
512
|
-
releaseWithoutCache(client, attempt);
|
|
516
|
+
releaseWithoutCache(client, attempt, trustPrebindResults);
|
|
513
517
|
return;
|
|
514
518
|
}
|
|
515
519
|
if (!storageClearInFlight) {
|
|
@@ -522,7 +526,7 @@ export async function bindActionQueryCache(client, scope, options = {}) {
|
|
|
522
526
|
}
|
|
523
527
|
catch (error) {
|
|
524
528
|
if (attempt === bindAttemptGeneration) {
|
|
525
|
-
releaseWithoutCache(client, attempt);
|
|
529
|
+
releaseWithoutCache(client, attempt, trustPrebindResults);
|
|
526
530
|
}
|
|
527
531
|
throw error;
|
|
528
532
|
}
|
|
@@ -530,16 +534,15 @@ export async function bindActionQueryCache(client, scope, options = {}) {
|
|
|
530
534
|
return;
|
|
531
535
|
}
|
|
532
536
|
if (!clearFinished || remainingBindBudget() <= 0) {
|
|
533
|
-
releaseWithoutCache(client, attempt);
|
|
537
|
+
releaseWithoutCache(client, attempt, trustPrebindResults);
|
|
534
538
|
return;
|
|
535
539
|
}
|
|
536
540
|
}
|
|
537
541
|
cacheSafety = readCacheSafetyState(true);
|
|
538
542
|
if (!cacheSafety || cacheSafety.pendingClearIntents.length > 0) {
|
|
539
|
-
releaseWithoutCache(client, attempt);
|
|
543
|
+
releaseWithoutCache(client, attempt, trustPrebindResults);
|
|
540
544
|
return;
|
|
541
545
|
}
|
|
542
|
-
const trustPrebindResults = options.trustPrebindResults === true;
|
|
543
546
|
const previousBinding = binding;
|
|
544
547
|
const alreadyBoundClient = previousBinding?.client === client;
|
|
545
548
|
const deniedBeforeBind = client
|
|
@@ -788,14 +791,15 @@ export async function bindActionQueryCache(client, scope, options = {}) {
|
|
|
788
791
|
}
|
|
789
792
|
catch (error) {
|
|
790
793
|
if (binding === currentBinding)
|
|
791
|
-
closeBinding();
|
|
794
|
+
closeBinding(trustPrebindResults);
|
|
792
795
|
throw error;
|
|
793
796
|
}
|
|
794
797
|
}
|
|
795
798
|
/** Sign-out: stop, drop this document's results, and delete every stored
|
|
796
799
|
* record. */
|
|
797
|
-
export async function clearActionQueryCache() {
|
|
800
|
+
export async function clearActionQueryCache(client) {
|
|
798
801
|
closeBinding();
|
|
802
|
+
client?.removeQueries({ queryKey: ACTION_QUERY_KEY });
|
|
799
803
|
const clear = beginStorageClear();
|
|
800
804
|
const clearFinished = await waitForCleanup(clear, "Cached action results could not be cleared in time; cleanup remains required.");
|
|
801
805
|
if (!clearFinished) {
|
|
@@ -814,14 +818,23 @@ export function ActionQueryCacheGate({ children }) {
|
|
|
814
818
|
? actionQueryCacheScope(session, clientBuildId())
|
|
815
819
|
: null;
|
|
816
820
|
const terminalUnauthenticated = status === "unauthenticated";
|
|
821
|
+
const [signedOutCacheCleared, setSignedOutCacheCleared] = useState(false);
|
|
817
822
|
const bindAttempt = useMemo(() => ({
|
|
818
823
|
trustPrebindResults: scope !== null && !terminalUnauthenticated && isSessionFromFirstRead(),
|
|
819
824
|
}), [queryClient, scope, terminalUnauthenticated]);
|
|
820
825
|
const [settledAttempt, setSettledAttempt] = useState(null);
|
|
826
|
+
useLayoutEffect(() => {
|
|
827
|
+
if (!terminalUnauthenticated) {
|
|
828
|
+
setSignedOutCacheCleared(false);
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
const clearing = clearActionQueryCache(queryClient);
|
|
832
|
+
setSignedOutCacheCleared(true);
|
|
833
|
+
void clearing.catch((error) => console.warn("Unable to clear cached action results", error));
|
|
834
|
+
}, [queryClient, terminalUnauthenticated]);
|
|
821
835
|
useEffect(() => {
|
|
822
836
|
// A transient session reread does not replace a same-scope cache binding.
|
|
823
837
|
if (terminalUnauthenticated) {
|
|
824
|
-
clearActionQueryCache().catch((error) => console.warn("Unable to clear cached action results", error));
|
|
825
838
|
setSettledAttempt(bindAttempt);
|
|
826
839
|
return;
|
|
827
840
|
}
|
|
@@ -846,7 +859,13 @@ export function ActionQueryCacheGate({ children }) {
|
|
|
846
859
|
closeBinding();
|
|
847
860
|
};
|
|
848
861
|
}, [bindAttempt, queryClient, scope, terminalUnauthenticated]);
|
|
849
|
-
const restoring = scope !== null &&
|
|
862
|
+
const restoring = scope !== null &&
|
|
863
|
+
settledAttempt !== bindAttempt &&
|
|
864
|
+
!bindAttempt.trustPrebindResults;
|
|
850
865
|
const holdUntrustedChildren = scope !== null && !bindAttempt.trustPrebindResults && restoring;
|
|
851
|
-
|
|
866
|
+
const holdSignedOutChildren = terminalUnauthenticated && !signedOutCacheCleared;
|
|
867
|
+
const trustedBindingPending = scope !== null &&
|
|
868
|
+
settledAttempt !== bindAttempt &&
|
|
869
|
+
bindAttempt.trustPrebindResults;
|
|
870
|
+
return (_jsx(trustedActionQueryCacheBindingPendingContext.Provider, { value: trustedBindingPending, children: _jsx(IsRestoringProvider, { value: restoring, children: holdUntrustedChildren || holdSignedOutChildren ? null : children }) }));
|
|
852
871
|
}
|
|
@@ -2,6 +2,8 @@ import { type ReactElement, type ReactNode, type Ref } from "react";
|
|
|
2
2
|
import "./motion-text.css";
|
|
3
3
|
export type MotionTextUnit = "character" | "word" | "line" | "paragraph";
|
|
4
4
|
export type MotionTextDirection = "forward" | "reverse";
|
|
5
|
+
export type MotionTextAnimationDirection = "in" | "out";
|
|
6
|
+
export type MotionTextOrder = "left-to-right" | "right-to-left" | "center-out" | "random" | "top-to-bottom" | "bottom-to-top";
|
|
5
7
|
export type MotionTextProperty = "opacity" | "translate" | "scale" | "rotate" | "filter";
|
|
6
8
|
export type MotionTextPlaybackMode = "loop" | "once" | "ping-pong";
|
|
7
9
|
export interface MotionTextKeyframe {
|
|
@@ -14,6 +16,10 @@ export interface MotionTextAnimation {
|
|
|
14
16
|
unit: MotionTextUnit;
|
|
15
17
|
direction: MotionTextDirection;
|
|
16
18
|
staggerMs: number;
|
|
19
|
+
animationDirection?: MotionTextAnimationDirection;
|
|
20
|
+
order?: MotionTextOrder;
|
|
21
|
+
overlapPercent?: number;
|
|
22
|
+
ignoreSpaces?: boolean;
|
|
17
23
|
delayMs?: number;
|
|
18
24
|
property: MotionTextProperty;
|
|
19
25
|
durationMs: number;
|