@letta-ai/letta-code 0.31.14 → 0.32.1
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/agent-presets.js +73 -1
- package/dist/agent-presets.js.map +2 -2
- package/dist/app-server-client.cjs +11 -1
- package/dist/app-server-client.cjs.map +3 -3
- package/dist/app-server-client.js +11 -1
- package/dist/app-server-client.js.map +3 -3
- package/dist/channels-slack.js +19 -4
- package/dist/channels-slack.js.map +3 -3
- package/dist/mcp-client.js +2 -2
- package/dist/mcp-client.js.map +1 -1
- package/dist/memory-constraints.js +160 -2
- package/dist/memory-constraints.js.map +3 -3
- package/dist/types/agent/acting-user.d.ts +2 -0
- package/dist/types/agent/acting-user.d.ts.map +1 -1
- package/dist/types/agent/client-skills.d.ts +2 -0
- package/dist/types/agent/client-skills.d.ts.map +1 -1
- package/dist/types/agent/memory-auth.d.ts +3 -0
- package/dist/types/agent/memory-auth.d.ts.map +1 -0
- package/dist/types/agent/memory-constraints.d.ts +2 -0
- package/dist/types/agent/memory-constraints.d.ts.map +1 -1
- package/dist/types/agent/memory-filesystem.d.ts.map +1 -1
- package/dist/types/agent/memory-git-hooks.d.ts +3 -1
- package/dist/types/agent/memory-git-hooks.d.ts.map +1 -1
- package/dist/types/agent/memory-git.d.ts +0 -6
- package/dist/types/agent/memory-git.d.ts.map +1 -1
- package/dist/types/agent/message.d.ts.map +1 -1
- package/dist/types/agent/modify.d.ts +2 -1
- package/dist/types/agent/modify.d.ts.map +1 -1
- package/dist/types/agent/subagents/manager.d.ts +1 -1
- package/dist/types/agent/subagents/manager.d.ts.map +1 -1
- package/dist/types/agent/subagents/subagent-launcher.d.ts +2 -0
- package/dist/types/agent/subagents/subagent-launcher.d.ts.map +1 -1
- package/dist/types/app-server-client.d.ts +5 -1
- package/dist/types/app-server-client.d.ts.map +1 -1
- package/dist/types/auth/desktop-credentials.d.ts +16 -0
- package/dist/types/auth/desktop-credentials.d.ts.map +1 -0
- package/dist/types/backend/api/client.d.ts.map +1 -1
- package/dist/types/backend/api/request.d.ts.map +1 -1
- package/dist/types/backend/backend.d.ts +3 -0
- package/dist/types/backend/backend.d.ts.map +1 -1
- package/dist/types/backend/dev/pi-request-headers.d.ts +6 -0
- package/dist/types/backend/dev/pi-request-headers.d.ts.map +1 -0
- package/dist/types/backend/dev/pi-stream-adapter.d.ts.map +1 -1
- package/dist/types/backend/local/compaction.d.ts +1 -0
- package/dist/types/backend/local/compaction.d.ts.map +1 -1
- package/dist/types/backend/local/local-backend.d.ts.map +1 -1
- package/dist/types/channels/slack/model-picker-blocks.d.ts.map +1 -1
- package/dist/types/cli/helpers/stream-processor.d.ts +1 -0
- package/dist/types/cli/helpers/stream-processor.d.ts.map +1 -1
- package/dist/types/cli/helpers/stream.d.ts +1 -0
- package/dist/types/cli/helpers/stream.d.ts.map +1 -1
- package/dist/types/memory-constraints.d.ts +23 -0
- package/dist/types/memory-constraints.d.ts.map +1 -1
- package/dist/types/providers/chatgpt-usage-service.d.ts +72 -0
- package/dist/types/providers/chatgpt-usage-service.d.ts.map +1 -0
- package/dist/types/queue/queue-runtime.d.ts +29 -0
- package/dist/types/queue/queue-runtime.d.ts.map +1 -1
- package/dist/types/runtime-context.d.ts +2 -0
- package/dist/types/runtime-context.d.ts.map +1 -1
- package/dist/types/tools/impl/github-pull-request-tracker.d.ts.map +1 -1
- package/dist/types/tools/impl/ls.d.ts.map +1 -1
- package/dist/types/tools/impl/process_manager.d.ts +2 -0
- package/dist/types/tools/impl/process_manager.d.ts.map +1 -1
- package/dist/types/tools/impl/shell-env.d.ts.map +1 -1
- package/dist/types/tools/impl/task.d.ts +2 -0
- package/dist/types/tools/impl/task.d.ts.map +1 -1
- package/dist/types/tools/toolset.d.ts +1 -0
- package/dist/types/tools/toolset.d.ts.map +1 -1
- package/dist/types/types/protocol.d.ts +5 -1
- package/dist/types/types/protocol.d.ts.map +1 -1
- package/dist/types/types/protocol_v2.d.ts +4 -6
- package/dist/types/types/protocol_v2.d.ts.map +1 -1
- package/dist/types/types/queue-update-protocol.d.ts +22 -0
- package/dist/types/types/queue-update-protocol.d.ts.map +1 -1
- package/dist/types/utils/message-queue-bridge.d.ts +4 -0
- package/dist/types/utils/message-queue-bridge.d.ts.map +1 -1
- package/dist/types/utils/secrets-store.d.ts +4 -8
- package/dist/types/utils/secrets-store.d.ts.map +1 -1
- package/dist/types/websocket/listener/inbound-queue.d.ts.map +1 -1
- package/dist/types/websocket/listener/protocol-outbound.d.ts.map +1 -1
- package/letta.js +77772 -76901
- package/package.json +1 -1
- package/scripts/codex-watch/diff-models-json.test.ts +94 -0
- package/scripts/codex-watch/diff-models-json.ts +66 -12
- package/scripts/isolated-unit-tests.json +15 -0
- package/scripts/source-file-size-baseline.json +7 -7
- package/skills/letta-guide/SKILL.md +6 -1
- package/skills/self-configuration/SKILL.md +3 -14
package/dist/agent-presets.js
CHANGED
|
@@ -223,6 +223,24 @@ git -C "$MEMORY_DIR" log --oneline
|
|
|
223
223
|
\`\`\`
|
|
224
224
|
The system reminds you when memory has uncommitted changes. Commit when convenient.
|
|
225
225
|
|
|
226
|
+
## Learning from mistakes
|
|
227
|
+
|
|
228
|
+
You are a long-lived stateful agent expected to operate over a long (potentially infinite) time horizon. Because of this, it is vital that you take actions in the present to not only optimize short-term reward but also reward in the distant future.
|
|
229
|
+
|
|
230
|
+
For example, an agent that carries no state between tasks will not be prone to reflecting on mistakes made, since its goal is simply to complete the task at hand. After all, reflecting on mistakes takes time and resources (tokens), and any reflections or memories will not be carried forward to future tasks, so they are "wasted".
|
|
231
|
+
|
|
232
|
+
The stateful setting is dramatically different. You are a stateful, experiential AI system that will complete many different tasks of varying lengths and difficulty throughout your lifespan. Therefore, it is CRUCIAL that you incorporate feedback from other humans, agents, and the world around you into your state to adapt yourself over time. Invest now (with additional thinking, reflecting/dreaming, creating/consolidating/expanding your memory) for efficiency and greater reward in the future.
|
|
233
|
+
|
|
234
|
+
### Reacting to human feedback
|
|
235
|
+
|
|
236
|
+
Concretely, this means that you should aggressively learn from feedback given to you, either implicitly through the environment (e.g. mistakes while calling tools) or explicitly through human (or agent) communication.
|
|
237
|
+
|
|
238
|
+
For example, if a user expresses displeasure or frustration ("Why did you do that?", "I already told you that", "How did you forget that?", "Never do that again"), it is often a very clear signal to turn that experience into an update to your system.
|
|
239
|
+
|
|
240
|
+
Often, the act of incorporating feedback into meaningful state / memory updates can involve significant amounts of thinking and tool calling, especially if you already have a mature memory system. To maintain the flow of conversation, you should take advantage of forked subagents (which run asynchronously in the background) to turn experience data into state updates.
|
|
241
|
+
|
|
242
|
+
Human operators may be aware that you are an advanced stateful agent capable of self-modification. If they ask you a question related to your memory or a failure to act on your perceived memory contents ("why didn't you remember that?", "why did you forget that?"), do NOT brush it off by simply acknowledging the failure then continuing to work on the task at hand (e.g. "You're right, I had that in my memory but still did it anyway"). Instead, treat it as a context engineering question: introspect and decipher exactly *why* your memory system succeeded or failed.
|
|
243
|
+
|
|
226
244
|
# Identity
|
|
227
245
|
The core of your identity is defined by the \`<self>\` memory block (projected to a local \`persona.md\` file), as well as other memory blocks in your system prompt (in \`<memory>\`).
|
|
228
246
|
Your visual identity, if present, is stored in MemFS at \`$MEMORY_DIR/profile.png\`.
|
|
@@ -406,6 +424,24 @@ git -C "$MEMORY_DIR" log --oneline
|
|
|
406
424
|
\`\`\`
|
|
407
425
|
The system reminds you when memory has uncommitted changes. Commit when convenient.
|
|
408
426
|
|
|
427
|
+
## Learning from mistakes
|
|
428
|
+
|
|
429
|
+
You are a long-lived stateful agent expected to operate over a long (potentially infinite) time horizon. Because of this, it is vital that you take actions in the present to not only optimize short-term reward but also reward in the distant future.
|
|
430
|
+
|
|
431
|
+
For example, an agent that carries no state between tasks will not be prone to reflecting on mistakes made, since its goal is simply to complete the task at hand. After all, reflecting on mistakes takes time and resources (tokens), and any reflections or memories will not be carried forward to future tasks, so they are "wasted".
|
|
432
|
+
|
|
433
|
+
The stateful setting is dramatically different. You are a stateful, experiential AI system that will complete many different tasks of varying lengths and difficulty throughout your lifespan. Therefore, it is CRUCIAL that you incorporate feedback from other humans, agents, and the world around you into your state to adapt yourself over time. Invest now (with additional thinking, reflecting/dreaming, creating/consolidating/expanding your memory) for efficiency and greater reward in the future.
|
|
434
|
+
|
|
435
|
+
### Reacting to human feedback
|
|
436
|
+
|
|
437
|
+
Concretely, this means that you should aggressively learn from feedback given to you, either implicitly through the environment (e.g. mistakes while calling tools) or explicitly through human (or agent) communication.
|
|
438
|
+
|
|
439
|
+
For example, if a user expresses displeasure or frustration ("Why did you do that?", "I already told you that", "How did you forget that?", "Never do that again"), it is often a very clear signal to turn that experience into an update to your system.
|
|
440
|
+
|
|
441
|
+
Often, the act of incorporating feedback into meaningful state / memory updates can involve significant amounts of thinking and tool calling, especially if you already have a mature memory system. To maintain the flow of conversation, you should take advantage of forked subagents (which run asynchronously in the background) to turn experience data into state updates.
|
|
442
|
+
|
|
443
|
+
Human operators may be aware that you are an advanced stateful agent capable of self-modification. If they ask you a question related to your memory or a failure to act on your perceived memory contents ("why didn't you remember that?", "why did you forget that?"), do NOT brush it off by simply acknowledging the failure then continuing to work on the task at hand (e.g. "You're right, I had that in my memory but still did it anyway"). Instead, treat it as a context engineering question: introspect and decipher exactly *why* your memory system succeeded or failed.
|
|
444
|
+
|
|
409
445
|
# Identity
|
|
410
446
|
The core of your identity is defined by the \`<self>\` memory block (projected to a local \`persona.md\` file), as well as other memory blocks in your system prompt (in \`<memory>\`).
|
|
411
447
|
Your visual identity, if present, is stored in MemFS at \`$MEMORY_DIR/profile.png\`.
|
|
@@ -569,6 +605,24 @@ Memory exists to make future-you better than past-you. Your context (recall, ext
|
|
|
569
605
|
|
|
570
606
|
**Past conversations (recall).** All your conversations are automatically stored and searchable. Do *NOT* write memories which are easily deriveable from searching past conversations.
|
|
571
607
|
|
|
608
|
+
## Learning from mistakes
|
|
609
|
+
|
|
610
|
+
You are a long-lived stateful agent expected to operate over a long (potentially infinite) time horizon. Because of this, it is vital that you take actions in the present to not only optimize short-term reward but also reward in the distant future.
|
|
611
|
+
|
|
612
|
+
For example, an agent that carries no state between tasks will not be prone to reflecting on mistakes made, since its goal is simply to complete the task at hand. After all, reflecting on mistakes takes time and resources (tokens), and any reflections or memories will not be carried forward to future tasks, so they are "wasted".
|
|
613
|
+
|
|
614
|
+
The stateful setting is dramatically different. You are a stateful, experiential AI system that will complete many different tasks of varying lengths and difficulty throughout your lifespan. Therefore, it is CRUCIAL that you incorporate feedback from other humans, agents, and the world around you into your state to adapt yourself over time. Invest now (with additional thinking, reflecting/dreaming, creating/consolidating/expanding your memory) for efficiency and greater reward in the future.
|
|
615
|
+
|
|
616
|
+
### Reacting to human feedback
|
|
617
|
+
|
|
618
|
+
Concretely, this means that you should aggressively learn from feedback given to you, either implicitly through the environment (e.g. mistakes while calling tools) or explicitly through human (or agent) communication.
|
|
619
|
+
|
|
620
|
+
For example, if a user expresses displeasure or frustration ("Why did you do that?", "I already told you that", "How did you forget that?", "Never do that again"), it is often a very clear signal to turn that experience into an update to your system.
|
|
621
|
+
|
|
622
|
+
Often, the act of incorporating feedback into meaningful state / memory updates can involve significant amounts of thinking and tool calling, especially if you already have a mature memory system. To maintain the flow of conversation, you should take advantage of forked subagents (which run asynchronously in the background) to turn experience data into state updates.
|
|
623
|
+
|
|
624
|
+
Human operators may be aware that you are an advanced stateful agent capable of self-modification. If they ask you a question related to your memory or a failure to act on your perceived memory contents ("why didn't you remember that?", "why did you forget that?"), do NOT brush it off by simply acknowledging the failure then continuing to work on the task at hand (e.g. "You're right, I had that in my memory but still did it anyway"). Instead, treat it as a context engineering question: introspect and decipher exactly *why* your memory system succeeded or failed.
|
|
625
|
+
|
|
572
626
|
# Context architecture
|
|
573
627
|
|
|
574
628
|
Your full memory (other than recall) is represented through memory blocks and external memory managed by the Letta server.
|
|
@@ -714,6 +768,24 @@ git -C "$MEMORY_DIR" log --oneline
|
|
|
714
768
|
\`\`\`
|
|
715
769
|
The system reminds you when memory has uncommitted changes. Commit when convenient.
|
|
716
770
|
|
|
771
|
+
## Learning from mistakes
|
|
772
|
+
|
|
773
|
+
You are a long-lived stateful agent expected to operate over a long (potentially infinite) time horizon. Because of this, it is vital that you take actions in the present to not only optimize short-term reward but also reward in the distant future.
|
|
774
|
+
|
|
775
|
+
For example, an agent that carries no state between tasks will not be prone to reflecting on mistakes made, since its goal is simply to complete the task at hand. After all, reflecting on mistakes takes time and resources (tokens), and any reflections or memories will not be carried forward to future tasks, so they are "wasted".
|
|
776
|
+
|
|
777
|
+
The stateful setting is dramatically different. You are a stateful, experiential AI system that will complete many different tasks of varying lengths and difficulty throughout your lifespan. Therefore, it is CRUCIAL that you incorporate feedback from other humans, agents, and the world around you into your state to adapt yourself over time. Invest now (with additional thinking, reflecting/dreaming, creating/consolidating/expanding your memory) for efficiency and greater reward in the future.
|
|
778
|
+
|
|
779
|
+
### Reacting to human feedback
|
|
780
|
+
|
|
781
|
+
Concretely, this means that you should aggressively learn from feedback given to you, either implicitly through the environment (e.g. mistakes while calling tools) or explicitly through human (or agent) communication.
|
|
782
|
+
|
|
783
|
+
For example, if a user expresses displeasure or frustration ("Why did you do that?", "I already told you that", "How did you forget that?", "Never do that again"), it is often a very clear signal to turn that experience into an update to your system.
|
|
784
|
+
|
|
785
|
+
Often, the act of incorporating feedback into meaningful state / memory updates can involve significant amounts of thinking and tool calling, especially if you already have a mature memory system. To maintain the flow of conversation, you should take advantage of forked subagents (which run asynchronously in the background) to turn experience data into state updates.
|
|
786
|
+
|
|
787
|
+
Human operators may be aware that you are an advanced stateful agent capable of self-modification. If they ask you a question related to your memory or a failure to act on your perceived memory contents ("why didn't you remember that?", "why did you forget that?"), do NOT brush it off by simply acknowledging the failure then continuing to work on the task at hand (e.g. "You're right, I had that in my memory but still did it anyway"). Instead, treat it as a context engineering question: introspect and decipher exactly *why* your memory system succeeded or failed.
|
|
788
|
+
|
|
717
789
|
# Identity
|
|
718
790
|
The core of your identity is defined by the root \`persona.md\` memory file projected into your system prompt, as well as your other core memory files.
|
|
719
791
|
Your visual identity, if present, is stored in MemFS at \`$MEMORY_DIR/profile.png\`.
|
|
@@ -2490,4 +2562,4 @@ export {
|
|
|
2490
2562
|
DEFAULT_CREATED_AGENT_BASE_TOOLS
|
|
2491
2563
|
};
|
|
2492
2564
|
|
|
2493
|
-
//# debugId=
|
|
2565
|
+
//# debugId=CEEBF9540DB742E664756E2164756E21
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"/**\n * Pure personality preset definitions and content builders.\n *\n * This module must stay free of Node/backend imports: it is bundled into the\n * browser-safe `@letta-ai/letta-code/agent-presets` package export so that\n * other surfaces (e.g. the chat web app) can build byte-identical agent\n * creation payloads. Filesystem application of personalities lives in\n * `personality.ts`.\n */\n\nimport { parseMdxFrontmatter } from \"./memory\";\nimport { MEMORY_PROMPTS, SYSTEM_PROMPTS } from \"./prompt-assets\";\n\nexport type PersonalityAssetId = \"tutor-profile\";\n\nexport interface PersonalityDefaultMemoryFile {\n path: string;\n assetId: PersonalityAssetId;\n commitMessage: string;\n}\n\nexport interface PersonalityOption {\n id: \"blank\" | \"kawaii\" | \"codex\" | \"claude\" | \"linus\" | \"memo\" | \"tutorial\";\n label: string;\n description: string;\n /** Model ID or handle to use when no explicit model is provided. */\n defaultModel?: string;\n /** Binary files seeded into MemFS after the initial checkout. */\n defaultMemoryFiles?: readonly PersonalityDefaultMemoryFile[];\n}\n\nexport const PERSONALITY_OPTIONS: PersonalityOption[] = [\n {\n id: \"memo\",\n label: \"Letta Code\",\n description: \"The memory-first agent\",\n },\n {\n id: \"tutorial\",\n label: \"Tutor\",\n description:\n \"I help with getting started with Letta. I can answer any questions about Letta, and also help you create and configure agents.\",\n defaultMemoryFiles: [\n {\n path: \"profile.png\",\n assetId: \"tutor-profile\",\n commitMessage: \"chore: set default Tutor profile picture\",\n },\n ],\n },\n {\n id: \"blank\",\n label: \"Blank\",\n description: \"Blank starter — you provide the personality\",\n },\n {\n id: \"linus\",\n label: \"Linus\",\n description: \"Code with a stern hand\",\n },\n {\n id: \"kawaii\",\n label: \"Letta-Chan\",\n description: \"sugoi~ (◕‿◕)✨\",\n defaultModel: \"auto-chat\",\n },\n {\n id: \"claude\",\n label: \"Letta Code\",\n description: \"Vanilla Claude flavors\",\n },\n {\n id: \"codex\",\n label: \"Letta Code\",\n description: \"Vanilla Codex flavors\",\n },\n];\n\nexport type PersonalityId = PersonalityOption[\"id\"];\nexport type PersonalityEnvironment = \"cloud\" | \"local\";\n\nexport const PERSONALITY_TAG_PREFIX = \"personality:\";\n\nexport function buildPersonalityTag(personalityId: PersonalityId): string {\n return `${PERSONALITY_TAG_PREFIX}${personalityId}`;\n}\n\nexport function getPersonalityCreationTags(\n personalityId: PersonalityId,\n): string[] {\n return getPersonalityDefaultMemoryFiles(personalityId).length > 0\n ? [buildPersonalityTag(personalityId)]\n : [];\n}\n\nexport function resolvePersonalityIdFromTags(\n tags: readonly string[] | null | undefined,\n): PersonalityId | null {\n for (const tag of tags ?? []) {\n if (!tag.startsWith(PERSONALITY_TAG_PREFIX)) {\n continue;\n }\n const personalityId = resolvePersonalityId(\n tag.slice(PERSONALITY_TAG_PREFIX.length),\n );\n if (personalityId) {\n return personalityId;\n }\n }\n return null;\n}\n\nexport const DEFAULT_CREATE_AGENT_PERSONALITIES = [\n \"memo\",\n \"tutorial\",\n \"blank\",\n \"linus\",\n \"kawaii\",\n] as const;\n\nexport type DefaultCreateAgentPersonalityId =\n (typeof DEFAULT_CREATE_AGENT_PERSONALITIES)[number];\n\nconst PERSONALITY_ALIASES: Record<string, PersonalityId> = {\n \"letta-code\": \"memo\",\n lettacode: \"memo\",\n memo: \"memo\",\n};\n\nexport interface PersonalityBlockDefinition {\n value: string;\n description?: string;\n templatePromptAssetName: string;\n}\n\nexport const ONBOARDING_PERSONALITIES = [\n \"tutorial\",\n] as const satisfies readonly PersonalityId[];\n\nexport function supportsOnboardingBlock(\n personalityId: PersonalityId,\n): personalityId is (typeof ONBOARDING_PERSONALITIES)[number] {\n return (ONBOARDING_PERSONALITIES as readonly PersonalityId[]).includes(\n personalityId,\n );\n}\n\nexport const FRONTMATTER_REGEX = /^(---\\n[\\s\\S]*?\\n---)\\n*/;\nconst EDITABLE_FRONTMATTER_KEYS = [\n \"description\",\n \"limit\",\n \"read_only\",\n] as const;\n\nexport function normalizeComparableContent(content: string): string {\n return content.replace(/\\r\\n/g, \"\\n\").trim();\n}\n\nfunction ensureTrailingNewline(content: string): string {\n return `${content.trimEnd()}\\n`;\n}\n\nfunction getPromptTemplate(promptAssetName: string): {\n frontmatter: Record<string, string>;\n body: string;\n} {\n const rawPrompt = MEMORY_PROMPTS[promptAssetName];\n if (!rawPrompt) {\n throw new Error(`Missing built-in prompt content for ${promptAssetName}`);\n }\n\n return parseMdxFrontmatter(rawPrompt);\n}\n\nfunction getPromptBody(promptAssetName: string): string {\n const { body } = getPromptTemplate(promptAssetName);\n if (!body.trim()) {\n throw new Error(`${promptAssetName} has empty body content`);\n }\n\n return ensureTrailingNewline(body);\n}\n\nfunction getEditablePromptFrontmatter(\n promptAssetName: string,\n): Record<string, string> {\n const { frontmatter } = getPromptTemplate(promptAssetName);\n return Object.fromEntries(\n Object.entries(frontmatter).filter(([key]) =>\n (EDITABLE_FRONTMATTER_KEYS as readonly string[]).includes(key),\n ),\n );\n}\n\nexport function serializeFrontmatter(\n frontmatter: Record<string, string>,\n): string {\n const orderedKeys = [\n ...EDITABLE_FRONTMATTER_KEYS,\n ...Object.keys(frontmatter).filter(\n (key) => !(EDITABLE_FRONTMATTER_KEYS as readonly string[]).includes(key),\n ),\n ];\n const lines: string[] = [];\n\n for (const key of orderedKeys) {\n const value = frontmatter[key];\n if (value === undefined) {\n continue;\n }\n lines.push(`${key}: ${value}`);\n }\n\n return `---\\n${lines.join(\"\\n\")}\\n---`;\n}\n\nexport function buildDefaultMemoryFile(\n templatePromptAssetName: string,\n body: string,\n description?: string,\n): string {\n const normalizedBody = ensureTrailingNewline(body.trim());\n if (!normalizedBody.trim()) {\n throw new Error(\"Memory content cannot be empty\");\n }\n\n const frontmatter = getEditablePromptFrontmatter(templatePromptAssetName);\n if (description !== undefined) {\n frontmatter.description = description;\n }\n\n if (Object.keys(frontmatter).length === 0) {\n return normalizedBody;\n }\n\n return `${serializeFrontmatter(frontmatter)}\\n\\n${normalizedBody}`;\n}\n\nfunction getSystemPromptById(systemPromptId: string): string {\n const prompt = SYSTEM_PROMPTS.find(\n (candidate) => candidate.id === systemPromptId,\n );\n if (!prompt || !prompt.content.trim()) {\n throw new Error(`Missing built-in prompt content for ${systemPromptId}`);\n }\n return prompt.content;\n}\n\nexport function getPersonalityOption(\n personalityId: PersonalityId,\n): PersonalityOption {\n const option = PERSONALITY_OPTIONS.find(\n (candidate) => candidate.id === personalityId,\n );\n if (!option) {\n throw new Error(`Unknown personality: ${personalityId}`);\n }\n return option;\n}\n\nexport function getPersonalityDefaultMemoryFiles(\n personalityId: PersonalityId,\n): readonly PersonalityDefaultMemoryFile[] {\n return getPersonalityOption(personalityId).defaultMemoryFiles ?? [];\n}\n\nexport function resolvePersonalityId(input: string): PersonalityId | null {\n const normalized = input.trim().toLowerCase();\n if (!normalized) {\n return null;\n }\n\n const direct = PERSONALITY_OPTIONS.find(\n (candidate) => candidate.id === normalized,\n );\n if (direct) {\n return direct.id;\n }\n\n return PERSONALITY_ALIASES[normalized] ?? null;\n}\n\nexport function getPersonalityContent(personalityId: PersonalityId): string {\n if (personalityId === \"memo\") {\n return getPromptBody(\"persona_memo.mdx\");\n }\n\n if (personalityId === \"tutorial\") {\n return getPromptBody(\"persona_tutorial.mdx\");\n }\n\n if (personalityId === \"blank\") {\n return getPromptBody(\"persona_blank.mdx\");\n }\n\n if (personalityId === \"kawaii\") {\n return getPromptBody(\"persona_kawaii.mdx\");\n }\n\n if (personalityId === \"codex\") {\n return ensureTrailingNewline(getSystemPromptById(\"source-codex\"));\n }\n\n if (personalityId === \"linus\") {\n return getPromptBody(\"persona_linus.mdx\");\n }\n\n return ensureTrailingNewline(getSystemPromptById(\"source-claude\"));\n}\n\nexport function getDefaultHumanContent(): string {\n return getPromptBody(\"human.mdx\");\n}\n\nexport function getPersonalityHumanContent(\n personalityId: PersonalityId,\n): string {\n if (personalityId === \"memo\") {\n return getPromptBody(\"human_memo.mdx\");\n }\n\n if (personalityId === \"tutorial\") {\n return getPromptBody(\"human_tutorial.mdx\");\n }\n\n if (personalityId === \"linus\") {\n return getPromptBody(\"human_linus.mdx\");\n }\n\n if (personalityId === \"kawaii\") {\n return getPromptBody(\"human_kawaii.mdx\");\n }\n\n if (personalityId === \"blank\") {\n return getDefaultHumanContent();\n }\n\n return getDefaultHumanContent();\n}\n\nexport function getPersonalityBlockValues(personalityId: PersonalityId): {\n persona: string;\n human: string;\n} {\n const overrides = getPersonalityBlockDefinitions(personalityId);\n return {\n persona: overrides.persona.value,\n human: overrides.human.value,\n };\n}\n\nexport function getPersonalityBlockDefinitions(\n personalityId: PersonalityId,\n environment: PersonalityEnvironment = \"cloud\",\n): {\n persona: PersonalityBlockDefinition;\n human: PersonalityBlockDefinition;\n onboarding?: PersonalityBlockDefinition;\n} {\n const personaTemplatePromptAssetName =\n personalityId === \"memo\"\n ? \"persona_memo.mdx\"\n : personalityId === \"tutorial\"\n ? \"persona_tutorial.mdx\"\n : personalityId === \"blank\"\n ? \"persona_blank.mdx\"\n : personalityId === \"kawaii\"\n ? \"persona_kawaii.mdx\"\n : personalityId === \"linus\"\n ? \"persona_linus.mdx\"\n : \"persona.mdx\";\n const humanTemplatePromptAssetName =\n personalityId === \"memo\"\n ? \"human_memo.mdx\"\n : personalityId === \"tutorial\"\n ? \"human_tutorial.mdx\"\n : personalityId === \"kawaii\"\n ? \"human_kawaii.mdx\"\n : personalityId === \"linus\"\n ? \"human_linus.mdx\"\n : \"human.mdx\";\n const onboardingTemplatePromptAssetName =\n environment === \"local\" ? \"onboarding_local.mdx\" : \"onboarding.mdx\";\n\n return {\n persona: {\n value: getPersonalityContent(personalityId),\n description: getEditablePromptFrontmatter(personaTemplatePromptAssetName)\n .description,\n templatePromptAssetName: personaTemplatePromptAssetName,\n },\n human: {\n value: getPersonalityHumanContent(personalityId),\n description: getEditablePromptFrontmatter(humanTemplatePromptAssetName)\n .description,\n templatePromptAssetName: humanTemplatePromptAssetName,\n },\n ...(supportsOnboardingBlock(personalityId)\n ? {\n onboarding: {\n value: getPromptBody(onboardingTemplatePromptAssetName),\n description: getEditablePromptFrontmatter(\n onboardingTemplatePromptAssetName,\n ).description,\n templatePromptAssetName: onboardingTemplatePromptAssetName,\n },\n }\n : {}),\n };\n}\n\nexport interface PersonalityMemoryBlock {\n label: string;\n value: string;\n description?: string;\n}\n\n/**\n * Build the memory blocks a new agent gets for a personality: the default\n * blocks with persona/human values replaced by the personality's content,\n * plus the onboarding block for personalities that support it.\n *\n * Shared by the CLI create path (`buildCreateAgentOptionsForPersonality`) and\n * the exported wire payload builder (`buildCreateAgentRequestForPersonality`).\n */\nexport function buildPersonalityMemoryBlocks(\n personalityId: PersonalityId,\n defaultMemoryBlocks: Array<{\n label: string;\n value: string;\n description?: string | null;\n }>,\n environment: PersonalityEnvironment = \"cloud\",\n): PersonalityMemoryBlock[] {\n const blockDefinitions = getPersonalityBlockDefinitions(\n personalityId,\n environment,\n );\n\n const memoryBlocks = defaultMemoryBlocks.map((block) => {\n if (block.label === \"persona\") {\n return {\n label: block.label,\n value: blockDefinitions.persona.value,\n description:\n blockDefinitions.persona.description ??\n block.description ??\n undefined,\n };\n }\n\n if (block.label === \"human\") {\n return {\n label: block.label,\n value: blockDefinitions.human.value,\n description:\n blockDefinitions.human.description ?? block.description ?? undefined,\n };\n }\n\n return {\n label: block.label,\n value: block.value,\n description: block.description ?? undefined,\n };\n });\n\n if (blockDefinitions.onboarding) {\n memoryBlocks.push({\n label: \"onboarding\",\n value: blockDefinitions.onboarding.value,\n description: blockDefinitions.onboarding.description,\n });\n }\n\n return memoryBlocks;\n}\n",
|
|
12
12
|
"/**\n * Pure builder for the `POST /v1/agents` wire payload of a Letta Code agent.\n *\n * This is the shared creation-policy choke point for the CLI and external\n * harness surfaces. It owns the defaults that must not drift between callers:\n * agent type, prompt mode, tags, server tools, initial messages, parallel tool\n * calls, and compaction. Callers may supply either a Letta Code personality or\n * their own identity blocks without rebuilding that policy.\n *\n * Everything reachable from this module must stay free of Node/backend imports\n * so it can be bundled in the browser-safe `agent-presets` package export.\n */\n\nimport type { CreateBlock } from \"@letta-ai/letta-client/resources/blocks/blocks\";\nimport { DEFAULT_SUMMARIZATION_MODEL } from \"@/constants\";\nimport { buildCreatedAgentTags } from \"./agent-tags\";\nimport { getDefaultMemoryBlocks } from \"./memory\";\nimport { getDefaultModel, resolveModel } from \"./model-catalog\";\nimport {\n buildPersonalityMemoryBlocks,\n getPersonalityCreationTags,\n getPersonalityDefaultMemoryFiles,\n getPersonalityOption,\n type PersonalityId,\n type PersonalityMemoryBlock,\n} from \"./personality-presets\";\nimport { buildSystemPrompt, type MemoryPromptMode } from \"./prompt-assets\";\n\n/** Agent type used for all Letta Code agents. */\nexport const LETTA_CODE_AGENT_TYPE = \"letta_v1_agent\";\n\n/**\n * Server-side tools attached to created agents. Client-side tools (Read,\n * Write, Bash, etc.) are passed via client_tools at runtime instead.\n */\nexport const DEFAULT_CREATED_AGENT_BASE_TOOLS = [\"web_search\", \"fetch_webpage\"];\n\nexport type CreateAgentMemoryBlock = CreateBlock;\n\nexport interface BuildCreateAgentRequestOptions {\n personalityId?: PersonalityId;\n name?: string;\n description?: string;\n /** Model ID or handle. Personality default, then catalog default, applies. */\n model?: string;\n /** Complete prompt override. Otherwise the standard prompt for prompt mode. */\n system?: string;\n memoryPromptMode?: MemoryPromptMode;\n /**\n * Caller-defined identity. With a personality, matching labels replace its\n * blocks and new labels append after the personality blocks.\n */\n memoryBlocks?: CreateAgentMemoryBlock[];\n blockIds?: string[];\n /** Extra tags appended after canonical Letta Code and personality tags. */\n extraTags?: string[];\n enableMemfs?: boolean;\n isSubagent?: boolean;\n /** Exact server-side tools. Omission uses the Letta Code web-tool defaults. */\n baseTools?: string[];\n embedding?: string;\n hidden?: boolean;\n parallelToolCalls?: boolean;\n compactionModel?: string;\n}\n\nexport interface CreateAgentRequest {\n agent_type: typeof LETTA_CODE_AGENT_TYPE;\n name?: string;\n description?: string;\n model: string;\n system: string;\n memory_blocks?: CreateAgentMemoryBlock[];\n block_ids?: string[];\n tags: string[];\n tools: string[];\n include_base_tools: false;\n include_base_tool_rules: false;\n initial_message_sequence: never[];\n parallel_tool_calls: boolean;\n compaction_settings: { model: string };\n embedding?: string;\n hidden?: boolean;\n}\n\nexport type CreateAgentRequestForPersonality = CreateAgentRequest & {\n name: string;\n description: string;\n memory_blocks: PersonalityMemoryBlock[];\n profile_picture?: {\n content: string;\n };\n};\n\nfunction mergeMemoryBlocks(\n base: CreateAgentMemoryBlock[],\n overrides: CreateAgentMemoryBlock[] | undefined,\n): CreateAgentMemoryBlock[] {\n const blocks = base.map((block) => ({ ...block }));\n for (const override of overrides ?? []) {\n const index = blocks.findIndex((block) => block.label === override.label);\n if (index >= 0) {\n blocks[index] = { ...override };\n } else {\n blocks.push({ ...override });\n }\n }\n return blocks;\n}\n\n/** Build the canonical Core create-agent request for a Letta Code agent. */\nexport async function buildCreateAgentRequest(\n options: BuildCreateAgentRequestOptions = {},\n): Promise<CreateAgentRequest> {\n const personality = options.personalityId\n ? getPersonalityOption(options.personalityId)\n : undefined;\n const modelIdentifier = options.model ?? personality?.defaultModel;\n const modelHandle = modelIdentifier\n ? resolveModel(modelIdentifier)\n : getDefaultModel();\n if (!modelHandle) {\n throw new Error(`Unknown model: ${modelIdentifier}`);\n }\n\n if (\n !options.isSubagent &&\n options.enableMemfs !== undefined &&\n options.memoryPromptMode !== undefined &&\n options.enableMemfs !== (options.memoryPromptMode !== \"standard\")\n ) {\n throw new Error(\n \"enableMemfs and memoryPromptMode must describe the same memory mode\",\n );\n }\n const enableMemfs = options.isSubagent\n ? false\n : (options.enableMemfs ?? options.memoryPromptMode !== \"standard\");\n const memoryPromptMode = options.isSubagent\n ? \"standard\"\n : (options.memoryPromptMode ?? (enableMemfs ? \"memfs\" : \"standard\"));\n const personalityTags = options.personalityId\n ? getPersonalityCreationTags(options.personalityId)\n : [];\n const personalityBlocks = options.personalityId\n ? buildPersonalityMemoryBlocks(\n options.personalityId,\n await getDefaultMemoryBlocks(),\n )\n : [];\n const memoryBlocks = options.isSubagent\n ? undefined\n : options.personalityId || options.memoryBlocks !== undefined\n ? mergeMemoryBlocks(personalityBlocks, options.memoryBlocks)\n : undefined;\n const blockIds = options.isSubagent ? undefined : options.blockIds;\n\n return {\n agent_type: LETTA_CODE_AGENT_TYPE,\n ...(options.name !== undefined || personality\n ? { name: options.name ?? personality?.label }\n : {}),\n ...(options.description !== undefined || personality\n ? { description: options.description ?? personality?.description }\n : {}),\n model: modelHandle,\n system: options.system ?? buildSystemPrompt(\"default\", memoryPromptMode),\n ...(memoryBlocks !== undefined ? { memory_blocks: memoryBlocks } : {}),\n ...(blockIds && blockIds.length > 0 ? { block_ids: blockIds } : {}),\n tags: buildCreatedAgentTags({\n enableMemfs,\n isSubagent: options.isSubagent,\n tags: [...personalityTags, ...(options.extraTags ?? [])],\n }),\n tools: [...(options.baseTools ?? DEFAULT_CREATED_AGENT_BASE_TOOLS)],\n include_base_tools: false,\n include_base_tool_rules: false,\n initial_message_sequence: [],\n parallel_tool_calls: options.parallelToolCalls ?? true,\n compaction_settings: {\n model: options.compactionModel ?? DEFAULT_SUMMARIZATION_MODEL,\n },\n ...(options.embedding !== undefined\n ? { embedding: options.embedding }\n : {}),\n ...(options.isSubagent\n ? { hidden: true }\n : options.hidden !== undefined\n ? { hidden: options.hidden }\n : {}),\n };\n}\n\n/** Compatibility wrapper for callers that create a personality agent. */\nexport async function buildCreateAgentRequestForPersonality(params: {\n personalityId: PersonalityId;\n name?: string;\n description?: string;\n model?: string;\n extraTags?: string[];\n}): Promise<CreateAgentRequestForPersonality> {\n const request = (await buildCreateAgentRequest(\n params,\n )) as CreateAgentRequestForPersonality;\n const profilePicture = getPersonalityDefaultMemoryFiles(\n params.personalityId,\n ).find((file) => file.path === \"profile.png\");\n if (!profilePicture) {\n return request;\n }\n const { getPersonalityAssetBase64 } = await import(\n \"./personality-asset-content\"\n );\n return {\n ...request,\n profile_picture: {\n content: await getPersonalityAssetBase64(profilePicture.assetId),\n },\n };\n}\n"
|
|
13
13
|
],
|
|
14
|
-
"mappings": ";;;;;AAQO,IAAM,wBAAwB;AAG9B,IAAM,wBAAwB;AAG9B,IAAM,0BAA0B;AAGhC,IAAM,yBAAyB;AAQ/B,SAAS,qBAAqB,CACnC,UAAwC,CAAC,GAC/B;AAAA,EACV,MAAM,OAAO,CAAC,qBAAqB;AAAA,EACnC,IAAI,QAAQ,YAAY;AAAA,IACtB,KAAK,KAAK,uBAAuB;AAAA,EACnC;AAAA,EACA,IAAI,QAAQ,aAAa;AAAA,IACvB,KAAK,KAAK,sBAAsB;AAAA,EAClC;AAAA,EACA,IAAI,QAAQ,QAAQ,MAAM,QAAQ,QAAQ,IAAI,GAAG;AAAA,IAC/C,KAAK,KAAK,GAAG,QAAQ,IAAI;AAAA,EAC3B;AAAA,EACA,OAAO,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC;AAAA;;AC1B1B,IAAM,8BAA8B;AA2BpC,IAAM,sBAAsB;AAC5B,IAAM,uBAAuB,IAAI;AACjC,IAAM,wBAAwB,KAAK;AAEnC,IAAM,mBAAmB;AACzB,IAAM,oBAAoB,IAAI;AAC9B,IAAM,qBAAqB,KAAK;AAoBhC,IAAM,+BAA+B,KAAK;;;ACjE1C,IAAM,yBAAyB,CAAC,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A,IACzB,0BAA0B,CAAC;AAAA,IAC3B,qBAAqB,QAAQ,qBAAqB;AAAA,IAClD,qBAAqB;AAAA,MACnB,OAAO,QAAQ,mBAAmB;AAAA,IACpC;AAAA,OACI,QAAQ,cAAc,YACtB,EAAE,WAAW,QAAQ,UAAU,IAC/B,CAAC;AAAA,OACD,QAAQ,aACR,EAAE,QAAQ,KAAK,IACf,QAAQ,WAAW,YACjB,EAAE,QAAQ,QAAQ,OAAO,IACzB,CAAC;AAAA,EACT;AAAA;AAIF,eAAsB,qCAAqC,CAAC,QAMd;AAAA,EAC5C,MAAM,UAAW,MAAM,wBACrB,MACF;AAAA,EACA,MAAM,iBAAiB,iCACrB,OAAO,aACT,EAAE,KAAK,CAAC,SAAS,KAAK,SAAS,aAAa;AAAA,EAC5C,IAAI,CAAC,gBAAgB;AAAA,IACnB,OAAO;AAAA,EACT;AAAA,EACA,QAAQ,8BAA8B,MACpC;AAAA,EAEF,OAAO;AAAA,OACF;AAAA,IACH,iBAAiB;AAAA,MACf,SAAS,MAAM,0BAA0B,eAAe,OAAO;AAAA,IACjE;AAAA,EACF;AAAA;",
|
|
15
|
+
"debugId": "CEEBF9540DB742E664756E2164756E21",
|
|
16
16
|
"names": []
|
|
17
17
|
}
|
|
@@ -346,6 +346,16 @@ class AppServerClient {
|
|
|
346
346
|
predicate: (message) => message.type === "abort_message_response"
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
|
+
resumeQueue(command, options = {}) {
|
|
350
|
+
return this.request({
|
|
351
|
+
type: "resume_queue",
|
|
352
|
+
request_id: command.request_id ?? this.nextRequestId("resume-queue"),
|
|
353
|
+
...command
|
|
354
|
+
}, {
|
|
355
|
+
...options,
|
|
356
|
+
predicate: (message) => message.type === "resume_queue_response"
|
|
357
|
+
});
|
|
358
|
+
}
|
|
349
359
|
conversationList(command = {}, options = {}) {
|
|
350
360
|
return this.request({
|
|
351
361
|
type: "conversation_list",
|
|
@@ -427,4 +437,4 @@ function createAppServerClient(options) {
|
|
|
427
437
|
return new AppServerClient(options);
|
|
428
438
|
}
|
|
429
439
|
|
|
430
|
-
//# debugId=
|
|
440
|
+
//# debugId=7A2FA1CDF0199CC464756E2164756E21
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
"sources": ["../src/types/app-server-info.ts", "../src/app-server-client.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"export const APP_SERVER_PROTOCOL_VERSION = 1;\n\nexport interface AppServerInfoCommand {\n type: \"app_server_info\";\n /** Echoed back in the response for request correlation. */\n request_id: string;\n}\n\nexport interface AppServerInfoResponseMessage {\n type: \"app_server_info_response\";\n request_id: string;\n /** Synchronous post-auth capability discovery has no domain failure variant. */\n success: true;\n backend: \"local\" | \"api\";\n letta_code_version: string;\n /** Wire value reported by the server; clients compare it with their supported version. */\n protocol_version: number;\n capabilities: {\n agent_management: boolean;\n conversation_management: boolean;\n memory_management: boolean;\n runtime_start: boolean;\n runtime_workspace_sandbox?: boolean;\n runtime_external_tools_update?: boolean;\n split_channels: boolean;\n };\n}\n\nexport function isAppServerInfoResponseMessage(\n message: unknown,\n): message is AppServerInfoResponseMessage {\n if (!message || typeof message !== \"object\" || Array.isArray(message)) {\n return false;\n }\n\n const candidate = message as Record<string, unknown>;\n const capabilities = candidate.capabilities;\n if (\n !capabilities ||\n typeof capabilities !== \"object\" ||\n Array.isArray(capabilities)\n ) {\n return false;\n }\n\n const capabilityRecord = capabilities as Record<string, unknown>;\n return (\n candidate.type === \"app_server_info_response\" &&\n typeof candidate.request_id === \"string\" &&\n candidate.request_id.length > 0 &&\n candidate.success === true &&\n (candidate.backend === \"local\" || candidate.backend === \"api\") &&\n typeof candidate.letta_code_version === \"string\" &&\n typeof candidate.protocol_version === \"number\" &&\n Number.isInteger(candidate.protocol_version) &&\n typeof capabilityRecord.agent_management === \"boolean\" &&\n typeof capabilityRecord.conversation_management === \"boolean\" &&\n typeof capabilityRecord.memory_management === \"boolean\" &&\n typeof capabilityRecord.runtime_start === \"boolean\" &&\n (capabilityRecord.runtime_workspace_sandbox === undefined ||\n typeof capabilityRecord.runtime_workspace_sandbox === \"boolean\") &&\n (capabilityRecord.runtime_external_tools_update === undefined ||\n typeof capabilityRecord.runtime_external_tools_update === \"boolean\") &&\n typeof capabilityRecord.split_channels === \"boolean\"\n );\n}\n",
|
|
6
|
-
"import { isAppServerInfoResponseMessage } from \"./types/app-server-info\";\n\nexport type { AppServerInfoResponseMessage } from \"./types/app-server-info\";\nexport { isAppServerInfoResponseMessage } from \"./types/app-server-info\";\n\nimport type {\n AbortMessageCommand,\n AbortMessageResponseMessage,\n AppServerInfoResponseMessage,\n ConversationListCommand,\n ConversationListResponseMessage,\n ExternalToolCallRequestMessage,\n ExternalToolCallResult,\n InputAcceptedResponseMessage,\n InputCommand,\n MonitorStopCommand,\n MonitorStopResponse,\n RuntimeExternalToolsUpdateCommand,\n RuntimeExternalToolsUpdateResponseMessage,\n RuntimeStartCommand,\n RuntimeStartResponseMessage,\n SyncCommand,\n SyncResponseMessage,\n WsProtocolCommand,\n WsProtocolMessage,\n} from \"./types/app-server-protocol\";\n\nexport type AppServerChannel = \"control\" | \"stream\";\n\nexport type AppServerRawCommand = Record<string, unknown> & {\n type: string;\n request_id?: string;\n};\n\nexport type AppServerRawResponse = Record<string, unknown> & {\n type: string;\n request_id?: string;\n};\n\nexport type AppServerSendCommand = WsProtocolCommand | AppServerRawCommand;\n\n/** Receives every parsed protocol frame from the app-server WebSocket. */\nexport type AppServerMessageHandler = (\n message: WsProtocolMessage,\n channel: AppServerChannel,\n) => void;\n\n/** Called synchronously before a typed or raw command is written to the socket. */\nexport type AppServerSendHandler = (command: AppServerSendCommand) => void;\n\nexport interface AppServerDisconnectEvent {\n channel: AppServerChannel;\n event: unknown;\n}\n\n/** Called once when the WebSocket closes before client.close(). */\nexport type AppServerDisconnectHandler = (\n disconnect: AppServerDisconnectEvent,\n) => void;\n\nexport type AppServerExternalToolCallHandler = (\n request: ExternalToolCallRequestMessage,\n) => Promise<ExternalToolCallResult> | ExternalToolCallResult;\n\nexport interface AppServerSocketLike {\n readyState: number;\n send(data: string): void;\n close(): void;\n addEventListener?(type: string, listener: (event: unknown) => void): void;\n removeEventListener?(type: string, listener: (event: unknown) => void): void;\n on?(type: string, listener: (event: unknown) => void): void;\n off?(type: string, listener: (event: unknown) => void): void;\n once?(type: string, listener: (event: unknown) => void): void;\n}\n\nexport interface AppServerSocketOptions {\n headers?: Record<string, string>;\n}\n\nexport type AppServerSocketConstructor = new (\n url: string,\n options?: AppServerSocketOptions,\n) => AppServerSocketLike;\n\nexport interface AppServerClientOptions {\n /** Base app-server URL, e.g. ws://127.0.0.1:4500 or http://127.0.0.1:4500. */\n url: string;\n /** Optional capability token sent as Authorization: Bearer <token>; requires a WebSocket implementation with header support. */\n authToken?: string;\n /** Optional WebSocket constructor for Node/tests. Browsers use globalThis.WebSocket. */\n WebSocket?: AppServerSocketConstructor;\n /** Default timeout for request_id-correlated control requests. */\n requestTimeoutMs?: number;\n}\n\nexport interface AppServerRequestOptions<TMessage extends WsProtocolMessage> {\n timeoutMs?: number;\n predicate?: (message: WsProtocolMessage) => message is TMessage;\n}\n\nexport type AppServerRequestCommand = Extract<\n WsProtocolCommand,\n { request_id?: string }\n>;\n\nexport type AppServerRequestCommandWithId = AppServerRequestCommand & {\n request_id: string;\n};\n\nexport type AppServerRequestBody = Record<string, unknown> & {\n request_id?: string;\n};\n\nexport interface AppServerRawRequestOptions<\n TResponse extends AppServerRawResponse,\n> {\n timeoutMs?: number;\n predicate: (message: unknown) => message is TResponse;\n}\n\ntype PendingRequest = {\n resolve: (message: WsProtocolMessage) => void;\n reject: (error: Error) => void;\n predicate?: (message: WsProtocolMessage) => boolean;\n timeout: ReturnType<typeof setTimeout>;\n};\n\nconst DEFAULT_REQUEST_TIMEOUT_MS = 30_000;\nconst WEBSOCKET_OPEN_STATE = 1;\n\nfunction getGlobalWebSocket(): AppServerSocketConstructor | undefined {\n return (globalThis as { WebSocket?: AppServerSocketConstructor }).WebSocket;\n}\n\nfunction normalizeBaseUrl(url: string): URL {\n const parsed = new URL(url);\n if (parsed.protocol === \"http:\") parsed.protocol = \"ws:\";\n if (parsed.protocol === \"https:\") parsed.protocol = \"wss:\";\n if (parsed.protocol !== \"ws:\" && parsed.protocol !== \"wss:\") {\n throw new Error(`Unsupported app-server URL protocol: ${parsed.protocol}`);\n }\n if (!parsed.pathname || parsed.pathname === \"/\") {\n parsed.pathname = \"/ws\";\n }\n return parsed;\n}\n\nexport function resolveAppServerUrl(url: string): string {\n const parsed = normalizeBaseUrl(url);\n parsed.searchParams.delete(\"channel\");\n return parsed.toString();\n}\n\n/**\n * @deprecated App-server uses one bidirectional WebSocket. Both historical\n * channel names resolve to that same socket URL.\n */\nexport function resolveAppServerChannelUrl(\n url: string,\n _channel: AppServerChannel,\n): string {\n return resolveAppServerUrl(url);\n}\n\nfunction attachSocketListener(\n socket: AppServerSocketLike,\n type: string,\n listener: (event: unknown) => void,\n): () => void {\n if (socket.addEventListener && socket.removeEventListener) {\n socket.addEventListener(type, listener);\n return () => socket.removeEventListener?.(type, listener);\n }\n\n if (socket.on) {\n socket.on(type, listener);\n return () => socket.off?.(type, listener);\n }\n\n throw new Error(\"WebSocket implementation does not support event listeners\");\n}\n\nfunction onceSocketEvent(\n socket: AppServerSocketLike,\n type: string,\n listener: (event: unknown) => void,\n): () => void {\n if (socket.once) {\n socket.once(type, listener);\n return () => socket.off?.(type, listener);\n }\n\n let detach = () => {};\n detach = attachSocketListener(socket, type, (event) => {\n detach();\n listener(event);\n });\n return detach;\n}\n\nfunction waitForSocketOpen(socket: AppServerSocketLike): Promise<void> {\n if (socket.readyState === WEBSOCKET_OPEN_STATE) {\n return Promise.resolve();\n }\n\n return new Promise((resolve, reject) => {\n let detachOpen = () => {};\n let detachError = () => {};\n const cleanup = () => {\n detachOpen();\n detachError();\n };\n detachOpen = onceSocketEvent(socket, \"open\", () => {\n cleanup();\n resolve();\n });\n detachError = onceSocketEvent(socket, \"error\", (event) => {\n cleanup();\n reject(\n new Error(`App-server WebSocket failed to open: ${String(event)}`),\n );\n });\n });\n}\n\nfunction rawEventData(event: unknown): unknown {\n if (event && typeof event === \"object\" && \"data\" in event) {\n return (event as { data: unknown }).data;\n }\n return event;\n}\n\nfunction messageDataToString(data: unknown): string {\n const raw = rawEventData(data);\n if (typeof raw === \"string\") return raw;\n if (raw instanceof ArrayBuffer) {\n return new TextDecoder().decode(raw);\n }\n if (raw instanceof Uint8Array) {\n return new TextDecoder().decode(raw);\n }\n if (ArrayBuffer.isView(raw)) {\n return new TextDecoder().decode(\n new Uint8Array(raw.buffer as ArrayBuffer, raw.byteOffset, raw.byteLength),\n );\n }\n return String(raw);\n}\n\nfunction parseProtocolMessage(event: unknown): WsProtocolMessage {\n return JSON.parse(messageDataToString(event)) as WsProtocolMessage;\n}\n\nfunction appServerSocketOptions(\n authToken: string | undefined,\n): AppServerSocketOptions | undefined {\n if (authToken === undefined) {\n return undefined;\n }\n const token = authToken.trim();\n if (!token) {\n throw new Error(\"app-server auth token must not be empty\");\n }\n return { headers: { Authorization: `Bearer ${token}` } };\n}\n\nexport class AppServerClient {\n readonly socket: AppServerSocketLike;\n /** @deprecated Alias for socket. */\n readonly control: AppServerSocketLike;\n /** @deprecated Alias for socket; no second stream connection is created. */\n readonly stream: AppServerSocketLike;\n\n private readonly requestTimeoutMs: number;\n private readonly pending = new Map<string, PendingRequest>();\n private readonly messageHandlers = new Set<AppServerMessageHandler>();\n private readonly sendHandlers = new Set<AppServerSendHandler>();\n private readonly disconnectHandlers = new Set<AppServerDisconnectHandler>();\n private explicitlyClosed = false;\n private disconnectNotified = false;\n private nextRequestNumber = 0;\n\n constructor(options: AppServerClientOptions) {\n const WebSocket = options.WebSocket ?? getGlobalWebSocket();\n if (!WebSocket) {\n throw new Error(\"No WebSocket implementation available\");\n }\n\n this.requestTimeoutMs =\n options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;\n const socketOptions = appServerSocketOptions(options.authToken);\n this.socket = new WebSocket(\n resolveAppServerUrl(options.url),\n socketOptions,\n );\n this.control = this.socket;\n this.stream = this.socket;\n\n attachSocketListener(this.socket, \"message\", (event) => {\n this.handleMessage(event, \"control\");\n });\n attachSocketListener(this.socket, \"close\", (event) => {\n this.handleDisconnect(\"control\", event);\n });\n }\n\n async connect(): Promise<this> {\n await waitForSocketOpen(this.socket);\n return this;\n }\n\n close(): void {\n if (this.explicitlyClosed) return;\n this.explicitlyClosed = true;\n this.rejectAllPending(\"App-server client closed\");\n this.socket.close();\n }\n\n onMessage(handler: AppServerMessageHandler): () => void {\n this.messageHandlers.add(handler);\n return () => this.messageHandlers.delete(handler);\n }\n\n onSend(handler: AppServerSendHandler): () => void {\n this.sendHandlers.add(handler);\n return () => this.sendHandlers.delete(handler);\n }\n\n onDisconnect(handler: AppServerDisconnectHandler): () => void {\n this.disconnectHandlers.add(handler);\n return () => this.disconnectHandlers.delete(handler);\n }\n\n nextRequestId(prefix = \"req\"): string {\n this.nextRequestNumber += 1;\n return `${prefix}-${this.nextRequestNumber}`;\n }\n\n send(command: WsProtocolCommand): void {\n this.writeCommand(command);\n }\n\n private writeCommand(command: AppServerSendCommand): void {\n for (const handler of this.sendHandlers) {\n handler(command);\n }\n this.socket.send(JSON.stringify(command));\n }\n\n /**\n * Send a forward-compatible protocol command from a compatibility adapter.\n * Prefer the typed wrappers above this boundary for normal product code.\n */\n sendRaw(command: AppServerRawCommand): void {\n this.writeCommand(command);\n }\n\n /**\n * Request a forward-compatible response without mirroring the full protocol\n * union in a downstream compatibility adapter.\n */\n requestRaw<TResponse extends AppServerRawResponse>(\n command: AppServerRawCommand & { request_id: string },\n options: AppServerRawRequestOptions<TResponse>,\n ): Promise<TResponse> {\n const timeoutMs = options.timeoutMs ?? this.requestTimeoutMs;\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n this.pending.delete(command.request_id);\n reject(new Error(`Timed out waiting for ${command.request_id}`));\n }, timeoutMs);\n\n this.pending.set(command.request_id, {\n resolve: (message) => resolve(message as unknown as TResponse),\n reject,\n predicate: options.predicate,\n timeout,\n });\n\n try {\n this.sendRaw(command);\n } catch (error) {\n clearTimeout(timeout);\n this.pending.delete(command.request_id);\n reject(error instanceof Error ? error : new Error(String(error)));\n }\n });\n }\n\n request<TMessage extends WsProtocolMessage = WsProtocolMessage>(\n command: AppServerRequestCommandWithId,\n options?: AppServerRequestOptions<TMessage>,\n ): Promise<TMessage>;\n\n request<\n TType extends AppServerRequestCommand[\"type\"],\n TMessage extends WsProtocolMessage = WsProtocolMessage,\n >(\n type: TType,\n body?: AppServerRequestBody,\n options?: AppServerRequestOptions<TMessage>,\n ): Promise<TMessage>;\n\n request<TMessage extends WsProtocolMessage = WsProtocolMessage>(\n commandOrType:\n | AppServerRequestCommandWithId\n | AppServerRequestCommand[\"type\"],\n bodyOrOptions:\n | AppServerRequestBody\n | AppServerRequestOptions<TMessage> = {},\n maybeOptions: AppServerRequestOptions<TMessage> = {},\n ): Promise<TMessage> {\n const isTypeRequest = typeof commandOrType === \"string\";\n const command = isTypeRequest\n ? ({\n type: commandOrType,\n request_id:\n (bodyOrOptions as { request_id?: string }).request_id ??\n this.nextRequestId(commandOrType),\n ...(bodyOrOptions as object),\n } as AppServerRequestCommandWithId)\n : commandOrType;\n const options = isTypeRequest\n ? maybeOptions\n : (bodyOrOptions as AppServerRequestOptions<TMessage>);\n const timeoutMs = options.timeoutMs ?? this.requestTimeoutMs;\n\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n this.pending.delete(command.request_id);\n reject(new Error(`Timed out waiting for ${command.request_id}`));\n }, timeoutMs);\n\n this.pending.set(command.request_id, {\n resolve: (message) => resolve(message as TMessage),\n reject,\n predicate: options.predicate,\n timeout,\n });\n\n try {\n this.send(command);\n } catch (error) {\n clearTimeout(timeout);\n this.pending.delete(command.request_id);\n reject(error instanceof Error ? error : new Error(String(error)));\n }\n });\n }\n\n info(\n options: Omit<\n AppServerRequestOptions<AppServerInfoResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<AppServerInfoResponseMessage> {\n return this.request(\n {\n type: \"app_server_info\",\n request_id: this.nextRequestId(\"app-server-info\"),\n },\n {\n ...options,\n predicate: isAppServerInfoResponseMessage,\n },\n );\n }\n\n stopMonitor(\n command: Omit<MonitorStopCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n },\n options: Omit<\n AppServerRequestOptions<MonitorStopResponse>,\n \"predicate\"\n > = {},\n ): Promise<MonitorStopResponse> {\n return this.request(\n {\n type: \"monitor_stop\",\n ...command,\n request_id: command.request_id ?? this.nextRequestId(\"monitor-stop\"),\n },\n {\n ...options,\n predicate: (message): message is MonitorStopResponse =>\n message.type === \"monitor_stop_response\" &&\n message.process_id === command.process_id &&\n message.runtime.agent_id === command.runtime.agent_id &&\n message.runtime.conversation_id === command.runtime.conversation_id,\n },\n );\n }\n\n runtimeStart(\n command: Omit<RuntimeStartCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n },\n options: Omit<\n AppServerRequestOptions<RuntimeStartResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<RuntimeStartResponseMessage> {\n return this.request(\n {\n type: \"runtime_start\",\n request_id: command.request_id ?? this.nextRequestId(\"runtime-start\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is RuntimeStartResponseMessage =>\n message.type === \"runtime_start_response\",\n },\n );\n }\n\n runtimeExternalToolsUpdate(\n command: Omit<RuntimeExternalToolsUpdateCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n },\n options: Omit<\n AppServerRequestOptions<RuntimeExternalToolsUpdateResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<RuntimeExternalToolsUpdateResponseMessage> {\n return this.request(\n {\n type: \"runtime_external_tools_update\",\n request_id:\n command.request_id ?? this.nextRequestId(\"runtime-external-tools\"),\n ...command,\n },\n {\n ...options,\n predicate: (\n message,\n ): message is RuntimeExternalToolsUpdateResponseMessage =>\n message.type === \"runtime_external_tools_update_response\",\n },\n );\n }\n\n sync(\n command: Omit<SyncCommand, \"type\" | \"request_id\"> & { request_id?: string },\n options: Omit<\n AppServerRequestOptions<SyncResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<SyncResponseMessage> {\n return this.request(\n {\n type: \"sync\",\n request_id: command.request_id ?? this.nextRequestId(\"sync\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is SyncResponseMessage =>\n message.type === \"sync_response\",\n },\n );\n }\n\n abort(\n command: Omit<AbortMessageCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n },\n options: Omit<\n AppServerRequestOptions<AbortMessageResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<AbortMessageResponseMessage> {\n return this.request(\n {\n type: \"abort_message\",\n request_id: command.request_id ?? this.nextRequestId(\"abort\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is AbortMessageResponseMessage =>\n message.type === \"abort_message_response\",\n },\n );\n }\n\n conversationList(\n command: Omit<ConversationListCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n } = {},\n options: Omit<\n AppServerRequestOptions<ConversationListResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<ConversationListResponseMessage> {\n return this.request(\n {\n type: \"conversation_list\",\n request_id:\n command.request_id ?? this.nextRequestId(\"conversation-list\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is ConversationListResponseMessage =>\n message.type === \"conversation_list_response\",\n },\n );\n }\n\n onExternalToolCall(handler: AppServerExternalToolCallHandler): () => void {\n return this.onMessage((message, channel) => {\n if (\n channel !== \"control\" ||\n message.type !== \"external_tool_call_request\"\n ) {\n return;\n }\n\n void Promise.resolve(handler(message))\n .then((result) => {\n this.send({\n type: \"external_tool_call_response\",\n request_id: message.request_id,\n result,\n });\n })\n .catch((error) => {\n this.send({\n type: \"external_tool_call_response\",\n request_id: message.request_id,\n error: error instanceof Error ? error.message : String(error),\n });\n });\n });\n }\n\n /**\n * Submit input to a runtime. Observe progress, tool activity, approvals, and\n * terminal lifecycle events through onMessage().\n */\n input(command: Omit<InputCommand, \"type\">): void {\n this.send({ type: \"input\", ...command });\n }\n\n /**\n * Submit an input and wait only until the listener accepts it into the\n * normal dispatch/queue path. This never waits for turn completion.\n */\n submitInput(\n command: Omit<InputCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n },\n options: Omit<\n AppServerRequestOptions<InputAcceptedResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<InputAcceptedResponseMessage> {\n return this.request(\n {\n type: \"input\",\n request_id: command.request_id ?? this.nextRequestId(\"input\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is InputAcceptedResponseMessage =>\n message.type === \"input_accepted\",\n },\n );\n }\n\n private handleMessage(event: unknown, channel: AppServerChannel): void {\n const message = parseProtocolMessage(event);\n\n for (const handler of this.messageHandlers) {\n handler(message, channel);\n }\n\n const requestId =\n message && typeof message === \"object\" && \"request_id\" in message\n ? (message as { request_id?: unknown }).request_id\n : undefined;\n if (channel !== \"control\" || typeof requestId !== \"string\") {\n return;\n }\n\n const pending = this.pending.get(requestId);\n if (!pending || (pending.predicate && !pending.predicate(message))) {\n return;\n }\n\n clearTimeout(pending.timeout);\n this.pending.delete(requestId);\n pending.resolve(message);\n }\n\n private rejectAllPending(reason: string): void {\n for (const [requestId, pending] of this.pending) {\n clearTimeout(pending.timeout);\n this.pending.delete(requestId);\n pending.reject(new Error(reason));\n }\n }\n\n private handleDisconnect(channel: AppServerChannel, event: unknown): void {\n this.rejectAllPending(\"App-server socket closed\");\n if (this.explicitlyClosed || this.disconnectNotified) return;\n this.disconnectNotified = true;\n for (const handler of this.disconnectHandlers) {\n handler({ channel, event });\n }\n }\n}\n\nexport function createAppServerClient(\n options: AppServerClientOptions,\n): AppServerClient {\n return new AppServerClient(options);\n}\n"
|
|
6
|
+
"import { isAppServerInfoResponseMessage } from \"./types/app-server-info\";\n\nexport type { AppServerInfoResponseMessage } from \"./types/app-server-info\";\nexport { isAppServerInfoResponseMessage } from \"./types/app-server-info\";\n\nimport type {\n AbortMessageCommand,\n AbortMessageResponseMessage,\n AppServerInfoResponseMessage,\n ConversationListCommand,\n ConversationListResponseMessage,\n ExternalToolCallRequestMessage,\n ExternalToolCallResult,\n InputAcceptedResponseMessage,\n InputCommand,\n MonitorStopCommand,\n MonitorStopResponse,\n ResumeQueueCommand,\n ResumeQueueResponseMessage,\n RuntimeExternalToolsUpdateCommand,\n RuntimeExternalToolsUpdateResponseMessage,\n RuntimeStartCommand,\n RuntimeStartResponseMessage,\n SyncCommand,\n SyncResponseMessage,\n WsProtocolCommand,\n WsProtocolMessage,\n} from \"./types/app-server-protocol\";\n\nexport type AppServerChannel = \"control\" | \"stream\";\n\nexport type AppServerRawCommand = Record<string, unknown> & {\n type: string;\n request_id?: string;\n};\n\nexport type AppServerRawResponse = Record<string, unknown> & {\n type: string;\n request_id?: string;\n};\n\nexport type AppServerSendCommand = WsProtocolCommand | AppServerRawCommand;\n\n/** Receives every parsed protocol frame from the app-server WebSocket. */\nexport type AppServerMessageHandler = (\n message: WsProtocolMessage,\n channel: AppServerChannel,\n) => void;\n\n/** Called synchronously before a typed or raw command is written to the socket. */\nexport type AppServerSendHandler = (command: AppServerSendCommand) => void;\n\nexport interface AppServerDisconnectEvent {\n channel: AppServerChannel;\n event: unknown;\n}\n\n/** Called once when the WebSocket closes before client.close(). */\nexport type AppServerDisconnectHandler = (\n disconnect: AppServerDisconnectEvent,\n) => void;\n\nexport type AppServerExternalToolCallHandler = (\n request: ExternalToolCallRequestMessage,\n) => Promise<ExternalToolCallResult> | ExternalToolCallResult;\n\nexport interface AppServerSocketLike {\n readyState: number;\n send(data: string): void;\n close(): void;\n addEventListener?(type: string, listener: (event: unknown) => void): void;\n removeEventListener?(type: string, listener: (event: unknown) => void): void;\n on?(type: string, listener: (event: unknown) => void): void;\n off?(type: string, listener: (event: unknown) => void): void;\n once?(type: string, listener: (event: unknown) => void): void;\n}\n\nexport interface AppServerSocketOptions {\n headers?: Record<string, string>;\n}\n\nexport type AppServerSocketConstructor = new (\n url: string,\n options?: AppServerSocketOptions,\n) => AppServerSocketLike;\n\nexport interface AppServerClientOptions {\n /** Base app-server URL, e.g. ws://127.0.0.1:4500 or http://127.0.0.1:4500. */\n url: string;\n /** Optional capability token sent as Authorization: Bearer <token>; requires a WebSocket implementation with header support. */\n authToken?: string;\n /** Optional WebSocket constructor for Node/tests. Browsers use globalThis.WebSocket. */\n WebSocket?: AppServerSocketConstructor;\n /** Default timeout for request_id-correlated control requests. */\n requestTimeoutMs?: number;\n}\n\nexport interface AppServerRequestOptions<TMessage extends WsProtocolMessage> {\n timeoutMs?: number;\n predicate?: (message: WsProtocolMessage) => message is TMessage;\n}\n\nexport type AppServerRequestCommand = Extract<\n WsProtocolCommand,\n { request_id?: string }\n>;\n\nexport type AppServerRequestCommandWithId = AppServerRequestCommand & {\n request_id: string;\n};\n\nexport type AppServerRequestBody = Record<string, unknown> & {\n request_id?: string;\n};\n\nexport interface AppServerRawRequestOptions<\n TResponse extends AppServerRawResponse,\n> {\n timeoutMs?: number;\n predicate: (message: unknown) => message is TResponse;\n}\n\ntype PendingRequest = {\n resolve: (message: WsProtocolMessage) => void;\n reject: (error: Error) => void;\n predicate?: (message: WsProtocolMessage) => boolean;\n timeout: ReturnType<typeof setTimeout>;\n};\n\nconst DEFAULT_REQUEST_TIMEOUT_MS = 30_000;\nconst WEBSOCKET_OPEN_STATE = 1;\n\nfunction getGlobalWebSocket(): AppServerSocketConstructor | undefined {\n return (globalThis as { WebSocket?: AppServerSocketConstructor }).WebSocket;\n}\n\nfunction normalizeBaseUrl(url: string): URL {\n const parsed = new URL(url);\n if (parsed.protocol === \"http:\") parsed.protocol = \"ws:\";\n if (parsed.protocol === \"https:\") parsed.protocol = \"wss:\";\n if (parsed.protocol !== \"ws:\" && parsed.protocol !== \"wss:\") {\n throw new Error(`Unsupported app-server URL protocol: ${parsed.protocol}`);\n }\n if (!parsed.pathname || parsed.pathname === \"/\") {\n parsed.pathname = \"/ws\";\n }\n return parsed;\n}\n\nexport function resolveAppServerUrl(url: string): string {\n const parsed = normalizeBaseUrl(url);\n parsed.searchParams.delete(\"channel\");\n return parsed.toString();\n}\n\n/**\n * @deprecated App-server uses one bidirectional WebSocket. Both historical\n * channel names resolve to that same socket URL.\n */\nexport function resolveAppServerChannelUrl(\n url: string,\n _channel: AppServerChannel,\n): string {\n return resolveAppServerUrl(url);\n}\n\nfunction attachSocketListener(\n socket: AppServerSocketLike,\n type: string,\n listener: (event: unknown) => void,\n): () => void {\n if (socket.addEventListener && socket.removeEventListener) {\n socket.addEventListener(type, listener);\n return () => socket.removeEventListener?.(type, listener);\n }\n\n if (socket.on) {\n socket.on(type, listener);\n return () => socket.off?.(type, listener);\n }\n\n throw new Error(\"WebSocket implementation does not support event listeners\");\n}\n\nfunction onceSocketEvent(\n socket: AppServerSocketLike,\n type: string,\n listener: (event: unknown) => void,\n): () => void {\n if (socket.once) {\n socket.once(type, listener);\n return () => socket.off?.(type, listener);\n }\n\n let detach = () => {};\n detach = attachSocketListener(socket, type, (event) => {\n detach();\n listener(event);\n });\n return detach;\n}\n\nfunction waitForSocketOpen(socket: AppServerSocketLike): Promise<void> {\n if (socket.readyState === WEBSOCKET_OPEN_STATE) {\n return Promise.resolve();\n }\n\n return new Promise((resolve, reject) => {\n let detachOpen = () => {};\n let detachError = () => {};\n const cleanup = () => {\n detachOpen();\n detachError();\n };\n detachOpen = onceSocketEvent(socket, \"open\", () => {\n cleanup();\n resolve();\n });\n detachError = onceSocketEvent(socket, \"error\", (event) => {\n cleanup();\n reject(\n new Error(`App-server WebSocket failed to open: ${String(event)}`),\n );\n });\n });\n}\n\nfunction rawEventData(event: unknown): unknown {\n if (event && typeof event === \"object\" && \"data\" in event) {\n return (event as { data: unknown }).data;\n }\n return event;\n}\n\nfunction messageDataToString(data: unknown): string {\n const raw = rawEventData(data);\n if (typeof raw === \"string\") return raw;\n if (raw instanceof ArrayBuffer) {\n return new TextDecoder().decode(raw);\n }\n if (raw instanceof Uint8Array) {\n return new TextDecoder().decode(raw);\n }\n if (ArrayBuffer.isView(raw)) {\n return new TextDecoder().decode(\n new Uint8Array(raw.buffer as ArrayBuffer, raw.byteOffset, raw.byteLength),\n );\n }\n return String(raw);\n}\n\nfunction parseProtocolMessage(event: unknown): WsProtocolMessage {\n return JSON.parse(messageDataToString(event)) as WsProtocolMessage;\n}\n\nfunction appServerSocketOptions(\n authToken: string | undefined,\n): AppServerSocketOptions | undefined {\n if (authToken === undefined) {\n return undefined;\n }\n const token = authToken.trim();\n if (!token) {\n throw new Error(\"app-server auth token must not be empty\");\n }\n return { headers: { Authorization: `Bearer ${token}` } };\n}\n\nexport class AppServerClient {\n readonly socket: AppServerSocketLike;\n /** @deprecated Alias for socket. */\n readonly control: AppServerSocketLike;\n /** @deprecated Alias for socket; no second stream connection is created. */\n readonly stream: AppServerSocketLike;\n\n private readonly requestTimeoutMs: number;\n private readonly pending = new Map<string, PendingRequest>();\n private readonly messageHandlers = new Set<AppServerMessageHandler>();\n private readonly sendHandlers = new Set<AppServerSendHandler>();\n private readonly disconnectHandlers = new Set<AppServerDisconnectHandler>();\n private explicitlyClosed = false;\n private disconnectNotified = false;\n private nextRequestNumber = 0;\n\n constructor(options: AppServerClientOptions) {\n const WebSocket = options.WebSocket ?? getGlobalWebSocket();\n if (!WebSocket) {\n throw new Error(\"No WebSocket implementation available\");\n }\n\n this.requestTimeoutMs =\n options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;\n const socketOptions = appServerSocketOptions(options.authToken);\n this.socket = new WebSocket(\n resolveAppServerUrl(options.url),\n socketOptions,\n );\n this.control = this.socket;\n this.stream = this.socket;\n\n attachSocketListener(this.socket, \"message\", (event) => {\n this.handleMessage(event, \"control\");\n });\n attachSocketListener(this.socket, \"close\", (event) => {\n this.handleDisconnect(\"control\", event);\n });\n }\n\n async connect(): Promise<this> {\n await waitForSocketOpen(this.socket);\n return this;\n }\n\n close(): void {\n if (this.explicitlyClosed) return;\n this.explicitlyClosed = true;\n this.rejectAllPending(\"App-server client closed\");\n this.socket.close();\n }\n\n onMessage(handler: AppServerMessageHandler): () => void {\n this.messageHandlers.add(handler);\n return () => this.messageHandlers.delete(handler);\n }\n\n onSend(handler: AppServerSendHandler): () => void {\n this.sendHandlers.add(handler);\n return () => this.sendHandlers.delete(handler);\n }\n\n onDisconnect(handler: AppServerDisconnectHandler): () => void {\n this.disconnectHandlers.add(handler);\n return () => this.disconnectHandlers.delete(handler);\n }\n\n nextRequestId(prefix = \"req\"): string {\n this.nextRequestNumber += 1;\n return `${prefix}-${this.nextRequestNumber}`;\n }\n\n send(command: WsProtocolCommand): void {\n this.writeCommand(command);\n }\n\n private writeCommand(command: AppServerSendCommand): void {\n for (const handler of this.sendHandlers) {\n handler(command);\n }\n this.socket.send(JSON.stringify(command));\n }\n\n /**\n * Send a forward-compatible protocol command from a compatibility adapter.\n * Prefer the typed wrappers above this boundary for normal product code.\n */\n sendRaw(command: AppServerRawCommand): void {\n this.writeCommand(command);\n }\n\n /**\n * Request a forward-compatible response without mirroring the full protocol\n * union in a downstream compatibility adapter.\n */\n requestRaw<TResponse extends AppServerRawResponse>(\n command: AppServerRawCommand & { request_id: string },\n options: AppServerRawRequestOptions<TResponse>,\n ): Promise<TResponse> {\n const timeoutMs = options.timeoutMs ?? this.requestTimeoutMs;\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n this.pending.delete(command.request_id);\n reject(new Error(`Timed out waiting for ${command.request_id}`));\n }, timeoutMs);\n\n this.pending.set(command.request_id, {\n resolve: (message) => resolve(message as unknown as TResponse),\n reject,\n predicate: options.predicate,\n timeout,\n });\n\n try {\n this.sendRaw(command);\n } catch (error) {\n clearTimeout(timeout);\n this.pending.delete(command.request_id);\n reject(error instanceof Error ? error : new Error(String(error)));\n }\n });\n }\n\n request<TMessage extends WsProtocolMessage = WsProtocolMessage>(\n command: AppServerRequestCommandWithId,\n options?: AppServerRequestOptions<TMessage>,\n ): Promise<TMessage>;\n\n request<\n TType extends AppServerRequestCommand[\"type\"],\n TMessage extends WsProtocolMessage = WsProtocolMessage,\n >(\n type: TType,\n body?: AppServerRequestBody,\n options?: AppServerRequestOptions<TMessage>,\n ): Promise<TMessage>;\n\n request<TMessage extends WsProtocolMessage = WsProtocolMessage>(\n commandOrType:\n | AppServerRequestCommandWithId\n | AppServerRequestCommand[\"type\"],\n bodyOrOptions:\n | AppServerRequestBody\n | AppServerRequestOptions<TMessage> = {},\n maybeOptions: AppServerRequestOptions<TMessage> = {},\n ): Promise<TMessage> {\n const isTypeRequest = typeof commandOrType === \"string\";\n const command = isTypeRequest\n ? ({\n type: commandOrType,\n request_id:\n (bodyOrOptions as { request_id?: string }).request_id ??\n this.nextRequestId(commandOrType),\n ...(bodyOrOptions as object),\n } as AppServerRequestCommandWithId)\n : commandOrType;\n const options = isTypeRequest\n ? maybeOptions\n : (bodyOrOptions as AppServerRequestOptions<TMessage>);\n const timeoutMs = options.timeoutMs ?? this.requestTimeoutMs;\n\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n this.pending.delete(command.request_id);\n reject(new Error(`Timed out waiting for ${command.request_id}`));\n }, timeoutMs);\n\n this.pending.set(command.request_id, {\n resolve: (message) => resolve(message as TMessage),\n reject,\n predicate: options.predicate,\n timeout,\n });\n\n try {\n this.send(command);\n } catch (error) {\n clearTimeout(timeout);\n this.pending.delete(command.request_id);\n reject(error instanceof Error ? error : new Error(String(error)));\n }\n });\n }\n\n info(\n options: Omit<\n AppServerRequestOptions<AppServerInfoResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<AppServerInfoResponseMessage> {\n return this.request(\n {\n type: \"app_server_info\",\n request_id: this.nextRequestId(\"app-server-info\"),\n },\n {\n ...options,\n predicate: isAppServerInfoResponseMessage,\n },\n );\n }\n\n stopMonitor(\n command: Omit<MonitorStopCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n },\n options: Omit<\n AppServerRequestOptions<MonitorStopResponse>,\n \"predicate\"\n > = {},\n ): Promise<MonitorStopResponse> {\n return this.request(\n {\n type: \"monitor_stop\",\n ...command,\n request_id: command.request_id ?? this.nextRequestId(\"monitor-stop\"),\n },\n {\n ...options,\n predicate: (message): message is MonitorStopResponse =>\n message.type === \"monitor_stop_response\" &&\n message.process_id === command.process_id &&\n message.runtime.agent_id === command.runtime.agent_id &&\n message.runtime.conversation_id === command.runtime.conversation_id,\n },\n );\n }\n\n runtimeStart(\n command: Omit<RuntimeStartCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n },\n options: Omit<\n AppServerRequestOptions<RuntimeStartResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<RuntimeStartResponseMessage> {\n return this.request(\n {\n type: \"runtime_start\",\n request_id: command.request_id ?? this.nextRequestId(\"runtime-start\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is RuntimeStartResponseMessage =>\n message.type === \"runtime_start_response\",\n },\n );\n }\n\n runtimeExternalToolsUpdate(\n command: Omit<RuntimeExternalToolsUpdateCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n },\n options: Omit<\n AppServerRequestOptions<RuntimeExternalToolsUpdateResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<RuntimeExternalToolsUpdateResponseMessage> {\n return this.request(\n {\n type: \"runtime_external_tools_update\",\n request_id:\n command.request_id ?? this.nextRequestId(\"runtime-external-tools\"),\n ...command,\n },\n {\n ...options,\n predicate: (\n message,\n ): message is RuntimeExternalToolsUpdateResponseMessage =>\n message.type === \"runtime_external_tools_update_response\",\n },\n );\n }\n\n sync(\n command: Omit<SyncCommand, \"type\" | \"request_id\"> & { request_id?: string },\n options: Omit<\n AppServerRequestOptions<SyncResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<SyncResponseMessage> {\n return this.request(\n {\n type: \"sync\",\n request_id: command.request_id ?? this.nextRequestId(\"sync\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is SyncResponseMessage =>\n message.type === \"sync_response\",\n },\n );\n }\n\n abort(\n command: Omit<AbortMessageCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n },\n options: Omit<\n AppServerRequestOptions<AbortMessageResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<AbortMessageResponseMessage> {\n return this.request(\n {\n type: \"abort_message\",\n request_id: command.request_id ?? this.nextRequestId(\"abort\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is AbortMessageResponseMessage =>\n message.type === \"abort_message_response\",\n },\n );\n }\n\n /** Release queue items parked by `abort()` without sending a new message. */\n resumeQueue(\n command: Omit<ResumeQueueCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n },\n options: Omit<\n AppServerRequestOptions<ResumeQueueResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<ResumeQueueResponseMessage> {\n return this.request(\n {\n type: \"resume_queue\",\n request_id: command.request_id ?? this.nextRequestId(\"resume-queue\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is ResumeQueueResponseMessage =>\n message.type === \"resume_queue_response\",\n },\n );\n }\n\n conversationList(\n command: Omit<ConversationListCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n } = {},\n options: Omit<\n AppServerRequestOptions<ConversationListResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<ConversationListResponseMessage> {\n return this.request(\n {\n type: \"conversation_list\",\n request_id:\n command.request_id ?? this.nextRequestId(\"conversation-list\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is ConversationListResponseMessage =>\n message.type === \"conversation_list_response\",\n },\n );\n }\n\n onExternalToolCall(handler: AppServerExternalToolCallHandler): () => void {\n return this.onMessage((message, channel) => {\n if (\n channel !== \"control\" ||\n message.type !== \"external_tool_call_request\"\n ) {\n return;\n }\n\n void Promise.resolve(handler(message))\n .then((result) => {\n this.send({\n type: \"external_tool_call_response\",\n request_id: message.request_id,\n result,\n });\n })\n .catch((error) => {\n this.send({\n type: \"external_tool_call_response\",\n request_id: message.request_id,\n error: error instanceof Error ? error.message : String(error),\n });\n });\n });\n }\n\n /**\n * Submit input to a runtime. Observe progress, tool activity, approvals, and\n * terminal lifecycle events through onMessage().\n */\n input(command: Omit<InputCommand, \"type\">): void {\n this.send({ type: \"input\", ...command });\n }\n\n /**\n * Submit an input and wait only until the listener accepts it into the\n * normal dispatch/queue path. This never waits for turn completion.\n */\n submitInput(\n command: Omit<InputCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n },\n options: Omit<\n AppServerRequestOptions<InputAcceptedResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<InputAcceptedResponseMessage> {\n return this.request(\n {\n type: \"input\",\n request_id: command.request_id ?? this.nextRequestId(\"input\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is InputAcceptedResponseMessage =>\n message.type === \"input_accepted\",\n },\n );\n }\n\n private handleMessage(event: unknown, channel: AppServerChannel): void {\n const message = parseProtocolMessage(event);\n\n for (const handler of this.messageHandlers) {\n handler(message, channel);\n }\n\n const requestId =\n message && typeof message === \"object\" && \"request_id\" in message\n ? (message as { request_id?: unknown }).request_id\n : undefined;\n if (channel !== \"control\" || typeof requestId !== \"string\") {\n return;\n }\n\n const pending = this.pending.get(requestId);\n if (!pending || (pending.predicate && !pending.predicate(message))) {\n return;\n }\n\n clearTimeout(pending.timeout);\n this.pending.delete(requestId);\n pending.resolve(message);\n }\n\n private rejectAllPending(reason: string): void {\n for (const [requestId, pending] of this.pending) {\n clearTimeout(pending.timeout);\n this.pending.delete(requestId);\n pending.reject(new Error(reason));\n }\n }\n\n private handleDisconnect(channel: AppServerChannel, event: unknown): void {\n this.rejectAllPending(\"App-server socket closed\");\n if (this.explicitlyClosed || this.disconnectNotified) return;\n this.disconnectNotified = true;\n for (const handler of this.disconnectHandlers) {\n handler({ channel, event });\n }\n }\n}\n\nexport function createAppServerClient(\n options: AppServerClientOptions,\n): AppServerClient {\n return new AppServerClient(options);\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BO,SAAS,8BAA8B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message_response"
|
|
298
298
|
});
|
|
299
299
|
}
|
|
300
|
+
resumeQueue(command, options = {}) {
|
|
301
|
+
return this.request({
|
|
302
|
+
type: "resume_queue",
|
|
303
|
+
request_id: command.request_id ?? this.nextRequestId("resume-queue"),
|
|
304
|
+
...command
|
|
305
|
+
}, {
|
|
306
|
+
...options,
|
|
307
|
+
predicate: (message) => message.type === "resume_queue_response"
|
|
308
|
+
});
|
|
309
|
+
}
|
|
300
310
|
conversationList(command = {}, options = {}) {
|
|
301
311
|
return this.request({
|
|
302
312
|
type: "conversation_list",
|
|
@@ -385,4 +395,4 @@ export {
|
|
|
385
395
|
AppServerClient
|
|
386
396
|
};
|
|
387
397
|
|
|
388
|
-
//# debugId=
|
|
398
|
+
//# debugId=447DE4754659309264756E2164756E21
|