@adapttable/ai-react 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/dist/index.cjs +13 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { AgentApply, AgentCapabilityDefinition, AgentContextInputs, AgentObservation, AgentSession, AlwaysAllowedState, ApprovalResult, ApprovalSubject, AssistantAllowance, AssistantAnswer, AssistantInterruption, AssistantInterruption as AssistantInterruption$1, AssistantMessage, AssistantQuestion, AssistantResumeHandle, AssistantResumeHandle as AssistantResumeHandle$1, AssistantStatus, AssistantSuggestion, AssistantSuggestion as AssistantSuggestion$1, AssistantTransport, CommitPolicy, SharedApproval, TableAgentBridge as TableAgentBridge$1, TableAgentColumnPatch, TableAssistantSnapshot, TableAssistantStore, WritePolicy } from "@adapttable/ai";
|
|
2
|
+
import { AgentApply, AgentCapabilityDefinition, AgentContextInputs, AgentObservation, AgentSession, AlwaysAllowedState, ApprovalResult, ApprovalSubject, AssistantAllowance, AssistantAnswer, AssistantAudio, AssistantInterruption, AssistantInterruption as AssistantInterruption$1, AssistantMessage, AssistantQuestion, AssistantResumeHandle, AssistantResumeHandle as AssistantResumeHandle$1, AssistantStatus, AssistantSuggestion, AssistantSuggestion as AssistantSuggestion$1, AssistantTransport, CommitPolicy, SharedApproval, TableAgentBridge as TableAgentBridge$1, TableAgentColumnPatch, TableAssistantSnapshot, TableAssistantStore, WritePolicy } from "@adapttable/ai";
|
|
3
3
|
import { AgentApprovalPending, AgentProgress, SpeechInputHandle, StaticTableFeature } from "@adapttable/react/adapter";
|
|
4
4
|
import { ActionAiOptions } from "@adapttable/core";
|
|
5
5
|
import { SpeechClip, VoiceOptions } from "@adapttable/ai/voice";
|
|
@@ -108,6 +108,12 @@ interface TableAssistantState {
|
|
|
108
108
|
readonly setDraft: (draft: string) => void;
|
|
109
109
|
/** Send the draft, or the given text. Resolves when the turn settles. */
|
|
110
110
|
readonly send: (text?: string) => Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Send a recording as the reader's turn — pass it as `onClip` to
|
|
113
|
+
* backend-mode `useSpeechInput`. The transcript the backend returns becomes
|
|
114
|
+
* the reader's message.
|
|
115
|
+
*/
|
|
116
|
+
readonly sendClip: (clip: AssistantAudio) => Promise<void>;
|
|
111
117
|
/** Abort the turn in flight. Safe to call when nothing is in flight. */
|
|
112
118
|
readonly stop: () => void;
|
|
113
119
|
/**
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/assistant.tsx","../src/react.tsx","../src/useSpeechInput.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/assistant.tsx","../src/react.tsx","../src/useSpeechInput.ts"],"mappings":";;;;;;;UAoFiB;;WAEN,SAAS;;;;;;;;WAQT,YAAY;;;;;;;;;;WAUZ;;WAEA,uBAAuB;;WAEvB;;WAEA,gBAAgB;;;;;;;;;WAShB;;;;;;;;;;;WAWA,cAAc;;;;;;;;WAQd,sBAAsB;;;;;;;;;WAStB,YAAY,QAAQ;;WAEpB,eAAe;;;;;;;;;WASf,oBAAoB;;WAEpB,oBAAoB,mBAAmB;;;;;;;;;WASvC;;;UAIM;WACN,QAAQ;;;;;;;;WAQR;WACA,mBAAmB;WACnB;WACA,WAAW;;WAEX,OAAO,kBAAkB;;;;;;WAMzB,WAAW,MAAM,mBAAmB;;WAEpC;;;;;;WAMA,cAAc;;;;;;;WAOd,aAAa;;WAEb,WAAW;;WAEX;;;;;;;;;WASA,UAAU;;;;;;;;WAQV,UAAU;;WAEV,SAAS;IAAU;IAAmB;;;;;;;;;WAQtC;aACE;aACA;aACA;;;WAGF,gBAAgB;;WAEhB,aAAa,2BAA2B;;WAExC,wBAAwB;;WAExB,oBAAoB;;WAEpB,sBAAsB;;WAEtB,gBAAgB,eAAe;WAC/B;WACA,UAAU;;WAEV;;;;;;WAMA;;;;;;;;;;;;;;iBAeK,kBACd,SAAS,wBACR;;;KC3LS,mBAAmB,mBAAc;;;;;;cAehC,uDAAiB,gBAAA;;;;;;UAOb;;WAEN;;WAEA,cAAc;;WAEd,WAAW;;WAEX,SAAS;;WAET,aACP,SAAS,iBACT,SAAS,gBACN,QAAQ;;WAEJ,UAAU,SAAS,eAAe;;WAElC;;WAEA,SAAS;;WAET,gBAAgB;;WAEhB,QAAQ;;WAER,wBAAwB;;;;;;;;;;;;;;;;;;;WAmBxB,qBAAqB,SAAS,eAAe;;;;;;;;;;WAU7C;;;;;;;;;;WAUA;aAGM;;;;;;;aAOA,cAAc;;;;;;;;;;iBAw6Cf,WAAW,SAAS,oBAAoB;;;;UCxkDvC;WACN,QAAQ;;WAER;;WAEA,WAAW;;WAEX,UAAU,MAAM;;;;;;;;;;iBAaX,eACd,SAAS,wBACR"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { AgentApply, AgentCapabilityDefinition, AgentContextInputs, AgentObservation, AgentSession, AlwaysAllowedState, ApprovalResult, ApprovalSubject, AssistantAllowance, AssistantAnswer, AssistantInterruption, AssistantInterruption as AssistantInterruption$1, AssistantMessage, AssistantQuestion, AssistantResumeHandle, AssistantResumeHandle as AssistantResumeHandle$1, AssistantStatus, AssistantSuggestion, AssistantSuggestion as AssistantSuggestion$1, AssistantTransport, CommitPolicy, SharedApproval, TableAgentBridge as TableAgentBridge$1, TableAgentColumnPatch, TableAssistantSnapshot, TableAssistantStore, WritePolicy } from "@adapttable/ai";
|
|
2
|
+
import { AgentApply, AgentCapabilityDefinition, AgentContextInputs, AgentObservation, AgentSession, AlwaysAllowedState, ApprovalResult, ApprovalSubject, AssistantAllowance, AssistantAnswer, AssistantAudio, AssistantInterruption, AssistantInterruption as AssistantInterruption$1, AssistantMessage, AssistantQuestion, AssistantResumeHandle, AssistantResumeHandle as AssistantResumeHandle$1, AssistantStatus, AssistantSuggestion, AssistantSuggestion as AssistantSuggestion$1, AssistantTransport, CommitPolicy, SharedApproval, TableAgentBridge as TableAgentBridge$1, TableAgentColumnPatch, TableAssistantSnapshot, TableAssistantStore, WritePolicy } from "@adapttable/ai";
|
|
3
3
|
import { AgentApprovalPending, AgentProgress, SpeechInputHandle, StaticTableFeature } from "@adapttable/react/adapter";
|
|
4
4
|
import { ActionAiOptions } from "@adapttable/core";
|
|
5
5
|
import { SpeechClip, VoiceOptions } from "@adapttable/ai/voice";
|
|
@@ -108,6 +108,12 @@ interface TableAssistantState {
|
|
|
108
108
|
readonly setDraft: (draft: string) => void;
|
|
109
109
|
/** Send the draft, or the given text. Resolves when the turn settles. */
|
|
110
110
|
readonly send: (text?: string) => Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Send a recording as the reader's turn — pass it as `onClip` to
|
|
113
|
+
* backend-mode `useSpeechInput`. The transcript the backend returns becomes
|
|
114
|
+
* the reader's message.
|
|
115
|
+
*/
|
|
116
|
+
readonly sendClip: (clip: AssistantAudio) => Promise<void>;
|
|
111
117
|
/** Abort the turn in flight. Safe to call when nothing is in flight. */
|
|
112
118
|
readonly stop: () => void;
|
|
113
119
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/assistant.tsx","../src/react.tsx","../src/useSpeechInput.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/assistant.tsx","../src/react.tsx","../src/useSpeechInput.ts"],"mappings":";;;;;;;UAoFiB;;WAEN,SAAS;;;;;;;;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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { agentColumnsFromNeutral, agentFiltersFromDefs, agentObservation, agentPagination, aggregationsFor, applyAggregations, assertAlwaysAllow, closeTransaction, contractFingerprint, createAgentSession, createApprovalMemory, createTableAssistant, displayProposals, mayAlwaysAllow, monotonicRevision, observationFromNeutral, openTransaction, readRowsFromNeutral, recordDecision, registerWebMcpTools, resolveApproval, resolveRowFromNeutral, revisionToken, settleDecisions, sharedApproval } from "@adapttable/ai";
|
|
2
|
+
import { agentColumnsFromNeutral, agentFiltersFromDefs, agentObservation, agentPagination, aggregationsFor, applyAggregations, assertAlwaysAllow, closeTransaction, contractFingerprint, createAgentSession, createApprovalMemory, createTableAssistant, displayProposals, mayAlwaysAllow, monotonicRevision, observationFromNeutral, openTransaction, readRowsFromNeutral, recordDecision, registerWebMcpTools, resolveApproval, resolveRowFromNeutral, revisionToken, settleDecisions, sharedApproval, tableActionCapabilities, tableActionSignature } from "@adapttable/ai";
|
|
3
3
|
import { AGENT_ALWAYS_ALLOW_STATE, AGENT_APPROVAL_STATE, AGENT_PROGRESS_STATE, AGENT_VIEW_STATE, FeatureStateScope, deriveRuntimeOperations, featureStateKey, useFeatureState, useTableRuntime } from "@adapttable/react/adapter";
|
|
4
4
|
import { useCallback, useDebugValue, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
5
5
|
import { sampleColumns } from "@adapttable/ai/context";
|
|
@@ -72,6 +72,7 @@ function useTableAssistant(options) {
|
|
|
72
72
|
draft: state.draft,
|
|
73
73
|
setDraft: store.setDraft,
|
|
74
74
|
send: store.send,
|
|
75
|
+
sendClip: store.sendClip,
|
|
75
76
|
stop: store.stop,
|
|
76
77
|
resume: store.resume,
|
|
77
78
|
interrupted: state.interrupted,
|
|
@@ -735,7 +736,17 @@ function bindLiveSession(optionsRef, runtimeRef, revisionCounter, flushAdmission
|
|
|
735
736
|
onProgress: (report) => {
|
|
736
737
|
reportProgress.current(report);
|
|
737
738
|
},
|
|
738
|
-
capabilities: optionsRef.current.capabilities,
|
|
739
|
+
capabilities: [...optionsRef.current.capabilities ?? [], ...tableActionCapabilities(runtimeRef.current.view()?.actions, {
|
|
740
|
+
actions: () => runtimeRef.current.view()?.actions,
|
|
741
|
+
rowFor: (rowKey) => {
|
|
742
|
+
const view = runtimeRef.current.view();
|
|
743
|
+
return view?.rows.find((row) => view.getRowId(row) === rowKey);
|
|
744
|
+
},
|
|
745
|
+
selectedIds: () => {
|
|
746
|
+
const selection = runtimeRef.current.view()?.selection;
|
|
747
|
+
return selection ? [...selection.selectedIds] : void 0;
|
|
748
|
+
}
|
|
749
|
+
})],
|
|
739
750
|
...optionsRef.current.capabilityApproval ? { capabilityApproval: optionsRef.current.capabilityApproval } : {},
|
|
740
751
|
...optionsRef.current.excludeCapabilities ? { excludeCapabilities: optionsRef.current.excludeCapabilities } : {}
|
|
741
752
|
});
|
|
@@ -768,7 +779,7 @@ function TableAgentProvider({ feature, children }) {
|
|
|
768
779
|
const waitForChrome = useRef(() => Promise.resolve(false));
|
|
769
780
|
const reportProgress = useRef(() => void 0);
|
|
770
781
|
const tableIdRef = useRef(options.tableId);
|
|
771
|
-
const registryKeyOf = (next) => `${exclusionKey(next.excludeCapabilities)}!${JSON.stringify(next.capabilityApproval ?? {})}`;
|
|
782
|
+
const registryKeyOf = (next) => `${exclusionKey(next.excludeCapabilities)}!${JSON.stringify(next.capabilityApproval ?? {})}!${tableActionSignature(runtime.view()?.actions)}`;
|
|
772
783
|
const registryRef = useRef(registryKeyOf(options));
|
|
773
784
|
const registryKey = registryKeyOf(options);
|
|
774
785
|
const sessionRef = useRef(null);
|