@stigmer/react 3.12.6 → 3.12.8
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.map +1 -1
- package/composer/ComposerToolbar.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/ResultView.d.ts.map +1 -1
- package/execution/ResultView.js +6 -0
- package/execution/ResultView.js.map +1 -1
- package/execution/ToolCallItem.d.ts.map +1 -1
- package/execution/ToolCallItem.js +13 -2
- package/execution/ToolCallItem.js.map +1 -1
- package/execution/tool-categories.d.ts +1 -1
- package/execution/tool-categories.d.ts.map +1 -1
- package/execution/tool-categories.js +6 -0
- package/execution/tool-categories.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/identity-account/AccountPreferencesPanel.d.ts +2 -1
- package/identity-account/AccountPreferencesPanel.d.ts.map +1 -1
- package/identity-account/AccountPreferencesPanel.js +41 -3
- package/identity-account/AccountPreferencesPanel.js.map +1 -1
- package/identity-account/useAccountExecutionDefaults.d.ts +7 -0
- package/identity-account/useAccountExecutionDefaults.d.ts.map +1 -1
- package/identity-account/useAccountExecutionDefaults.js +5 -2
- package/identity-account/useAccountExecutionDefaults.js.map +1 -1
- package/index.d.ts +5 -2
- package/index.d.ts.map +1 -1
- package/index.js +5 -1
- package/index.js.map +1 -1
- package/internal/MemoryEnabledRow.d.ts +37 -0
- package/internal/MemoryEnabledRow.d.ts.map +1 -0
- package/internal/MemoryEnabledRow.js +25 -0
- package/internal/MemoryEnabledRow.js.map +1 -0
- 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/MemoryProposalCard.d.ts +35 -0
- package/memory/MemoryProposalCard.d.ts.map +1 -0
- package/memory/MemoryProposalCard.js +73 -0
- package/memory/MemoryProposalCard.js.map +1 -0
- package/memory/index.d.ts +10 -0
- package/memory/index.d.ts.map +1 -0
- package/memory/index.js +14 -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/useMemory.d.ts +39 -0
- package/memory/useMemory.d.ts.map +1 -0
- package/memory/useMemory.js +43 -0
- package/memory/useMemory.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/organization/OrgPreferencesPanel.d.ts.map +1 -1
- package/organization/OrgPreferencesPanel.js +36 -4
- package/organization/OrgPreferencesPanel.js.map +1 -1
- package/package.json +4 -4
- package/session/AutoApproveIndicator.d.ts +18 -0
- package/session/AutoApproveIndicator.d.ts.map +1 -0
- package/session/AutoApproveIndicator.js +23 -0
- package/session/AutoApproveIndicator.js.map +1 -0
- package/session/NewSessionViewer.d.ts.map +1 -1
- package/session/NewSessionViewer.js +10 -1
- package/session/NewSessionViewer.js.map +1 -1
- package/session/SessionViewer.d.ts +26 -1
- package/session/SessionViewer.d.ts.map +1 -1
- package/session/SessionViewer.js +28 -22
- 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/facets/SetupTab.d.ts +43 -6
- package/session/facets/SetupTab.d.ts.map +1 -1
- package/session/facets/SetupTab.js +32 -36
- package/session/facets/SetupTab.js.map +1 -1
- package/session/facets/UsageTab.d.ts +2 -1
- package/session/facets/UsageTab.d.ts.map +1 -1
- package/session/facets/UsageTab.js +11 -5
- package/session/facets/UsageTab.js.map +1 -1
- package/session/facets/index.d.ts +1 -1
- package/session/facets/index.d.ts.map +1 -1
- package/session/facets/primitives.d.ts +58 -0
- package/session/facets/primitives.d.ts.map +1 -0
- package/session/facets/primitives.js +59 -0
- package/session/facets/primitives.js.map +1 -0
- package/session/index.d.ts +5 -1
- 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 +16 -0
- package/session/useNewSessionFlow.d.ts.map +1 -1
- package/session/useNewSessionFlow.js +25 -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 +41 -10
- package/session/useSessionPageFlow.d.ts.map +1 -1
- package/session/useSessionPageFlow.js +67 -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/attachment/__tests__/prepare-image.test.ts +12 -6
- package/src/composer/ComposerToolbar.tsx +1 -0
- package/src/execution/MessageThread.tsx +8 -11
- package/src/execution/ResultView.tsx +6 -0
- package/src/execution/ToolCallItem.tsx +18 -1
- package/src/execution/tool-categories.ts +7 -0
- package/src/execution/useFileChangeContent.ts +5 -12
- package/src/identity-account/AccountPreferencesPanel.tsx +89 -2
- package/src/identity-account/__tests__/AccountPreferencesPanel.test.tsx +112 -0
- package/src/identity-account/__tests__/useAccountExecutionDefaults.test.tsx +34 -1
- package/src/identity-account/useAccountExecutionDefaults.ts +12 -2
- package/src/index.ts +38 -0
- package/src/internal/MemoryEnabledRow.tsx +92 -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/MemoryProposalCard.tsx +181 -0
- package/src/memory/__tests__/MemoryListPanel.test.tsx +259 -0
- package/src/memory/__tests__/MemoryProposalCard.test.tsx +236 -0
- package/src/memory/__tests__/memoryHooks.test.tsx +283 -0
- package/src/memory/index.ts +24 -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/useMemory.ts +80 -0
- package/src/memory/useRejectMemory.ts +65 -0
- package/src/memory/useUpdateMemoryContent.ts +67 -0
- package/src/organization/OrgPreferencesPanel.tsx +52 -3
- package/src/organization/__tests__/OrgPreferencesPanel.test.tsx +65 -0
- package/src/session/AutoApproveIndicator.tsx +45 -0
- package/src/session/NewSessionViewer.tsx +17 -0
- package/src/session/SessionViewer.tsx +78 -41
- package/src/session/TranscriptExportMenu.tsx +78 -0
- package/src/session/__tests__/NewSessionViewer.test.tsx +32 -0
- package/src/session/__tests__/SessionViewer-autoApprove.test.tsx +244 -0
- package/src/session/__tests__/SessionViewer-transcriptExport.test.tsx +189 -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 +89 -0
- package/src/session/__tests__/useSessionPageFlow.autoApprove.test.tsx +263 -2
- package/src/session/facets/SetupTab.tsx +193 -157
- package/src/session/facets/UsageTab.tsx +38 -38
- package/src/session/facets/index.ts +1 -0
- package/src/session/facets/primitives.tsx +169 -0
- package/src/session/index.ts +10 -0
- package/src/session/useExportTranscript.ts +171 -0
- package/src/session/useNewSessionFlow.ts +42 -6
- package/src/session/useSessionConversation.ts +10 -16
- package/src/session/useSessionExecutions.ts +5 -26
- package/src/session/useSessionPageFlow.ts +108 -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/switch/Switch.tsx +4 -0
- package/src/usage/useExportCSV.ts +2 -14
- package/src/workflow/__tests__/useWorkflowCanvas.dirty.test.tsx +7 -2
- package/src/workflow/__tests__/useWorkflowCanvas.drag.test.tsx +7 -2
- package/src/workspace/WorkspaceSurface.tsx +26 -3
- package/styles.css +1 -1
- package/switch/Switch.d.ts +3 -1
- package/switch/Switch.d.ts.map +1 -1
- package/switch/Switch.js +2 -2
- package/switch/Switch.js.map +1 -1
- package/usage/useExportCSV.d.ts.map +1 -1
- package/usage/useExportCSV.js +2 -13
- package/usage/useExportCSV.js.map +1 -1
- package/workspace/WorkspaceSurface.js +11 -2
- package/workspace/WorkspaceSurface.js.map +1 -1
|
@@ -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,39 @@
|
|
|
1
|
+
import type { Memory } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/api_pb";
|
|
2
|
+
/** Return value of {@link useMemory}. */
|
|
3
|
+
export interface UseMemoryReturn {
|
|
4
|
+
/** The memory record, or `null` while loading / not found / on error. */
|
|
5
|
+
readonly memory: Memory | null;
|
|
6
|
+
/** `true` while the initial fetch is in flight. */
|
|
7
|
+
readonly isLoading: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* `true` when the record no longer exists. A first-class STATE, not an
|
|
10
|
+
* error: deletion is the platform's consent-revocation mechanism, so a
|
|
11
|
+
* consumer (the proposal chip, a deep link) must render "no longer
|
|
12
|
+
* stored" honestly rather than a failure.
|
|
13
|
+
*/
|
|
14
|
+
readonly notFound: boolean;
|
|
15
|
+
/** Error from the last failed request (never not-found), or `null`. */
|
|
16
|
+
readonly error: Error | null;
|
|
17
|
+
/** Discard cached data and re-fetch the record from the server. */
|
|
18
|
+
readonly refetch: () => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Data hook that fetches one memory record by id.
|
|
22
|
+
*
|
|
23
|
+
* Built for surfaces that hold a memory's identity but not its CURRENT
|
|
24
|
+
* lifecycle state — the in-thread proposal chip is the primary consumer:
|
|
25
|
+
* the tool result it renders from is frozen at capture time, while the
|
|
26
|
+
* record may have been confirmed, rejected, or deleted since (from the
|
|
27
|
+
* chip itself, the memory settings page, or another device). Content
|
|
28
|
+
* visibility is subject-only, so the fetch answers only for the person
|
|
29
|
+
* the memory is about.
|
|
30
|
+
*
|
|
31
|
+
* Pass `null` as `id` to skip fetching (stable no-op).
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* const { memory, isLoading, notFound } = useMemory(memoryId);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function useMemory(id: string | null): UseMemoryReturn;
|
|
39
|
+
//# sourceMappingURL=useMemory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMemory.d.ts","sourceRoot":"","sources":["../../src/memory/useMemory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qDAAqD,CAAC;AAKlF,yCAAyC;AACzC,MAAM,WAAW,eAAe;IAC9B,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B;AAUD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,CA2B5D"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { isNotFound } from "@stigmer/sdk";
|
|
3
|
+
import { useStigmer } from "../hooks.js";
|
|
4
|
+
import { useFetch } from "../internal/useFetch.js";
|
|
5
|
+
const PENDING_LOOKUP = { memory: null, notFound: false };
|
|
6
|
+
/**
|
|
7
|
+
* Data hook that fetches one memory record by id.
|
|
8
|
+
*
|
|
9
|
+
* Built for surfaces that hold a memory's identity but not its CURRENT
|
|
10
|
+
* lifecycle state — the in-thread proposal chip is the primary consumer:
|
|
11
|
+
* the tool result it renders from is frozen at capture time, while the
|
|
12
|
+
* record may have been confirmed, rejected, or deleted since (from the
|
|
13
|
+
* chip itself, the memory settings page, or another device). Content
|
|
14
|
+
* visibility is subject-only, so the fetch answers only for the person
|
|
15
|
+
* the memory is about.
|
|
16
|
+
*
|
|
17
|
+
* Pass `null` as `id` to skip fetching (stable no-op).
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { memory, isLoading, notFound } = useMemory(memoryId);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export function useMemory(id) {
|
|
25
|
+
const stigmer = useStigmer();
|
|
26
|
+
const { data, isLoading, error, refetch } = useFetch(id
|
|
27
|
+
? () => stigmer.memory.get(id).then((memory) => ({ memory, notFound: false }), (err) => {
|
|
28
|
+
// Deletion is a state this hook reports, never an error it
|
|
29
|
+
// throws — every other failure propagates.
|
|
30
|
+
if (isNotFound(err))
|
|
31
|
+
return { memory: null, notFound: true };
|
|
32
|
+
throw err;
|
|
33
|
+
})
|
|
34
|
+
: null, [stigmer, id], PENDING_LOOKUP);
|
|
35
|
+
return {
|
|
36
|
+
memory: data.memory,
|
|
37
|
+
isLoading,
|
|
38
|
+
notFound: data.notFound,
|
|
39
|
+
error,
|
|
40
|
+
refetch,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=useMemory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMemory.js","sourceRoot":"","sources":["../../src/memory/useMemory.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AA2BnD,MAAM,cAAc,GAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAEvE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,SAAS,CAAC,EAAiB;IACzC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,QAAQ,CAClD,EAAE;QACA,CAAC,CAAC,GAAG,EAAE,CACH,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CACzB,CAAC,MAAM,EAAgB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EACvD,CAAC,GAAG,EAAgB,EAAE;YACpB,2DAA2D;YAC3D,2CAA2C;YAC3C,IAAI,UAAU,CAAC,GAAG,CAAC;gBAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YAC7D,MAAM,GAAG,CAAC;QACZ,CAAC,CACF;QACL,CAAC,CAAC,IAAI,EACR,CAAC,OAAO,EAAE,EAAE,CAAC,EACb,cAAc,CACf,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,SAAS;QACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK;QACL,OAAO;KACR,CAAC;AACJ,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"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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.reject()`. A rejected memory is never
|
|
7
|
+
* recalled; the record is kept as an audit trail until deleted.
|
|
8
|
+
*
|
|
9
|
+
* Rejecting an already-rejected memory succeeds and changes nothing.
|
|
10
|
+
* Rejecting a confirmed memory fails with FAILED_PRECONDITION —
|
|
11
|
+
* deleting a confirmed memory is how it is revoked.
|
|
12
|
+
*
|
|
13
|
+
* Rejection is deliberately one click on every surface, with no
|
|
14
|
+
* confirmation dialog (DD-005 D4): expensive review teaches users to
|
|
15
|
+
* ignore the proposal queue.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const { rejectMemory, isRejecting } = useRejectMemory();
|
|
20
|
+
*
|
|
21
|
+
* await rejectMemory(memory.metadata?.id ?? "");
|
|
22
|
+
* refetch(); // refresh the list after the decision
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export function useRejectMemory() {
|
|
26
|
+
const stigmer = useStigmer();
|
|
27
|
+
const [isRejecting, setIsRejecting] = useState(false);
|
|
28
|
+
const [error, setError] = useState(null);
|
|
29
|
+
const clearError = useCallback(() => setError(null), []);
|
|
30
|
+
const rejectMemory = useCallback(async (id) => {
|
|
31
|
+
setIsRejecting(true);
|
|
32
|
+
setError(null);
|
|
33
|
+
try {
|
|
34
|
+
return await stigmer.memory.reject(id);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
setError(toError(err));
|
|
38
|
+
throw err;
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
setIsRejecting(false);
|
|
42
|
+
}
|
|
43
|
+
}, [stigmer]);
|
|
44
|
+
return { rejectMemory, isRejecting, error, clearError };
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=useRejectMemory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRejectMemory.js","sourceRoot":"","sources":["../../src/memory/useRejectMemory.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;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,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,cAAc,CAAC,IAAI,CAAC,CAAC;QACrB,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,cAAc,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;IACH,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Memory } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/api_pb";
|
|
2
|
+
/** Return value of {@link useUpdateMemoryContent}. */
|
|
3
|
+
export interface UseUpdateMemoryContentReturn {
|
|
4
|
+
/** Replace a memory's fact text. Resolves with the updated record. */
|
|
5
|
+
readonly updateContent: (memory: Memory, content: string) => Promise<Memory>;
|
|
6
|
+
/** `true` while the update request is in flight. */
|
|
7
|
+
readonly isUpdating: boolean;
|
|
8
|
+
/** Error from the last failed update, or `null` when healthy. */
|
|
9
|
+
readonly error: Error | null;
|
|
10
|
+
/** Reset `error` to `null`. */
|
|
11
|
+
readonly clearError: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Behavior hook that edits a memory's fact text — the one field the
|
|
15
|
+
* subject owns after capture (DD-004).
|
|
16
|
+
*
|
|
17
|
+
* The update RPC replaces the entire spec, so the loaded record is
|
|
18
|
+
* mapped through the generated `toMemoryUpdateInput` and only `content`
|
|
19
|
+
* is overridden — the wipe-safe editing rule. Subject and provenance
|
|
20
|
+
* ride along verbatim (they are update-immutable server-side), and the
|
|
21
|
+
* consent lifecycle is never touched by updates.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const { updateContent, isUpdating } = useUpdateMemoryContent();
|
|
26
|
+
*
|
|
27
|
+
* await updateContent(memory, editedText);
|
|
28
|
+
* refetch(); // refresh the list after the edit
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function useUpdateMemoryContent(): UseUpdateMemoryContentReturn;
|
|
32
|
+
//# sourceMappingURL=useUpdateMemoryContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUpdateMemoryContent.d.ts","sourceRoot":"","sources":["../../src/memory/useUpdateMemoryContent.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qDAAqD,CAAC;AAKlF,sDAAsD;AACtD,MAAM,WAAW,4BAA4B;IAC3C,sEAAsE;IACtE,QAAQ,CAAC,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7E,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;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,IAAI,4BAA4B,CA4BrE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import { toMemoryUpdateInput } from "@stigmer/sdk";
|
|
4
|
+
import { useStigmer } from "../hooks.js";
|
|
5
|
+
import { toError } from "../internal/toError.js";
|
|
6
|
+
/**
|
|
7
|
+
* Behavior hook that edits a memory's fact text — the one field the
|
|
8
|
+
* subject owns after capture (DD-004).
|
|
9
|
+
*
|
|
10
|
+
* The update RPC replaces the entire spec, so the loaded record is
|
|
11
|
+
* mapped through the generated `toMemoryUpdateInput` and only `content`
|
|
12
|
+
* is overridden — the wipe-safe editing rule. Subject and provenance
|
|
13
|
+
* ride along verbatim (they are update-immutable server-side), and the
|
|
14
|
+
* consent lifecycle is never touched by updates.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const { updateContent, isUpdating } = useUpdateMemoryContent();
|
|
19
|
+
*
|
|
20
|
+
* await updateContent(memory, editedText);
|
|
21
|
+
* refetch(); // refresh the list after the edit
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export function useUpdateMemoryContent() {
|
|
25
|
+
const stigmer = useStigmer();
|
|
26
|
+
const [isUpdating, setIsUpdating] = useState(false);
|
|
27
|
+
const [error, setError] = useState(null);
|
|
28
|
+
const clearError = useCallback(() => setError(null), []);
|
|
29
|
+
const updateContent = useCallback(async (memory, content) => {
|
|
30
|
+
setIsUpdating(true);
|
|
31
|
+
setError(null);
|
|
32
|
+
try {
|
|
33
|
+
return await stigmer.memory.update({
|
|
34
|
+
...toMemoryUpdateInput(memory),
|
|
35
|
+
content,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
setError(toError(err));
|
|
40
|
+
throw err;
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
setIsUpdating(false);
|
|
44
|
+
}
|
|
45
|
+
}, [stigmer]);
|
|
46
|
+
return { updateContent, isUpdating, error, clearError };
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=useUpdateMemoryContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUpdateMemoryContent.js","sourceRoot":"","sources":["../../src/memory/useUpdateMemoryContent.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAcjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,sBAAsB;IACpC,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,aAAa,GAAG,WAAW,CAC/B,KAAK,EAAE,MAAc,EAAE,OAAe,EAAmB,EAAE;QACzD,aAAa,CAAC,IAAI,CAAC,CAAC;QACpB,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEf,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;gBACjC,GAAG,mBAAmB,CAAC,MAAM,CAAC;gBAC9B,OAAO;aACR,CAAC,CAAC;QACL,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,aAAa,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrgPreferencesPanel.d.ts","sourceRoot":"","sources":["../../src/organization/OrgPreferencesPanel.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2DAA2D,CAAC;
|
|
1
|
+
{"version":3,"file":"OrgPreferencesPanel.d.ts","sourceRoot":"","sources":["../../src/organization/OrgPreferencesPanel.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2DAA2D,CAAC;AAQ9F,6CAA6C;AAC7C,MAAM,WAAW,wBAAwB;IACvC,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+DAA+D;IAC/D,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,CAAC;IACjD,yDAAyD;IACzD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,SAAS,EACT,SAAS,GACV,EAAE,wBAAwB,kDA8N1B"}
|