akanjs 3.0.0-alpha.53 → 3.0.0-alpha.55
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/constant/fieldInfo.ts +11 -3
- package/constant/textFieldPaths.ts +13 -7
- package/local/apps/serverLifecycle/serverLifecycle-local.db-shm +0 -0
- package/local/apps/serverLifecycle/serverLifecycle-local_solid.db-shm +0 -0
- package/package.json +1 -1
- package/server/rscWorker.tsx +5 -13
- package/server/webRouter.ts +3 -5
- package/store/agent/StoreSurfaceSource.ts +9 -1
- package/store/agentic/AgentValue.ts +12 -5
- package/types/constant/fieldInfo.d.ts +10 -3
- package/types/store/agent/StoreSurfaceSource.d.ts +9 -1
- package/types/store/agentic/AgentValue.d.ts +8 -0
- package/types/ui/Agent/Chat.d.ts +25 -4
- package/types/ui/Agent/Zone.d.ts +23 -4
- package/types/ui/Agent/agentSessionOf.d.ts +12 -3
- package/types/ui/Agent/index.d.ts +1 -1
- package/types/ui/Agent/sessionHistory.d.ts +1 -1
- package/types/ui/Agent/sessionView.d.ts +15 -0
- package/types/ui/RecentTime.d.ts +18 -1
- package/types/ui/index.d.ts +5 -3
- package/types/vendor/use-agentic/AgentProvider.d.ts +1 -2
- package/types/vendor/use-agentic/AgentSession.d.ts +33 -6
- package/types/vendor/use-agentic/AgenticSurface.d.ts +5 -0
- package/ui/Agent/Chat.tsx +76 -36
- package/ui/Agent/Zone.tsx +44 -12
- package/ui/Agent/agentSessionOf.ts +23 -4
- package/ui/Agent/sessionHistory.ts +10 -3
- package/ui/Agent/sessionView.ts +38 -0
- package/ui/RecentTime.tsx +83 -35
- package/ui/System/Client.tsx +19 -7
- package/ui/System/ThemeToggle.tsx +14 -5
- package/ui/index.ts +29 -3
- package/vendor/use-agentic/AgentProvider.tsx +1 -1
- package/vendor/use-agentic/AgentSession.ts +84 -19
- package/vendor/use-agentic/AgenticSurface.ts +9 -0
package/constant/fieldInfo.ts
CHANGED
|
@@ -505,6 +505,14 @@ export interface FieldObject {
|
|
|
505
505
|
[key: string]: ConstantField;
|
|
506
506
|
}
|
|
507
507
|
|
|
508
|
+
/**
|
|
509
|
+
* `text` names a column in the plaintext search mirror, so a masked field carrying one would publish what it
|
|
510
|
+
* masks through search — the class build refuses it (`TextFieldPaths`). Removing the key from the option type
|
|
511
|
+
* moves that refusal to the call site, where the fix is obvious. Distributive because `FieldOption` is a union:
|
|
512
|
+
* a plain `Omit` over it would collapse to the keys the members share.
|
|
513
|
+
*/
|
|
514
|
+
type WithoutTextRole<Option> = Option extends unknown ? Omit<Option, "text"> : never;
|
|
515
|
+
|
|
508
516
|
type FieldOption<
|
|
509
517
|
Value extends ConstantFieldTypeInput,
|
|
510
518
|
MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never,
|
|
@@ -568,7 +576,7 @@ field.hidden = <
|
|
|
568
576
|
MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never,
|
|
569
577
|
>(
|
|
570
578
|
value: Value,
|
|
571
|
-
option: FieldOption<Value, MapValue
|
|
579
|
+
option: WithoutTextRole<FieldOption<Value, MapValue>> = {},
|
|
572
580
|
) =>
|
|
573
581
|
new FieldInfo<"hidden", Value, ExplicitType, MapValue>(value, {
|
|
574
582
|
...option,
|
|
@@ -581,7 +589,7 @@ field.secret = <
|
|
|
581
589
|
MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never,
|
|
582
590
|
>(
|
|
583
591
|
value: Value,
|
|
584
|
-
option: FieldOption<Value, MapValue
|
|
592
|
+
option: WithoutTextRole<FieldOption<Value, MapValue>> = {},
|
|
585
593
|
) =>
|
|
586
594
|
new FieldInfo<"secret", Value | null, ExplicitType | null, MapValue>(value, {
|
|
587
595
|
...option,
|
|
@@ -596,7 +604,7 @@ export const resolve = <
|
|
|
596
604
|
MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never,
|
|
597
605
|
>(
|
|
598
606
|
value: Value,
|
|
599
|
-
option: FieldOption<Value, MapValue
|
|
607
|
+
option: WithoutTextRole<FieldOption<Value, MapValue>> = {},
|
|
600
608
|
) =>
|
|
601
609
|
new FieldInfo<"resolve", Value, ExplicitType, MapValue>(value, {
|
|
602
610
|
...option,
|
|
@@ -34,17 +34,23 @@ export class TextFieldPaths extends TextFieldPathSet {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
#assertReachable(path: string, parent: ConstantField) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (parent.fieldType === "
|
|
37
|
+
|
|
38
|
+
const fix = `Drop the text role on "${path}", or leave the parent unmasked.`;
|
|
39
|
+
if (parent.fieldType === "secret") throw new Error(`Text field "${path}" is under a secret field. ${fix}`);
|
|
40
|
+
if (parent.fieldType === "hidden") throw new Error(`Text field "${path}" is under a hidden field. ${fix}`);
|
|
41
|
+
if (parent.fieldType === "resolve") throw new Error(`Text field "${path}" is under a resolved field. ${fix}`);
|
|
40
42
|
if (parent.arrDepth > 1) throw new Error(`Text field "${path}" is under a nested array and cannot be indexed`);
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
#assertIndexable(key: string, role: TextFieldRole, field: ConstantField) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (field.fieldType === "
|
|
47
|
-
|
|
46
|
+
|
|
47
|
+
const masked = `The search mirror stores plaintext. Drop the text role on "${key}", or make the field plain.`;
|
|
48
|
+
if (field.fieldType === "secret")
|
|
49
|
+
throw new Error(`Text field "${key}" is secret and must not be indexed. ${masked}`);
|
|
50
|
+
if (field.fieldType === "hidden")
|
|
51
|
+
throw new Error(`Text field "${key}" is hidden and must not be indexed. ${masked}`);
|
|
52
|
+
if (field.fieldType === "resolve")
|
|
53
|
+
throw new Error(`Text field "${key}" is resolved and is absent from _doc. Drop the text role on "${key}".`);
|
|
48
54
|
if (field.isMap) throw new Error(`Text field "${key}" is a Map and cannot be indexed`);
|
|
49
55
|
if (field.arrDepth > 1) throw new Error(`Text field "${key}" is a nested array and cannot be indexed`);
|
|
50
56
|
const modelRef = field.modelRef as unknown as Cls;
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/server/rscWorker.tsx
CHANGED
|
@@ -547,7 +547,6 @@ export class RscRenderer {
|
|
|
547
547
|
});
|
|
548
548
|
return;
|
|
549
549
|
}
|
|
550
|
-
const theme = untrackedCookies().get("theme")?.value;
|
|
551
550
|
let element: ReactNode;
|
|
552
551
|
let effectivePatchDecision = safePatchDecision;
|
|
553
552
|
if (match && safePatchDecision.status === "patch" && safePatchDecision.patch) {
|
|
@@ -563,9 +562,9 @@ export class RscRenderer {
|
|
|
563
562
|
reason: "suffix-compose-fallback",
|
|
564
563
|
commonPrefixLength: safePatchDecision.commonPrefixLength,
|
|
565
564
|
};
|
|
566
|
-
element = await this.#renderMatched(urlObj, match,
|
|
565
|
+
element = await this.#renderMatched(urlObj, match, searchParams);
|
|
567
566
|
} else element = suffixElement;
|
|
568
|
-
} else if (match) element = await this.#renderMatched(urlObj, match,
|
|
567
|
+
} else if (match) element = await this.#renderMatched(urlObj, match, searchParams);
|
|
569
568
|
else element = await this.#renderNotFound(urlObj);
|
|
570
569
|
const traceCacheKey =
|
|
571
570
|
effectivePatchDecision.status === "patch" ? (patchCacheEntry?.key ?? cacheEntry?.key) : cacheEntry?.key;
|
|
@@ -1236,12 +1235,8 @@ export class RscRenderer {
|
|
|
1236
1235
|
const routeHeadSnapshot = this.#createRouteHeadSnapshot(url, routeHead, {
|
|
1237
1236
|
hasExplicitLanguageAlternates: routeHead.hasExplicitLanguageAlternates,
|
|
1238
1237
|
});
|
|
1239
|
-
const theme = untrackedCookies().get("theme")?.value;
|
|
1240
1238
|
return (
|
|
1241
|
-
<html
|
|
1242
|
-
lang={params.lang ?? RscRenderer.#getLocale(pathname, this.#i18n)}
|
|
1243
|
-
{...(theme ? { "data-theme": theme } : { suppressHydrationWarning: true })}
|
|
1244
|
-
>
|
|
1239
|
+
<html lang={params.lang ?? RscRenderer.#getLocale(pathname, this.#i18n)} suppressHydrationWarning>
|
|
1245
1240
|
<head key="head">
|
|
1246
1241
|
<meta key="charset" charSet="utf-8" />
|
|
1247
1242
|
<meta key="viewport" name="viewport" content="width=device-width, initial-scale=1" />
|
|
@@ -1263,7 +1258,6 @@ export class RscRenderer {
|
|
|
1263
1258
|
async #renderMatched(
|
|
1264
1259
|
url: URL,
|
|
1265
1260
|
match: { pathRoute: PathRoute; params: Record<string, string> },
|
|
1266
|
-
theme?: string,
|
|
1267
1261
|
searchParams = RouteTreeBuilder.parseSearchParams(url.search),
|
|
1268
1262
|
): Promise<ReactNode> {
|
|
1269
1263
|
this.#logger.verbose(
|
|
@@ -1289,11 +1283,9 @@ export class RscRenderer {
|
|
|
1289
1283
|
searchParams,
|
|
1290
1284
|
navKey: url.pathname + url.search,
|
|
1291
1285
|
});
|
|
1286
|
+
|
|
1292
1287
|
return (
|
|
1293
|
-
<html
|
|
1294
|
-
lang={match.params.lang ?? this.#i18n.defaultLocale}
|
|
1295
|
-
{...(theme ? { "data-theme": theme } : { suppressHydrationWarning: true })}
|
|
1296
|
-
>
|
|
1288
|
+
<html lang={match.params.lang ?? this.#i18n.defaultLocale} suppressHydrationWarning>
|
|
1297
1289
|
<head key="head">
|
|
1298
1290
|
<meta key="charset" charSet="utf-8" />
|
|
1299
1291
|
<meta key="viewport" name="viewport" content="width=device-width, initial-scale=1" />
|
package/server/webRouter.ts
CHANGED
|
@@ -610,7 +610,8 @@ export class WebRouter {
|
|
|
610
610
|
if (rscResult.type === "redirect")
|
|
611
611
|
return Response.redirect(new URL(rscResult.location, url.origin), rscResult.status);
|
|
612
612
|
if (rscResult.type === "not-found") return this.#renderSystemNotFoundFallbackResponse(req, url);
|
|
613
|
-
|
|
613
|
+
|
|
614
|
+
const cookieTheme = WebRouter.#cookieValue(req, "theme");
|
|
614
615
|
const hostRequestStore = createRequestStore(req);
|
|
615
616
|
const extraBootstrapInline = [
|
|
616
617
|
rscResult.trace?.routeState
|
|
@@ -628,7 +629,7 @@ export class WebRouter {
|
|
|
628
629
|
bootstrapModules: [this.#artifact.rscClientUrl],
|
|
629
630
|
extraBootstrapInline: extraBootstrapInline || undefined,
|
|
630
631
|
importmap: this.#artifact.vendorMap,
|
|
631
|
-
theme:
|
|
632
|
+
theme: cookieTheme ?? rscResult.theme ?? "system",
|
|
632
633
|
lateControl: rscResult.lateControl,
|
|
633
634
|
waitForAllReady: rscResult.trace?.ssrBlocking ?? false,
|
|
634
635
|
onCancel: (reason: unknown) => {
|
|
@@ -797,9 +798,6 @@ export class WebRouter {
|
|
|
797
798
|
}
|
|
798
799
|
}
|
|
799
800
|
|
|
800
|
-
static #hasCookie(req: Request, name: string): boolean {
|
|
801
|
-
return parseCookieHeader(req.headers.get("cookie") ?? "").has(name);
|
|
802
|
-
}
|
|
803
801
|
#getHtmlCacheEntry(req: Request, url: URL): { entry: RouteCacheEntry | null; reason?: string } {
|
|
804
802
|
const decision = resolvePublicRouteCacheEntryDecision({
|
|
805
803
|
request: req,
|
|
@@ -13,13 +13,21 @@ import { ScreenTarget } from "./ScreenTarget";
|
|
|
13
13
|
*
|
|
14
14
|
* Per zone view: a zone's `readState` reaches the keys its own subtree subscribes, and its `readScreen` and
|
|
15
15
|
* `highlight` reach into its own `data-agent-zone` container rather than the whole document. A page can shadow any
|
|
16
|
-
* of them by registering a hook tool of the same name — hook entries win over a source's.
|
|
16
|
+
* of them by registering a hook tool of the same name — hook entries win over a source's. **That is a root-scope
|
|
17
|
+
* move only**: inside a zone the hook entry is registered under its scope-prefixed name, which can never collide
|
|
18
|
+
* with the bare name a source publishes, so a zone drops a built-in with the session's `builtins` option instead.
|
|
17
19
|
*/
|
|
18
20
|
export class StoreSurfaceSource implements SurfaceSource {
|
|
19
21
|
/** Defined in `akanjs/ui/styles.css`, so the flash follows the app's own theme tokens. */
|
|
20
22
|
static readonly highlightClass = "akan-agent-highlight";
|
|
21
23
|
/** Mirrors the animation in that stylesheet: the class outlives the ring by nothing. */
|
|
22
24
|
static readonly highlightMs = 2400;
|
|
25
|
+
/**
|
|
26
|
+
* What `tools()` contributes, in the order it builds them — the list a session's `builtins` option selects from.
|
|
27
|
+
* A screen that declares a hook tool of one of these names is not in it: that entry is the screen's, not this
|
|
28
|
+
* source's, so withholding the built-ins never withholds a tool a component published on purpose.
|
|
29
|
+
*/
|
|
30
|
+
static readonly builtins = ["navigate", "goBack", "readScreen", "readState", "highlight"] as const;
|
|
23
31
|
|
|
24
32
|
#bridge: AgentBridge | null;
|
|
25
33
|
readonly #builtins = new Map<string, ToolEntry[]>();
|
|
@@ -22,6 +22,11 @@ export type AgentFieldType = AgentSingleType | AgentSingleType[];
|
|
|
22
22
|
* A model class resolves to its state object rather than its instance type, so a component may hand over either
|
|
23
23
|
* the hydrated document or the plain data copied out of one — masking reads the model that was named, not the
|
|
24
24
|
* class the value still carries.
|
|
25
|
+
*
|
|
26
|
+
* A scalar is recognised by `refName` and has to be matched before `FIELD_META`: `via.ts` augments the global
|
|
27
|
+
* `String`, `Boolean`, `Date` and `Map` constructors with `DatabaseConstantStatics`, so those four carry field
|
|
28
|
+
* metadata and would otherwise read as models. A model carries no `refName`, and `Map` — carrying neither — falls
|
|
29
|
+
* through to the model branch and is refused at declaration time instead.
|
|
25
30
|
*/
|
|
26
31
|
export type AgentValueOf<T> = T extends readonly (infer F)[]
|
|
27
32
|
? AgentValueOf<F>[]
|
|
@@ -31,11 +36,13 @@ export type AgentValueOf<T> = T extends readonly (infer F)[]
|
|
|
31
36
|
? V
|
|
32
37
|
: T extends DateConstructor
|
|
33
38
|
? Dayjs | Date | string
|
|
34
|
-
: T extends { [
|
|
35
|
-
?
|
|
36
|
-
: T extends { [
|
|
37
|
-
?
|
|
38
|
-
:
|
|
39
|
+
: T extends { refName: string; [CLIENT_VALUE]: infer V }
|
|
40
|
+
? V
|
|
41
|
+
: T extends { [FIELD_META]: unknown }
|
|
42
|
+
? GetStateObject<UnCls<T>>
|
|
43
|
+
: T extends { [CLIENT_VALUE]: infer V }
|
|
44
|
+
? V
|
|
45
|
+
: unknown;
|
|
39
46
|
|
|
40
47
|
type ValueKind = "any" | "date" | "scalar" | "enum" | "model";
|
|
41
48
|
|
|
@@ -172,6 +172,13 @@ export declare class ConstantField<FieldType extends ConstantFieldKind = Constan
|
|
|
172
172
|
export interface FieldObject {
|
|
173
173
|
[key: string]: ConstantField;
|
|
174
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* `text` names a column in the plaintext search mirror, so a masked field carrying one would publish what it
|
|
177
|
+
* masks through search — the class build refuses it (`TextFieldPaths`). Removing the key from the option type
|
|
178
|
+
* moves that refusal to the call site, where the fix is obvious. Distributive because `FieldOption` is a union:
|
|
179
|
+
* a plain `Omit` over it would collapse to the keys the members share.
|
|
180
|
+
*/
|
|
181
|
+
type WithoutTextRole<Option> = Option extends unknown ? Omit<Option, "text"> : never;
|
|
175
182
|
type FieldOption<Value extends ConstantFieldTypeInput, MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never, Metadata extends {
|
|
176
183
|
[key: string]: any;
|
|
177
184
|
} = {
|
|
@@ -182,11 +189,11 @@ export type PlainTypeToFieldType<PlainType> = PlainType extends [infer First, ..
|
|
|
182
189
|
export declare const field: {
|
|
183
190
|
<ExplicitType, Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never>(value: Value, option?: FieldOption<Value, MapValue>): FieldInfo<"property", Value, ExplicitType, MapValue, FieldKindSource<Value>, UnCls<FieldKindSource<Value>> extends BaseObject ? true : false, FieldKindSource<Value> extends infer T ? T extends FieldKindSource<Value> ? T extends EnumInstance<string, any> ? true : false : never : never, FieldKindSource<Value> extends infer T_1 ? T_1 extends FieldKindSource<Value> ? T_1 extends typeof PrimitiveScalar ? true : false : never : never, FieldKindSource<Value> extends infer T_2 ? T_2 extends FieldKindSource<Value> ? T_2 extends MapConstructor ? true : false : never : never, (UnCls<FieldKindSource<Value>> extends BaseObject ? true : false) extends infer T_3 ? T_3 extends (UnCls<FieldKindSource<Value>> extends BaseObject ? true : false) ? T_3 extends true ? false : (FieldKindSource<Value> extends infer T_4 ? T_4 extends FieldKindSource<Value> ? T_4 extends EnumInstance<string, any> ? true : false : never : never) extends infer T_5 ? T_5 extends (FieldKindSource<Value> extends infer T_12 ? T_12 extends FieldKindSource<Value> ? T_12 extends EnumInstance<string, any> ? true : false : never : never) ? T_5 extends true ? false : (FieldKindSource<Value> extends infer T_6 ? T_6 extends FieldKindSource<Value> ? T_6 extends typeof PrimitiveScalar ? true : false : never : never) extends infer T_7 ? T_7 extends (FieldKindSource<Value> extends infer T_11 ? T_11 extends FieldKindSource<Value> ? T_11 extends typeof PrimitiveScalar ? true : false : never : never) ? T_7 extends true ? false : (FieldKindSource<Value> extends infer T_8 ? T_8 extends FieldKindSource<Value> ? T_8 extends MapConstructor ? true : false : never : never) extends infer T_9 ? T_9 extends (FieldKindSource<Value> extends infer T_10 ? T_10 extends FieldKindSource<Value> ? T_10 extends MapConstructor ? true : false : never : never) ? T_9 extends true ? false : true : never : never : never : never : never : never : never : never, false, false>;
|
|
184
191
|
visual<ExplicitType, Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never>(value: Value, option?: FieldOption<Value, MapValue>): FieldInfo<"property", Value, ExplicitType, MapValue, FieldKindSource<Value>, UnCls<FieldKindSource<Value>> extends BaseObject ? true : false, FieldKindSource<Value> extends infer T ? T extends FieldKindSource<Value> ? T extends EnumInstance<string, any> ? true : false : never : never, FieldKindSource<Value> extends infer T_1 ? T_1 extends FieldKindSource<Value> ? T_1 extends typeof PrimitiveScalar ? true : false : never : never, FieldKindSource<Value> extends infer T_2 ? T_2 extends FieldKindSource<Value> ? T_2 extends MapConstructor ? true : false : never : never, (UnCls<FieldKindSource<Value>> extends BaseObject ? true : false) extends infer T_3 ? T_3 extends (UnCls<FieldKindSource<Value>> extends BaseObject ? true : false) ? T_3 extends true ? false : (FieldKindSource<Value> extends infer T_4 ? T_4 extends FieldKindSource<Value> ? T_4 extends EnumInstance<string, any> ? true : false : never : never) extends infer T_5 ? T_5 extends (FieldKindSource<Value> extends infer T_12 ? T_12 extends FieldKindSource<Value> ? T_12 extends EnumInstance<string, any> ? true : false : never : never) ? T_5 extends true ? false : (FieldKindSource<Value> extends infer T_6 ? T_6 extends FieldKindSource<Value> ? T_6 extends typeof PrimitiveScalar ? true : false : never : never) extends infer T_7 ? T_7 extends (FieldKindSource<Value> extends infer T_11 ? T_11 extends FieldKindSource<Value> ? T_11 extends typeof PrimitiveScalar ? true : false : never : never) ? T_7 extends true ? false : (FieldKindSource<Value> extends infer T_8 ? T_8 extends FieldKindSource<Value> ? T_8 extends MapConstructor ? true : false : never : never) extends infer T_9 ? T_9 extends (FieldKindSource<Value> extends infer T_10 ? T_10 extends FieldKindSource<Value> ? T_10 extends MapConstructor ? true : false : never : never) ? T_9 extends true ? false : true : never : never : never : never : never : never : never : never, false, false>;
|
|
185
|
-
hidden<ExplicitType, Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never>(value: Value, option?: FieldOption<Value, MapValue
|
|
186
|
-
secret<ExplicitType, Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never>(value: Value, option?: FieldOption<Value, MapValue
|
|
192
|
+
hidden<ExplicitType, Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never>(value: Value, option?: WithoutTextRole<FieldOption<Value, MapValue>>): FieldInfo<"hidden", Value, ExplicitType, MapValue, FieldKindSource<Value>, UnCls<FieldKindSource<Value>> extends BaseObject ? true : false, FieldKindSource<Value> extends infer T ? T extends FieldKindSource<Value> ? T extends EnumInstance<string, any> ? true : false : never : never, FieldKindSource<Value> extends infer T_1 ? T_1 extends FieldKindSource<Value> ? T_1 extends typeof PrimitiveScalar ? true : false : never : never, FieldKindSource<Value> extends infer T_2 ? T_2 extends FieldKindSource<Value> ? T_2 extends MapConstructor ? true : false : never : never, (UnCls<FieldKindSource<Value>> extends BaseObject ? true : false) extends infer T_3 ? T_3 extends (UnCls<FieldKindSource<Value>> extends BaseObject ? true : false) ? T_3 extends true ? false : (FieldKindSource<Value> extends infer T_4 ? T_4 extends FieldKindSource<Value> ? T_4 extends EnumInstance<string, any> ? true : false : never : never) extends infer T_5 ? T_5 extends (FieldKindSource<Value> extends infer T_12 ? T_12 extends FieldKindSource<Value> ? T_12 extends EnumInstance<string, any> ? true : false : never : never) ? T_5 extends true ? false : (FieldKindSource<Value> extends infer T_6 ? T_6 extends FieldKindSource<Value> ? T_6 extends typeof PrimitiveScalar ? true : false : never : never) extends infer T_7 ? T_7 extends (FieldKindSource<Value> extends infer T_11 ? T_11 extends FieldKindSource<Value> ? T_11 extends typeof PrimitiveScalar ? true : false : never : never) ? T_7 extends true ? false : (FieldKindSource<Value> extends infer T_8 ? T_8 extends FieldKindSource<Value> ? T_8 extends MapConstructor ? true : false : never : never) extends infer T_9 ? T_9 extends (FieldKindSource<Value> extends infer T_10 ? T_10 extends FieldKindSource<Value> ? T_10 extends MapConstructor ? true : false : never : never) ? T_9 extends true ? false : true : never : never : never : never : never : never : never : never, true, false>;
|
|
193
|
+
secret<ExplicitType, Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never>(value: Value, option?: WithoutTextRole<FieldOption<Value, MapValue>>): FieldInfo<"secret", Value | null, ExplicitType | null, MapValue, SingleValue<Value> & {}, UnCls<SingleValue<Value> & {}> extends BaseObject ? true : false, SingleValue<Value> & {} extends infer T ? T extends SingleValue<Value> & {} ? T extends EnumInstance<string, any> ? true : false : never : never, SingleValue<Value> & {} extends infer T_1 ? T_1 extends SingleValue<Value> & {} ? T_1 extends typeof PrimitiveScalar ? true : false : never : never, SingleValue<Value> & {} extends infer T_2 ? T_2 extends SingleValue<Value> & {} ? T_2 extends MapConstructor ? true : false : never : never, (UnCls<SingleValue<Value> & {}> extends BaseObject ? true : false) extends infer T_3 ? T_3 extends (UnCls<SingleValue<Value> & {}> extends BaseObject ? true : false) ? T_3 extends true ? false : (SingleValue<Value> & {} extends infer T_4 ? T_4 extends SingleValue<Value> & {} ? T_4 extends EnumInstance<string, any> ? true : false : never : never) extends infer T_5 ? T_5 extends (SingleValue<Value> & {} extends infer T_12 ? T_12 extends SingleValue<Value> & {} ? T_12 extends EnumInstance<string, any> ? true : false : never : never) ? T_5 extends true ? false : (SingleValue<Value> & {} extends infer T_6 ? T_6 extends SingleValue<Value> & {} ? T_6 extends typeof PrimitiveScalar ? true : false : never : never) extends infer T_7 ? T_7 extends (SingleValue<Value> & {} extends infer T_11 ? T_11 extends SingleValue<Value> & {} ? T_11 extends typeof PrimitiveScalar ? true : false : never : never) ? T_7 extends true ? false : (SingleValue<Value> & {} extends infer T_8 ? T_8 extends SingleValue<Value> & {} ? T_8 extends MapConstructor ? true : false : never : never) extends infer T_9 ? T_9 extends (SingleValue<Value> & {} extends infer T_10 ? T_10 extends SingleValue<Value> & {} ? T_10 extends MapConstructor ? true : false : never : never) ? T_9 extends true ? false : true : never : never : never : never : never : never : never : never, false, true>;
|
|
187
194
|
};
|
|
188
195
|
/** Builds a resolved field that is derived rather than treated as a stored property. */
|
|
189
|
-
export declare const resolve: <ExplicitType, Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never>(value: Value, option?: FieldOption<Value, MapValue
|
|
196
|
+
export declare const resolve: <ExplicitType, Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never>(value: Value, option?: WithoutTextRole<FieldOption<Value, MapValue>>) => FieldInfo<"resolve", Value, ExplicitType, MapValue, FieldKindSource<Value>, UnCls<FieldKindSource<Value>> extends BaseObject ? true : false, FieldKindSource<Value> extends infer T ? T extends FieldKindSource<Value> ? T extends EnumInstance<string, any> ? true : false : never : never, FieldKindSource<Value> extends infer T_1 ? T_1 extends FieldKindSource<Value> ? T_1 extends typeof PrimitiveScalar ? true : false : never : never, FieldKindSource<Value> extends infer T_2 ? T_2 extends FieldKindSource<Value> ? T_2 extends MapConstructor ? true : false : never : never, (UnCls<FieldKindSource<Value>> extends BaseObject ? true : false) extends infer T_3 ? T_3 extends (UnCls<FieldKindSource<Value>> extends BaseObject ? true : false) ? T_3 extends true ? false : (FieldKindSource<Value> extends infer T_4 ? T_4 extends FieldKindSource<Value> ? T_4 extends EnumInstance<string, any> ? true : false : never : never) extends infer T_5 ? T_5 extends (FieldKindSource<Value> extends infer T_12 ? T_12 extends FieldKindSource<Value> ? T_12 extends EnumInstance<string, any> ? true : false : never : never) ? T_5 extends true ? false : (FieldKindSource<Value> extends infer T_6 ? T_6 extends FieldKindSource<Value> ? T_6 extends typeof PrimitiveScalar ? true : false : never : never) extends infer T_7 ? T_7 extends (FieldKindSource<Value> extends infer T_11 ? T_11 extends FieldKindSource<Value> ? T_11 extends typeof PrimitiveScalar ? true : false : never : never) ? T_7 extends true ? false : (FieldKindSource<Value> extends infer T_8 ? T_8 extends FieldKindSource<Value> ? T_8 extends MapConstructor ? true : false : never : never) extends infer T_9 ? T_9 extends (FieldKindSource<Value> extends infer T_10 ? T_10 extends FieldKindSource<Value> ? T_10 extends MapConstructor ? true : false : never : never) ? T_9 extends true ? false : true : never : never : never : never : never : never : never : never, false, false>;
|
|
190
197
|
export type FieldBuilder = typeof field;
|
|
191
198
|
export type FieldResolver = typeof resolve;
|
|
192
199
|
export {};
|
|
@@ -8,7 +8,9 @@ import { AgentBridge } from "./AgentBridge.d.ts";
|
|
|
8
8
|
*
|
|
9
9
|
* Per zone view: a zone's `readState` reaches the keys its own subtree subscribes, and its `readScreen` and
|
|
10
10
|
* `highlight` reach into its own `data-agent-zone` container rather than the whole document. A page can shadow any
|
|
11
|
-
* of them by registering a hook tool of the same name — hook entries win over a source's.
|
|
11
|
+
* of them by registering a hook tool of the same name — hook entries win over a source's. **That is a root-scope
|
|
12
|
+
* move only**: inside a zone the hook entry is registered under its scope-prefixed name, which can never collide
|
|
13
|
+
* with the bare name a source publishes, so a zone drops a built-in with the session's `builtins` option instead.
|
|
12
14
|
*/
|
|
13
15
|
export declare class StoreSurfaceSource implements SurfaceSource {
|
|
14
16
|
#private;
|
|
@@ -16,6 +18,12 @@ export declare class StoreSurfaceSource implements SurfaceSource {
|
|
|
16
18
|
static readonly highlightClass = "akan-agent-highlight";
|
|
17
19
|
/** Mirrors the animation in that stylesheet: the class outlives the ring by nothing. */
|
|
18
20
|
static readonly highlightMs = 2400;
|
|
21
|
+
/**
|
|
22
|
+
* What `tools()` contributes, in the order it builds them — the list a session's `builtins` option selects from.
|
|
23
|
+
* A screen that declares a hook tool of one of these names is not in it: that entry is the screen's, not this
|
|
24
|
+
* source's, so withholding the built-ins never withholds a tool a component published on purpose.
|
|
25
|
+
*/
|
|
26
|
+
static readonly builtins: readonly ["navigate", "goBack", "readScreen", "readState", "highlight"];
|
|
19
27
|
/** Lazy by default: `AgentBridge.of()` walks the whole store, so it waits for the first enumeration. */
|
|
20
28
|
constructor(bridge?: AgentBridge);
|
|
21
29
|
tools: (view?: string[]) => ToolEntry[];
|
|
@@ -7,10 +7,18 @@ export type AgentFieldType = AgentSingleType | AgentSingleType[];
|
|
|
7
7
|
* A model class resolves to its state object rather than its instance type, so a component may hand over either
|
|
8
8
|
* the hydrated document or the plain data copied out of one — masking reads the model that was named, not the
|
|
9
9
|
* class the value still carries.
|
|
10
|
+
*
|
|
11
|
+
* A scalar is recognised by `refName` and has to be matched before `FIELD_META`: `via.ts` augments the global
|
|
12
|
+
* `String`, `Boolean`, `Date` and `Map` constructors with `DatabaseConstantStatics`, so those four carry field
|
|
13
|
+
* metadata and would otherwise read as models. A model carries no `refName`, and `Map` — carrying neither — falls
|
|
14
|
+
* through to the model branch and is refused at declaration time instead.
|
|
10
15
|
*/
|
|
11
16
|
export type AgentValueOf<T> = T extends readonly (infer F)[] ? AgentValueOf<F>[] : T extends {
|
|
12
17
|
refName: "Any";
|
|
13
18
|
} ? unknown : T extends EnumInstance<string, infer V> ? V : T extends DateConstructor ? Dayjs | Date | string : T extends {
|
|
19
|
+
refName: string;
|
|
20
|
+
[CLIENT_VALUE]: infer V;
|
|
21
|
+
} ? V : T extends {
|
|
14
22
|
[FIELD_META]: unknown;
|
|
15
23
|
} ? GetStateObject<UnCls<T>> : T extends {
|
|
16
24
|
[CLIENT_VALUE]: infer V;
|
package/types/ui/Agent/Chat.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import { type AgentRunner, type CompactOptions } from "../../vendor/use-agentic.d.ts";
|
|
2
|
+
import { type AgentRunner, type AgentSessionOptions, type CompactOptions, type SessionHistory } from "../../vendor/use-agentic.d.ts";
|
|
3
3
|
import type { AttachReader } from "./attachment.d.ts";
|
|
4
4
|
import type { PersistOption } from "./sessionHistory.d.ts";
|
|
5
|
+
import type { BuiltinOption } from "./sessionView.d.ts";
|
|
5
6
|
import type { VoiceEngine } from "./voice.d.ts";
|
|
6
7
|
export interface ChatProps {
|
|
7
8
|
/** Reaches whichever surface is showing — the launcher while closed, the panel while open. */
|
|
@@ -17,6 +18,13 @@ export interface ChatProps {
|
|
|
17
18
|
* messages left verbatim below the summary. Tune it per provider; `{ at: 0 }` turns it off.
|
|
18
19
|
*/
|
|
19
20
|
compact?: CompactOptions;
|
|
21
|
+
/**
|
|
22
|
+
* Which of the runtime's own tools this chat's agent gets — all of them by default, `false` none, an array
|
|
23
|
+
* exactly the ones it names. A chat that must not leave the screen it is on drops `navigate` and `goBack`.
|
|
24
|
+
*/
|
|
25
|
+
builtins?: BuiltinOption;
|
|
26
|
+
/** Called after a compaction replaced messages with one summary — where a host syncs its own watermark. */
|
|
27
|
+
onCompact?: AgentSessionOptions["onCompact"];
|
|
20
28
|
defaultOpen?: boolean;
|
|
21
29
|
/**
|
|
22
30
|
* Controlled open state. Pass it with `onOpenChange` to drive the panel from the app's own control — a header
|
|
@@ -26,8 +34,14 @@ export interface ChatProps {
|
|
|
26
34
|
onOpenChange?: (open: boolean) => void;
|
|
27
35
|
/** `false` draws no launcher, for an app that opens the panel from a control of its own. */
|
|
28
36
|
launcher?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Keeps the transcript across reloads — sessionStorage by default, `{ storage: "local" }` to outlive the tab, or
|
|
39
|
+
* a `SessionHistory` of the app's own to keep it anywhere else, a server included.
|
|
40
|
+
*
|
|
41
|
+
* Ignored, like every session option above it, when an enclosing `Agent.Zone` or `AgentProvider` already holds a
|
|
42
|
+
* session: this chat then binds to that one, and the options belong to whoever built it.
|
|
43
|
+
*/
|
|
44
|
+
persist?: PersistOption | SessionHistory;
|
|
31
45
|
/** Renders in the page flow instead of floating above it — a zone chat that lives inside its own section. */
|
|
32
46
|
inline?: boolean;
|
|
33
47
|
/** `false` gives the browser its own Cmd/Ctrl+L back, for an app whose shell already spends that chord. */
|
|
@@ -39,6 +53,13 @@ export interface ChatProps {
|
|
|
39
53
|
intro?: ReactNode;
|
|
40
54
|
/** Extra header controls, left of the built-in clear and close buttons. */
|
|
41
55
|
header?: ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* `false` draws no header bar at all — for an `inline` chat inside a panel the app already titles. The extra
|
|
58
|
+
* `header` controls go with it, and the clear action stays reachable as the `/new` command.
|
|
59
|
+
*/
|
|
60
|
+
chrome?: boolean;
|
|
61
|
+
/** The composer's opening text, read once at mount — where a `?prompt=` lands without sending it. */
|
|
62
|
+
defaultDraft?: string;
|
|
42
63
|
/**
|
|
43
64
|
* Reads a file the user attached into an attachment, or answers `null` to leave it to the built-in reader
|
|
44
65
|
* (images as bytes, text as text). This is where an app puts what needs a parser — a PDF's text, a spreadsheet's
|
|
@@ -60,6 +81,6 @@ export interface ChatProps {
|
|
|
60
81
|
* `persist` keeps it. An enclosing AgentProvider's session wins, which is how an app isolates a surface or swaps
|
|
61
82
|
* the loop while keeping this UI.
|
|
62
83
|
*/
|
|
63
|
-
export declare const DefaultChat: ({ className, title, instructions, runner, maxTurns, compact, defaultOpen, open: openProp, onOpenChange, launcher, persist, inline, shortcut, launcherClassName, panelClassName, intro, header, attach, voice, }: ChatProps) => ReactNode;
|
|
84
|
+
export declare const DefaultChat: ({ className, title, instructions, runner, maxTurns, compact, builtins, onCompact, defaultOpen, open: openProp, onOpenChange, launcher, persist, inline, shortcut, launcherClassName, panelClassName, intro, header, chrome, defaultDraft, attach, voice, }: ChatProps) => ReactNode;
|
|
64
85
|
declare const _default: import("react").ComponentType<ChatProps>;
|
|
65
86
|
export default _default;
|
package/types/ui/Agent/Zone.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import { type AgentRunner, type CompactOptions } from "../../vendor/use-agentic.d.ts";
|
|
2
|
+
import { type AgentRunner, type AgentSession, type AgentSessionOptions, type CompactOptions, type SessionHistory } from "../../vendor/use-agentic.d.ts";
|
|
3
3
|
import type { PersistOption } from "./sessionHistory.d.ts";
|
|
4
|
+
import type { BuiltinOption } from "./sessionView.d.ts";
|
|
4
5
|
export interface ZoneProps {
|
|
5
6
|
className?: string;
|
|
6
7
|
/** Names the zone; the scope id and the `data-agent-zone` container both derive from it. */
|
|
@@ -12,8 +13,26 @@ export interface ZoneProps {
|
|
|
12
13
|
maxTurns?: number;
|
|
13
14
|
/** When this zone's conversation summarizes itself — same contract as the chat's own `compact`. */
|
|
14
15
|
compact?: CompactOptions;
|
|
15
|
-
/**
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Which of the runtime's own tools this zone's agent gets — all of them by default, `false` none, an array
|
|
18
|
+
* exactly the ones it names. `builtins={["readScreen", "readState"]}` is how a zone that must not leave the
|
|
19
|
+
* screen stops being able to: the tools are withheld, not discouraged, so a prompt cannot talk the model past it.
|
|
20
|
+
*/
|
|
21
|
+
builtins?: BuiltinOption;
|
|
22
|
+
/**
|
|
23
|
+
* Keeps this zone's transcript across reloads, keyed by the zone's scope path — web storage by default, or a
|
|
24
|
+
* `SessionHistory` of the app's own to keep it anywhere else, a server included.
|
|
25
|
+
*/
|
|
26
|
+
persist?: PersistOption | SessionHistory;
|
|
27
|
+
/** Called after a compaction replaced messages with one summary — where a host syncs its own watermark. */
|
|
28
|
+
onCompact?: AgentSessionOptions["onCompact"];
|
|
29
|
+
/**
|
|
30
|
+
* Runs this zone on a session the app built instead of one of its own, and the app then owns it: unmounting the
|
|
31
|
+
* zone leaves it running. Read once at mount, like every other session option here.
|
|
32
|
+
*/
|
|
33
|
+
session?: AgentSession;
|
|
34
|
+
/** Hands the session out once it exists, for a page or store that wants to send into it or watch it. */
|
|
35
|
+
onSession?: (session: AgentSession) => void;
|
|
17
36
|
children: ReactNode;
|
|
18
37
|
}
|
|
19
38
|
/**
|
|
@@ -22,4 +41,4 @@ export interface ZoneProps {
|
|
|
22
41
|
* zones are views, never walls. An `Agent.Chat` mounted inside binds to this session automatically, so two zones
|
|
23
42
|
* on one screen run two conversations in parallel, each seeing only its own subtree.
|
|
24
43
|
*/
|
|
25
|
-
export declare const Zone: ({ className, id, label, instructions, runner, maxTurns, compact, persist, children, }: ZoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export declare const Zone: ({ className, id, label, instructions, runner, maxTurns, compact, builtins, persist, onCompact, session: provided, onSession, children, }: ZoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type AgentRunner, AgentSession, type CompactOptions } from "../../vendor/use-agentic.d.ts";
|
|
1
|
+
import { type AgentRunner, AgentSession, type AgentSessionOptions, type CompactOptions, type SessionHistory } from "../../vendor/use-agentic.d.ts";
|
|
2
2
|
import { type PersistOption } from "./sessionHistory.d.ts";
|
|
3
|
+
import { type BuiltinOption } from "./sessionView.d.ts";
|
|
3
4
|
export interface AgentSessionSetup {
|
|
4
5
|
/** Read per call rather than captured, so text the session builds follows a language switched mid-conversation. */
|
|
5
6
|
l: (key: string) => string;
|
|
@@ -9,10 +10,18 @@ export interface AgentSessionSetup {
|
|
|
9
10
|
instructions?: string;
|
|
10
11
|
maxTurns?: number;
|
|
11
12
|
compact?: CompactOptions;
|
|
12
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Which of the runtime's own tools this session gets: all of them by default, none with `false`, exactly the
|
|
15
|
+
* ones an array names. A zone whose conversation must stay on one screen takes `navigate` and `goBack` off it.
|
|
16
|
+
*/
|
|
17
|
+
builtins?: BuiltinOption;
|
|
18
|
+
/** Web storage by default; a `SessionHistory` puts the transcript wherever the app keeps it, including a server. */
|
|
19
|
+
persist?: PersistOption | SessionHistory;
|
|
20
|
+
/** Called after a compaction replaced messages with one summary — where a host syncs its own watermark. */
|
|
21
|
+
onCompact?: AgentSessionOptions["onCompact"];
|
|
13
22
|
}
|
|
14
23
|
/**
|
|
15
24
|
* The one place a chat session is wired to the akan runtime. Chat and Zone both build one, and building it twice
|
|
16
25
|
* is how a zone came to be the only surface with no `compact` option — an option added on one side of a copy.
|
|
17
26
|
*/
|
|
18
|
-
export declare const agentSessionOf: ({ l, view, runner, instructions, maxTurns, compact, persist, }: AgentSessionSetup) => AgentSession;
|
|
27
|
+
export declare const agentSessionOf: ({ l, view, runner, instructions, maxTurns, compact, builtins, persist, onCompact, }: AgentSessionSetup) => AgentSession;
|
|
@@ -14,5 +14,5 @@ export declare const Agent: {
|
|
|
14
14
|
StateKey: typeof StateKey;
|
|
15
15
|
Tool: typeof Tool;
|
|
16
16
|
Transcript: typeof Transcript;
|
|
17
|
-
Zone: ({ className, id, label, instructions, runner, maxTurns, compact, persist, children, }: import("./Zone.d.ts").ZoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
Zone: ({ className, id, label, instructions, runner, maxTurns, compact, builtins, persist, onCompact, session: provided, onSession, children, }: import("./Zone.d.ts").ZoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
};
|
|
@@ -11,4 +11,4 @@ export type PersistOption = boolean | {
|
|
|
11
11
|
* why the cap is applied *before* the pairing repair: the window it keeps can start between a tool call and the
|
|
12
12
|
* result answering it, and a transcript restored in that state is refused by the provider on its first turn.
|
|
13
13
|
*/
|
|
14
|
-
export declare const sessionHistoryOf: (persist: PersistOption | undefined, pathKey?: string) => SessionHistory | undefined;
|
|
14
|
+
export declare const sessionHistoryOf: (persist: PersistOption | SessionHistory | undefined, pathKey?: string) => SessionHistory | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StoreSurfaceSource } from "akanjs/store";
|
|
2
|
+
import type { AgenticSurface, SurfaceView } from "../../vendor/use-agentic.d.ts";
|
|
3
|
+
/** One of the tools the akan runtime contributes to every screen, whatever that screen declares. */
|
|
4
|
+
export type AgentBuiltin = (typeof StoreSurfaceSource.builtins)[number];
|
|
5
|
+
/** `true` (the default) takes all of them, `false` none, an array exactly the ones it names. */
|
|
6
|
+
export type BuiltinOption = boolean | AgentBuiltin[];
|
|
7
|
+
/**
|
|
8
|
+
* The half of the surface one session reads: scoped to its zone, and narrowed to the built-ins it was given.
|
|
9
|
+
*
|
|
10
|
+
* Narrowing happens here rather than on the source because the source is shared — two sessions read one registry,
|
|
11
|
+
* and a zone that must not navigate away cannot take `navigate` off the screen for the root agent too. A withheld
|
|
12
|
+
* tool is withheld from `call` as well as from the listing, answering the same "unknown tool" a name that was
|
|
13
|
+
* never registered gets: a tool the model can still reach by guessing its name is not withheld.
|
|
14
|
+
*/
|
|
15
|
+
export declare const sessionView: (surface: AgenticSurface, path: string[], builtins?: BuiltinOption) => SurfaceView;
|
package/types/ui/RecentTime.d.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { type Dayjs } from "akanjs/base";
|
|
2
|
+
export type RecentTimeRelativeUnit = "second" | "minute" | "hour" | "day" | "week" | "month" | "year";
|
|
3
|
+
export type RecentTimeRelativeStyle = "fromNow" | "always" | "auto";
|
|
4
|
+
export interface RecentTimeRelative {
|
|
5
|
+
unit: RecentTimeRelativeUnit;
|
|
6
|
+
/** Signed count in `unit`. Negative is past, positive is future, `0` is now. */
|
|
7
|
+
count: number;
|
|
8
|
+
date: Dayjs;
|
|
9
|
+
now: Dayjs;
|
|
10
|
+
defaultLabel: string;
|
|
11
|
+
}
|
|
12
|
+
export type RecentTimeRelativeFormat = RecentTimeRelativeStyle | ((relative: RecentTimeRelative) => string);
|
|
2
13
|
export interface RecentTimeProps {
|
|
3
14
|
/** Date value to render. Null renders nothing, and epoch placeholder values render --:--. */
|
|
4
15
|
date: Date | Dayjs | null;
|
|
@@ -6,7 +17,13 @@ export interface RecentTimeProps {
|
|
|
6
17
|
breakUnit?: Intl.RelativeTimeFormatUnit;
|
|
7
18
|
/** Use compact automatic formatting or always include date and time. */
|
|
8
19
|
format?: "full" | "auto";
|
|
20
|
+
/**
|
|
21
|
+
* Relative phrasing. `"fromNow"` (default) keeps dayjs locale strings (`하루 전`).
|
|
22
|
+
* `"always"` / `"auto"` use `Intl.RelativeTimeFormat` — `1일 전` vs `어제`.
|
|
23
|
+
* A function replaces the relative label; return `defaultLabel` to keep the default.
|
|
24
|
+
*/
|
|
25
|
+
relative?: RecentTimeRelativeFormat;
|
|
9
26
|
/** Additional classes for the trigger span. */
|
|
10
27
|
className?: string;
|
|
11
28
|
}
|
|
12
|
-
export declare const RecentTime: ({ date, breakUnit, format, className }: RecentTimeProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
29
|
+
export declare const RecentTime: ({ date, breakUnit, format, relative, className }: RecentTimeProps) => import("react/jsx-runtime").JSX.Element | null;
|
package/types/ui/index.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
export { SessionContext, useAgent } from "../vendor/use-agentic.d.ts";
|
|
1
|
+
export { AgentProvider, type AgentProviderProps, type AgentRunner, AgentSession, type AgentSessionOptions, type ChatMessage, type CompactOptions, type ContextBlock, httpRunner, type PublishedTool, type RunnerEvent, type RunnerRequest, SessionContext, type SessionHistory, type SurfaceView, useAgent, } from "../vendor/use-agentic.d.ts";
|
|
2
2
|
export { Agent } from "./Agent.d.ts";
|
|
3
3
|
export { type ApprovalProps, DefaultApproval } from "./Agent/Approval.d.ts";
|
|
4
|
-
export { agentSessionOf } from "./Agent/agentSessionOf.d.ts";
|
|
4
|
+
export { type AgentSessionSetup, agentSessionOf } from "./Agent/agentSessionOf.d.ts";
|
|
5
5
|
export { type AttachReader, maxAttachmentBytes } from "./Agent/attachment.d.ts";
|
|
6
6
|
export { type BubbleProps, DefaultBubble } from "./Agent/Bubble.d.ts";
|
|
7
7
|
export type { ChatProps } from "./Agent/Chat.d.ts";
|
|
8
8
|
export { type ChatCommand, ChatCommands } from "./Agent/ChatCommands.d.ts";
|
|
9
9
|
export { type ComposerProps, DefaultComposer } from "./Agent/Composer.d.ts";
|
|
10
|
+
export { fetchRunner } from "./Agent/fetchRunner.d.ts";
|
|
10
11
|
export { DefaultLauncher, type LauncherProps } from "./Agent/Launcher.d.ts";
|
|
11
12
|
export { type CodeProps, DefaultCode, DefaultMarkdown, type MarkdownProps } from "./Agent/Markdown.d.ts";
|
|
12
13
|
export { DefaultMenu, type MenuProps as AgentMenuProps, type MenuRow } from "./Agent/Menu.d.ts";
|
|
13
14
|
export { DefaultQuestion, type QuestionProps } from "./Agent/Question.d.ts";
|
|
14
15
|
export type { PersistOption } from "./Agent/sessionHistory.d.ts";
|
|
16
|
+
export type { AgentBuiltin, BuiltinOption } from "./Agent/sessionView.d.ts";
|
|
15
17
|
export { tokenCount } from "./Agent/tokenCount.d.ts";
|
|
16
18
|
export type { VoiceEngine, VoiceHandlers, VoiceListener, VoiceSpeech } from "./Agent/voice.d.ts";
|
|
17
19
|
export { agentAttrs } from "./agentAttrs.d.ts";
|
|
@@ -52,7 +54,7 @@ export { Pagination } from "./Pagination.d.ts";
|
|
|
52
54
|
export { Popconfirm } from "./Popconfirm.d.ts";
|
|
53
55
|
export { Portal } from "./Portal.d.ts";
|
|
54
56
|
export { Radio } from "./Radio.d.ts";
|
|
55
|
-
export { RecentTime } from "./RecentTime.d.ts";
|
|
57
|
+
export { RecentTime, type RecentTimeProps, type RecentTimeRelative, type RecentTimeRelativeFormat, type RecentTimeRelativeStyle, type RecentTimeRelativeUnit, } from "./RecentTime.d.ts";
|
|
56
58
|
export { Refresh } from "./Refresh.d.ts";
|
|
57
59
|
export { type BadgeVariants, type ButtonVariants, badgeRecipe, buttonRecipe, type InputSurfaceVariants, inputRecipe, recipe, tv, } from "./recipe.d.ts";
|
|
58
60
|
export { ScreenNavigator } from "./ScreenNavigator.d.ts";
|
|
@@ -2,7 +2,7 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
import { AgenticSurface } from "./AgenticSurface.d.ts";
|
|
3
3
|
import { AgentSession, type AgentSessionOptions } from "./AgentSession.d.ts";
|
|
4
4
|
import type { AgentRunner } from "./types.d.ts";
|
|
5
|
-
interface AgentProviderProps extends AgentSessionOptions {
|
|
5
|
+
export interface AgentProviderProps extends AgentSessionOptions {
|
|
6
6
|
surface?: AgenticSurface;
|
|
7
7
|
session?: AgentSession;
|
|
8
8
|
runner?: AgentRunner;
|
|
@@ -15,4 +15,3 @@ interface AgentProviderProps extends AgentSessionOptions {
|
|
|
15
15
|
* `useAgent` reads.
|
|
16
16
|
*/
|
|
17
17
|
export declare const AgentProvider: ({ surface, session, runner, children, ...options }: AgentProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export {};
|