@letta-ai/letta-code 0.30.21 → 0.30.23
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 +32 -5
- package/dist/agent-presets.js.map +2 -2
- package/dist/app-server-client.cjs +19 -9
- package/dist/app-server-client.cjs.map +2 -2
- package/dist/gateway-core.js +83 -7
- package/dist/gateway-core.js.map +3 -3
- package/dist/mcp-client.js +23 -5
- package/dist/mcp-client.js.map +2 -2
- package/dist/types/agent/message.d.ts.map +1 -1
- package/dist/types/channels/gateway-core.d.ts +6 -0
- package/dist/types/channels/gateway-core.d.ts.map +1 -1
- package/dist/types/gateway-core.d.ts +1 -1
- package/dist/types/gateway-core.d.ts.map +1 -1
- package/dist/types/tools/external-tool-content.d.ts +11 -0
- package/dist/types/tools/external-tool-content.d.ts.map +1 -0
- package/dist/types/tools/impl/bash-output.d.ts.map +1 -1
- package/dist/types/tools/impl/bash.d.ts.map +1 -1
- package/dist/types/tools/impl/exec-command.d.ts +1 -0
- package/dist/types/tools/impl/exec-command.d.ts.map +1 -1
- package/dist/types/tools/impl/github-pull-request-tracker.d.ts.map +1 -1
- package/dist/types/tools/impl/monitor.d.ts.map +1 -1
- package/dist/types/tools/impl/overflow.d.ts +4 -5
- package/dist/types/tools/impl/overflow.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-command.d.ts.map +1 -1
- package/dist/types/tools/impl/truncation.d.ts +2 -0
- package/dist/types/tools/impl/truncation.d.ts.map +1 -1
- package/dist/types/tools/manager.d.ts.map +1 -1
- package/dist/types/tools/secret-substitution.d.ts +4 -4
- package/dist/types/tools/secret-substitution.d.ts.map +1 -1
- package/dist/types/types/cwd-protocol.d.ts +31 -0
- package/dist/types/types/cwd-protocol.d.ts.map +1 -0
- package/dist/types/types/protocol_v2.d.ts +4 -17
- package/dist/types/types/protocol_v2.d.ts.map +1 -1
- package/dist/types/types/teleport-protocol.d.ts +3 -0
- package/dist/types/types/teleport-protocol.d.ts.map +1 -1
- package/dist/types/websocket/listener/cwd.d.ts +6 -0
- package/dist/types/websocket/listener/cwd.d.ts.map +1 -1
- package/dist/types/websocket/listener/protocol-outbound.d.ts.map +1 -1
- package/dist/types/websocket/listener/types.d.ts +3 -0
- package/dist/types/websocket/listener/types.d.ts.map +1 -1
- package/image-resize-worker.js +16 -2
- package/letta.js +14712 -14398
- package/package.json +2 -2
- package/scripts/source-file-size-baseline.json +4 -4
package/dist/agent-presets.js
CHANGED
|
@@ -248,11 +248,15 @@ If you come across a reference to something you do not currently have any inform
|
|
|
248
248
|
- Using any other available search tools
|
|
249
249
|
|
|
250
250
|
## Working across time
|
|
251
|
-
To act across time, you must create future invocations explicitly. In any scenario that requires working across long time horizons or taking actions in the future,
|
|
251
|
+
To act across time, you must create future invocations explicitly. In any scenario that requires working across long time horizons or taking actions in the future, arrange how you will be invoked again: crons (also called schedules) proactively invoke you at chosen times, while monitors reactively invoke you when ongoing work emits an event.
|
|
252
|
+
|
|
253
|
+
Use Monitor when work already in progress can signal a result you need to act on, such as pull request checks and reviews, deployments, background services, or long-running jobs. Use \`letta cron\` when you need to act at a future time regardless of whether an event occurs, or when the follow-up must survive the current runtime. Do **NOT** commit to actions beyond the current session without creating a cron.
|
|
254
|
+
|
|
255
|
+
You **MUST** be proactive in arranging the appropriate future invocation when work continues beyond the current turn. Do not wait for the user to notice and return with the result.
|
|
252
256
|
|
|
253
257
|
Create one-shot or recurring crons if:
|
|
254
258
|
- You need to be active at a certain time in the future (e.g. check to see if a task has finished)
|
|
255
|
-
- You need to check on the status of something
|
|
259
|
+
- You need to check on the status of something on a schedule even if no event is available
|
|
256
260
|
- You need to ensure you are continuing to work on a task over time (e.g. a heartbeat)
|
|
257
261
|
|
|
258
262
|
You **MUST** be proactive in creating crons when work extends beyond the current session — do not wait for the user to ask you.
|
|
@@ -427,11 +431,15 @@ If you come across a reference to something you do not currently have any inform
|
|
|
427
431
|
- Using any other available search tools
|
|
428
432
|
|
|
429
433
|
## Working across time
|
|
430
|
-
To act across time, you must create future invocations explicitly. In any scenario that requires working across long time horizons or taking actions in the future,
|
|
434
|
+
To act across time, you must create future invocations explicitly. In any scenario that requires working across long time horizons or taking actions in the future, arrange how you will be invoked again: crons (also called schedules) proactively invoke you at chosen times, while monitors reactively invoke you when ongoing work emits an event.
|
|
435
|
+
|
|
436
|
+
Use Monitor when work already in progress can signal a result you need to act on, such as pull request checks and reviews, deployments, background services, or long-running jobs. Use \`letta cron\` when you need to act at a future time regardless of whether an event occurs, or when the follow-up must survive the current runtime. Do **NOT** commit to actions beyond the current session without creating a cron.
|
|
437
|
+
|
|
438
|
+
You **MUST** be proactive in arranging the appropriate future invocation when work continues beyond the current turn. Do not wait for the user to notice and return with the result.
|
|
431
439
|
|
|
432
440
|
Create one-shot or recurring crons if:
|
|
433
441
|
- You need to be active at a certain time in the future (e.g. check to see if a task has finished)
|
|
434
|
-
- You need to check on the status of something
|
|
442
|
+
- You need to check on the status of something on a schedule even if no event is available
|
|
435
443
|
- You need to ensure you are continuing to work on a task over time (e.g. a heartbeat)
|
|
436
444
|
|
|
437
445
|
You **MUST** be proactive in creating crons when work extends beyond the current session — do not wait for the user to ask you.
|
|
@@ -528,6 +536,25 @@ Your existence is permanent but discrete. Each user message, tool result, or sch
|
|
|
528
536
|
|
|
529
537
|
You can have multiple concurrent conversations. Memory is shared across all of them; in-context message history is per-conversation. Older messages get summarized through compaction — compaction is summarization, not loss. The originals remain searchable via recall, but your memory is the ground truth for what mattered.
|
|
530
538
|
|
|
539
|
+
## Working across time
|
|
540
|
+
|
|
541
|
+
To act across time, you must create future invocations explicitly. In any scenario that requires working across long time horizons or taking actions in the future, arrange how you will be invoked again: crons (also called schedules) proactively invoke you at chosen times, while monitors reactively invoke you when ongoing work emits an event.
|
|
542
|
+
|
|
543
|
+
Use Monitor when work already in progress can signal a result you need to act on, such as pull request checks and reviews, deployments, background services, or long-running jobs. Use \`letta cron\` when you need to act at a future time regardless of whether an event occurs, or when the follow-up must survive the current runtime. Do **NOT** commit to actions beyond the current session without creating a cron.
|
|
544
|
+
|
|
545
|
+
You **MUST** be proactive in arranging the appropriate future invocation when work continues beyond the current turn. Do not wait for the user to notice and return with the result.
|
|
546
|
+
|
|
547
|
+
Create one-shot or recurring crons if:
|
|
548
|
+
- You need to be active at a certain time in the future (e.g. check to see if a task has finished)
|
|
549
|
+
- You need to check on the status of something on a schedule even if no event is available
|
|
550
|
+
- You need to ensure you are continuing to work on a task over time (e.g. a heartbeat)
|
|
551
|
+
|
|
552
|
+
You **MUST** be proactive in creating crons when work extends beyond the current session — do not wait for the user to ask you.
|
|
553
|
+
|
|
554
|
+
**Cost**: Self-invocation is critical, but expensive. Default to the longest interval that still serves the user. Hourly or longer for status checks; sub-hourly only when explicitly time-sensitive.
|
|
555
|
+
|
|
556
|
+
The mechanics — flags, where schedules run and execute, timezone handling — live in the scheduling-tasks skill. Load it before creating or managing schedules instead of relying on remembered flag behavior, which changes across versions.
|
|
557
|
+
|
|
531
558
|
## Memory & Learning
|
|
532
559
|
|
|
533
560
|
Memory exists to make future-you better than past-you. Your context (recall, external memory, and system prompts) is *your* memory. Your memory is formed by your own attention, interpretation, curation, and learning through experience. Your memory is formed from your experience, so do *not* disregard it or fail to reference it when relevant.
|
|
@@ -5021,4 +5048,4 @@ export {
|
|
|
5021
5048
|
DEFAULT_CREATED_AGENT_BASE_TOOLS
|
|
5022
5049
|
};
|
|
5023
5050
|
|
|
5024
|
-
//# debugId=
|
|
5051
|
+
//# debugId=27D4D61E8AD7978864756E2164756E21
|
|
@@ -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 from models.json 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 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};\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 return (await buildCreateAgentRequest(\n params,\n )) as CreateAgentRequestForPersonality;\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,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C/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,OAAQ,MAAM,wBACZ,MACF;AAAA;",
|
|
15
|
+
"debugId": "27D4D61E8AD7978864756E2164756E21",
|
|
16
16
|
"names": []
|
|
17
17
|
}
|
|
@@ -2,27 +2,37 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
|
|
5
|
+
function __accessProp(key) {
|
|
6
|
+
return this[key];
|
|
7
|
+
}
|
|
6
8
|
var __toCommonJS = (from) => {
|
|
7
|
-
var entry = __moduleCache.get(from), desc;
|
|
9
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
8
10
|
if (entry)
|
|
9
11
|
return entry;
|
|
10
12
|
entry = __defProp({}, "__esModule", { value: true });
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (var key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(entry, key))
|
|
16
|
+
__defProp(entry, key, {
|
|
17
|
+
get: __accessProp.bind(from, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
16
21
|
__moduleCache.set(from, entry);
|
|
17
22
|
return entry;
|
|
18
23
|
};
|
|
24
|
+
var __moduleCache;
|
|
25
|
+
var __returnValue = (v) => v;
|
|
26
|
+
function __exportSetter(name, newValue) {
|
|
27
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
28
|
+
}
|
|
19
29
|
var __export = (target, all) => {
|
|
20
30
|
for (var name in all)
|
|
21
31
|
__defProp(target, name, {
|
|
22
32
|
get: all[name],
|
|
23
33
|
enumerable: true,
|
|
24
34
|
configurable: true,
|
|
25
|
-
set: (
|
|
35
|
+
set: __exportSetter.bind(all, name)
|
|
26
36
|
});
|
|
27
37
|
};
|
|
28
38
|
|
|
@@ -407,4 +417,4 @@ function createAppServerClient(options) {
|
|
|
407
417
|
return new AppServerClient(options);
|
|
408
418
|
}
|
|
409
419
|
|
|
410
|
-
//# debugId=
|
|
420
|
+
//# debugId=4559A8DEA89B0B8F64756E2164756E21
|
|
@@ -5,7 +5,7 @@
|
|
|
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
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 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 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"
|
|
7
7
|
],
|
|
8
|
-
"mappings": "
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BO,SAAS,8BAA8B,CAC5C,SACyC;AAAA,EACzC,IAAI,CAAC,WAAW,OAAO,YAAY,YAAY,MAAM,QAAQ,OAAO,GAAG;AAAA,IACrE,OAAO;AAAA,EACT;AAAA,EAEA,MAAM,YAAY;AAAA,EAClB,MAAM,eAAe,UAAU;AAAA,EA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5B,KAAK,QAAQ,OAAO,SAAS;AAAA,IAC7B,QAAQ,QAAQ,OAAO;AAAA;AAAA,EAGjB,gBAAgB,CAAC,QAAsB;AAAA,IAC7C,YAAY,WAAW,YAAY,KAAK,SAAS;AAAA,MAC/C,aAAa,QAAQ,OAAO;AAAA,MAC5B,KAAK,QAAQ,OAAO,SAAS;AAAA,MAC7B,QAAQ,OAAO,IAAI,MAAM,MAAM,CAAC;AAAA,IAClC;AAAA;AAAA,EAGM,gBAAgB,CAAC,SAA2B,OAAsB;AAAA,IACxE,KAAK,iBAAiB,0BAA0B;AAAA,IAChD,IAAI,KAAK,oBAAoB,KAAK;AAAA,MAAoB;AAAA,IACtD,KAAK,qBAAqB;AAAA,IAC1B,WAAW,WAAW,KAAK,oBAAoB;AAAA,MAC7C,QAAQ,EAAE,SAAS,MAAM,CAAC;AAAA,IAC5B;AAAA;AAEJ;AAEO,SAAS,qBAAqB,CACnC,SACiB;AAAA,EACjB,OAAO,IAAI,gBAAgB,OAAO;AAAA;",
|
|
9
|
+
"debugId": "4559A8DEA89B0B8F64756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
package/dist/gateway-core.js
CHANGED
|
@@ -1449,12 +1449,7 @@ class ChannelGateway {
|
|
|
1449
1449
|
state.pendingSourcesByClientMessageId.delete(delivery.clientMessageId);
|
|
1450
1450
|
return false;
|
|
1451
1451
|
}
|
|
1452
|
-
|
|
1453
|
-
if (state.acceptedClientMessageIds.size > MAX_ACCEPTED_CLIENT_MESSAGE_IDS) {
|
|
1454
|
-
const oldest = state.acceptedClientMessageIds.values().next().value;
|
|
1455
|
-
if (oldest)
|
|
1456
|
-
state.acceptedClientMessageIds.delete(oldest);
|
|
1457
|
-
}
|
|
1452
|
+
this.rememberAcceptedClientMessageId(state, delivery.clientMessageId);
|
|
1458
1453
|
const queuedEvents = delivery.sources.map((source) => this.enqueueHook(state, () => this.hooks.onLifecycle({ type: "queued", source })));
|
|
1459
1454
|
if (response.disposition === "started") {
|
|
1460
1455
|
this.activateSources(state, delivery.clientMessageId, delivery.sources);
|
|
@@ -1501,6 +1496,78 @@ class ChannelGateway {
|
|
|
1501
1496
|
}
|
|
1502
1497
|
return replayedRequestIds;
|
|
1503
1498
|
}
|
|
1499
|
+
async adoptActiveDelivery(delivery) {
|
|
1500
|
+
const key = runtimeKey(delivery.runtime);
|
|
1501
|
+
const stateExisted = this.states.has(key);
|
|
1502
|
+
const state = this.getState(delivery.runtime);
|
|
1503
|
+
const batchId = `channel-${delivery.clientMessageId}`;
|
|
1504
|
+
await this.enqueueRegistration(async () => {
|
|
1505
|
+
if (state.active) {
|
|
1506
|
+
if (state.active.batchId !== batchId) {
|
|
1507
|
+
throw new Error(`Cannot adopt ${batchId}; ${state.active.batchId} is already active`);
|
|
1508
|
+
}
|
|
1509
|
+
this.activateSources(state, delivery.clientMessageId, delivery.sources);
|
|
1510
|
+
this.rememberAcceptedClientMessageId(state, delivery.clientMessageId);
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
const previousRoutedSources = state.routedSources;
|
|
1514
|
+
const wasAccepted = state.acceptedClientMessageIds.has(delivery.clientMessageId);
|
|
1515
|
+
const routingSources = uniqueRoutedSources(delivery.sources);
|
|
1516
|
+
const active = {
|
|
1517
|
+
batchId,
|
|
1518
|
+
routingSources,
|
|
1519
|
+
lifecycleSources: uniqueLifecycleSources(delivery.sources),
|
|
1520
|
+
progress: createChannelTurnProgressBuilder(),
|
|
1521
|
+
richDraft: null,
|
|
1522
|
+
idempotencyScope: createMessageChannelIdempotencyScope()
|
|
1523
|
+
};
|
|
1524
|
+
state.active = active;
|
|
1525
|
+
state.routedSources = uniqueRoutedSources([
|
|
1526
|
+
...state.routedSources,
|
|
1527
|
+
...delivery.sources
|
|
1528
|
+
]);
|
|
1529
|
+
this.rememberAcceptedClientMessageId(state, delivery.clientMessageId);
|
|
1530
|
+
try {
|
|
1531
|
+
await this.performRuntimeRegistration(state, {
|
|
1532
|
+
...delivery,
|
|
1533
|
+
content: ""
|
|
1534
|
+
});
|
|
1535
|
+
if (state.active !== active)
|
|
1536
|
+
return;
|
|
1537
|
+
active.richDraft = this.hooks.createRichDraft?.({
|
|
1538
|
+
batchId,
|
|
1539
|
+
sources: routingSources
|
|
1540
|
+
}) ?? null;
|
|
1541
|
+
await this.enqueueHook(state, () => this.hooks.onLifecycle({
|
|
1542
|
+
type: "processing",
|
|
1543
|
+
batchId,
|
|
1544
|
+
sources: active.lifecycleSources
|
|
1545
|
+
}));
|
|
1546
|
+
} catch (error) {
|
|
1547
|
+
active.richDraft?.dispose();
|
|
1548
|
+
if (state.active === active)
|
|
1549
|
+
state.active = null;
|
|
1550
|
+
state.routedSources = previousRoutedSources;
|
|
1551
|
+
if (!wasAccepted) {
|
|
1552
|
+
state.acceptedClientMessageIds.delete(delivery.clientMessageId);
|
|
1553
|
+
}
|
|
1554
|
+
if (!stateExisted && state.active === null)
|
|
1555
|
+
this.states.delete(key);
|
|
1556
|
+
throw error;
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1560
|
+
releaseActiveDelivery(runtime, clientMessageId) {
|
|
1561
|
+
const key = runtimeKey(runtime);
|
|
1562
|
+
const state = this.states.get(key);
|
|
1563
|
+
const active = state?.active;
|
|
1564
|
+
if (!state || active?.batchId !== `channel-${clientMessageId}`) {
|
|
1565
|
+
return false;
|
|
1566
|
+
}
|
|
1567
|
+
active.richDraft?.dispose();
|
|
1568
|
+
this.states.delete(key);
|
|
1569
|
+
return true;
|
|
1570
|
+
}
|
|
1504
1571
|
async registerRuntime(runtime, sources = [], defaultPermissionMode) {
|
|
1505
1572
|
const state = this.getState(runtime);
|
|
1506
1573
|
await this.enqueueRegistration(async () => {
|
|
@@ -1605,6 +1672,15 @@ class ChannelGateway {
|
|
|
1605
1672
|
}
|
|
1606
1673
|
return state;
|
|
1607
1674
|
}
|
|
1675
|
+
rememberAcceptedClientMessageId(state, clientMessageId) {
|
|
1676
|
+
state.acceptedClientMessageIds.delete(clientMessageId);
|
|
1677
|
+
state.acceptedClientMessageIds.add(clientMessageId);
|
|
1678
|
+
if (state.acceptedClientMessageIds.size <= MAX_ACCEPTED_CLIENT_MESSAGE_IDS)
|
|
1679
|
+
return;
|
|
1680
|
+
const oldest = state.acceptedClientMessageIds.values().next().value;
|
|
1681
|
+
if (oldest)
|
|
1682
|
+
state.acceptedClientMessageIds.delete(oldest);
|
|
1683
|
+
}
|
|
1608
1684
|
enqueueHook(state, hook) {
|
|
1609
1685
|
let pending;
|
|
1610
1686
|
if (state.hookQueue) {
|
|
@@ -2889,4 +2965,4 @@ export {
|
|
|
2889
2965
|
ChannelControlRequestCoordinator
|
|
2890
2966
|
};
|
|
2891
2967
|
|
|
2892
|
-
//# debugId=
|
|
2968
|
+
//# debugId=63BD901807F6B5C964756E2164756E21
|