@personaai/react 0.7.9 → 0.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +42 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +42 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -112,6 +112,25 @@ interface PersonaPresentedFile {
|
|
|
112
112
|
title: string;
|
|
113
113
|
description: string;
|
|
114
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* One `execute` tool call against an Agent's sandbox (real shell execution
|
|
117
|
+
* in an isolated CodeSandbox VM — requires the Agent's `sandboxEnabled` and
|
|
118
|
+
* a `CSB_API_KEY` Project Secret; see the Agent's `sandboxEnabled` field).
|
|
119
|
+
* Derived from `PersonaToolCall`s named `execute` across every message in
|
|
120
|
+
* the conversation, in stream order — not a separate live/history-tracked
|
|
121
|
+
* state, so it's always consistent with `messages`.
|
|
122
|
+
*/
|
|
123
|
+
interface PersonaSandboxCommand {
|
|
124
|
+
toolCallId: string;
|
|
125
|
+
/** The shell command, parsed from the tool call's `args`. Falls back to the raw args string while still streaming/incomplete. */
|
|
126
|
+
command: string;
|
|
127
|
+
/** stdout/stderr, once the call finishes. */
|
|
128
|
+
output?: string;
|
|
129
|
+
/** `null` when the result parsed but didn't carry an exit code; `undefined` while still running. */
|
|
130
|
+
exitCode?: number | null;
|
|
131
|
+
status: "running" | "done" | "error";
|
|
132
|
+
seq?: number;
|
|
133
|
+
}
|
|
115
134
|
interface PersonaProviderProps {
|
|
116
135
|
/** Base URL where the Persona runtime / adapter is mounted, e.g. "http://localhost:4000/api/persona" */
|
|
117
136
|
baseUrl: string;
|
|
@@ -429,6 +448,7 @@ declare function useChat(options?: UseChatOptions): {
|
|
|
429
448
|
presentedFile: PersonaPresentedFile | null;
|
|
430
449
|
dismissPresentedFile: () => void;
|
|
431
450
|
openWorkspaceFile: (path: string) => void;
|
|
451
|
+
sandboxCommands: PersonaSandboxCommand[];
|
|
432
452
|
stop: () => void;
|
|
433
453
|
reload: () => void;
|
|
434
454
|
clear: () => void;
|
|
@@ -659,6 +679,6 @@ declare function supportsStreamingFetch(): boolean;
|
|
|
659
679
|
*/
|
|
660
680
|
declare function openSSEStream(opts: OpenSSEOptions): Promise<SSEStream>;
|
|
661
681
|
|
|
662
|
-
declare const VERSION = "0.7.
|
|
682
|
+
declare const VERSION = "0.7.10";
|
|
663
683
|
|
|
664
|
-
export { type OpenSSEOptions, type PersonaAgentSummary, type PersonaClarificationQuestion, type PersonaFileItem, type PersonaHealthInfo, type PersonaHitlActionRequest, type PersonaInterrupt, type PersonaMcpConnection, type PersonaMemoryAgentGroup, type PersonaMemoryFile, type PersonaMemoryList, type PersonaMessage, type PersonaPresentedFile, PersonaProvider, type PersonaProviderProps, type PersonaResumeValue, type PersonaRole, type PersonaStreamingEvent, type PersonaSubagentActivityEntry, type PersonaThread, type PersonaTodo, type PersonaToolCall, type PersonaVoiceEndReason, type PersonaVoiceState, type PersonaVoiceToolCall, type PersonaVoiceTranscriptLine, type PersonaWorkspaceFile, type SSEReader, type SSEStream, type SendMessageOverride, type UseChatOptions, type UseMcpConnectionsOptions, type UseMcpOptions, type UseVoiceOptions, type UseVoiceResult, VERSION, openSSEStream, supportsStreamingFetch, useAgents, useChat, useConnection, useFiles, useMcp, useMcpConnections, useMemory, usePersonaContext, useThreads, useVoice };
|
|
684
|
+
export { type OpenSSEOptions, type PersonaAgentSummary, type PersonaClarificationQuestion, type PersonaFileItem, type PersonaHealthInfo, type PersonaHitlActionRequest, type PersonaInterrupt, type PersonaMcpConnection, type PersonaMemoryAgentGroup, type PersonaMemoryFile, type PersonaMemoryList, type PersonaMessage, type PersonaPresentedFile, PersonaProvider, type PersonaProviderProps, type PersonaResumeValue, type PersonaRole, type PersonaSandboxCommand, type PersonaStreamingEvent, type PersonaSubagentActivityEntry, type PersonaThread, type PersonaTodo, type PersonaToolCall, type PersonaVoiceEndReason, type PersonaVoiceState, type PersonaVoiceToolCall, type PersonaVoiceTranscriptLine, type PersonaWorkspaceFile, type SSEReader, type SSEStream, type SendMessageOverride, type UseChatOptions, type UseMcpConnectionsOptions, type UseMcpOptions, type UseVoiceOptions, type UseVoiceResult, VERSION, openSSEStream, supportsStreamingFetch, useAgents, useChat, useConnection, useFiles, useMcp, useMcpConnections, useMemory, usePersonaContext, useThreads, useVoice };
|
package/dist/index.d.ts
CHANGED
|
@@ -112,6 +112,25 @@ interface PersonaPresentedFile {
|
|
|
112
112
|
title: string;
|
|
113
113
|
description: string;
|
|
114
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* One `execute` tool call against an Agent's sandbox (real shell execution
|
|
117
|
+
* in an isolated CodeSandbox VM — requires the Agent's `sandboxEnabled` and
|
|
118
|
+
* a `CSB_API_KEY` Project Secret; see the Agent's `sandboxEnabled` field).
|
|
119
|
+
* Derived from `PersonaToolCall`s named `execute` across every message in
|
|
120
|
+
* the conversation, in stream order — not a separate live/history-tracked
|
|
121
|
+
* state, so it's always consistent with `messages`.
|
|
122
|
+
*/
|
|
123
|
+
interface PersonaSandboxCommand {
|
|
124
|
+
toolCallId: string;
|
|
125
|
+
/** The shell command, parsed from the tool call's `args`. Falls back to the raw args string while still streaming/incomplete. */
|
|
126
|
+
command: string;
|
|
127
|
+
/** stdout/stderr, once the call finishes. */
|
|
128
|
+
output?: string;
|
|
129
|
+
/** `null` when the result parsed but didn't carry an exit code; `undefined` while still running. */
|
|
130
|
+
exitCode?: number | null;
|
|
131
|
+
status: "running" | "done" | "error";
|
|
132
|
+
seq?: number;
|
|
133
|
+
}
|
|
115
134
|
interface PersonaProviderProps {
|
|
116
135
|
/** Base URL where the Persona runtime / adapter is mounted, e.g. "http://localhost:4000/api/persona" */
|
|
117
136
|
baseUrl: string;
|
|
@@ -429,6 +448,7 @@ declare function useChat(options?: UseChatOptions): {
|
|
|
429
448
|
presentedFile: PersonaPresentedFile | null;
|
|
430
449
|
dismissPresentedFile: () => void;
|
|
431
450
|
openWorkspaceFile: (path: string) => void;
|
|
451
|
+
sandboxCommands: PersonaSandboxCommand[];
|
|
432
452
|
stop: () => void;
|
|
433
453
|
reload: () => void;
|
|
434
454
|
clear: () => void;
|
|
@@ -659,6 +679,6 @@ declare function supportsStreamingFetch(): boolean;
|
|
|
659
679
|
*/
|
|
660
680
|
declare function openSSEStream(opts: OpenSSEOptions): Promise<SSEStream>;
|
|
661
681
|
|
|
662
|
-
declare const VERSION = "0.7.
|
|
682
|
+
declare const VERSION = "0.7.10";
|
|
663
683
|
|
|
664
|
-
export { type OpenSSEOptions, type PersonaAgentSummary, type PersonaClarificationQuestion, type PersonaFileItem, type PersonaHealthInfo, type PersonaHitlActionRequest, type PersonaInterrupt, type PersonaMcpConnection, type PersonaMemoryAgentGroup, type PersonaMemoryFile, type PersonaMemoryList, type PersonaMessage, type PersonaPresentedFile, PersonaProvider, type PersonaProviderProps, type PersonaResumeValue, type PersonaRole, type PersonaStreamingEvent, type PersonaSubagentActivityEntry, type PersonaThread, type PersonaTodo, type PersonaToolCall, type PersonaVoiceEndReason, type PersonaVoiceState, type PersonaVoiceToolCall, type PersonaVoiceTranscriptLine, type PersonaWorkspaceFile, type SSEReader, type SSEStream, type SendMessageOverride, type UseChatOptions, type UseMcpConnectionsOptions, type UseMcpOptions, type UseVoiceOptions, type UseVoiceResult, VERSION, openSSEStream, supportsStreamingFetch, useAgents, useChat, useConnection, useFiles, useMcp, useMcpConnections, useMemory, usePersonaContext, useThreads, useVoice };
|
|
684
|
+
export { type OpenSSEOptions, type PersonaAgentSummary, type PersonaClarificationQuestion, type PersonaFileItem, type PersonaHealthInfo, type PersonaHitlActionRequest, type PersonaInterrupt, type PersonaMcpConnection, type PersonaMemoryAgentGroup, type PersonaMemoryFile, type PersonaMemoryList, type PersonaMessage, type PersonaPresentedFile, PersonaProvider, type PersonaProviderProps, type PersonaResumeValue, type PersonaRole, type PersonaSandboxCommand, type PersonaStreamingEvent, type PersonaSubagentActivityEntry, type PersonaThread, type PersonaTodo, type PersonaToolCall, type PersonaVoiceEndReason, type PersonaVoiceState, type PersonaVoiceToolCall, type PersonaVoiceTranscriptLine, type PersonaWorkspaceFile, type SSEReader, type SSEStream, type SendMessageOverride, type UseChatOptions, type UseMcpConnectionsOptions, type UseMcpOptions, type UseVoiceOptions, type UseVoiceResult, VERSION, openSSEStream, supportsStreamingFetch, useAgents, useChat, useConnection, useFiles, useMcp, useMcpConnections, useMemory, usePersonaContext, useThreads, useVoice };
|
package/dist/index.js
CHANGED
|
@@ -330,6 +330,37 @@ function parsePresentedFile(content) {
|
|
|
330
330
|
return null;
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
+
function parseSandboxCommand(tc) {
|
|
334
|
+
let command = tc.args ?? "";
|
|
335
|
+
try {
|
|
336
|
+
const parsedArgs = JSON.parse(tc.args || "{}");
|
|
337
|
+
if (typeof parsedArgs.command === "string") command = parsedArgs.command;
|
|
338
|
+
} catch {
|
|
339
|
+
}
|
|
340
|
+
let output;
|
|
341
|
+
let exitCode;
|
|
342
|
+
if (tc.result) {
|
|
343
|
+
try {
|
|
344
|
+
const parsedResult = JSON.parse(tc.result);
|
|
345
|
+
if (typeof parsedResult.output === "string") {
|
|
346
|
+
output = parsedResult.output;
|
|
347
|
+
exitCode = typeof parsedResult.exitCode === "number" ? parsedResult.exitCode : null;
|
|
348
|
+
} else {
|
|
349
|
+
output = tc.result;
|
|
350
|
+
}
|
|
351
|
+
} catch {
|
|
352
|
+
output = tc.result;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
toolCallId: tc.toolCallId,
|
|
357
|
+
command,
|
|
358
|
+
output,
|
|
359
|
+
exitCode,
|
|
360
|
+
status: tc.isError ? "error" : tc.result ? "done" : "running",
|
|
361
|
+
seq: tc.seq
|
|
362
|
+
};
|
|
363
|
+
}
|
|
333
364
|
function normalizeWorkspaceFiles(raw) {
|
|
334
365
|
const normalized = {};
|
|
335
366
|
for (const [path, file] of Object.entries(raw || {})) {
|
|
@@ -390,6 +421,15 @@ function useChat(options = {}) {
|
|
|
390
421
|
const [files, setFiles] = useState({});
|
|
391
422
|
const [todos, setTodos] = useState([]);
|
|
392
423
|
const [presentedFile, setPresentedFile] = useState(null);
|
|
424
|
+
const sandboxCommands = useMemo2(() => {
|
|
425
|
+
const commands = [];
|
|
426
|
+
for (const message of messages) {
|
|
427
|
+
for (const tc of message.toolCalls ?? []) {
|
|
428
|
+
if (tc.toolName === "execute") commands.push(parseSandboxCommand(tc));
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
return commands;
|
|
432
|
+
}, [messages]);
|
|
393
433
|
const abortControllerRef = useRef(null);
|
|
394
434
|
const loadedThreadIdRef = useRef(void 0);
|
|
395
435
|
const voiceThreadRef = useRef(threadId);
|
|
@@ -1065,6 +1105,7 @@ function useChat(options = {}) {
|
|
|
1065
1105
|
presentedFile,
|
|
1066
1106
|
dismissPresentedFile,
|
|
1067
1107
|
openWorkspaceFile,
|
|
1108
|
+
sandboxCommands,
|
|
1068
1109
|
stop,
|
|
1069
1110
|
reload,
|
|
1070
1111
|
clear,
|
|
@@ -2036,7 +2077,7 @@ import {
|
|
|
2036
2077
|
getLogLevel,
|
|
2037
2078
|
isLevelEnabled
|
|
2038
2079
|
} from "@personaai/logger";
|
|
2039
|
-
var VERSION = "0.7.
|
|
2080
|
+
var VERSION = "0.7.10";
|
|
2040
2081
|
export {
|
|
2041
2082
|
PersonaProvider,
|
|
2042
2083
|
VERSION,
|