@agentick/core 0.7.0 → 0.9.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/dist/.tsbuildinfo.build +1 -1
- package/dist/agentick-instance.d.ts.map +1 -1
- package/dist/agentick-instance.js +28 -0
- package/dist/agentick-instance.js.map +1 -1
- package/dist/app/inbox-storage.d.ts +24 -0
- package/dist/app/inbox-storage.d.ts.map +1 -0
- package/dist/app/inbox-storage.js +99 -0
- package/dist/app/inbox-storage.js.map +1 -0
- package/dist/app/session.d.ts +23 -2
- package/dist/app/session.d.ts.map +1 -1
- package/dist/app/session.js +308 -26
- package/dist/app/session.js.map +1 -1
- package/dist/app/types.d.ts +97 -0
- package/dist/app/types.d.ts.map +1 -1
- package/dist/app.d.ts +2 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +1 -0
- package/dist/app.js.map +1 -1
- package/dist/com/object-model.d.ts +9 -3
- package/dist/com/object-model.d.ts.map +1 -1
- package/dist/com/object-model.js +52 -24
- package/dist/com/object-model.js.map +1 -1
- package/dist/compiler/collector.d.ts.map +1 -1
- package/dist/compiler/collector.js +179 -11
- package/dist/compiler/collector.js.map +1 -1
- package/dist/component/component.d.ts +6 -0
- package/dist/component/component.d.ts.map +1 -1
- package/dist/component/component.js.map +1 -1
- package/dist/engine/tool-executor.d.ts +15 -1
- package/dist/engine/tool-executor.d.ts.map +1 -1
- package/dist/engine/tool-executor.js +64 -6
- package/dist/engine/tool-executor.js.map +1 -1
- package/dist/hooks/execution-context.d.ts +23 -0
- package/dist/hooks/execution-context.d.ts.map +1 -0
- package/dist/hooks/execution-context.js +33 -0
- package/dist/hooks/execution-context.js.map +1 -0
- package/dist/hooks/expandable.d.ts +29 -2
- package/dist/hooks/expandable.d.ts.map +1 -1
- package/dist/hooks/expandable.js +28 -7
- package/dist/hooks/expandable.js.map +1 -1
- package/dist/hooks/gate.d.ts +27 -0
- package/dist/hooks/gate.d.ts.map +1 -0
- package/dist/hooks/gate.js +59 -0
- package/dist/hooks/gate.js.map +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/jsx/components/auto-summary.d.ts +31 -0
- package/dist/jsx/components/auto-summary.d.ts.map +1 -0
- package/dist/jsx/components/auto-summary.js +83 -0
- package/dist/jsx/components/auto-summary.js.map +1 -0
- package/dist/jsx/components/collapsed.d.ts +12 -2
- package/dist/jsx/components/collapsed.d.ts.map +1 -1
- package/dist/jsx/components/collapsed.js +16 -1
- package/dist/jsx/components/collapsed.js.map +1 -1
- package/dist/jsx/components/content.d.ts +26 -13
- package/dist/jsx/components/content.d.ts.map +1 -1
- package/dist/jsx/components/content.js +64 -15
- package/dist/jsx/components/content.js.map +1 -1
- package/dist/jsx/components/index.d.ts +1 -0
- package/dist/jsx/components/index.d.ts.map +1 -1
- package/dist/jsx/components/index.js +1 -0
- package/dist/jsx/components/index.js.map +1 -1
- package/dist/jsx/components/primitives.d.ts +34 -2
- package/dist/jsx/components/primitives.d.ts.map +1 -1
- package/dist/jsx/components/primitives.js +82 -24
- package/dist/jsx/components/primitives.js.map +1 -1
- package/dist/local-transport.d.ts.map +1 -1
- package/dist/local-transport.js +4 -0
- package/dist/local-transport.js.map +1 -1
- package/dist/model/adapter.d.ts +9 -1
- package/dist/model/adapter.d.ts.map +1 -1
- package/dist/model/adapter.js +11 -4
- package/dist/model/adapter.js.map +1 -1
- package/dist/model/embedding.d.ts +55 -0
- package/dist/model/embedding.d.ts.map +1 -0
- package/dist/model/embedding.js +43 -0
- package/dist/model/embedding.js.map +1 -0
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +2 -0
- package/dist/model/index.js.map +1 -1
- package/dist/model/model.d.ts +6 -0
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js.map +1 -1
- package/dist/renderers/base.d.ts +9 -0
- package/dist/renderers/base.d.ts.map +1 -1
- package/dist/renderers/base.js +31 -0
- package/dist/renderers/base.js.map +1 -1
- package/dist/renderers/markdown.d.ts.map +1 -1
- package/dist/renderers/markdown.js +21 -3
- package/dist/renderers/markdown.js.map +1 -1
- package/dist/renderers/xml.d.ts.map +1 -1
- package/dist/renderers/xml.js +9 -1
- package/dist/renderers/xml.js.map +1 -1
- package/dist/testing/mock-app.d.ts.map +1 -1
- package/dist/testing/mock-app.js +12 -0
- package/dist/testing/mock-app.js.map +1 -1
- package/dist/tool/index.d.ts +1 -0
- package/dist/tool/index.d.ts.map +1 -1
- package/dist/tool/index.js +1 -0
- package/dist/tool/index.js.map +1 -1
- package/dist/tool/tool-procedure.d.ts +17 -0
- package/dist/tool/tool-procedure.d.ts.map +1 -0
- package/dist/tool/tool-procedure.js +39 -0
- package/dist/tool/tool-procedure.js.map +1 -0
- package/dist/tool/tool.d.ts +10 -0
- package/dist/tool/tool.d.ts.map +1 -1
- package/dist/tool/tool.js +7 -6
- package/dist/tool/tool.js.map +1 -1
- package/dist/utils/classify-error.d.ts +1 -1
- package/dist/utils/classify-error.d.ts.map +1 -1
- package/dist/utils/classify-error.js +8 -0
- package/dist/utils/classify-error.js.map +1 -1
- package/package.json +51 -3
package/dist/index.js
CHANGED
|
@@ -15,7 +15,9 @@ export { createApp, Agentick, AgentickInstance, run, runComponent, SessionImpl }
|
|
|
15
15
|
// ============================================================================
|
|
16
16
|
// JSX Components (re-export from jsx/components)
|
|
17
17
|
// ============================================================================
|
|
18
|
-
export { Model, Section, Timeline, Message, User, Assistant, System, ToolResult as ToolResultComponent, Markdown, XML, Collapsed,
|
|
18
|
+
export { Model, Section, Timeline, Message, User, Assistant, System, ToolResult as ToolResultComponent, Markdown, XML, Ephemeral, Grounding, Collapsed,
|
|
19
|
+
// Auto-summary for collapsed components
|
|
20
|
+
autoMessageSummary, autoSectionSummary, autoContentSummary,
|
|
19
21
|
// Token budget (types + pure functions, used via Timeline props)
|
|
20
22
|
compactEntries, } from "./jsx/components/index";
|
|
21
23
|
// ============================================================================
|
|
@@ -27,7 +29,7 @@ export { useState, useEffect, useReducer, useMemo, useCallback, useRef } from "r
|
|
|
27
29
|
// ============================================================================
|
|
28
30
|
export { useSignal, useComputed, useCom, useTickState,
|
|
29
31
|
// Lifecycle hooks
|
|
30
|
-
useOnMount, useOnUnmount, useOnTickStart, useOnTickEnd, useAfterCompile, useOnExecutionEnd, useContinuation,
|
|
32
|
+
useOnMount, useOnUnmount, useOnTickStart, useOnTickEnd, useAfterCompile, useOnExecutionEnd, useOnExecutionStart, useContinuation,
|
|
31
33
|
// Data hooks
|
|
32
34
|
useData, useInvalidateData, useComState,
|
|
33
35
|
// Timeline
|
|
@@ -36,6 +38,8 @@ useTimeline,
|
|
|
36
38
|
useResolved,
|
|
37
39
|
// Expandable content
|
|
38
40
|
Expandable,
|
|
41
|
+
// Gates
|
|
42
|
+
gate, useGate,
|
|
39
43
|
// Knobs
|
|
40
44
|
knob, isKnob, useKnob, Knobs, useKnobsContext, useKnobsContextOptional,
|
|
41
45
|
// Context utilization
|
|
@@ -43,7 +47,7 @@ useContextInfo, useContextInfoStore, createContextInfoStore, ContextInfoProvider
|
|
|
43
47
|
// ============================================================================
|
|
44
48
|
// Tools
|
|
45
49
|
// ============================================================================
|
|
46
|
-
export { createTool } from "./tool/index";
|
|
50
|
+
export { createTool, useToolProcedure } from "./tool/index";
|
|
47
51
|
// ============================================================================
|
|
48
52
|
// Model
|
|
49
53
|
// ============================================================================
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAC/E,cAAc,kBAAkB,CAAC;AAEjC,+EAA+E;A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cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,GAGpB,MAAM,SAAS,CAAC;AAEjB,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAC/E,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAG5D,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,cAAc,SAAS,CAAC;AAOxB,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,+EAA+E;AAC/E,WAAW;AACX,+EAA+E;AAC/E,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-summary functions for collapsed components.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions — no React, fully testable.
|
|
5
|
+
* Each returns a short text summary suitable for:
|
|
6
|
+
* - Knob description (model sees this in set_knob tool)
|
|
7
|
+
* - Collapsed rendering fallback (when collapsed={true})
|
|
8
|
+
*/
|
|
9
|
+
import type { ContentBlock, MessageRoles } from "@agentick/shared";
|
|
10
|
+
/**
|
|
11
|
+
* Auto-summarize a message.
|
|
12
|
+
*
|
|
13
|
+
* Role-aware:
|
|
14
|
+
* - Assistant messages: text-only (no tool/media metadata).
|
|
15
|
+
* Including fake metadata like "[tools: shell ×3]" in assistant
|
|
16
|
+
* summaries causes ICL corruption — the model starts producing
|
|
17
|
+
* literal metadata strings instead of real tool calls.
|
|
18
|
+
* - Other roles: role prefix + truncated text.
|
|
19
|
+
*/
|
|
20
|
+
export declare function autoMessageSummary(role: MessageRoles, content?: ContentBlock[] | string | any[]): string;
|
|
21
|
+
/**
|
|
22
|
+
* Auto-summarize a section.
|
|
23
|
+
* Uses title, falls back to id, falls back to "section".
|
|
24
|
+
*/
|
|
25
|
+
export declare function autoSectionSummary(title?: string, id?: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Auto-summarize a content block by type.
|
|
28
|
+
* Returns a type-specific default like "[image]", "[code: ts]", etc.
|
|
29
|
+
*/
|
|
30
|
+
export declare function autoContentSummary(type: string, props: Record<string, any>): string;
|
|
31
|
+
//# sourceMappingURL=auto-summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-summary.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/auto-summary.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAUnE;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,YAAY,EAAE,GAAG,MAAM,GAAG,GAAG,EAAE,GACxC,MAAM,CAaR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAgCnF"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-summary functions for collapsed components.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions — no React, fully testable.
|
|
5
|
+
* Each returns a short text summary suitable for:
|
|
6
|
+
* - Knob description (model sees this in set_knob tool)
|
|
7
|
+
* - Collapsed rendering fallback (when collapsed={true})
|
|
8
|
+
*/
|
|
9
|
+
import { extractText } from "@agentick/shared";
|
|
10
|
+
const MAX_SUMMARY_LENGTH = 80;
|
|
11
|
+
function truncate(text, max = MAX_SUMMARY_LENGTH) {
|
|
12
|
+
if (text.length <= max)
|
|
13
|
+
return text;
|
|
14
|
+
return text.slice(0, max - 1) + "…";
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Auto-summarize a message.
|
|
18
|
+
*
|
|
19
|
+
* Role-aware:
|
|
20
|
+
* - Assistant messages: text-only (no tool/media metadata).
|
|
21
|
+
* Including fake metadata like "[tools: shell ×3]" in assistant
|
|
22
|
+
* summaries causes ICL corruption — the model starts producing
|
|
23
|
+
* literal metadata strings instead of real tool calls.
|
|
24
|
+
* - Other roles: role prefix + truncated text.
|
|
25
|
+
*/
|
|
26
|
+
export function autoMessageSummary(role, content) {
|
|
27
|
+
if (!content)
|
|
28
|
+
return `[${role}]`;
|
|
29
|
+
const text = typeof content === "string" ? content : extractText(content, " ");
|
|
30
|
+
if (!text)
|
|
31
|
+
return `[${role}]`;
|
|
32
|
+
if (role === "assistant") {
|
|
33
|
+
// Text-only for assistant — never include tool/media metadata
|
|
34
|
+
return truncate(text);
|
|
35
|
+
}
|
|
36
|
+
return truncate(`${role}: ${text}`);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Auto-summarize a section.
|
|
40
|
+
* Uses title, falls back to id, falls back to "section".
|
|
41
|
+
*/
|
|
42
|
+
export function autoSectionSummary(title, id) {
|
|
43
|
+
return title ?? id ?? "section";
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Auto-summarize a content block by type.
|
|
47
|
+
* Returns a type-specific default like "[image]", "[code: ts]", etc.
|
|
48
|
+
*/
|
|
49
|
+
export function autoContentSummary(type, props) {
|
|
50
|
+
switch (type) {
|
|
51
|
+
case "Text":
|
|
52
|
+
case "text": {
|
|
53
|
+
const text = props.text ?? props.children;
|
|
54
|
+
if (typeof text === "string")
|
|
55
|
+
return truncate(text);
|
|
56
|
+
return "[text]";
|
|
57
|
+
}
|
|
58
|
+
case "Image":
|
|
59
|
+
case "image":
|
|
60
|
+
return props.altText ? `[image: ${truncate(props.altText, 40)}]` : "[image]";
|
|
61
|
+
case "Code":
|
|
62
|
+
case "code":
|
|
63
|
+
return props.language ? `[code: ${props.language}]` : "[code]";
|
|
64
|
+
case "Json":
|
|
65
|
+
case "json":
|
|
66
|
+
return "[json]";
|
|
67
|
+
case "Document":
|
|
68
|
+
case "document":
|
|
69
|
+
return props.title ? `[document: ${truncate(props.title, 40)}]` : "[document]";
|
|
70
|
+
case "Audio":
|
|
71
|
+
case "audio":
|
|
72
|
+
return "[audio]";
|
|
73
|
+
case "Video":
|
|
74
|
+
case "video":
|
|
75
|
+
return "[video]";
|
|
76
|
+
case "ToolUse":
|
|
77
|
+
case "tooluse":
|
|
78
|
+
return props.name ? `[tool: ${props.name}]` : "[tool]";
|
|
79
|
+
default:
|
|
80
|
+
return `[${type}]`;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=auto-summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-summary.js","sourceRoot":"","sources":["../../../src/jsx/components/auto-summary.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,SAAS,QAAQ,CAAC,IAAY,EAAE,GAAG,GAAG,kBAAkB;IACtD,IAAI,IAAI,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;AACtC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAkB,EAClB,OAAyC;IAEzC,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,IAAI,GAAG,CAAC;IAEjC,MAAM,IAAI,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,OA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AC,CAAC,cAAc,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC;QACjF,KAAK,OAAO,CAAC;QACb,KAAK,OAAO;YACV,OAAO,SAAS,CAAC;QACnB,KAAK,OAAO,CAAC;QACb,KAAK,OAAO;YACV,OAAO,SAAS,CAAC;QACnB,KAAK,SAAS,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC;QACzD;YACE,OAAO,IAAI,IAAI,GAAG,CAAC;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -2,11 +2,21 @@ import React from "react";
|
|
|
2
2
|
export interface CollapsedProps {
|
|
3
3
|
name: string;
|
|
4
4
|
group?: string;
|
|
5
|
-
children?:
|
|
5
|
+
children?: React.ReactNode;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Collapsed intrinsic wrapper.
|
|
9
|
+
*
|
|
10
|
+
* Compiles to a text content block with semantic metadata:
|
|
11
|
+
* - `rendererTag: "collapsed"` for format-specific rendering
|
|
12
|
+
* - `rendererAttrs: { name, group }` for expand targeting
|
|
13
|
+
*
|
|
14
|
+
* String children pass through as `text` prop.
|
|
15
|
+
* ReactNode children render as child elements — the collector's
|
|
16
|
+
* extractText recursively collects text from them.
|
|
17
|
+
*/
|
|
7
18
|
export declare function Collapsed({ name, group, children }: CollapsedProps): React.ReactElement<{
|
|
8
19
|
name: string;
|
|
9
20
|
group: string | undefined;
|
|
10
|
-
text: string;
|
|
11
21
|
}, string | React.JSXElementConstructor<any>>;
|
|
12
22
|
//# sourceMappingURL=collapsed.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsed.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/collapsed.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"collapsed.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/collapsed.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,cAAc;;;8CAMlE"}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
const h = React.createElement;
|
|
3
|
+
/**
|
|
4
|
+
* Collapsed intrinsic wrapper.
|
|
5
|
+
*
|
|
6
|
+
* Compiles to a text content block with semantic metadata:
|
|
7
|
+
* - `rendererTag: "collapsed"` for format-specific rendering
|
|
8
|
+
* - `rendererAttrs: { name, group }` for expand targeting
|
|
9
|
+
*
|
|
10
|
+
* String children pass through as `text` prop.
|
|
11
|
+
* ReactNode children render as child elements — the collector's
|
|
12
|
+
* extractText recursively collects text from them.
|
|
13
|
+
*/
|
|
3
14
|
export function Collapsed({ name, group, children }) {
|
|
4
|
-
|
|
15
|
+
if (typeof children === "string" || typeof children === "number") {
|
|
16
|
+
return h("Collapsed", { name, group, text: String(children) });
|
|
17
|
+
}
|
|
18
|
+
// ReactNode children: render as child elements for recursive text extraction
|
|
19
|
+
return h("Collapsed", { name, group }, children);
|
|
5
20
|
}
|
|
6
21
|
//# sourceMappingURL=collapsed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsed.js","sourceRoot":"","sources":["../../../src/jsx/components/collapsed.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC;AAQ9B,MAAM,UAAU,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAkB;IACjE,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,IAAI,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"collapsed.js","sourceRoot":"","sources":["../../../src/jsx/components/collapsed.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC;AAQ9B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAkB;IACjE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjE,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjE,CAAC;IACD,6EAA6E;IAC7E,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,QAAQ,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { JSX } from "react";
|
|
2
3
|
import type { ContentBlock as ContentBlockType, MediaSource } from "@agentick/shared";
|
|
3
4
|
import type { CodeLanguage } from "@agentick/shared";
|
|
4
5
|
import type { ComponentBaseProps } from "../jsx-types";
|
|
6
|
+
/**
|
|
7
|
+
* Collapse props shared by all expandable content blocks.
|
|
8
|
+
* When `collapsed` is provided, the block renders an Expandable wrapper
|
|
9
|
+
* that shows a summary by default, expandable via set_knob.
|
|
10
|
+
*
|
|
11
|
+
* - `true`: auto-summarize based on content block type
|
|
12
|
+
* - `string`: use this string as the collapsed summary
|
|
13
|
+
* - `ReactNode`: render this as collapsed content (must produce text)
|
|
14
|
+
*/
|
|
15
|
+
export interface CollapseProps {
|
|
16
|
+
collapsed?: boolean | string | React.ReactNode;
|
|
17
|
+
collapsedName?: string;
|
|
18
|
+
collapsedGroup?: string;
|
|
19
|
+
}
|
|
5
20
|
/**
|
|
6
21
|
* Content component primitives for composing Message content.
|
|
7
22
|
* These provide a React-like API for building ContentBlock[].
|
|
8
23
|
*/
|
|
9
|
-
export interface ContentBlockProps extends ComponentBaseProps {
|
|
24
|
+
export interface ContentBlockProps extends ComponentBaseProps, CollapseProps {
|
|
10
25
|
id?: string;
|
|
11
26
|
}
|
|
12
27
|
export type { ContentBlockType };
|
|
@@ -14,19 +29,9 @@ export type { ContentBlockType };
|
|
|
14
29
|
* Text content block.
|
|
15
30
|
* Usage: <Text>Hello world</Text> or <Text text="Hello" />
|
|
16
31
|
*
|
|
17
|
-
* Children take precedence over text prop (React convention - explicit wins).
|
|
18
|
-
* Children can include JSX formatting elements (bold, italic, code, etc.)
|
|
19
|
-
* which will be collected and formatted appropriately.
|
|
20
|
-
*
|
|
21
32
|
* @example
|
|
22
|
-
* // Plain text
|
|
23
33
|
* <Text>Hello world</Text>
|
|
24
|
-
*
|
|
25
|
-
* // With inline formatting
|
|
26
34
|
* <Text>Hello <b>bold</b> and <inlineCode>code</inlineCode></Text>
|
|
27
|
-
*
|
|
28
|
-
* // With dynamic content
|
|
29
|
-
* <Text><b>{isOld ? '[OLD] ' : ''}</b>{message.text}</Text>
|
|
30
35
|
*/
|
|
31
36
|
export interface TextProps extends ContentBlockProps {
|
|
32
37
|
children?: any;
|
|
@@ -86,8 +91,6 @@ export declare function Code(props: CodeProps): JSX.Element;
|
|
|
86
91
|
/**
|
|
87
92
|
* JSON content block.
|
|
88
93
|
* Usage: <Json data={{ key: 'value' }} />
|
|
89
|
-
*
|
|
90
|
-
* Children take precedence over text prop (React convention - explicit wins).
|
|
91
94
|
*/
|
|
92
95
|
export interface JsonProps extends ContentBlockProps {
|
|
93
96
|
data?: any;
|
|
@@ -95,4 +98,14 @@ export interface JsonProps extends ContentBlockProps {
|
|
|
95
98
|
text?: string;
|
|
96
99
|
}
|
|
97
100
|
export declare function Json(props: JsonProps): JSX.Element;
|
|
101
|
+
/**
|
|
102
|
+
* Tool use content block.
|
|
103
|
+
* Usage: <ToolUse name="shell" toolUseId="call_1" input={{ cmd: "ls" }} />
|
|
104
|
+
*/
|
|
105
|
+
export interface ToolUseProps extends ContentBlockProps {
|
|
106
|
+
name: string;
|
|
107
|
+
toolUseId: string;
|
|
108
|
+
input?: Record<string, unknown>;
|
|
109
|
+
}
|
|
110
|
+
export declare function ToolUse(props: ToolUseProps): JSX.Element;
|
|
98
111
|
//# sourceMappingURL=content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/content.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,IAAI,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAYvD;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MA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AAM,CAAC;CACrB;AACD,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAGpD;AAMD;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,iBAAiB;IAClD,QAAQ,EAAE,YAAY,GAAG,MAAM,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AACD,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAGlD;AAMD;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,iBAAiB;IAClD,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AACD,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAgBlD;AAMD;;;GAGG;AACH,MAAM,WAAW,YAAa,SAAQ,iBAAiB;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AACD,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CAGxD"}
|
|
@@ -1,36 +1,85 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { Expandable } from "../../hooks/expandable";
|
|
3
|
+
import { Collapsed } from "./collapsed";
|
|
4
|
+
import { autoContentSummary } from "./auto-summary";
|
|
2
5
|
// Helper for createElement
|
|
3
6
|
const h = React.createElement;
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Helper to strip collapse props before passing to intrinsic elements
|
|
9
|
+
// ============================================================================
|
|
10
|
+
function stripCollapse(props) {
|
|
11
|
+
const { collapsed: _c, collapsedName: _cn, collapsedGroup: _cg, ...rest } = props;
|
|
12
|
+
return rest;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Wrap an intrinsic element in Expandable when collapsed prop is set.
|
|
16
|
+
* Collapsed state renders a Collapsed intrinsic; expanded renders the original block.
|
|
17
|
+
*
|
|
18
|
+
* The `intrinsicType` and `intrinsicProps` are needed for auto-summary
|
|
19
|
+
* when collapsed={true} — the summary is derived from the block type and props.
|
|
20
|
+
*/
|
|
21
|
+
function withCollapse(props, intrinsic, intrinsicType, intrinsicProps) {
|
|
22
|
+
if (props.collapsed === undefined || props.collapsed === false)
|
|
23
|
+
return intrinsic;
|
|
24
|
+
// Derive knob summary (always a string, for set_knob tool description)
|
|
25
|
+
const summary = typeof props.collapsed === "string"
|
|
26
|
+
? props.collapsed
|
|
27
|
+
: autoContentSummary(intrinsicType, intrinsicProps);
|
|
28
|
+
// Derive collapsed children for the Collapsed intrinsic
|
|
29
|
+
const collapsedChildren = props.collapsed === true ? summary : props.collapsed;
|
|
30
|
+
return h(Expandable, {
|
|
31
|
+
name: props.collapsedName,
|
|
32
|
+
group: props.collapsedGroup,
|
|
33
|
+
summary,
|
|
34
|
+
children: (expanded, name) => expanded ? intrinsic : h(Collapsed, { name, group: props.collapsedGroup }, collapsedChildren),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
4
37
|
export function Text(props) {
|
|
5
|
-
|
|
38
|
+
const stripped = stripCollapse(props);
|
|
39
|
+
return withCollapse(props, h("Text", stripped), "Text", stripped);
|
|
6
40
|
}
|
|
7
41
|
export function Image(props) {
|
|
8
|
-
|
|
42
|
+
const stripped = stripCollapse(props);
|
|
43
|
+
return withCollapse(props, h("Image", stripped), "Image", stripped);
|
|
9
44
|
}
|
|
10
45
|
export function Document(props) {
|
|
11
|
-
|
|
46
|
+
const stripped = stripCollapse(props);
|
|
47
|
+
return withCollapse(props, h("Document", stripped), "Document", stripped);
|
|
12
48
|
}
|
|
13
49
|
export function Audio(props) {
|
|
14
|
-
|
|
50
|
+
const stripped = stripCollapse(props);
|
|
51
|
+
return withCollapse(props, h("Audio", stripped), "Audio", stripped);
|
|
15
52
|
}
|
|
16
53
|
export function Video(props) {
|
|
17
|
-
|
|
54
|
+
const stripped = stripCollapse(props);
|
|
55
|
+
return withCollapse(props, h("Video", stripped), "Video", stripped);
|
|
18
56
|
}
|
|
19
57
|
export function Code(props) {
|
|
20
|
-
|
|
58
|
+
const stripped = stripCollapse(props);
|
|
59
|
+
return withCollapse(props, h("Code", stripped), "Code", stripped);
|
|
21
60
|
}
|
|
22
61
|
export function Json(props) {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
62
|
+
const stripped = stripCollapse(props);
|
|
63
|
+
const childrenText = stripped.children !== undefined
|
|
64
|
+
? typeof stripped.children === "string"
|
|
65
|
+
? stripped.children
|
|
66
|
+
: stripped.children?.join("") || ""
|
|
27
67
|
: undefined;
|
|
28
|
-
const text = childrenText ??
|
|
29
|
-
|
|
30
|
-
...omit(
|
|
31
|
-
text: text || JSON.stringify(
|
|
32
|
-
}
|
|
68
|
+
const text = childrenText ?? stripped.text ?? "";
|
|
69
|
+
const intrinsicProps = {
|
|
70
|
+
...omit(stripped, ["children"]),
|
|
71
|
+
text: text || JSON.stringify(stripped.data),
|
|
72
|
+
};
|
|
73
|
+
const intrinsic = h("Json", intrinsicProps);
|
|
74
|
+
return withCollapse(props, intrinsic, "Json", intrinsicProps);
|
|
75
|
+
}
|
|
76
|
+
export function ToolUse(props) {
|
|
77
|
+
const stripped = stripCollapse(props);
|
|
78
|
+
return withCollapse(props, h("ToolUse", stripped), "ToolUse", stripped);
|
|
33
79
|
}
|
|
80
|
+
// ============================================================================
|
|
81
|
+
// Helpers
|
|
82
|
+
// ============================================================================
|
|
34
83
|
function omit(obj, keys) {
|
|
35
84
|
const result = { ...obj };
|
|
36
85
|
for (const key of keys) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../../src/jsx/components/content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../../src/jsx/components/content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,2BAA2B;AAC3B,MAAM,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC;AAgC9B,+EAA+E;AAC/E,sEAAsE;AACtE,+EAA+E;AAE/E,SAAS,aAAa,CAA0B,KAAQ;IACtD,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAClF,OAAO,IAAW,CAAC;AACrB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,YAAY,CACnB,KAAoB,EACpB,SAAsB,EACtB,aAAqB,EACrB,cAAmC;IAEnC,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,KAAK,CAAC,SAAS,KAAK,KAAK;QAAE,OAAO,SAAS,CAAC;IAEjF,uEAAuE;IACvE,MAAM,OAAO,GACX,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ;QACjC,CAAC,CAAC,KAAK,CAAC,SAAS;QACjB,CAAC,CAAC,kBAAkB,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IAExD,wDAAwD;IACxD,MAAM,iBAAiB,GAAoB,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC;IAEhG,OAAO,CAAC,CAAC,UAAU,EAAE;QACnB,IAAI,EAAE,KAAK,CAAC,aAAa;QACzB,KAAK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EAAE,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAC1E,CAAC;AAED,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E,SAAS,IAAI,CAAuB,GAAM,EAAE,IAAS;IACnD,MAAM,MAAM,GAAQ,EAAE,GAAG,GAAG,EAAE,CAAC;IAC/B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/jsx/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/jsx/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ContentBlock, Message, MessageRoles } from "@agentick/shared";
|
|
2
|
+
import React from "react";
|
|
2
3
|
import type { JSX } from "react";
|
|
3
4
|
import type { JSX as AgentickJSX } from "../jsx-runtime";
|
|
4
5
|
import type { StreamEvent } from "../../engine/engine-events";
|
|
@@ -66,12 +67,31 @@ export type EntryProps = {
|
|
|
66
67
|
} & EntryCommonProps;
|
|
67
68
|
}[EntryKind];
|
|
68
69
|
export declare function Entry(props: EntryProps): JSX.Element;
|
|
70
|
+
/**
|
|
71
|
+
* Section primitive component props.
|
|
72
|
+
* Extends intrinsic section props with collapse support.
|
|
73
|
+
*/
|
|
74
|
+
export type SectionProps = AgentickJSX.IntrinsicElements["section"] & {
|
|
75
|
+
/**
|
|
76
|
+
* Enables collapse behavior.
|
|
77
|
+
* - `true`: auto-summarize from title/id
|
|
78
|
+
* - `string`: use as collapsed summary
|
|
79
|
+
* - `ReactNode`: render as collapsed content (must produce text)
|
|
80
|
+
*/
|
|
81
|
+
collapsed?: boolean | string | React.ReactNode;
|
|
82
|
+
/** Explicit knob name for collapse toggle. Auto-generated if omitted. */
|
|
83
|
+
collapsedName?: string;
|
|
84
|
+
/** Group name for batch expansion via set_knob. */
|
|
85
|
+
collapsedGroup?: string;
|
|
86
|
+
};
|
|
69
87
|
/**
|
|
70
88
|
* Section primitive component.
|
|
71
89
|
* When used in JSX: <Section id="..." content="..." />
|
|
72
90
|
* Returns an intrinsic "section" element for react-reconciler compatibility.
|
|
91
|
+
*
|
|
92
|
+
* When `collapsed` is provided, enables collapse/expand behavior via knob.
|
|
73
93
|
*/
|
|
74
|
-
export declare function Section(props:
|
|
94
|
+
export declare function Section(props: SectionProps): JSX.Element;
|
|
75
95
|
/**
|
|
76
96
|
* Message primitive component props.
|
|
77
97
|
* Allows spreading Message objects directly, plus JSX-specific props.
|
|
@@ -88,16 +108,28 @@ export type MessageProps = Partial<Omit<Message, "content" | "role">> & {
|
|
|
88
108
|
tags?: string[];
|
|
89
109
|
visibility?: "model" | "observer" | "log";
|
|
90
110
|
children?: any;
|
|
111
|
+
/**
|
|
112
|
+
* Enables collapse behavior.
|
|
113
|
+
* - `true`: auto-summarize from role and content
|
|
114
|
+
* - `string`: use as collapsed summary
|
|
115
|
+
* - `ReactNode`: render as collapsed content (must produce text)
|
|
116
|
+
*/
|
|
117
|
+
collapsed?: boolean | string | React.ReactNode;
|
|
118
|
+
/** Explicit knob name for collapse toggle. Auto-generated if omitted. */
|
|
119
|
+
collapsedName?: string;
|
|
120
|
+
/** Group name for batch expansion via set_knob. */
|
|
121
|
+
collapsedGroup?: string;
|
|
91
122
|
} & ComponentBaseProps;
|
|
92
123
|
/**
|
|
93
124
|
* Message primitive component.
|
|
94
|
-
* Semantic sugar wrapper that wraps Entry with kind="message" for intuitive API.
|
|
95
125
|
*
|
|
96
126
|
* Accepts Message objects via spreading, converts to Entry structure.
|
|
127
|
+
* When `collapsed` is provided, enables collapse/expand behavior via knob.
|
|
97
128
|
*
|
|
98
129
|
* Usage:
|
|
99
130
|
* <Message role="user">Hello</Message>
|
|
100
131
|
* <Message {...messageFromTimeline} tags={['important']} />
|
|
132
|
+
* <Message {...msg} collapsed="[ref:3] user asked about weather" />
|
|
101
133
|
* Compiles to: <Entry kind="message" message={{ role: 'user', content: [...] }} />
|
|
102
134
|
*/
|
|
103
135
|
export declare function Message(props: MessageProps): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/primitives.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/jsx/components/primitives.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAUvD,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAExF;;;;;;;;GAQG;AACH;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,WAAW,CAAC;CACpB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