@stigmer/react 3.12.6 → 3.12.7
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/composer/ComposerToolbar.d.ts +19 -1
- package/composer/ComposerToolbar.d.ts.map +1 -1
- package/composer/ComposerToolbar.js +7 -2
- package/composer/ComposerToolbar.js.map +1 -1
- package/composer/SessionComposer.d.ts +10 -0
- package/composer/SessionComposer.d.ts.map +1 -1
- package/composer/SessionComposer.js +2 -2
- package/composer/SessionComposer.js.map +1 -1
- package/composer/index.d.ts +1 -0
- package/composer/index.d.ts.map +1 -1
- package/composer/index.js.map +1 -1
- package/execution/MessageThread.d.ts.map +1 -1
- package/execution/MessageThread.js +8 -11
- package/execution/MessageThread.js.map +1 -1
- package/execution/useFileChangeContent.d.ts +2 -6
- package/execution/useFileChangeContent.d.ts.map +1 -1
- package/execution/useFileChangeContent.js +4 -12
- package/execution/useFileChangeContent.js.map +1 -1
- package/index.d.ts +6 -3
- package/index.d.ts.map +1 -1
- package/index.js +5 -1
- package/index.js.map +1 -1
- package/internal/download.d.ts +8 -0
- package/internal/download.d.ts.map +1 -0
- package/internal/download.js +25 -0
- package/internal/download.js.map +1 -0
- package/library/useExportResource.d.ts.map +1 -1
- package/library/useExportResource.js +3 -17
- package/library/useExportResource.js.map +1 -1
- package/memory/MemoryListPanel.d.ts +35 -0
- package/memory/MemoryListPanel.d.ts.map +1 -0
- package/memory/MemoryListPanel.js +141 -0
- package/memory/MemoryListPanel.js.map +1 -0
- package/memory/index.d.ts +8 -0
- package/memory/index.d.ts.map +1 -0
- package/memory/index.js +12 -0
- package/memory/index.js.map +1 -0
- package/memory/memoryGroups.d.ts +31 -0
- package/memory/memoryGroups.d.ts.map +1 -0
- package/memory/memoryGroups.js +52 -0
- package/memory/memoryGroups.js.map +1 -0
- package/memory/useConfirmMemory.d.ts +31 -0
- package/memory/useConfirmMemory.d.ts.map +1 -0
- package/memory/useConfirmMemory.js +43 -0
- package/memory/useConfirmMemory.js.map +1 -0
- package/memory/useDeleteMemory.d.ts +30 -0
- package/memory/useDeleteMemory.d.ts.map +1 -0
- package/memory/useDeleteMemory.js +42 -0
- package/memory/useDeleteMemory.js.map +1 -0
- package/memory/useMemories.d.ts +33 -0
- package/memory/useMemories.d.ts.map +1 -0
- package/memory/useMemories.js +42 -0
- package/memory/useMemories.js.map +1 -0
- package/memory/useRejectMemory.d.ts +34 -0
- package/memory/useRejectMemory.d.ts.map +1 -0
- package/memory/useRejectMemory.js +46 -0
- package/memory/useRejectMemory.js.map +1 -0
- package/memory/useUpdateMemoryContent.d.ts +32 -0
- package/memory/useUpdateMemoryContent.d.ts.map +1 -0
- package/memory/useUpdateMemoryContent.js +48 -0
- package/memory/useUpdateMemoryContent.js.map +1 -0
- package/package.json +4 -4
- package/session/NewSessionViewer.d.ts.map +1 -1
- package/session/NewSessionViewer.js +9 -1
- package/session/NewSessionViewer.js.map +1 -1
- package/session/SessionViewer.d.ts +14 -1
- package/session/SessionViewer.d.ts.map +1 -1
- package/session/SessionViewer.js +21 -25
- package/session/SessionViewer.js.map +1 -1
- package/session/TranscriptExportMenu.d.ts +24 -0
- package/session/TranscriptExportMenu.d.ts.map +1 -0
- package/session/TranscriptExportMenu.js +26 -0
- package/session/TranscriptExportMenu.js.map +1 -0
- package/session/index.d.ts +4 -0
- package/session/index.d.ts.map +1 -1
- package/session/index.js +2 -0
- package/session/index.js.map +1 -1
- package/session/useExportTranscript.d.ts +44 -0
- package/session/useExportTranscript.d.ts.map +1 -0
- package/session/useExportTranscript.js +109 -0
- package/session/useExportTranscript.js.map +1 -0
- package/session/useNewSessionFlow.d.ts +11 -0
- package/session/useNewSessionFlow.d.ts.map +1 -1
- package/session/useNewSessionFlow.js +14 -6
- package/session/useNewSessionFlow.js.map +1 -1
- package/session/useSessionConversation.d.ts.map +1 -1
- package/session/useSessionConversation.js +7 -19
- package/session/useSessionConversation.js.map +1 -1
- package/session/useSessionExecutions.d.ts +2 -14
- package/session/useSessionExecutions.d.ts.map +1 -1
- package/session/useSessionExecutions.js +4 -26
- package/session/useSessionExecutions.js.map +1 -1
- package/session/useSessionPageFlow.d.ts +23 -10
- package/session/useSessionPageFlow.d.ts.map +1 -1
- package/session/useSessionPageFlow.js +61 -9
- package/session/useSessionPageFlow.js.map +1 -1
- package/settings/MemorySection.d.ts +12 -0
- package/settings/MemorySection.d.ts.map +1 -0
- package/settings/MemorySection.js +21 -0
- package/settings/MemorySection.js.map +1 -0
- package/settings/index.d.ts +1 -0
- package/settings/index.d.ts.map +1 -1
- package/settings/index.js +1 -0
- package/settings/index.js.map +1 -1
- package/settings/settings-nav.d.ts.map +1 -1
- package/settings/settings-nav.js +2 -1
- package/settings/settings-nav.js.map +1 -1
- package/src/__tests__/public-api.test.ts +21 -0
- package/src/composer/ComposerToolbar.tsx +58 -0
- package/src/composer/SessionComposer.tsx +13 -1
- package/src/composer/__tests__/ComposerToolbar-autoApprove.test.tsx +80 -0
- package/src/composer/index.ts +1 -0
- package/src/execution/MessageThread.tsx +8 -11
- package/src/execution/useFileChangeContent.ts +5 -12
- package/src/index.ts +34 -0
- package/src/internal/download.ts +29 -0
- package/src/library/useExportResource.ts +3 -19
- package/src/memory/MemoryListPanel.tsx +532 -0
- package/src/memory/__tests__/MemoryListPanel.test.tsx +259 -0
- package/src/memory/__tests__/memoryHooks.test.tsx +220 -0
- package/src/memory/index.ts +19 -0
- package/src/memory/memoryGroups.ts +64 -0
- package/src/memory/useConfirmMemory.ts +62 -0
- package/src/memory/useDeleteMemory.ts +61 -0
- package/src/memory/useMemories.ts +66 -0
- package/src/memory/useRejectMemory.ts +65 -0
- package/src/memory/useUpdateMemoryContent.ts +67 -0
- package/src/session/NewSessionViewer.tsx +15 -1
- package/src/session/SessionViewer.tsx +48 -49
- package/src/session/TranscriptExportMenu.tsx +78 -0
- package/src/session/__tests__/SessionViewer-autoApproveToggle.test.tsx +178 -0
- package/src/session/__tests__/SessionViewer-transcriptExport.test.tsx +151 -0
- package/src/session/__tests__/TranscriptExportMenu.test.tsx +97 -0
- package/src/session/__tests__/useExportTranscript.test.tsx +187 -0
- package/src/session/__tests__/useNewSessionFlow.test.tsx +33 -0
- package/src/session/__tests__/useSessionPageFlow.autoApprove.test.tsx +176 -2
- package/src/session/index.ts +9 -0
- package/src/session/useExportTranscript.ts +171 -0
- package/src/session/useNewSessionFlow.ts +28 -7
- package/src/session/useSessionConversation.ts +10 -16
- package/src/session/useSessionExecutions.ts +5 -26
- package/src/session/useSessionPageFlow.ts +84 -21
- package/src/settings/MemorySection.tsx +45 -0
- package/src/settings/index.ts +1 -0
- package/src/settings/settings-nav.ts +2 -0
- package/src/usage/useExportCSV.ts +2 -14
- package/usage/useExportCSV.d.ts.map +1 -1
- package/usage/useExportCSV.js +2 -13
- package/usage/useExportCSV.js.map +1 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import { cn } from "@stigmer/theme";
|
|
5
|
+
import { getUserMessage } from "@stigmer/sdk";
|
|
6
|
+
import { timestampDate } from "@bufbuild/protobuf/wkt";
|
|
7
|
+
import { MemoryLifecycleState } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/enum_pb";
|
|
8
|
+
import { formatRelativeTime } from "../activity/format-relative-time.js";
|
|
9
|
+
import { SpinnerIcon } from "../internal/SpinnerIcon.js";
|
|
10
|
+
import { formatMemoryProvenance, groupMemoriesByLifecycle } from "./memoryGroups.js";
|
|
11
|
+
import { useConfirmMemory } from "./useConfirmMemory.js";
|
|
12
|
+
import { useDeleteMemory } from "./useDeleteMemory.js";
|
|
13
|
+
import { useMemories } from "./useMemories.js";
|
|
14
|
+
import { useRejectMemory } from "./useRejectMemory.js";
|
|
15
|
+
import { useUpdateMemoryContent } from "./useUpdateMemoryContent.js";
|
|
16
|
+
/**
|
|
17
|
+
* Lists everything the platform remembers about the caller in an
|
|
18
|
+
* organization, grouped pending-proposals-first (DD-005 D4): proposals
|
|
19
|
+
* awaiting a decision, then confirmed facts, then rejected proposals
|
|
20
|
+
* kept for audit.
|
|
21
|
+
*
|
|
22
|
+
* Every fact is shown VERBATIM — the exact stored text is what future
|
|
23
|
+
* prompts inject, byte for byte, so the review surface never paraphrases
|
|
24
|
+
* (DD-005 D6). Provenance renders beside each agent-proposed fact.
|
|
25
|
+
* Actions per state: confirm/reject/delete on proposals (reject is
|
|
26
|
+
* one-click — no confirmation dialog), edit/delete on confirmed facts,
|
|
27
|
+
* delete on rejected ones. Delete asks inline; it works in any state.
|
|
28
|
+
*
|
|
29
|
+
* All visual properties flow through `--stgm-*` design tokens.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <MemoryListPanel org="acme" />
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function MemoryListPanel({ org, className, now }) {
|
|
37
|
+
const { memories, isLoading, error, refetch } = useMemories(org);
|
|
38
|
+
// At most one row is mid-interaction at a time — the ApiKeyListPanel
|
|
39
|
+
// single-confirmation posture, extended with an editing mode.
|
|
40
|
+
const [rowState, setRowState] = useState({ mode: "idle" });
|
|
41
|
+
const resetRow = useCallback(() => setRowState({ mode: "idle" }), []);
|
|
42
|
+
const handleChanged = useCallback(() => {
|
|
43
|
+
setRowState({ mode: "idle" });
|
|
44
|
+
refetch();
|
|
45
|
+
}, [refetch]);
|
|
46
|
+
if (isLoading) {
|
|
47
|
+
return (_jsx("div", { className: cn("stg:space-y-2", className), "aria-busy": "true", "aria-label": "Loading memories", children: Array.from({ length: 2 }, (_, i) => (_jsx("div", { className: "stg:bg-muted-subtle stg:h-14 stg:animate-pulse stg:rounded-lg" }, i))) }));
|
|
48
|
+
}
|
|
49
|
+
if (error) {
|
|
50
|
+
return (_jsx("p", { className: cn("stg:text-destructive stg:text-xs", className), role: "alert", children: getUserMessage(error) }));
|
|
51
|
+
}
|
|
52
|
+
if (memories.length === 0) {
|
|
53
|
+
return (_jsx("p", { className: cn("stg:text-muted-foreground stg:py-4 stg:text-center stg:text-xs", className), children: "Nothing remembered yet. When an agent proposes a fact worth keeping, it appears here for your decision." }));
|
|
54
|
+
}
|
|
55
|
+
const groups = groupMemoriesByLifecycle(memories);
|
|
56
|
+
return (_jsxs("div", { className: cn("stg:space-y-6", className), children: [groups.proposed.length > 0 && (_jsx(MemoryGroup, { heading: "Pending proposals", description: "Facts agents proposed to remember. Nothing is stored in your sessions until you confirm it.", memories: groups.proposed, rowState: rowState, setRowState: setRowState, onChanged: handleChanged, onCancel: resetRow, now: now })), groups.confirmed.length > 0 && (_jsx(MemoryGroup, { heading: "Remembered", description: "Confirmed facts, shared with agents in your future sessions.", memories: groups.confirmed, rowState: rowState, setRowState: setRowState, onChanged: handleChanged, onCancel: resetRow, now: now })), groups.rejected.length > 0 && (_jsx(MemoryGroup, { heading: "Rejected", description: "Proposals you declined, kept for reference. Delete them to clear the record.", memories: groups.rejected, rowState: rowState, setRowState: setRowState, onChanged: handleChanged, onCancel: resetRow, now: now }))] }));
|
|
57
|
+
}
|
|
58
|
+
function MemoryGroup({ heading, description, memories, rowState, setRowState, onChanged, onCancel, now, }) {
|
|
59
|
+
return (_jsxs("div", { children: [_jsx("h3", { className: "stg:text-foreground stg:text-xs stg:font-semibold", children: heading }), _jsx("p", { className: "stg:text-muted-foreground stg:mb-2 stg:text-xs", children: description }), _jsx("div", { className: "stg:space-y-2", role: "list", "aria-label": heading, children: memories.map((memory) => {
|
|
60
|
+
const id = memory.metadata?.id ?? "";
|
|
61
|
+
return (_jsx(MemoryRow, { memory: memory, now: now, mode: rowState.mode !== "idle" && rowState.id === id
|
|
62
|
+
? rowState.mode
|
|
63
|
+
: "idle", onStartDelete: () => setRowState({ mode: "confirming-delete", id }), onStartEdit: () => setRowState({ mode: "editing", id }), onCancel: onCancel, onChanged: onChanged }, id));
|
|
64
|
+
}) })] }));
|
|
65
|
+
}
|
|
66
|
+
function MemoryRow({ memory, now, mode, onStartDelete, onStartEdit, onCancel, onChanged, }) {
|
|
67
|
+
const id = memory.metadata?.id ?? "";
|
|
68
|
+
const content = memory.spec?.content ?? "";
|
|
69
|
+
const state = memory.status?.lifecycleState;
|
|
70
|
+
const provenance = formatMemoryProvenance(memory);
|
|
71
|
+
const stateChangedAt = memory.status?.stateChangedAt;
|
|
72
|
+
const { confirmMemory, isConfirming, error: confirmError } = useConfirmMemory();
|
|
73
|
+
const { rejectMemory, isRejecting, error: rejectError } = useRejectMemory();
|
|
74
|
+
const { deleteMemory, isDeleting, error: deleteError } = useDeleteMemory();
|
|
75
|
+
const actionError = confirmError ?? rejectError ?? deleteError;
|
|
76
|
+
const isBusy = isConfirming || isRejecting || isDeleting;
|
|
77
|
+
const act = useCallback(async (action) => {
|
|
78
|
+
try {
|
|
79
|
+
await action(id);
|
|
80
|
+
onChanged();
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// error state is surfaced via the hooks
|
|
84
|
+
}
|
|
85
|
+
}, [id, onChanged]);
|
|
86
|
+
if (mode === "editing") {
|
|
87
|
+
return (_jsx(MemoryEditRow, { memory: memory, onCancel: onCancel, onSaved: onChanged }));
|
|
88
|
+
}
|
|
89
|
+
if (mode === "confirming-delete") {
|
|
90
|
+
return (_jsxs("div", { role: "listitem", className: "stg:flex stg:items-center stg:justify-between stg:gap-3 stg:rounded-lg stg:border stg:border-destructive/30 stg:bg-destructive-subtle stg:px-3 stg:py-2.5", children: [_jsxs("div", { className: "stg:min-w-0 stg:flex-1", children: [_jsxs("p", { className: "stg:text-xs stg:text-foreground", children: ["Forget this permanently? ", _jsx("q", { className: "stg:italic", children: content })] }), deleteError && (_jsx("p", { className: "stg:mt-0.5 stg:text-[0.65rem] stg:text-destructive", children: getUserMessage(deleteError) }))] }), _jsxs("div", { className: "stg:flex stg:shrink-0 stg:items-center stg:gap-1.5", children: [_jsxs("button", { type: "button", onClick: () => void act(deleteMemory), disabled: isDeleting, className: cn("stg:inline-flex stg:items-center stg:gap-1 stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium", "stg:bg-destructive stg:text-destructive-foreground stg:hover:bg-destructive-hover", "stg:disabled:pointer-events-none stg:disabled:opacity-50"), children: [isDeleting && _jsx(SpinnerIcon, { size: 12 }), "Delete"] }), _jsx("button", { type: "button", onClick: onCancel, disabled: isDeleting, className: cn("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs", "stg:text-muted-foreground stg:hover:text-foreground stg:hover:bg-accent-hover", "stg:disabled:pointer-events-none stg:disabled:opacity-50"), children: "Cancel" })] })] }));
|
|
91
|
+
}
|
|
92
|
+
return (_jsx("div", { role: "listitem", className: "stg:rounded-lg stg:border stg:border-border-muted stg:px-3 stg:py-2.5 stg:hover:border-border stg:transition-colors", children: _jsxs("div", { className: "stg:flex stg:items-start stg:justify-between stg:gap-3", children: [_jsxs("div", { className: "stg:min-w-0 stg:flex-1", children: [_jsx("p", { className: "stg:text-sm stg:text-foreground stg:whitespace-pre-wrap", children: content }), _jsxs("p", { className: "stg:mt-1 stg:text-xs stg:text-muted-foreground", children: [provenance ? `${provenance} · ` : "", formatStateStamp(state, stateChangedAt ? timestampDate(stateChangedAt) : undefined, now)] }), actionError && (_jsx("p", { className: "stg:mt-0.5 stg:text-[0.65rem] stg:text-destructive", role: "alert", children: getUserMessage(actionError) }))] }), _jsxs("div", { className: "stg:flex stg:shrink-0 stg:items-center stg:gap-1.5", children: [state === MemoryLifecycleState.lifecycle_state_confirmed && (_jsx(RowButton, { label: `Edit memory: ${content}`, onClick: onStartEdit, disabled: isBusy, children: "Edit" })), isProposed(state) && (_jsxs(_Fragment, { children: [_jsxs(RowButton, { label: `Confirm memory: ${content}`, onClick: () => void act(confirmMemory), disabled: isBusy, emphasis: "primary", children: [isConfirming && _jsx(SpinnerIcon, { size: 12 }), "Confirm"] }), _jsxs(RowButton, { label: `Reject memory: ${content}`, onClick: () => void act(rejectMemory), disabled: isBusy, children: [isRejecting && _jsx(SpinnerIcon, { size: 12 }), "Reject"] })] })), _jsx("button", { type: "button", onClick: onStartDelete, disabled: isBusy, "aria-label": `Delete memory: ${content}`, className: cn("stg:shrink-0 stg:rounded stg:p-1", "stg:text-muted-foreground stg:hover:text-destructive stg:hover:bg-destructive-subtle", "stg:transition-colors stg:disabled:pointer-events-none stg:disabled:opacity-50"), children: _jsx(TrashIcon, {}) })] })] }) }));
|
|
93
|
+
}
|
|
94
|
+
// MemoryEditRow edits the fact text in place — the one field the
|
|
95
|
+
// subject owns. Saving maps the loaded record through the generated
|
|
96
|
+
// update mapper (wipe-safe) and overrides only content.
|
|
97
|
+
function MemoryEditRow({ memory, onCancel, onSaved, }) {
|
|
98
|
+
const [draft, setDraft] = useState(memory.spec?.content ?? "");
|
|
99
|
+
const { updateContent, isUpdating, error } = useUpdateMemoryContent();
|
|
100
|
+
const trimmed = draft.trim();
|
|
101
|
+
const canSave = trimmed.length > 0 && trimmed.length <= 500 && !isUpdating;
|
|
102
|
+
const handleSave = async () => {
|
|
103
|
+
try {
|
|
104
|
+
await updateContent(memory, trimmed);
|
|
105
|
+
onSaved();
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// error state is surfaced via the hook
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return (_jsxs("div", { role: "listitem", className: "stg:rounded-lg stg:border stg:border-border stg:px-3 stg:py-2.5", children: [_jsx("textarea", { value: draft, onChange: (e) => setDraft(e.target.value), rows: 2, maxLength: 500, "aria-label": "Edit memory text", className: cn("stg:w-full stg:resize-y stg:rounded-md stg:border stg:border-input stg:bg-background stg:px-2 stg:py-1.5 stg:text-sm stg:text-foreground", "stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring") }), _jsxs("div", { className: "stg:mt-1.5 stg:flex stg:items-center stg:justify-between", children: [_jsxs("span", { className: "stg:text-[0.65rem] stg:text-muted-foreground", children: [trimmed.length, "/500"] }), _jsxs("div", { className: "stg:flex stg:items-center stg:gap-1.5", children: [_jsxs(RowButton, { label: "Save memory text", onClick: () => void handleSave(), disabled: !canSave, emphasis: "primary", children: [isUpdating && _jsx(SpinnerIcon, { size: 12 }), "Save"] }), _jsx(RowButton, { label: "Cancel editing", onClick: onCancel, disabled: isUpdating, children: "Cancel" })] })] }), error && (_jsx("p", { className: "stg:mt-1 stg:text-[0.65rem] stg:text-destructive", role: "alert", children: getUserMessage(error) }))] }));
|
|
112
|
+
}
|
|
113
|
+
// ---------------------------------------------------------------------------
|
|
114
|
+
// Presentation helpers (internal)
|
|
115
|
+
// ---------------------------------------------------------------------------
|
|
116
|
+
function isProposed(state) {
|
|
117
|
+
// The zero unspecified state should not exist (create stamps
|
|
118
|
+
// proposed); offering the decision actions is the safe rendering.
|
|
119
|
+
return (state === undefined ||
|
|
120
|
+
state === MemoryLifecycleState.lifecycle_state_unspecified ||
|
|
121
|
+
state === MemoryLifecycleState.lifecycle_state_proposed);
|
|
122
|
+
}
|
|
123
|
+
function formatStateStamp(state, changedAt, now) {
|
|
124
|
+
const verb = state === MemoryLifecycleState.lifecycle_state_confirmed
|
|
125
|
+
? "Confirmed"
|
|
126
|
+
: state === MemoryLifecycleState.lifecycle_state_rejected
|
|
127
|
+
? "Rejected"
|
|
128
|
+
: "Proposed";
|
|
129
|
+
if (!changedAt)
|
|
130
|
+
return verb;
|
|
131
|
+
return `${verb} ${formatRelativeTime(changedAt, now)}`;
|
|
132
|
+
}
|
|
133
|
+
function RowButton({ label, onClick, disabled, emphasis, children, }) {
|
|
134
|
+
return (_jsx("button", { type: "button", "aria-label": label, onClick: onClick, disabled: disabled, className: cn("stg:inline-flex stg:items-center stg:gap-1 stg:rounded-md stg:px-2 stg:py-1 stg:text-xs stg:font-medium", emphasis === "primary"
|
|
135
|
+
? "stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover"
|
|
136
|
+
: "stg:border stg:border-input stg:bg-background stg:text-foreground stg:hover:bg-accent stg:hover:text-accent-foreground", "stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring", "stg:disabled:pointer-events-none stg:disabled:opacity-50"), children: children }));
|
|
137
|
+
}
|
|
138
|
+
function TrashIcon() {
|
|
139
|
+
return (_jsxs("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [_jsx("path", { d: "M2.5 4h11M5.5 4V2.5a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1V4" }), _jsx("path", { d: "M12.5 4v9a1 1 0 0 1-1 1h-7a1 1 0 0 1-1-1V4" }), _jsx("line", { x1: "6.5", y1: "7", x2: "6.5", y2: "11" }), _jsx("line", { x1: "9.5", y1: "7", x2: "9.5", y2: "11" })] }));
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=MemoryListPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemoryListPanel.js","sourceRoot":"","sources":["../../src/memory/MemoryListPanel.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB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X,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,iBACV,MAAM,aAElB,eAAM,CAAC,EAAC,qDAAqD,GAAG,EAChE,eAAM,CAAC,EAAC,4CAA4C,GAAG,EACvD,eAAM,EAAE,EAAC,KAAK,EAAC,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,KAAK,EAAC,EAAE,EAAC,IAAI,GAAG,EACzC,eAAM,EAAE,EAAC,KAAK,EAAC,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,KAAK,EAAC,EAAE,EAAC,IAAI,GAAG,IACrC,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { MemoryListPanel, type MemoryListPanelProps } from "./MemoryListPanel.js";
|
|
2
|
+
export { groupMemoriesByLifecycle, formatMemoryProvenance, type MemoryGroups, } from "./memoryGroups.js";
|
|
3
|
+
export { useMemories, type UseMemoriesReturn } from "./useMemories.js";
|
|
4
|
+
export { useConfirmMemory, type UseConfirmMemoryReturn } from "./useConfirmMemory.js";
|
|
5
|
+
export { useRejectMemory, type UseRejectMemoryReturn } from "./useRejectMemory.js";
|
|
6
|
+
export { useDeleteMemory, type UseDeleteMemoryReturn } from "./useDeleteMemory.js";
|
|
7
|
+
export { useUpdateMemoryContent, type UseUpdateMemoryContentReturn, } from "./useUpdateMemoryContent.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/memory/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,KAAK,YAAY,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EACL,sBAAsB,EACtB,KAAK,4BAA4B,GAClC,MAAM,6BAA6B,CAAC"}
|
package/memory/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Memory — agent-proposed, user-confirmed facts (stigmer/stigmer#293
|
|
2
|
+
// Phase 2). The record is the trust surface over the recall seam: every
|
|
3
|
+
// fact is individually reviewable, editable, and deletable, and nothing
|
|
4
|
+
// is recalled until its subject confirms it.
|
|
5
|
+
export { MemoryListPanel } from "./MemoryListPanel.js";
|
|
6
|
+
export { groupMemoriesByLifecycle, formatMemoryProvenance, } from "./memoryGroups.js";
|
|
7
|
+
export { useMemories } from "./useMemories.js";
|
|
8
|
+
export { useConfirmMemory } from "./useConfirmMemory.js";
|
|
9
|
+
export { useRejectMemory } from "./useRejectMemory.js";
|
|
10
|
+
export { useDeleteMemory } from "./useDeleteMemory.js";
|
|
11
|
+
export { useUpdateMemoryContent, } from "./useUpdateMemoryContent.js";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/memory/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,wEAAwE;AACxE,wEAAwE;AACxE,6CAA6C;AAE7C,OAAO,EAAE,eAAe,EAA6B,MAAM,sBAAsB,CAAC;AAClF,OAAO,EACL,wBAAwB,EACxB,sBAAsB,GAEvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAA0B,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAA+B,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,eAAe,EAA8B,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,eAAe,EAA8B,MAAM,sBAAsB,CAAC;AACnF,OAAO,EACL,sBAAsB,GAEvB,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Memory } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/api_pb";
|
|
2
|
+
/** Memories bucketed by consent lifecycle, pending proposals first. */
|
|
3
|
+
export interface MemoryGroups {
|
|
4
|
+
/** Awaiting the caller's decision — the catch-up queue. */
|
|
5
|
+
readonly proposed: readonly Memory[];
|
|
6
|
+
/** Confirmed facts, recalled into future sessions. */
|
|
7
|
+
readonly confirmed: readonly Memory[];
|
|
8
|
+
/** Rejected proposals, kept for audit until deleted. */
|
|
9
|
+
readonly rejected: readonly Memory[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Buckets memories by lifecycle state for the pending-proposals-first
|
|
13
|
+
* page layout (DD-005 D4: the memory page is the catch-up surface for
|
|
14
|
+
* proposals scrolled past in session). Input order (newest first from
|
|
15
|
+
* the server) is preserved inside each bucket.
|
|
16
|
+
*
|
|
17
|
+
* A record in the zero `unspecified` state should not exist (create
|
|
18
|
+
* stamps `proposed`); it is bucketed with proposals so a decision
|
|
19
|
+
* surface is always offered rather than hiding the record.
|
|
20
|
+
*/
|
|
21
|
+
export declare function groupMemoriesByLifecycle(memories: readonly Memory[]): MemoryGroups;
|
|
22
|
+
/**
|
|
23
|
+
* One-line provenance attribution for a memory, or `null` when the
|
|
24
|
+
* record has none (created directly through the API, not by an agent).
|
|
25
|
+
*
|
|
26
|
+
* Trust requires "where did this come from" beside every fact (DD-004);
|
|
27
|
+
* agent/session display names are not resolvable from the record alone,
|
|
28
|
+
* so ids are shown — they are what links back to the source surfaces.
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatMemoryProvenance(memory: Memory): string | null;
|
|
31
|
+
//# sourceMappingURL=memoryGroups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoryGroups.d.ts","sourceRoot":"","sources":["../../src/memory/memoryGroups.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qDAAqD,CAAC;AAGlF,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,sDAAsD;IACtD,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B,YAAY,CAoBd;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQpE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { MemoryLifecycleState } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/enum_pb";
|
|
2
|
+
/**
|
|
3
|
+
* Buckets memories by lifecycle state for the pending-proposals-first
|
|
4
|
+
* page layout (DD-005 D4: the memory page is the catch-up surface for
|
|
5
|
+
* proposals scrolled past in session). Input order (newest first from
|
|
6
|
+
* the server) is preserved inside each bucket.
|
|
7
|
+
*
|
|
8
|
+
* A record in the zero `unspecified` state should not exist (create
|
|
9
|
+
* stamps `proposed`); it is bucketed with proposals so a decision
|
|
10
|
+
* surface is always offered rather than hiding the record.
|
|
11
|
+
*/
|
|
12
|
+
export function groupMemoriesByLifecycle(memories) {
|
|
13
|
+
const proposed = [];
|
|
14
|
+
const confirmed = [];
|
|
15
|
+
const rejected = [];
|
|
16
|
+
for (const memory of memories) {
|
|
17
|
+
switch (memory.status?.lifecycleState) {
|
|
18
|
+
case MemoryLifecycleState.lifecycle_state_confirmed:
|
|
19
|
+
confirmed.push(memory);
|
|
20
|
+
break;
|
|
21
|
+
case MemoryLifecycleState.lifecycle_state_rejected:
|
|
22
|
+
rejected.push(memory);
|
|
23
|
+
break;
|
|
24
|
+
default:
|
|
25
|
+
proposed.push(memory);
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return { proposed, confirmed, rejected };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* One-line provenance attribution for a memory, or `null` when the
|
|
33
|
+
* record has none (created directly through the API, not by an agent).
|
|
34
|
+
*
|
|
35
|
+
* Trust requires "where did this come from" beside every fact (DD-004);
|
|
36
|
+
* agent/session display names are not resolvable from the record alone,
|
|
37
|
+
* so ids are shown — they are what links back to the source surfaces.
|
|
38
|
+
*/
|
|
39
|
+
export function formatMemoryProvenance(memory) {
|
|
40
|
+
const provenance = memory.spec?.provenance;
|
|
41
|
+
if (!provenance)
|
|
42
|
+
return null;
|
|
43
|
+
const parts = [];
|
|
44
|
+
if (provenance.agentId)
|
|
45
|
+
parts.push(`agent ${provenance.agentId}`);
|
|
46
|
+
if (provenance.sessionId)
|
|
47
|
+
parts.push(`session ${provenance.sessionId}`);
|
|
48
|
+
if (parts.length === 0)
|
|
49
|
+
return null;
|
|
50
|
+
return `Proposed by ${parts.join(" in ")}`;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=memoryGroups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoryGroups.js","sourceRoot":"","sources":["../../src/memory/memoryGroups.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAY5F;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CACtC,QAA2B;IAE3B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,KAAK,MAAM,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC9B,QAAQ,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;YACtC,KAAK,oBAAoB,CAAC,yBAAyB;gBACjD,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACvB,MAAM;YACR,KAAK,oBAAoB,CAAC,wBAAwB;gBAChD,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACtB,MAAM;YACR;gBACE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACtB,MAAM;QACV,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AAC3C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAc;IACnD,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC;IAC3C,IAAI,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC;IAC7B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,UAAU,CAAC,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;IAClE,IAAI,UAAU,CAAC,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,WAAW,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;IACxE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,eAAe,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Memory } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/api_pb";
|
|
2
|
+
/** Return value of {@link useConfirmMemory}. */
|
|
3
|
+
export interface UseConfirmMemoryReturn {
|
|
4
|
+
/** Confirm a proposed memory by its resource ID. Resolves with the confirmed record. */
|
|
5
|
+
readonly confirmMemory: (id: string) => Promise<Memory>;
|
|
6
|
+
/** `true` while the confirm request is in flight. */
|
|
7
|
+
readonly isConfirming: boolean;
|
|
8
|
+
/** Error from the last failed confirm, or `null` when healthy. */
|
|
9
|
+
readonly error: Error | null;
|
|
10
|
+
/** Reset `error` to `null`. */
|
|
11
|
+
readonly clearError: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Behavior hook that wraps `memory.confirm()` — the consent act
|
|
15
|
+
* (DD-005 D3). A confirmed memory is recalled into the caller's future
|
|
16
|
+
* sessions as background context.
|
|
17
|
+
*
|
|
18
|
+
* Confirming an already-confirmed memory succeeds and changes nothing.
|
|
19
|
+
* Confirming a rejected memory fails with FAILED_PRECONDITION: the
|
|
20
|
+
* rejection stands — delete the record and let the agent propose again.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* const { confirmMemory, isConfirming } = useConfirmMemory();
|
|
25
|
+
*
|
|
26
|
+
* await confirmMemory(memory.metadata?.id ?? "");
|
|
27
|
+
* refetch(); // refresh the list after the decision
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function useConfirmMemory(): UseConfirmMemoryReturn;
|
|
31
|
+
//# sourceMappingURL=useConfirmMemory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConfirmMemory.d.ts","sourceRoot":"","sources":["../../src/memory/useConfirmMemory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qDAAqD,CAAC;AAIlF,gDAAgD;AAChD,MAAM,WAAW,sBAAsB;IACrC,wFAAwF;IACxF,QAAQ,CAAC,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACxD,qDAAqD;IACrD,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CAyBzD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import { useStigmer } from "../hooks.js";
|
|
4
|
+
import { toError } from "../internal/toError.js";
|
|
5
|
+
/**
|
|
6
|
+
* Behavior hook that wraps `memory.confirm()` — the consent act
|
|
7
|
+
* (DD-005 D3). A confirmed memory is recalled into the caller's future
|
|
8
|
+
* sessions as background context.
|
|
9
|
+
*
|
|
10
|
+
* Confirming an already-confirmed memory succeeds and changes nothing.
|
|
11
|
+
* Confirming a rejected memory fails with FAILED_PRECONDITION: the
|
|
12
|
+
* rejection stands — delete the record and let the agent propose again.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const { confirmMemory, isConfirming } = useConfirmMemory();
|
|
17
|
+
*
|
|
18
|
+
* await confirmMemory(memory.metadata?.id ?? "");
|
|
19
|
+
* refetch(); // refresh the list after the decision
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function useConfirmMemory() {
|
|
23
|
+
const stigmer = useStigmer();
|
|
24
|
+
const [isConfirming, setIsConfirming] = useState(false);
|
|
25
|
+
const [error, setError] = useState(null);
|
|
26
|
+
const clearError = useCallback(() => setError(null), []);
|
|
27
|
+
const confirmMemory = useCallback(async (id) => {
|
|
28
|
+
setIsConfirming(true);
|
|
29
|
+
setError(null);
|
|
30
|
+
try {
|
|
31
|
+
return await stigmer.memory.confirm(id);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
setError(toError(err));
|
|
35
|
+
throw err;
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
setIsConfirming(false);
|
|
39
|
+
}
|
|
40
|
+
}, [stigmer]);
|
|
41
|
+
return { confirmMemory, isConfirming, error, clearError };
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=useConfirmMemory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConfirmMemory.js","sourceRoot":"","sources":["../../src/memory/useConfirmMemory.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAcjD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IAEvD,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAEzD,MAAM,aAAa,GAAG,WAAW,CAC/B,KAAK,EAAE,EAAU,EAAmB,EAAE;QACpC,eAAe,CAAC,IAAI,CAAC,CAAC;QACtB,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEf,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC1C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,eAAe,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACH,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Memory } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/api_pb";
|
|
2
|
+
/** Return value of {@link useDeleteMemory}. */
|
|
3
|
+
export interface UseDeleteMemoryReturn {
|
|
4
|
+
/** Delete a memory by its resource ID, in any lifecycle state. Resolves with the deleted record. */
|
|
5
|
+
readonly deleteMemory: (id: string) => Promise<Memory>;
|
|
6
|
+
/** `true` while the delete request is in flight. */
|
|
7
|
+
readonly isDeleting: boolean;
|
|
8
|
+
/** Error from the last failed delete, or `null` when healthy. */
|
|
9
|
+
readonly error: Error | null;
|
|
10
|
+
/** Reset `error` to `null`. */
|
|
11
|
+
readonly clearError: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Behavior hook that wraps `memory.delete()`.
|
|
15
|
+
*
|
|
16
|
+
* Deletion works in any lifecycle state — it is never refused on
|
|
17
|
+
* lifecycle grounds (DD-004) — and is the revocation mechanism for
|
|
18
|
+
* confirmed facts: the fact stops reaching future sessions immediately.
|
|
19
|
+
* Past executions keep their immutable recall snapshots.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* const { deleteMemory, isDeleting, error } = useDeleteMemory();
|
|
24
|
+
*
|
|
25
|
+
* await deleteMemory(memory.metadata?.id ?? "");
|
|
26
|
+
* refetch(); // refresh the list after deletion
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function useDeleteMemory(): UseDeleteMemoryReturn;
|
|
30
|
+
//# sourceMappingURL=useDeleteMemory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeleteMemory.d.ts","sourceRoot":"","sources":["../../src/memory/useDeleteMemory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qDAAqD,CAAC;AAIlF,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC,oGAAoG;IACpG,QAAQ,CAAC,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACvD,oDAAoD;IACpD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,IAAI,qBAAqB,CAyBvD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import { useStigmer } from "../hooks.js";
|
|
4
|
+
import { toError } from "../internal/toError.js";
|
|
5
|
+
/**
|
|
6
|
+
* Behavior hook that wraps `memory.delete()`.
|
|
7
|
+
*
|
|
8
|
+
* Deletion works in any lifecycle state — it is never refused on
|
|
9
|
+
* lifecycle grounds (DD-004) — and is the revocation mechanism for
|
|
10
|
+
* confirmed facts: the fact stops reaching future sessions immediately.
|
|
11
|
+
* Past executions keep their immutable recall snapshots.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* const { deleteMemory, isDeleting, error } = useDeleteMemory();
|
|
16
|
+
*
|
|
17
|
+
* await deleteMemory(memory.metadata?.id ?? "");
|
|
18
|
+
* refetch(); // refresh the list after deletion
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export function useDeleteMemory() {
|
|
22
|
+
const stigmer = useStigmer();
|
|
23
|
+
const [isDeleting, setIsDeleting] = useState(false);
|
|
24
|
+
const [error, setError] = useState(null);
|
|
25
|
+
const clearError = useCallback(() => setError(null), []);
|
|
26
|
+
const deleteMemory = useCallback(async (id) => {
|
|
27
|
+
setIsDeleting(true);
|
|
28
|
+
setError(null);
|
|
29
|
+
try {
|
|
30
|
+
return await stigmer.memory.delete(id);
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
setError(toError(err));
|
|
34
|
+
throw err;
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
setIsDeleting(false);
|
|
38
|
+
}
|
|
39
|
+
}, [stigmer]);
|
|
40
|
+
return { deleteMemory, isDeleting, error, clearError };
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=useDeleteMemory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeleteMemory.js","sourceRoot":"","sources":["../../src/memory/useDeleteMemory.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAcjD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IAEvD,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAEzD,MAAM,YAAY,GAAG,WAAW,CAC9B,KAAK,EAAE,EAAU,EAAmB,EAAE;QACpC,aAAa,CAAC,IAAI,CAAC,CAAC;QACpB,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEf,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Memory } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/api_pb";
|
|
2
|
+
/** Return value of {@link useMemories}. */
|
|
3
|
+
export interface UseMemoriesReturn {
|
|
4
|
+
/** Every memory the caller can view in the org, newest first. */
|
|
5
|
+
readonly memories: readonly Memory[];
|
|
6
|
+
/** `true` while the initial fetch is in flight. */
|
|
7
|
+
readonly isLoading: boolean;
|
|
8
|
+
/** `true` while a background refetch is in flight. */
|
|
9
|
+
readonly isRefetching: boolean;
|
|
10
|
+
/** Error from the last failed request, or `null` when healthy. */
|
|
11
|
+
readonly error: Error | null;
|
|
12
|
+
/** Discard cached data and re-fetch the list from the server. */
|
|
13
|
+
readonly refetch: () => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Data hook that fetches the caller's memories in an organization.
|
|
17
|
+
*
|
|
18
|
+
* Memory content is subject-only: the server returns exactly the records
|
|
19
|
+
* that are about the caller (FGA-filtered in cloud; single-user in local
|
|
20
|
+
* mode), so this list is always "what the platform remembers about ME
|
|
21
|
+
* here". Ordering is newest first; group by lifecycle state for display
|
|
22
|
+
* with {@link groupMemoriesByLifecycle}.
|
|
23
|
+
*
|
|
24
|
+
* Pass `null` as `org` to skip fetching (stable no-op).
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* const { memories, isLoading, refetch } = useMemories(org);
|
|
29
|
+
* const groups = groupMemoriesByLifecycle(memories);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function useMemories(org: string | null): UseMemoriesReturn;
|
|
33
|
+
//# sourceMappingURL=useMemories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMemories.d.ts","sourceRoot":"","sources":["../../src/memory/useMemories.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qDAAqD,CAAC;AAalF,2CAA2C;AAC3C,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,iBAAiB,CAkBjE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { create } from "@bufbuild/protobuf";
|
|
3
|
+
import { ListMemoriesRequestSchema } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/io_pb";
|
|
4
|
+
import { useStigmer } from "../hooks.js";
|
|
5
|
+
import { useFetch } from "../internal/useFetch.js";
|
|
6
|
+
/**
|
|
7
|
+
* The server-enforced per-subject-per-org record ceiling (all lifecycle
|
|
8
|
+
* states). Requesting one page of exactly this size fetches EVERY record
|
|
9
|
+
* the caller can see, by construction — the cap is why this list needs
|
|
10
|
+
* no pagination UI.
|
|
11
|
+
*/
|
|
12
|
+
const MEMORY_CAP = 100;
|
|
13
|
+
/**
|
|
14
|
+
* Data hook that fetches the caller's memories in an organization.
|
|
15
|
+
*
|
|
16
|
+
* Memory content is subject-only: the server returns exactly the records
|
|
17
|
+
* that are about the caller (FGA-filtered in cloud; single-user in local
|
|
18
|
+
* mode), so this list is always "what the platform remembers about ME
|
|
19
|
+
* here". Ordering is newest first; group by lifecycle state for display
|
|
20
|
+
* with {@link groupMemoriesByLifecycle}.
|
|
21
|
+
*
|
|
22
|
+
* Pass `null` as `org` to skip fetching (stable no-op).
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* const { memories, isLoading, refetch } = useMemories(org);
|
|
27
|
+
* const groups = groupMemoriesByLifecycle(memories);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export function useMemories(org) {
|
|
31
|
+
const stigmer = useStigmer();
|
|
32
|
+
const { data: memories, isLoading, isRefetching, error, refetch } = useFetch(org
|
|
33
|
+
? () => stigmer.memory
|
|
34
|
+
.list(create(ListMemoriesRequestSchema, {
|
|
35
|
+
org,
|
|
36
|
+
pageInfo: { num: 1, size: MEMORY_CAP },
|
|
37
|
+
}))
|
|
38
|
+
.then((r) => [...r.items])
|
|
39
|
+
: null, [stigmer, org], []);
|
|
40
|
+
return { memories, isLoading, isRefetching, error, refetch };
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=useMemories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMemories.js","sourceRoot":"","sources":["../../src/memory/useMemories.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,UAAU,GAAG,GAAG,CAAC;AAgBvB;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,WAAW,CAAC,GAAkB;IAC5C,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,QAAQ,CAC1E,GAAG;QACD,CAAC,CAAC,GAAG,EAAE,CACH,OAAO,CAAC,MAAM;aACX,IAAI,CAAC,MAAM,CAAC,yBAAyB,EAAE;YACtC,GAAG;YACH,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE;SACvC,CAAC,CAAC;aACF,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC,CAAC,IAAI,EACR,CAAC,OAAO,EAAE,GAAG,CAAC,EACd,EAAc,CACf,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Memory } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/api_pb";
|
|
2
|
+
/** Return value of {@link useRejectMemory}. */
|
|
3
|
+
export interface UseRejectMemoryReturn {
|
|
4
|
+
/** Reject a proposed memory by its resource ID. Resolves with the rejected record. */
|
|
5
|
+
readonly rejectMemory: (id: string) => Promise<Memory>;
|
|
6
|
+
/** `true` while the reject request is in flight. */
|
|
7
|
+
readonly isRejecting: boolean;
|
|
8
|
+
/** Error from the last failed reject, or `null` when healthy. */
|
|
9
|
+
readonly error: Error | null;
|
|
10
|
+
/** Reset `error` to `null`. */
|
|
11
|
+
readonly clearError: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Behavior hook that wraps `memory.reject()`. A rejected memory is never
|
|
15
|
+
* recalled; the record is kept as an audit trail until deleted.
|
|
16
|
+
*
|
|
17
|
+
* Rejecting an already-rejected memory succeeds and changes nothing.
|
|
18
|
+
* Rejecting a confirmed memory fails with FAILED_PRECONDITION —
|
|
19
|
+
* deleting a confirmed memory is how it is revoked.
|
|
20
|
+
*
|
|
21
|
+
* Rejection is deliberately one click on every surface, with no
|
|
22
|
+
* confirmation dialog (DD-005 D4): expensive review teaches users to
|
|
23
|
+
* ignore the proposal queue.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const { rejectMemory, isRejecting } = useRejectMemory();
|
|
28
|
+
*
|
|
29
|
+
* await rejectMemory(memory.metadata?.id ?? "");
|
|
30
|
+
* refetch(); // refresh the list after the decision
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function useRejectMemory(): UseRejectMemoryReturn;
|
|
34
|
+
//# sourceMappingURL=useRejectMemory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRejectMemory.d.ts","sourceRoot":"","sources":["../../src/memory/useRejectMemory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qDAAqD,CAAC;AAIlF,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC,sFAAsF;IACtF,QAAQ,CAAC,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACvD,oDAAoD;IACpD,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,IAAI,qBAAqB,CAyBvD"}
|