@ai-matrx/chat 0.4.9 → 0.4.12
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/CHANGELOG.md +53 -0
- package/dist/agents/components/context-items/bodies/ContextInputBody.js +1 -1
- package/dist/agents/components/context-items/bodies/GenericBody.js +1 -1
- package/dist/agents/components/conversation-actions/conversation-verbs.js +1 -1
- package/dist/agents/components/inputs/smart-input/RunSkillPicker.js +1 -1
- package/dist/agents/components/live-run/LiveRunDisplay.js +1 -1
- package/dist/agents/components/live-run/LiveRunProgress.js +1 -1
- package/dist/agents/components/live-run/RunSetDisplay.js +1 -1
- package/dist/agents/components/messages-display/assistant/AgentAssistantMessage.js +2 -2
- package/dist/agents/components/messages-display/assistant/InPlaceAnswerEditor.js +1 -1
- package/dist/agents/components/messages-display/conversation-tools/find-in-conversation.js +1 -1
- package/dist/agents/components/messages-display/message-options/buildTaskSeedFromMessage.js +1 -1
- package/dist/agents/components/messages-display/user/AgentUserMessage.js +1 -1
- package/dist/agents/components/messages-display/user/FirstTurnVariables.js +1 -1
- package/dist/agents/components/run/AgentStatusIndicator.js +1 -1
- package/dist/agents/components/run/RunJobWorkingLine.js +1 -1
- package/dist/agents/components/shared/AgentNewRunButton.js +1 -1
- package/dist/agents/components/shared/AgentPlanningIndicator.js +1 -1
- package/dist/agents/conversation-export/conversation-transfer.js +1 -1
- package/dist/agents/conversation-export/document-markdown.js +1 -1
- package/dist/agents/hooks/useConversationRoutePromotion.js +1 -1
- package/dist/agents/hooks/useModelControls.js +1 -1
- package/dist/agents/redux/agent-definition/converters.js +1 -1
- package/dist/agents/redux/agent-definition/slice.js +1 -1
- package/dist/agents/redux/conversation-list/conversation-list.thunks.js +1 -1
- package/dist/agents/redux/execution-system/active-requests/active-requests.selectors.js +1 -1
- package/dist/agents/redux/execution-system/instance-context/sync-canvas-item-context.thunk.js +1 -1
- package/dist/agents/redux/execution-system/thunks/process-stream.js +1 -1
- package/dist/agents/redux/execution-system/thunks/resolve-base-url.js +17 -0
- package/dist/agents/redux/execution-system/thunks/run-ai-stream.d.ts +7 -0
- package/dist/agents/redux/execution-system/thunks/run-ai-stream.js +13 -0
- package/dist/agents/redux/execution-system/thunks/run-headless-agent-json.js +14 -2
- package/dist/agents/redux/execution-system/utils/assemble-cx-content-blocks.js +1 -1
- package/dist/agents/redux/execution-system/utils/normalize-content-blocks.js +1 -1
- package/dist/agents/redux/execution-system/utils/output-contract-guard.js +1 -1
- package/dist/agents/redux/execution-system/utils/stream-block-accumulator.js +8 -8
- package/dist/agents/routing/confidential-routing.d.ts +52 -0
- package/dist/agents/routing/confidential-routing.js +38 -0
- package/dist/agents/utils/canvasItemContext.js +1 -1
- package/dist/canvas/workspace/ChatPanelTitleMenu.js +1 -1
- package/dist/canvas/workspace/useCanvasWorkspaceConversation.js +1 -1
- package/dist/cx-chat/components/SsrSidebarChats.js +1 -1
- package/dist/cx-chat/components/core/ChatConversationClient.js +1 -1
- package/dist/cx-chat/components/messages/AssistantMessage.js +1 -1
- package/dist/cx-chat/hooks/useInstanceBootstrap.js +1 -1
- package/dist/cx-conversation/AssistantMessage.js +1 -1
- package/dist/host/configure.js +4 -1
- package/dist/host/contract.d.ts +14 -1
- package/dist/host/index.d.ts +1 -0
- package/dist/host/index.js +1 -0
- package/dist/mandates/llm-params.d.ts +1 -1
- package/dist/mandates/output-contract.js +1 -1
- package/dist/mandates/service.d.ts +1 -1
- package/dist/mandates/service.js +1 -1
- package/dist/mandates/test-run-core.js +1 -1
- package/dist/public-chat/components/PublicMessageOptionsMenu.js +1 -1
- package/dist/surfaces/services/surface-config.service.js +1 -1
- package/dist/tool-call-visualization/components/ToolCallBatch.js +1 -1
- package/dist/tool-call-visualization/components/ToolCallVisualization.js +1 -1
- package/dist/tool-call-visualization/renderers/agent-call/AgentCallInline.js +1 -1
- package/dist/tool-call-visualization/renderers/agent-call/CollabCallCard.js +1 -1
- package/dist/tool-call-visualization/renderers/agent-call/collab-subtitle.js +3 -3
- package/dist/tool-call-visualization/renderers/skill/SkillInline.js +1 -1
- package/dist/tool-call-visualization/result-fields/KeyValueGrid.js +1 -1
- package/dist/tool-call-visualization/result-fields/ResultValue.js +1 -1
- package/dist/tool-call-visualization/result-fields/shape.js +1 -1
- package/dist/tool-call-visualization/utils/cxToolCallToLifecycleEntry.js +2 -2
- package/dist/tool-call-visualization/utils/human-copy.js +3 -3
- package/dist/ui/mandates-storage/provision-shapes.d.ts +1 -1
- package/dist/ui/mandates-storage/provision-shapes.js +1 -1
- package/dist/ui/markdown-stream/EnhancedChatMarkdown.js +1 -1
- package/dist/ui/treatment-shape.d.ts +1 -1
- package/dist/ui/treatment-shape.js +1 -1
- package/dist/voice-agent/relay/useVoiceRelaySession.js +1 -1
- package/package.json +26 -9
- package/dist/agents/hooks/useWarmAgent.d.ts +0 -8
- package/dist/agents/hooks/useWarmAgent.js +0 -25
- package/dist/agents/utils/artifactId.d.ts +0 -34
- package/dist/agents/utils/artifactId.js +0 -15
- package/dist/ui/ShimmerText.d.ts +0 -5
- package/dist/ui/ShimmerText.js +0 -21
- package/dist/ui/addressWithoutNavigating.d.ts +0 -68
- package/dist/ui/addressWithoutNavigating.js +0 -60
- package/dist/utils/content-ir/decision-answers-ids.d.ts +0 -3
- package/dist/utils/content-ir/decision-answers-ids.js +0 -6
- package/dist/utils/content-ir/envelope-parity.d.ts +0 -12
- package/dist/utils/content-ir/envelope-parity.js +0 -32
- package/dist/utils/content-ir/instance-title.d.ts +0 -26
- package/dist/utils/content-ir/instance-title.js +0 -39
- package/dist/utils/content-ir/kinds/kind-markdown-utils.d.ts +0 -84
- package/dist/utils/content-ir/kinds/kind-markdown-utils.js +0 -233
- package/dist/utils/content-ir/kinds/kind-value-markdown.d.ts +0 -5
- package/dist/utils/content-ir/kinds/kind-value-markdown.js +0 -17
- package/dist/utils/content-ir/legacy-quiz-envelope.d.ts +0 -3
- package/dist/utils/content-ir/legacy-quiz-envelope.js +0 -45
- package/dist/utils/content-ir/surfaces/embedded-kind-json.d.ts +0 -140
- package/dist/utils/content-ir/surfaces/embedded-kind-json.js +0 -527
- package/dist/utils/content-ir/surfaces/json-kind-signal.d.ts +0 -307
- package/dist/utils/content-ir/surfaces/json-kind-signal.js +0 -945
- package/dist/utils/content-ir/surfaces/kind-image-alt.d.ts +0 -27
- package/dist/utils/content-ir/surfaces/kind-image-alt.js +0 -117
- package/dist/utils/content-ir/surfaces/kind-one-line.d.ts +0 -67
- package/dist/utils/content-ir/surfaces/kind-one-line.js +0 -209
- package/dist/utils/content-ir/surfaces/kind-text-label.d.ts +0 -20
- package/dist/utils/content-ir/surfaces/kind-text-label.js +0 -50
- package/dist/utils/content-ir/surfaces/kind-text-to-markdown.d.ts +0 -47
- package/dist/utils/content-ir/surfaces/kind-text-to-markdown.js +0 -399
- package/dist/utils/content-ir/surfaces/markdown-escaped-kind.d.ts +0 -54
- package/dist/utils/content-ir/surfaces/markdown-escaped-kind.js +0 -128
- package/dist/utils/content-ir/surfaces/quoted-kind-lift.d.ts +0 -61
- package/dist/utils/content-ir/surfaces/quoted-kind-lift.js +0 -215
- package/dist/utils/inline-decision/decision-options.d.ts +0 -21
- package/dist/utils/inline-decision/decision-options.js +0 -32
- package/dist/utils/json.d.ts +0 -63
- package/dist/utils/json.js +0 -22
- package/dist/utils/markdown/plain-title.d.ts +0 -25
- package/dist/utils/markdown/plain-title.js +0 -51
- package/dist/utils/rendered-find.d.ts +0 -9
- package/dist/utils/rendered-find.js +0 -68
- package/dist/utils/rich-editor/core/caret-context.d.ts +0 -24
- package/dist/utils/rich-editor/core/caret-context.js +0 -73
- package/dist/utils/rich-editor/in-place/caret-handoff.d.ts +0 -3
- package/dist/utils/rich-editor/in-place/caret-handoff.js +0 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isMaterializedArtifactId } from "
|
|
1
|
+
import { isMaterializedArtifactId } from "@ai-matrx/rich-content/utils/lifted/artifactId";
|
|
2
2
|
const CANVAS_ITEM_SOURCE_KIND = "canvas_item";
|
|
3
3
|
const DESCRIPTION = "A pinned conversation artifact (code or JSON). Read with ctx_get on this key (the artifact UUID). Apply every change with ctx_patch \u2014 edits save as a new version of the same artifact. Do NOT recreate it; extend or edit it.";
|
|
4
4
|
function isCanvasItemContextKey(key) {
|
|
@@ -8,7 +8,7 @@ import { useAppSelector } from "../../store/hooks.js";
|
|
|
8
8
|
import { selectConversationTitle } from "../../agents/redux/execution-system/conversations/conversations.selectors.js";
|
|
9
9
|
import { selectConversationListItemById } from "../../agents/redux/conversation-list/conversation-list.selectors.js";
|
|
10
10
|
import { conversationRenameOpener } from "../../agents/components/conversation-actions/rename/conversationRenameOpener.js";
|
|
11
|
-
import { conversationTitleText } from "
|
|
11
|
+
import { conversationTitleText } from "@ai-matrx/content-ir/surfaces";
|
|
12
12
|
import { Button, Tile } from "@ai-matrx/design-system/controls";
|
|
13
13
|
import { ConversationHistorySidebar } from "../../agents/components/conversation-history/ConversationHistorySidebar.js";
|
|
14
14
|
const PANEL_HISTORY_SCOPE = "chat-panel-menu";
|
|
@@ -7,7 +7,7 @@ import { resumeConversation } from "../../agents/redux/execution-system/thunks/r
|
|
|
7
7
|
import { useAppDispatch, useAppSelector } from "../../store/hooks.js";
|
|
8
8
|
import { selectShouldPromptForOrganization } from "../../host/ui-slots.js";
|
|
9
9
|
import { selectIsCacheOnly } from "../../agents/redux/execution-system/conversations/conversations.selectors.js";
|
|
10
|
-
import { replaceAddressWithoutNavigating } from "
|
|
10
|
+
import { replaceAddressWithoutNavigating } from "@ai-matrx/rich-content/utils/addressWithoutNavigating";
|
|
11
11
|
import { describeLaunchError } from "./describe-launch-error.js";
|
|
12
12
|
import { selectOrganizationId, ensureOrganizationContext, isOrganizationSelectionCancelled } from "../../host/org.js";
|
|
13
13
|
function initialRequest(start) {
|
|
@@ -37,7 +37,7 @@ const toSidebarItem = (c) => ({
|
|
|
37
37
|
status: c.status
|
|
38
38
|
});
|
|
39
39
|
const selectSidebarConversations = (state) => selectGlobalConversationList(state);
|
|
40
|
-
import { conversationTitleText } from "
|
|
40
|
+
import { conversationTitleText } from "@ai-matrx/content-ir/surfaces";
|
|
41
41
|
const GROUP_ORDER = ["Today", "Yesterday", "This Week", "This Month", "Older"];
|
|
42
42
|
function groupByTime(items) {
|
|
43
43
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -24,7 +24,7 @@ import { useComposerMode } from "../../../agents/components/inputs/smart-input/c
|
|
|
24
24
|
import { ProposedDirectivesZone } from "../../../host/ui-slots.js";
|
|
25
25
|
import { ServerOperationBanner } from "../../../agents/runtime-reconnect/ServerOperationBanner.js";
|
|
26
26
|
import { pushAppHref } from "../../../host/ui-slots.js";
|
|
27
|
-
import { replaceAddressWithoutNavigating } from "
|
|
27
|
+
import { replaceAddressWithoutNavigating } from "@ai-matrx/rich-content/utils/addressWithoutNavigating";
|
|
28
28
|
import { Button } from "@ai-matrx/design-system/controls";
|
|
29
29
|
function ChatConversationClient({
|
|
30
30
|
conversationId,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
Save
|
|
14
14
|
} from "lucide-react";
|
|
15
15
|
import { Button } from "@ai-matrx/design-system/controls";
|
|
16
|
-
import
|
|
16
|
+
import MarkdownStream from "../../../ui/markdown-stream/MarkdownStream.js";
|
|
17
17
|
import AudioOutputBlockSkeleton from "../../../ui/AudioOutputBlockSkeleton.js";
|
|
18
18
|
import { useDomCapturePrint } from "../../../conversation/hooks/useDomCapturePrint.js";
|
|
19
19
|
import { useAppSelector, useAppDispatch } from "../../../store/hooks.js";
|
|
@@ -12,7 +12,7 @@ import { toast } from "../../host/notify.js";
|
|
|
12
12
|
import { isNotAuthenticatedError } from "../../host/identity.js";
|
|
13
13
|
import { isOrganizationSelectionCancelled } from "../../host/org.js";
|
|
14
14
|
import { DEFAULT_AGENT_ID } from "../components/agent/local-agents.js";
|
|
15
|
-
import { replaceAddressWithoutNavigating } from "
|
|
15
|
+
import { replaceAddressWithoutNavigating } from "@ai-matrx/rich-content/utils/addressWithoutNavigating";
|
|
16
16
|
import { ensureAgentCatalog, isAgentCatalogStale } from "../../agents/identity/agent-identity.js";
|
|
17
17
|
function parseChatUrl(pathname, searchParams) {
|
|
18
18
|
const agentPathMatch = pathname.match(/\/demos\/chat\/a\/([^/?]+)/);
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
Save
|
|
14
14
|
} from "lucide-react";
|
|
15
15
|
import { Button } from "@ai-matrx/design-system/controls";
|
|
16
|
-
import
|
|
16
|
+
import MarkdownStream from "../ui/markdown-stream/MarkdownStream.js";
|
|
17
17
|
import AudioOutputBlockSkeleton from "../ui/AudioOutputBlockSkeleton.js";
|
|
18
18
|
import { useDomCapturePrint } from "../conversation/hooks/useDomCapturePrint.js";
|
|
19
19
|
import { useAppSelector, useAppDispatch } from "../store/hooks.js";
|
package/dist/host/configure.js
CHANGED
|
@@ -44,8 +44,10 @@ const PORTS = [
|
|
|
44
44
|
"chrome",
|
|
45
45
|
"feedback",
|
|
46
46
|
"routes",
|
|
47
|
-
"canvas"
|
|
47
|
+
"canvas",
|
|
48
|
+
"routing"
|
|
48
49
|
];
|
|
50
|
+
const ANY_ROUTING = Object.freeze({ policy: () => "any" });
|
|
49
51
|
const EMPTY_REGISTRATIONS = Object.freeze({});
|
|
50
52
|
function assertDb(host) {
|
|
51
53
|
const db = host?.db;
|
|
@@ -127,6 +129,7 @@ function resolveChatHost(host) {
|
|
|
127
129
|
feedback: host.feedback ?? createDbFeedback(db, () => ref.identity),
|
|
128
130
|
routes: { ...DEFAULT_CHAT_ROUTES, ...host.routes },
|
|
129
131
|
canvas: host.canvas ?? createUnhostedCanvas(() => ref.diagnostics),
|
|
132
|
+
routing: host.routing ?? ANY_ROUTING,
|
|
130
133
|
overridden
|
|
131
134
|
});
|
|
132
135
|
return ref;
|
package/dist/host/contract.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ import type { ChatCanvasTabKind } from "./canvas-tabs.js";
|
|
|
25
25
|
import type { ChatWindowOpeners } from "./window-openers.js";
|
|
26
26
|
import type { DefaultChatServerApi, DefaultChatServerTypes } from "./defaults/server-api.js";
|
|
27
27
|
import type { ChatMessageSource } from "./source.js";
|
|
28
|
+
import type { ChatRoutingPolicy } from "../agents/routing/confidential-routing.js";
|
|
28
29
|
/**
|
|
29
30
|
* The connection contract (R10). Authenticated, RLS applies. Typed with the
|
|
30
31
|
* package's own `ChatDatabase` (`./db-types`, generated: the schemas the
|
|
@@ -731,6 +732,15 @@ export interface ChatAppIdentity {
|
|
|
731
732
|
/** `source_feature` for every conversation this app starts; absent keeps each screen's own. */
|
|
732
733
|
sourceFeature?: string;
|
|
733
734
|
}
|
|
735
|
+
/**
|
|
736
|
+
* Where each conversation's text may go (lanes/agents-chat-proposal.md W0(a)). The package enforces
|
|
737
|
+
* the answer at the one place every send resolves its target (`resolveBackendForConversation`): a
|
|
738
|
+
* `"local-only"` (confidential) conversation refuses every target but the Matrx Local engine on this
|
|
739
|
+
* computer, loudly, before a byte leaves the machine. Default: `"any"` for every conversation.
|
|
740
|
+
*/
|
|
741
|
+
export interface ChatRoutingPort {
|
|
742
|
+
policy(conversationId: string): ChatRoutingPolicy;
|
|
743
|
+
}
|
|
734
744
|
export interface ChatHost {
|
|
735
745
|
/**
|
|
736
746
|
* R10 connection contract. Authenticated, RLS applies. Required unless `source` is given: a
|
|
@@ -791,8 +801,10 @@ export interface ChatHost {
|
|
|
791
801
|
routes?: Partial<ChatRoutes>;
|
|
792
802
|
/** Default: no canvas here — every open refuses and says so. */
|
|
793
803
|
canvas?: ChatCanvasPort;
|
|
804
|
+
/** Default: every conversation may go to any target (`"any"`). */
|
|
805
|
+
routing?: ChatRoutingPort;
|
|
794
806
|
}
|
|
795
|
-
export type ChatPortName = "identity" | "org" | "server" | "notify" | "diagnostics" | "prefs" | "navigation" | "windows" | "catalog" | "registry" | "chrome" | "feedback" | "routes" | "canvas";
|
|
807
|
+
export type ChatPortName = "identity" | "org" | "server" | "notify" | "diagnostics" | "prefs" | "navigation" | "windows" | "catalog" | "registry" | "chrome" | "feedback" | "routes" | "canvas" | "routing";
|
|
796
808
|
/** Every port present. `overridden` names the ports the host supplied itself. */
|
|
797
809
|
export interface ResolvedChatHost {
|
|
798
810
|
/** The host's client, or the no-database stand-in when it gave only a `source`. */
|
|
@@ -818,5 +830,6 @@ export interface ResolvedChatHost {
|
|
|
818
830
|
feedback: ChatFeedbackPort;
|
|
819
831
|
routes: ChatRoutes;
|
|
820
832
|
canvas: ChatCanvasPort;
|
|
833
|
+
routing: ChatRoutingPort;
|
|
821
834
|
overridden: ReadonlySet<ChatPortName>;
|
|
822
835
|
}
|
package/dist/host/index.d.ts
CHANGED
|
@@ -24,3 +24,4 @@ export { createClient, getClaimsUser, schedulerDb, supabase, type ChatClaimsUser
|
|
|
24
24
|
export type { ChatDatabase } from "./db-types.js";
|
|
25
25
|
export { ChatNoDatabaseError, NO_DATABASE_CODE_PREFIX, createNoDatabaseStandIn, isChatNoDatabaseError, isNoDatabase, } from "./no-database.js";
|
|
26
26
|
export * from "./source.js";
|
|
27
|
+
export * from "../agents/routing/confidential-routing.js";
|
package/dist/host/index.js
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* keys the client run path honours. Field by field, no casts; unknown keys
|
|
6
6
|
* are dropped LOUDLY (the server's apply_overrides stays the authority).
|
|
7
7
|
*/
|
|
8
|
-
import type { JsonObject } from "
|
|
8
|
+
import type { JsonObject } from "@ai-matrx/rich-content/utils/json";
|
|
9
9
|
import type { FeLlmParams } from "../agents/types/agent-api-types.js";
|
|
10
10
|
export declare function toLlmParams(obj: JsonObject): Partial<FeLlmParams>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createClient } from "../host/db.js";
|
|
2
|
-
import { isJsonObject } from "
|
|
2
|
+
import { isJsonObject } from "@ai-matrx/rich-content/utils/json";
|
|
3
3
|
import { hasBrowserSession } from "../host/identity.js";
|
|
4
4
|
function outputSchemaKeys(outputSchema) {
|
|
5
5
|
if (!isJsonObject(outputSchema)) return /* @__PURE__ */ new Set();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FeLlmParams } from "../agents/types/agent-api-types.js";
|
|
2
2
|
import { type OrganizationAdmission } from "../host/server/organization-admission.js";
|
|
3
3
|
import { type MandateContract } from "@ai-matrx/agents/mandates";
|
|
4
|
-
import type { JsonObject } from "
|
|
4
|
+
import type { JsonObject } from "@ai-matrx/rich-content/utils/json";
|
|
5
5
|
import type { AnyMandateKey } from "@ai-matrx/agents/mandates";
|
|
6
6
|
import { type BindingPresentation } from "../ui/treatment-shape.js";
|
|
7
7
|
export interface ResolvedMandate {
|
package/dist/mandates/service.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createClient } from "../host/db.js";
|
|
3
3
|
import { getClaimsUser } from "../host/db.js";
|
|
4
|
-
import { isJsonObject } from "
|
|
4
|
+
import { isJsonObject } from "@ai-matrx/rich-content/utils/json";
|
|
5
5
|
import { recordUnavailable } from "../host/diagnostics.js";
|
|
6
6
|
import { apiGet, buildPath } from "../host/server/typed-client.js";
|
|
7
7
|
import { BackendApiError } from "@ai-matrx/agents/matrx";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { isJsonObject } from "
|
|
2
|
+
import { isJsonObject } from "@ai-matrx/rich-content/utils/json";
|
|
3
3
|
import { usableServerNotes } from "../ui/usable-server-notes.js";
|
|
4
4
|
function readMandateRunHolder(result) {
|
|
5
5
|
if (!isJsonObject(result)) {
|
|
@@ -26,7 +26,7 @@ import { useAppSelector as useSelector } from "../../store/hooks.js";
|
|
|
26
26
|
import { selectIsAuthenticated } from "../../host/identity.js";
|
|
27
27
|
import { useAppDispatch } from "../../store/hooks.js";
|
|
28
28
|
import { openOverlay, CHAT_WINDOWS } from "../../host/windows.js";
|
|
29
|
-
import { kindTextToMarkdown } from "
|
|
29
|
+
import { kindTextToMarkdown } from "@ai-matrx/content-ir/surfaces";
|
|
30
30
|
import { removeCodeSpans, replaceFences } from "@ai-matrx/content-ir/source";
|
|
31
31
|
import { selectOrganizationId, ensureOrganizationContext, isOrganizationSelectionCancelled } from "../../host/org.js";
|
|
32
32
|
import { downloadFile } from "@ai-matrx/kit/download";
|
|
@@ -3,7 +3,7 @@ import { storedMandateKey } from "@ai-matrx/agents/mandates";
|
|
|
3
3
|
import { createClient } from "../../host/db.js";
|
|
4
4
|
import { writeOne } from "@ai-matrx/data/db";
|
|
5
5
|
import { getClaimsUser } from "../../host/db.js";
|
|
6
|
-
import { isJsonObject } from "
|
|
6
|
+
import { isJsonObject } from "@ai-matrx/rich-content/utils/json";
|
|
7
7
|
import { fetchMandatePins } from "../../mandates/service.js";
|
|
8
8
|
import {
|
|
9
9
|
getNamespaceHandler,
|
|
@@ -4,7 +4,7 @@ import { useEffect, useState } from "react";
|
|
|
4
4
|
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
5
5
|
import { cn } from "@ai-matrx/design-system";
|
|
6
6
|
import { useAppSelector } from "../../store/hooks.js";
|
|
7
|
-
import { ShimmerText } from "
|
|
7
|
+
import { ShimmerText } from "@ai-matrx/rich-content/utils/lifted/ShimmerText";
|
|
8
8
|
import { getToolDisplayName } from "../registry/registry.js";
|
|
9
9
|
import { DIFF_START_OPEN_KNOB, readSurfaceWrite } from "../surface-write/readSurfaceWrite.js";
|
|
10
10
|
import { holdsADecision } from "./holdsADecision.js";
|
|
@@ -11,7 +11,7 @@ import { cn } from "@ai-matrx/design-system";
|
|
|
11
11
|
import { useAppDispatch, useAppSelector } from "../../store/hooks.js";
|
|
12
12
|
import { smartExecute } from "../../agents/redux/execution-system/thunks/smart-execute.thunk.js";
|
|
13
13
|
import { openOverlay, CHAT_WINDOWS } from "../../host/windows.js";
|
|
14
|
-
import { ShimmerText } from "
|
|
14
|
+
import { ShimmerText } from "@ai-matrx/rich-content/utils/lifted/ShimmerText";
|
|
15
15
|
import {
|
|
16
16
|
getInlineRenderer,
|
|
17
17
|
getToolDisplayName,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { Aperture, ImageIcon } from "lucide-react";
|
|
5
|
-
import
|
|
5
|
+
import MarkdownStream from "../../../ui/markdown-stream/MarkdownStream.js";
|
|
6
6
|
import { useAppSelector } from "../../../store/hooks.js";
|
|
7
7
|
import { selectAgentCallChildStream } from "../../../agents/redux/execution-system/active-requests/active-requests.selectors.js";
|
|
8
8
|
import { GenericRenderer } from "../../registry/GenericRenderer.js";
|
|
@@ -7,7 +7,7 @@ import { useAppSelector } from "../../../store/hooks.js";
|
|
|
7
7
|
import { selectAgentCallChildStream } from "../../../agents/redux/execution-system/active-requests/active-requests.selectors.js";
|
|
8
8
|
import { useConversationTitle } from "../../../agents/hooks/useConversationTitle.js";
|
|
9
9
|
import { EntityRef } from "../../../host/ui-slots.js";
|
|
10
|
-
import
|
|
10
|
+
import MarkdownStream from "../../../ui/markdown-stream/MarkdownStream.js";
|
|
11
11
|
import { AnswerValueView } from "../../../host/ui-slots.js";
|
|
12
12
|
import { stripThinkingStreaming } from "@ai-matrx/kit/text";
|
|
13
13
|
import { cn } from "@ai-matrx/design-system";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { kindTextLabel } from "
|
|
2
|
-
import { deriveInstanceTitle } from "
|
|
3
|
-
import { humanizeKind } from "
|
|
1
|
+
import { kindTextLabel } from "@ai-matrx/content-ir/surfaces";
|
|
2
|
+
import { deriveInstanceTitle } from "@ai-matrx/content-ir/surfaces";
|
|
3
|
+
import { humanizeKind } from "@ai-matrx/content-ir/surfaces";
|
|
4
4
|
import { getCollabCallInfo } from "./collab.js";
|
|
5
5
|
const MAX = 90;
|
|
6
6
|
function valueLabel(value) {
|
|
@@ -7,7 +7,7 @@ import { GenericRenderer } from "../../registry/GenericRenderer.js";
|
|
|
7
7
|
import { ToolErrorCard } from "../../result-fields/ToolErrorCard.js";
|
|
8
8
|
import { humanizeEnumValue } from "../../result-fields/shape.js";
|
|
9
9
|
import { ToolResultCard } from "../_shared-entity/ToolResultCard.js";
|
|
10
|
-
import { catalogProseText } from "
|
|
10
|
+
import { catalogProseText } from "@ai-matrx/content-ir/surfaces";
|
|
11
11
|
const SKILL_ICON_TINT = "text-violet-600 dark:text-violet-400";
|
|
12
12
|
function humanType(raw) {
|
|
13
13
|
if (typeof raw !== "string" || !raw) return null;
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
useStructuredDocumentPresentation
|
|
16
16
|
} from "./document-presentation.js";
|
|
17
17
|
import { KindValueNode } from "./KindValueNode.js";
|
|
18
|
-
import { rootKindSlug } from "
|
|
18
|
+
import { rootKindSlug } from "@ai-matrx/content-ir/surfaces";
|
|
19
19
|
import { useReportKindAtRawRenderer } from "@ai-matrx/rich-content/utils/report-kind-at-raw-renderer";
|
|
20
20
|
import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
|
|
21
21
|
import { Button } from "@ai-matrx/design-system/controls";
|
|
@@ -16,7 +16,7 @@ import { ShortId, IdListChip } from "./ShortId.js";
|
|
|
16
16
|
import { KindValueNode } from "./KindValueNode.js";
|
|
17
17
|
import { ResultRecordRef } from "./ResultRecordRef.js";
|
|
18
18
|
import { TextWithDoors } from "../../host/ui-slots.js";
|
|
19
|
-
import { valueCarriesKind } from "
|
|
19
|
+
import { valueCarriesKind } from "@ai-matrx/content-ir/surfaces";
|
|
20
20
|
import { useReportKindAtRawRenderer } from "@ai-matrx/rich-content/utils/report-kind-at-raw-renderer";
|
|
21
21
|
import { Button } from "@ai-matrx/design-system/controls";
|
|
22
22
|
const INLINE_MAX_DEPTH = 2;
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
markdownCarriesKind,
|
|
10
10
|
rootKindSlug,
|
|
11
11
|
valueCarriesKind
|
|
12
|
-
} from "
|
|
12
|
+
} from "@ai-matrx/content-ir/surfaces";
|
|
13
13
|
import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
|
|
14
14
|
const hasMarkdownTable = (value) => findTableStart(value.split("\n")) !== -1;
|
|
15
15
|
function isPlainObject(value) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { humanizeKind } from "
|
|
1
|
+
import { humanizeKind } from "@ai-matrx/content-ir/surfaces";
|
|
2
2
|
import {
|
|
3
3
|
firstKindSlug,
|
|
4
4
|
jsonKindSignal
|
|
5
|
-
} from "
|
|
5
|
+
} from "@ai-matrx/content-ir/surfaces";
|
|
6
6
|
import { displayNameFromToolEvents } from "./toolDisplayName.js";
|
|
7
7
|
function parseOutput(raw) {
|
|
8
8
|
if (!raw) return null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { kindValueToMarkdown } from "
|
|
2
|
-
import { valueCarriesKind } from "
|
|
3
|
-
import { kindTextToMarkdown } from "
|
|
1
|
+
import { kindValueToMarkdown } from "@ai-matrx/content-ir/surfaces";
|
|
2
|
+
import { valueCarriesKind } from "@ai-matrx/content-ir/surfaces";
|
|
3
|
+
import { kindTextToMarkdown } from "@ai-matrx/content-ir/surfaces";
|
|
4
4
|
function prettyJson(value) {
|
|
5
5
|
try {
|
|
6
6
|
return JSON.stringify(value, null, 2);
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* HERE at ingress with runtime validation — never a cast on the row.
|
|
32
32
|
*/
|
|
33
33
|
import type { Json } from "../../host/db-types.js";
|
|
34
|
-
import { type JsonObject } from "
|
|
34
|
+
import { type JsonObject } from "@ai-matrx/rich-content/utils/json";
|
|
35
35
|
import type { ValueMapping } from "../../surfaces/types.js";
|
|
36
36
|
import type { AnyMandateKey } from "@ai-matrx/agents/mandates";
|
|
37
37
|
/** Kind slugs whose values are prompt-substitutable scalars. Anything else
|
|
@@ -14,7 +14,7 @@ function MaybeSourceEdit({ source, save, children }) {
|
|
|
14
14
|
return /* @__PURE__ */ jsx(OptionalMarkdownSourceEditProvider, { source, save, children });
|
|
15
15
|
}
|
|
16
16
|
import { RichCopySplit } from "../../agent-copy/RichCopySplit.js";
|
|
17
|
-
import { ShimmerText } from "
|
|
17
|
+
import { ShimmerText } from "@ai-matrx/rich-content/utils/lifted/ShimmerText";
|
|
18
18
|
import {
|
|
19
19
|
RunJobWorkingLine,
|
|
20
20
|
useIsRunJob
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type JsonObject, type JsonValue } from "
|
|
1
|
+
import { type JsonObject, type JsonValue } from "@ai-matrx/rich-content/utils/json";
|
|
2
2
|
import type { ResultDisplayMode } from "../agents/utils/run-ui-utils.js";
|
|
3
3
|
import type { VariablesPanelStyle } from "../agents/components/inputs/variable-input-variations/variable-input-options.js";
|
|
4
4
|
import type { WritePolicyMap } from "../surfaces/types.js";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
setContextEntry
|
|
29
29
|
} from "../../agents/redux/execution-system/instance-context/instance-context.slice.js";
|
|
30
30
|
import { MANDATE_KEYS } from "@ai-matrx/agents/mandates";
|
|
31
|
-
import { kindTextToMarkdown } from "
|
|
31
|
+
import { kindTextToMarkdown } from "@ai-matrx/content-ir/surfaces";
|
|
32
32
|
const VOICE_COMMUNICATOR_MANDATE_KEY = MANDATE_KEYS.voice__communicator;
|
|
33
33
|
const NARRATION_DELAY_MS = 2500;
|
|
34
34
|
registerCommunicationLedgerTool();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-matrx/chat",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.12",
|
|
4
4
|
"description": "THE one AI Matrx person-to-agent chat system: the full chat (running agents, conversations, tool calls, streaming, context, surfaces, voice) as per-module subpaths @ai-matrx/chat/<domain>/<module> over a host contract (/host, /host/react) whose only required value is a db; plus the kernel compatibility entries (., /external-store, /matrx, /react, /tools, styles.css, tokens.css) until P28.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -227,25 +227,25 @@
|
|
|
227
227
|
"uuid": "^14.0.2",
|
|
228
228
|
"zod": "^4.6.5",
|
|
229
229
|
"@ai-matrx/agents": "latest",
|
|
230
|
+
"@ai-matrx/alchemy": "latest",
|
|
230
231
|
"@ai-matrx/associations": "latest",
|
|
231
232
|
"@ai-matrx/browser-audio": "latest",
|
|
232
|
-
"@ai-matrx/alchemy": "latest",
|
|
233
|
-
"@ai-matrx/canvas": "latest",
|
|
234
233
|
"@ai-matrx/content-ir": "latest",
|
|
235
|
-
"@ai-matrx/
|
|
234
|
+
"@ai-matrx/canvas": "latest",
|
|
235
|
+
"@ai-matrx/data": "latest",
|
|
236
236
|
"@ai-matrx/content-ir-react": "latest",
|
|
237
237
|
"@ai-matrx/design-system": "latest",
|
|
238
|
-
"@ai-matrx/
|
|
238
|
+
"@ai-matrx/diff": "latest",
|
|
239
239
|
"@ai-matrx/icons": "latest",
|
|
240
|
-
"@ai-matrx/media": "latest",
|
|
241
|
-
"@ai-matrx/print": "latest",
|
|
242
240
|
"@ai-matrx/kit": "latest",
|
|
241
|
+
"@ai-matrx/media": "latest",
|
|
243
242
|
"@ai-matrx/realtime": "latest",
|
|
244
|
-
"@ai-matrx/records": "latest",
|
|
243
|
+
"@ai-matrx/records-ui": "latest",
|
|
245
244
|
"@ai-matrx/rich-content": "latest",
|
|
245
|
+
"@ai-matrx/print": "latest",
|
|
246
246
|
"@ai-matrx/rich-editor": "latest",
|
|
247
247
|
"@ai-matrx/tap-target": "latest",
|
|
248
|
-
"@ai-matrx/records
|
|
248
|
+
"@ai-matrx/records": "latest"
|
|
249
249
|
},
|
|
250
250
|
"devDependencies": {
|
|
251
251
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
@@ -303,6 +303,23 @@
|
|
|
303
303
|
"optional": true
|
|
304
304
|
}
|
|
305
305
|
},
|
|
306
|
+
"matrx": {
|
|
307
|
+
"charter": "The whole person-to-agent chat.",
|
|
308
|
+
"owns": [
|
|
309
|
+
"running agents",
|
|
310
|
+
"conversations",
|
|
311
|
+
"tool calls",
|
|
312
|
+
"streaming",
|
|
313
|
+
"context",
|
|
314
|
+
"voice"
|
|
315
|
+
],
|
|
316
|
+
"mustNotOwn": [
|
|
317
|
+
"another package's logic",
|
|
318
|
+
"a second chat (src/compat, retiring)",
|
|
319
|
+
"its own host-slot copies"
|
|
320
|
+
],
|
|
321
|
+
"layer": 9
|
|
322
|
+
},
|
|
306
323
|
"scripts": {
|
|
307
324
|
"build": "pnpm --filter @ai-matrx/rich-editor build && pnpm clean && tsup && node ./scripts/copy-css.mjs && node ./scripts/tsc-own.mjs -p tsconfig.build.json && node ./scripts/finish-build.mjs",
|
|
308
325
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
interface UseWarmAgentOptions {
|
|
2
|
-
/** Pass true when the id is an agx_version id rather than an agent.definition id. */
|
|
3
|
-
isVersion?: boolean;
|
|
4
|
-
/** Skip warming entirely (e.g. when the id isn't ready yet). */
|
|
5
|
-
enabled?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare function useWarmAgent(agentId: string | null | undefined, { isVersion, enabled }?: UseWarmAgentOptions): void;
|
|
8
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import { useAppSelector } from "../../store/hooks.js";
|
|
4
|
-
import { selectResolvedBaseUrl } from "../../host/server/api-config.js";
|
|
5
|
-
import { warmAgent } from "@ai-matrx/agents/matrx";
|
|
6
|
-
function useWarmAgent(agentId, { isVersion = false, enabled = true } = {}) {
|
|
7
|
-
const baseUrl = useAppSelector(
|
|
8
|
-
selectResolvedBaseUrl
|
|
9
|
-
);
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
if (!enabled || !agentId || !baseUrl) return void 0;
|
|
12
|
-
const fire = () => warmAgent(agentId, { baseUrl, isVersion });
|
|
13
|
-
const ric = typeof window !== "undefined" ? window.requestIdleCallback : void 0;
|
|
14
|
-
const cancel = typeof window !== "undefined" ? window.cancelIdleCallback : void 0;
|
|
15
|
-
if (ric) {
|
|
16
|
-
const handle2 = ric(fire, { timeout: 2e3 });
|
|
17
|
-
return () => cancel?.(handle2);
|
|
18
|
-
}
|
|
19
|
-
const handle = window.setTimeout(fire, 500);
|
|
20
|
-
return () => window.clearTimeout(handle);
|
|
21
|
-
}, [agentId, baseUrl, isVersion, enabled]);
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
useWarmAgent
|
|
25
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* isMaterializedArtifactId — the R3 recognition primitive.
|
|
3
|
-
*
|
|
4
|
-
* An `<artifact>` (and every artifact renderer) carries an `id` that is EITHER:
|
|
5
|
-
* - a real `canvas_items` UUID → the artifact is MATERIALIZED (persisted). The
|
|
6
|
-
* UI renders the live row by id; data-touching types (tasks) can link/convert
|
|
7
|
-
* against the stable artifact id.
|
|
8
|
-
* - the model's own `artifact_N` (or a splitter fallback like `artifact-3`, or
|
|
9
|
-
* nothing) → NOT yet materialized → render inline; it's a materialization
|
|
10
|
-
* candidate, not a known artifact.
|
|
11
|
-
*
|
|
12
|
-
* This single UUID-shape test is what makes the whole system safe (vision R3):
|
|
13
|
-
* it does NOT matter whether the model ever learns to emit the shape — a
|
|
14
|
-
* non-UUID id is always treated as "new / unmaterialized", a UUID as "this exact
|
|
15
|
-
* persisted artifact." Used by the renderers (render-by-id vs inline) and by
|
|
16
|
-
* materialization (skip-already-materialized vs create-new).
|
|
17
|
-
*
|
|
18
|
-
* See `/Users/armanisadeghi/code/common-docs/systems/publish/artifacts/VISION.md` (R1–R3).
|
|
19
|
-
*/
|
|
20
|
-
/** True only for a canonical UUID — i.e. a real, persisted `canvas_items.id`. */
|
|
21
|
-
export declare function isMaterializedArtifactId(id?: string | null): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* readArtifactPointerId — the pointer-shape reader.
|
|
24
|
-
*
|
|
25
|
-
* A canvas item whose artifact has been MATERIALIZED stores only a POINTER in
|
|
26
|
-
* `content.data`: `{ artifactId }`. The body lives in the `canvas_items` row.
|
|
27
|
-
* Anything that consumes `content.data` (render, share, export) must recognise
|
|
28
|
-
* that shape instead of treating the pointer as the content — publishing a
|
|
29
|
-
* pointer produces a page with nothing in it.
|
|
30
|
-
*
|
|
31
|
-
* Returns the materialized artifact UUID, or undefined when `data` is real
|
|
32
|
-
* content (string, or an object that is not a pointer).
|
|
33
|
-
*/
|
|
34
|
-
export declare function readArtifactPointerId(data: unknown): string | undefined;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { isUuidShape } from "@ai-matrx/kit/uuid";
|
|
2
|
-
function isMaterializedArtifactId(id) {
|
|
3
|
-
return typeof id === "string" && isUuidShape(id.trim());
|
|
4
|
-
}
|
|
5
|
-
function readArtifactPointerId(data) {
|
|
6
|
-
if (typeof data !== "object" || data === null) return void 0;
|
|
7
|
-
if (!("artifactId" in data)) return void 0;
|
|
8
|
-
const id = data.artifactId;
|
|
9
|
-
if (typeof id !== "string") return void 0;
|
|
10
|
-
return isMaterializedArtifactId(id) ? id : void 0;
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
isMaterializedArtifactId,
|
|
14
|
-
readArtifactPointerId
|
|
15
|
-
};
|
package/dist/ui/ShimmerText.d.ts
DELETED
package/dist/ui/ShimmerText.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@ai-matrx/design-system";
|
|
4
|
-
function ShimmerText({ text, className }) {
|
|
5
|
-
return /* @__PURE__ */ jsx(
|
|
6
|
-
"span",
|
|
7
|
-
{
|
|
8
|
-
className: cn(
|
|
9
|
-
"inline-block bg-clip-text text-transparent bg-[length:200%_100%] animate-shimmer",
|
|
10
|
-
className
|
|
11
|
-
),
|
|
12
|
-
style: {
|
|
13
|
-
backgroundImage: "linear-gradient(90deg, hsl(var(--muted-foreground) / 0.3) 0%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground) / 0.3) 100%)"
|
|
14
|
-
},
|
|
15
|
-
children: text
|
|
16
|
-
}
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
ShimmerText
|
|
21
|
-
};
|