@letta-ai/letta-agent-sdk 0.6.3 → 0.7.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/AGENTS.md +42 -0
- package/README.md +64 -0
- package/dist/app-server-session.d.ts.map +1 -1
- package/dist/client-entry.d.ts +2 -0
- package/dist/client-entry.d.ts.map +1 -1
- package/dist/client-entry.js +496 -23
- package/dist/client-entry.js.map +13 -12
- package/dist/cloud-session.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +497 -24
- package/dist/index.js.map +14 -13
- package/dist/remote-client-session-core.d.ts +2 -2
- package/dist/remote-client-session-core.d.ts.map +1 -1
- package/dist/remote-session-protocol.d.ts +11 -0
- package/dist/remote-session-protocol.d.ts.map +1 -1
- package/dist/remote-turn-coordinator.d.ts +6 -1
- package/dist/remote-turn-coordinator.d.ts.map +1 -1
- package/dist/transcript-accumulator.d.ts +133 -0
- package/dist/transcript-accumulator.d.ts.map +1 -0
- package/dist/types.d.ts +29 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/validation.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/app-server-session.ts +9 -0
- package/src/client-entry.ts +14 -0
- package/src/cloud-session.ts +1 -0
- package/src/index.ts +15 -0
- package/src/remote-client-session-core.ts +15 -10
- package/src/remote-session-protocol.ts +24 -0
- package/src/remote-turn-coordinator.ts +11 -2
- package/src/transcript-accumulator.ts +823 -0
- package/src/types.ts +31 -1
- package/src/validation.ts +16 -0
package/src/types.ts
CHANGED
|
@@ -109,6 +109,25 @@ export type MessageContentItem = TextContent | ImageContent;
|
|
|
109
109
|
*/
|
|
110
110
|
export type SendMessage = string | MessageContentItem[];
|
|
111
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Per-turn options accepted by `send()`.
|
|
114
|
+
*/
|
|
115
|
+
export interface SendOptions {
|
|
116
|
+
/**
|
|
117
|
+
* Caller-supplied offline threading id (OTID) for this user message.
|
|
118
|
+
*
|
|
119
|
+
* The OTID is the canonical optimistic-input-matching key: stamp the row you
|
|
120
|
+
* render optimistically with the same value and you can correlate it with the
|
|
121
|
+
* persisted user message that comes back from the stream or from
|
|
122
|
+
* `listMessages()`. It is also used as the turn's `clientMessageId`, so it
|
|
123
|
+
* shows up on `SDKQueueItem.clientMessageId` while the message is queued.
|
|
124
|
+
*
|
|
125
|
+
* When omitted the SDK generates one. Must be a non-empty string; reuse the
|
|
126
|
+
* same value when retrying a send so the runtime can deduplicate it.
|
|
127
|
+
*/
|
|
128
|
+
otid?: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
112
131
|
// ═══════════════════════════════════════════════════════════════
|
|
113
132
|
// SKILLS / REMINDER / DREAMING TYPES
|
|
114
133
|
// ═══════════════════════════════════════════════════════════════
|
|
@@ -663,6 +682,13 @@ export interface CreateSessionOptions {
|
|
|
663
682
|
/** Working directory for the CLI process */
|
|
664
683
|
cwd?: string;
|
|
665
684
|
|
|
685
|
+
/**
|
|
686
|
+
* Run without loading or changing the agent's MemFS. The agent and
|
|
687
|
+
* conversation remain persistent; this only changes the session's local
|
|
688
|
+
* memory, agent-skill, agent-mod, transcript, and reflection behavior.
|
|
689
|
+
*/
|
|
690
|
+
stateless?: boolean;
|
|
691
|
+
|
|
666
692
|
/**
|
|
667
693
|
* Restrict available skills by source.
|
|
668
694
|
* Empty array disables all skills (`--no-skills`).
|
|
@@ -730,7 +756,11 @@ export interface LettaCodeClientSessionOptions extends CreateSessionOptions {
|
|
|
730
756
|
}
|
|
731
757
|
|
|
732
758
|
export interface LettaCodeSession extends AsyncDisposable {
|
|
733
|
-
|
|
759
|
+
/**
|
|
760
|
+
* Send a user message. Pass `{ otid }` to supply your own correlation id for
|
|
761
|
+
* optimistic reconciliation; the SDK generates one when omitted.
|
|
762
|
+
*/
|
|
763
|
+
send(message: SendMessage, options?: SendOptions): Promise<void>;
|
|
734
764
|
stream(): AsyncGenerator<SDKMessage>;
|
|
735
765
|
abort(): Promise<void>;
|
|
736
766
|
sendCommand(command: SDKProtocolCommand): Promise<void>;
|
package/src/validation.ts
CHANGED
|
@@ -223,6 +223,22 @@ function validateMcpServers(servers: McpServers | undefined): void {
|
|
|
223
223
|
* Validate CreateSessionOptions (used by createSession and resumeSession).
|
|
224
224
|
*/
|
|
225
225
|
export function validateCreateSessionOptions(options: CreateSessionOptions): void {
|
|
226
|
+
if (options.stateless !== undefined && typeof options.stateless !== "boolean") {
|
|
227
|
+
throw new Error("Invalid stateless. Expected a boolean.");
|
|
228
|
+
}
|
|
229
|
+
if (options.stateless) {
|
|
230
|
+
const persistedOption = [
|
|
231
|
+
["model", options.model],
|
|
232
|
+
["reasoningEffort", options.reasoningEffort],
|
|
233
|
+
["dreaming", options.dreaming],
|
|
234
|
+
["resources", options.resources],
|
|
235
|
+
].find(([, value]) => value !== undefined);
|
|
236
|
+
if (persistedOption) {
|
|
237
|
+
throw new Error(
|
|
238
|
+
`stateless sessions cannot set ${persistedOption[0]} because it changes persisted agent configuration.`,
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
226
242
|
validateClientToolset(options.toolset);
|
|
227
243
|
validateSkillSources(options.skillSources);
|
|
228
244
|
validateMcpServers(options.mcpServers);
|