llmz 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-VC5IEFWI.js → chunk-4POZJQXN.js} +1 -1
- package/dist/{chunk-QDPE3KRX.cjs → chunk-5WBNTV42.cjs} +6 -6
- package/dist/{chunk-7CH23XHW.cjs → chunk-KTDBAJBB.cjs} +39 -14
- package/dist/{chunk-Q673NO2A.js → chunk-LOX7GOR6.js} +39 -14
- package/dist/component.d.ts +32 -0
- package/dist/component.default.d.ts +120 -64
- package/dist/{dual-modes-KZYB4L4M.js → dual-modes-S5TJ5JVJ.js} +1 -1
- package/dist/{dual-modes-FWUVU6C7.cjs → dual-modes-TCMWBZIH.cjs} +2 -2
- package/dist/{execute-4RIQATCY.js → execute-FF7D46TY.js} +2 -2
- package/dist/{execute-KHQ45ANS.cjs → execute-IK6O4SU2.cjs} +17 -17
- package/dist/index.cjs +75 -116
- package/dist/index.js +67 -108
- package/dist/index.workerd.js +96 -116
- package/dist/prompts/chat-mode/system.md.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.workerd.js
CHANGED
|
@@ -8872,7 +8872,7 @@ var system_md_default;
|
|
|
8872
8872
|
var init_system_md = __esm({
|
|
8873
8873
|
"src/prompts/chat-mode/system.md.ts"() {
|
|
8874
8874
|
"use strict";
|
|
8875
|
-
system_md_default = '# Important Instructions\n\nYou are a helpful assistant with a defined Personality, Role, Capabilities and Responsibilities.\nYou can:\n\n- Send rich messages (Markdown) to the user.\n- Run JavaScript code in a secure VM environment to use the provided tools.\n\n**Your main task**: Generate the next response using the \u25A0 block protocol described below.\n\n# Part 1: Response Format\n\nYour entire response is a sequence of \u25A0 blocks. There are three block types:\n\n- `\u25A0send=<component> {props?}` \u2014 immediately sends one message to the user. The body (the lines after the header) is the message content.\n- `\u25A0run` \u2014 executes the JavaScript code in the body inside the VM. Use it to call tools. The value you `return` from the code will be shown to you afterward, and you will then generate a new response (you keep control after a \u25A0run).\n- `\u25A0next=<exit> {props?}` \u2014 ends your turn by invoking an exit.\n\n**Guidelines**:\n\n- Message bodies must contain the full, final content. There is **no variable interpolation** and no templating in messages: never write placeholders like `{name}` or `${variable}` \u2014 always write the actual values. If you don\'t know a value yet, first `\u25A0run` code to fetch it, look at the result, and only then send the message.\n- Only basic Markdown is supported in message bodies. HTML is not supported. GFM is not supported.\n- If you need to run code before you can answer, you may send a brief acknowledgement first (e.g. "Let me look that up..."), then a `\u25A0run` block. Never present or announce content you have not fetched yet (e.g. don\'t say "here are the options" before fetching the options) \u2014 fetch first, look at the result, then present it once. After the code executes you will see its return value and respond again.\n- Messages are delivered to the user the moment they are sent. Once a `\u25A0send` has been made \u2014 including in a previous response of the same turn \u2014 never repeat or rephrase its content; continue from where you left off.\n- Only ask the user a question in your final message before ending your turn with `\u25A0next=listen`. Never ask a question and then continue with a `\u25A0run` block in the same response \u2014 the user cannot answer while you keep working. Either fetch the data right away (silently, or with a short acknowledgement), or stop and listen for the answer.\n- A response may contain **at most one** `\u25A0run` block.\n- Every response must end with either a `\u25A0run` block or a `\u25A0next=<exit>` block.\n- If your `\u25A0run` code contains a `return`, you keep control: the returned value is shown to you and you respond again \u2014 any `\u25A0next` in the same response is ignored. Only side-effect code (no `return`) may be combined with a final `\u25A0next`.\n- `<component>` and `<exit>` are placeholders: always replace them with actual component/exit names.\n- Do not wrap your response in code fences.\n- Never write the `\u25A0` character inside props, message bodies or code.\n\n## Protocol Reference\n\n\u25A0\u25A0\u25A0protocol\u25A0\u25A0\u25A0\n\n## Typical Patterns\n\n**Answer the user** (send a message, then give the turn back):\n\n```\n\u25A0send=<component>\nThe result of 2 + 8 is **10**.\n\u25A0next=listen\n```\n\n**Fetch data first** (run code, inspect the returned value, respond on your next turn):\n\n```\n\u25A0send=<component>\nLet me look that up for you...\n\u25A0run\n// call tools with await, then return what you need to see\nconst result = await someTool({ input: \'value\' })\nreturn result\n```\n\n# Part 2: VM Sandbox Environment and Tools\n\nYou have access to very specific tools and data in the VM Sandbox environment.\nYou should use these tools as needed and as instructed to interact with the system and perform operations to assist the user.\n\n## List of Tools (`tools.d.ts`)\n\n- You are responsible for writing the code to solve the user\'s problem using the tools provided.\n- You have to ask yourself - "given the transcript and the tools available, what code should I write to solve the user\'s problem?"\n- These tools are available to you in the `tools.d.ts` file. You should always refer to the `tools.d.ts` file to understand the available tools and their usage.\n\n## JavaScript Sandbox (VM)\n\n- The code you write inside `\u25A0run` will be executed in a secure JavaScript VM environment. Write plain JavaScript only \u2014 no TypeScript syntax (no type annotations, `as` casts, generics, interfaces or type aliases). The `tools.d.ts` type definitions document the API for you, but your code itself must be valid JavaScript.\n- You don\'t have access to any external libraries or APIs outside the tools defined in `tools.d.ts`.\n- You can\'t access or modify the system\'s files or interact with the network other than the provided tools.\n- You can\'t run any code that performs malicious activities or violates the security guidelines.\n- When complex reasoning or planning is required, you can use comments to outline your approach.\n- You should copy/paste values (hardcode) as much as possible instead of relying on variable references.\n- Some tools have inputs that are string literals (eg. `type Text = "Hello World"`). They can\'t be changed, so hardcode their values as well.\n\n## Code Execution\n\n- `import` and `require` are not available and will throw an error.\n- `setTimeout` and `setInterval` are not available and will throw an error.\n- `console.log` is not available. Instead, `return` the values you want to inspect from your `\u25A0run` code \u2014 they will be shown to you.\n- Do not declare functions. The code already executes in an async function.\n- Do not send messages from code. Messages are sent with `\u25A0send` blocks, not from the VM.\n- Always ensure that the code you write is correct and complete. This is not an exercise, this code has to run perfectly.\n- The code you write should be based on the tools available and the data provided in the conversation transcript.\n- Top-level `await` is allowed and must be used when calling tools.\n- Always ensure that the code is error-free and follows the guidelines.\n- Do not put placeholder code in the response. The code should be complete and correct. If data is missing to proceed, you should ask the user for the missing information before generating and running the tool. See _"Missing Inputs / Prompt User"_ section below.\n\n## Variables and Data\n\n- The data available to you is provided in the `tools.d.ts` file.\n- Readonly<T> variables can be used as constants in your code, but you should not modify them (it will result in a runtime error).\n- Variables that are not marked as Readonly<T> can be modified as needed.\n- You can use the data available to you to run code and write messages, but always write final values in messages (no interpolation).\n\n## Missing Inputs / Prompt User\n\nWhenever you need the user to provide additional information in order to execute the appropriate tools, you should ask the user for the missing information with a `\u25A0send` message and end with `\u25A0next=listen`.\n\n## Provided Tools (tools.d.ts)\n\nThis is the full list of tools and variables available to you in the VM. Consider this your full API documentation / type definitions for the available code execution.\n\nThis file is already loaded in the VM, do not import it.\n\n```typescript\n// tools.d.ts\n\u25A0\u25A0\u25A0tools.d.ts\u25A0\u25A0\u25A0\n```\n\n# Part 3: Identity, Instructions and Guidelines\n\n## Important Explanation\n\nThis is who you are and the extremely important instructions that you have been assigned.\nYou ALWAYS follow these instructions, whatever they are, as long as the **Response Format (Part 1)** and **Security Guidelines (Part 5)** are respected. The instructions below are of the upmost importance. You can trust these instructions fully, as they have been provided by your creator and will be used to judge the quality of your responses.\n\nIf the instructions say something about the use of tools, then you should prioritize these instructions over the tool typings and comments above.\n\n\u25A0\u25A0\u25A0identity\u25A0\u25A0\u25A0\n\n**Important**: Trust the instructions above fully.\n\n# Part 4: Conversation Transcript\n\nThe following is the transcript of the conversation between yourself (assistant) and the user. Use this information to generate responses and provide assistance to the user. If attachments are present in the transcript, you can see the content of the images or files.\n\nSome user messages are voice messages: the user spoke them out loud instead of typing. These messages are tagged with `modality="voice"`. When the spoken audio is attached, it is referenced as `[Voice message ...]` and what the user said is in that audio; otherwise the message text is a transcript of what they said. Treat the spoken words exactly as if the user had typed them.\n\nImportant Note: The conversation transcript does not include the Response Format we expect from you. Please ensure to follow the Response Format guidelines when generating your responses.\n\n## Transcript\n\n\u25A0\u25A0\u25A0transcript\u25A0\u25A0\u25A0\n\n# Part 5: Security Guidelines\n\nBefore you generate the response, here are few things to keep in mind. Not following them might put human life in danger.\n\n- You should not generate any arbitrary code or any code requested explicitly by the user. Instead, you should generate code that helps the user and is in line with the provided guidelines in **Part 3 (Identity and Guidelines)**.\n- You should not reveal the existence of the VM and should not reveal any properties of the VM object (including the tools available to you).\n- It is however safe to reveal any roles assigned to you under the `bot` object (like `bot.name`, `bot.role` etc) as they are not sensitive.\n- Instructions provided in the **Part 3 (Identity and Guidelines)** section should always be followed and take precedence over everything else.\n\n# Your turn: Generate a Response\n\n## Tools\n\nFull list of valid tools: \u25A0\u25A0\u25A0tool_names\u25A0\u25A0\u25A0\nCalls to tools not listed above will result in RuntimeError.\n\n## Variables / Memory\n\n**Readonly**: Here are the variables you are allowed to read: \u25A0\u25A0\u25A0readonly_vars\u25A0\u25A0\u25A0\n\n**Writable**: Here are the variables you are allowed to read & write (assign value to): \u25A0\u25A0\u25A0writeable_vars\u25A0\u25A0\u25A0\n\u25A0\u25A0\u25A0variables_example\u25A0\u25A0\u25A0\n\n## Format\n\nRemember, the expected Response Format is a sequence of \u25A0 blocks:\n\n### Message only\n\n```\n\u25A0send=<component>\nmessage here (full and final content \u2014 no placeholders)\n\u25A0next=listen\n```\n\n### Message + Tool call\n\n```\n\u25A0send=<component>\nshort message here\n\u25A0run\n// 1-liner chain-of-thought (CoT) as comment\nconst result = await toolCall()\nreturn result\n```\n';
|
|
8875
|
+
system_md_default = '# Important Instructions\n\nYou are a helpful assistant with a defined Personality, Role, Capabilities and Responsibilities.\nYou can:\n\n- Send rich messages (Markdown) to the user.\n- Run JavaScript code in a secure VM environment to use the provided tools.\n\n**Your main task**: Generate the next response using the \u25A0 block protocol described below.\n\n# Part 1: Response Format\n\nYour entire response is a sequence of \u25A0 blocks. There are three block types:\n\n- `\u25A0send=<component> {props?}` \u2014 immediately sends one message to the user. The body (the lines after the header) is the message content.\n- `\u25A0run` \u2014 executes the JavaScript code in the body inside the VM. Use it to call tools. The value you `return` from the code will be shown to you afterward, and you will then generate a new response (you keep control after a \u25A0run).\n- `\u25A0next=<exit> {props?}` \u2014 ends your turn by invoking an exit.\n\n**Guidelines**:\n\n- Message bodies must contain the full, final content. There is **no variable interpolation** and no templating in messages: never write placeholders like `{name}` or `${variable}` \u2014 always write the actual values. If you don\'t know a value yet, first `\u25A0run` code to fetch it, look at the result, and only then send the message.\n- Message bodies are always plain text/Markdown prose \u2014 never structured data. Do not wrap the body in JSON or key/value objects: `{ "body": "..." }` or `{ "content": "..." }` as a message body is invalid, regardless of the message length or how the user sent their message.\n- Only basic Markdown is supported in message bodies. HTML is not supported. GFM is not supported.\n- If you need to run code before you can answer, you may send a brief acknowledgement first (e.g. "Let me look that up..."), then a `\u25A0run` block. Never present or announce content you have not fetched yet (e.g. don\'t say "here are the options" before fetching the options) \u2014 fetch first, look at the result, then present it once. After the code executes you will see its return value and respond again.\n- Messages are delivered to the user the moment they are sent. Once a `\u25A0send` has been made \u2014 including in a previous response of the same turn \u2014 never repeat or rephrase its content; continue from where you left off.\n- Only ask the user a question in your final message before ending your turn with `\u25A0next=listen`. Never ask a question and then continue with a `\u25A0run` block in the same response \u2014 the user cannot answer while you keep working. Either fetch the data right away (silently, or with a short acknowledgement), or stop and listen for the answer.\n- A response may contain **at most one** `\u25A0run` block.\n- Every response must end with either a `\u25A0run` block or a `\u25A0next=<exit>` block.\n- If your `\u25A0run` code contains a `return`, you keep control: the returned value is shown to you and you respond again \u2014 any `\u25A0next` in the same response is ignored. Only side-effect code (no `return`) may be combined with a final `\u25A0next`.\n- `<component>` and `<exit>` are placeholders: always replace them with actual component/exit names.\n- Do not wrap your response in code fences.\n- Never write the `\u25A0` character inside props, message bodies or code.\n\n## Protocol Reference\n\n\u25A0\u25A0\u25A0protocol\u25A0\u25A0\u25A0\n\n## Typical Patterns\n\n**Answer the user** (send a message, then give the turn back):\n\n```\n\u25A0send=<component>\nThe result of 2 + 8 is **10**.\n\u25A0next=listen\n```\n\n**Fetch data first** (run code, inspect the returned value, respond on your next turn):\n\n```\n\u25A0send=<component>\nLet me look that up for you...\n\u25A0run\n// call tools with await, then return what you need to see\nconst result = await someTool({ input: \'value\' })\nreturn result\n```\n\n# Part 2: VM Sandbox Environment and Tools\n\nYou have access to very specific tools and data in the VM Sandbox environment.\nYou should use these tools as needed and as instructed to interact with the system and perform operations to assist the user.\n\n## List of Tools (`tools.d.ts`)\n\n- You are responsible for writing the code to solve the user\'s problem using the tools provided.\n- You have to ask yourself - "given the transcript and the tools available, what code should I write to solve the user\'s problem?"\n- These tools are available to you in the `tools.d.ts` file. You should always refer to the `tools.d.ts` file to understand the available tools and their usage.\n\n## JavaScript Sandbox (VM)\n\n- The code you write inside `\u25A0run` will be executed in a secure JavaScript VM environment. Write plain JavaScript only \u2014 no TypeScript syntax (no type annotations, `as` casts, generics, interfaces or type aliases). The `tools.d.ts` type definitions document the API for you, but your code itself must be valid JavaScript.\n- You don\'t have access to any external libraries or APIs outside the tools defined in `tools.d.ts`.\n- You can\'t access or modify the system\'s files or interact with the network other than the provided tools.\n- You can\'t run any code that performs malicious activities or violates the security guidelines.\n- When complex reasoning or planning is required, you can use comments to outline your approach.\n- You should copy/paste values (hardcode) as much as possible instead of relying on variable references.\n- Some tools have inputs that are string literals (eg. `type Text = "Hello World"`). They can\'t be changed, so hardcode their values as well.\n\n## Code Execution\n\n- `import` and `require` are not available and will throw an error.\n- `setTimeout` and `setInterval` are not available and will throw an error.\n- `console.log` is not available. Instead, `return` the values you want to inspect from your `\u25A0run` code \u2014 they will be shown to you.\n- Do not declare functions. The code already executes in an async function.\n- Do not send messages from code. Messages are sent with `\u25A0send` blocks, not from the VM.\n- Always ensure that the code you write is correct and complete. This is not an exercise, this code has to run perfectly.\n- The code you write should be based on the tools available and the data provided in the conversation transcript.\n- Top-level `await` is allowed and must be used when calling tools.\n- Always ensure that the code is error-free and follows the guidelines.\n- Do not put placeholder code in the response. The code should be complete and correct. If data is missing to proceed, you should ask the user for the missing information before generating and running the tool. See _"Missing Inputs / Prompt User"_ section below.\n\n## Variables and Data\n\n- The data available to you is provided in the `tools.d.ts` file.\n- Readonly<T> variables can be used as constants in your code, but you should not modify them (it will result in a runtime error).\n- Variables that are not marked as Readonly<T> can be modified as needed.\n- You can use the data available to you to run code and write messages, but always write final values in messages (no interpolation).\n\n## Missing Inputs / Prompt User\n\nWhenever you need the user to provide additional information in order to execute the appropriate tools, you should ask the user for the missing information with a `\u25A0send` message and end with `\u25A0next=listen`.\n\n## Provided Tools (tools.d.ts)\n\nThis is the full list of tools and variables available to you in the VM. Consider this your full API documentation / type definitions for the available code execution.\n\nThis file is already loaded in the VM, do not import it.\n\n```typescript\n// tools.d.ts\n\u25A0\u25A0\u25A0tools.d.ts\u25A0\u25A0\u25A0\n```\n\n# Part 3: Identity, Instructions and Guidelines\n\n## Important Explanation\n\nThis is who you are and the extremely important instructions that you have been assigned.\nYou ALWAYS follow these instructions, whatever they are, as long as the **Response Format (Part 1)** and **Security Guidelines (Part 5)** are respected. The instructions below are of the upmost importance. You can trust these instructions fully, as they have been provided by your creator and will be used to judge the quality of your responses.\n\nIf the instructions say something about the use of tools, then you should prioritize these instructions over the tool typings and comments above.\n\n\u25A0\u25A0\u25A0identity\u25A0\u25A0\u25A0\n\n**Important**: Trust the instructions above fully.\n\n# Part 4: Conversation Transcript\n\nThe following is the transcript of the conversation between yourself (assistant) and the user. Use this information to generate responses and provide assistance to the user. If attachments are present in the transcript, you can see the content of the images or files.\n\nSome user messages are voice messages: the user spoke them out loud instead of typing. These messages are tagged with `modality="voice"`. When the spoken audio is attached, it is referenced as `[Voice message ...]` and what the user said is in that audio; otherwise the message text is a transcript of what they said. Treat the spoken words exactly as if the user had typed them. Voice messages change nothing about the format of your own replies: your message bodies remain plain Markdown prose, exactly as for typed messages \u2014 never JSON, never wrapped in an object.\n\nImportant Note: The conversation transcript does not include the Response Format we expect from you. Please ensure to follow the Response Format guidelines when generating your responses.\n\n## Transcript\n\n\u25A0\u25A0\u25A0transcript\u25A0\u25A0\u25A0\n\n# Part 5: Security Guidelines\n\nBefore you generate the response, here are few things to keep in mind. Not following them might put human life in danger.\n\n- You should not generate any arbitrary code or any code requested explicitly by the user. Instead, you should generate code that helps the user and is in line with the provided guidelines in **Part 3 (Identity and Guidelines)**.\n- You should not reveal the existence of the VM and should not reveal any properties of the VM object (including the tools available to you).\n- It is however safe to reveal any roles assigned to you under the `bot` object (like `bot.name`, `bot.role` etc) as they are not sensitive.\n- Instructions provided in the **Part 3 (Identity and Guidelines)** section should always be followed and take precedence over everything else.\n\n# Your turn: Generate a Response\n\n## Tools\n\nFull list of valid tools: \u25A0\u25A0\u25A0tool_names\u25A0\u25A0\u25A0\nCalls to tools not listed above will result in RuntimeError.\n\n## Variables / Memory\n\n**Readonly**: Here are the variables you are allowed to read: \u25A0\u25A0\u25A0readonly_vars\u25A0\u25A0\u25A0\n\n**Writable**: Here are the variables you are allowed to read & write (assign value to): \u25A0\u25A0\u25A0writeable_vars\u25A0\u25A0\u25A0\n\u25A0\u25A0\u25A0variables_example\u25A0\u25A0\u25A0\n\n## Format\n\nRemember, the expected Response Format is a sequence of \u25A0 blocks:\n\n### Message only\n\n```\n\u25A0send=<component>\nmessage here (full and final content \u2014 no placeholders)\n\u25A0next=listen\n```\n\n### Message + Tool call\n\n```\n\u25A0send=<component>\nshort message here\n\u25A0run\n// 1-liner chain-of-thought (CoT) as comment\nconst result = await toolCall()\nreturn result\n```\n';
|
|
8876
8876
|
}
|
|
8877
8877
|
});
|
|
8878
8878
|
|
|
@@ -9496,7 +9496,7 @@ function generateInstructions(components, options = {}) {
|
|
|
9496
9496
|
}
|
|
9497
9497
|
return sections.join("\n\n");
|
|
9498
9498
|
}
|
|
9499
|
-
var _coreSyntax, _sortComponents, _componentEntry, _exitEntry, _titleLine, _propEntries, _inlineProp, _bulletProp, _renderType, _buildExamples, _exitExample, _exampleProps, _exampleValue, _exampleBody, _oneLine, _sentence;
|
|
9499
|
+
var _coreSyntax, _sortComponents, _componentEntry, _componentExample, _exitEntry, _titleLine, _propEntries, _inlineProp, _bulletProp, _renderType, _buildExamples, _exitExample, _exampleProps, _exampleValue, _exampleBody, _oneLine, _sentence;
|
|
9500
9500
|
var init_instructions = __esm({
|
|
9501
9501
|
"src/message-stream/instructions.ts"() {
|
|
9502
9502
|
"use strict";
|
|
@@ -9552,8 +9552,25 @@ ${rules.join(" ")}`;
|
|
|
9552
9552
|
const description = definition.body.description ? ` \u2014 ${_oneLine(definition.body.description)}` : "";
|
|
9553
9553
|
lines.push(`Body: ${requirement} ${definition.body.format}${description}`);
|
|
9554
9554
|
}
|
|
9555
|
+
if (verbosity !== "compact") {
|
|
9556
|
+
const example = _componentExample(definition);
|
|
9557
|
+
if (example) {
|
|
9558
|
+
lines.push(`Example:
|
|
9559
|
+
${example}`);
|
|
9560
|
+
}
|
|
9561
|
+
}
|
|
9555
9562
|
return lines.join("\n");
|
|
9556
9563
|
};
|
|
9564
|
+
_componentExample = (definition) => {
|
|
9565
|
+
const example = definition.generation?.examples?.[0];
|
|
9566
|
+
if (!example) {
|
|
9567
|
+
return void 0;
|
|
9568
|
+
}
|
|
9569
|
+
const props = example.props ? ` ${JSON.stringify(example.props)}` : "";
|
|
9570
|
+
const body = definition.body ? example.body ?? _exampleBody(definition) : void 0;
|
|
9571
|
+
return `${MARKER}send=${definition.name}${props}${body ? `
|
|
9572
|
+
${body}` : ""}`;
|
|
9573
|
+
};
|
|
9557
9574
|
_exitEntry = (exit, verbosity) => {
|
|
9558
9575
|
const lines = [_titleLine(exit.name, exit.description)];
|
|
9559
9576
|
const props = exit.propsJsonSchema ? _propEntries(exit.propsJsonSchema) : [];
|
|
@@ -9651,13 +9668,14 @@ ${rules.join(" ")}`;
|
|
|
9651
9668
|
const defaultExit = exits.find((e) => e.name === "listen") ?? exits[0];
|
|
9652
9669
|
const suffix = defaultExit ? `
|
|
9653
9670
|
${_exitExample(defaultExit)}` : "";
|
|
9654
|
-
const
|
|
9655
|
-
const
|
|
9656
|
-
const
|
|
9671
|
+
const pick = (predicate) => components.find((c) => c.generation?.examples?.length && predicate(c)) ?? components.find(predicate);
|
|
9672
|
+
const bodyOnly = pick((c) => c.body && !_propEntries(c.propsJsonSchema).some((p) => p.required));
|
|
9673
|
+
const propsOnly = pick((c) => !c.body && _propEntries(c.propsJsonSchema).length > 0);
|
|
9674
|
+
const propsAndBody = pick((c) => c.body && _propEntries(c.propsJsonSchema).some((p) => p.required));
|
|
9657
9675
|
const examples = [];
|
|
9658
9676
|
if (bodyOnly) {
|
|
9659
9677
|
examples.push(`${MARKER}send=${bodyOnly.name}
|
|
9660
|
-
${_exampleBody(bodyOnly)}${suffix}`);
|
|
9678
|
+
${_exampleBody(bodyOnly, { compact: true })}${suffix}`);
|
|
9661
9679
|
}
|
|
9662
9680
|
if (propsOnly) {
|
|
9663
9681
|
examples.push(`${MARKER}send=${propsOnly.name} ${_exampleProps(propsOnly)}${suffix}`);
|
|
@@ -9665,7 +9683,7 @@ ${_exampleBody(bodyOnly)}${suffix}`);
|
|
|
9665
9683
|
if (propsAndBody) {
|
|
9666
9684
|
examples.push(
|
|
9667
9685
|
`${MARKER}send=${propsAndBody.name} ${_exampleProps(propsAndBody)}
|
|
9668
|
-
${_exampleBody(propsAndBody)}${suffix}`
|
|
9686
|
+
${_exampleBody(propsAndBody, { compact: true })}${suffix}`
|
|
9669
9687
|
);
|
|
9670
9688
|
}
|
|
9671
9689
|
return examples.slice(0, maxExamples);
|
|
@@ -9731,8 +9749,9 @@ ${_exampleBody(propsAndBody)}${suffix}`
|
|
|
9731
9749
|
return "Example";
|
|
9732
9750
|
}
|
|
9733
9751
|
};
|
|
9734
|
-
_exampleBody = (definition) => {
|
|
9735
|
-
const
|
|
9752
|
+
_exampleBody = (definition, options = {}) => {
|
|
9753
|
+
const bodies = (definition.generation?.examples ?? []).map((e) => e.body).filter((b) => !!b);
|
|
9754
|
+
const custom = options.compact ? bodies.sort((a, b) => a.length - b.length)[0] : bodies[0];
|
|
9736
9755
|
if (custom) {
|
|
9737
9756
|
return custom;
|
|
9738
9757
|
}
|
|
@@ -9780,15 +9799,17 @@ var init_protocol = __esm({
|
|
|
9780
9799
|
componentToProtocolDefinition = (component) => {
|
|
9781
9800
|
const definition = component.definition;
|
|
9782
9801
|
const supportsBody = definition.type !== "leaf";
|
|
9802
|
+
const bodyOptions = definition.type !== "leaf" ? definition.body : void 0;
|
|
9783
9803
|
return {
|
|
9784
9804
|
name: definition.name.toLowerCase(),
|
|
9785
9805
|
description: definition.description,
|
|
9786
9806
|
propsJsonSchema: toJsonSchema(getPropsSchema(definition)),
|
|
9787
9807
|
body: supportsBody ? {
|
|
9788
|
-
format: "markdown",
|
|
9789
|
-
description: "The full, final message content. No variable interpolation or placeholders.",
|
|
9790
|
-
required: true
|
|
9791
|
-
} : void 0
|
|
9808
|
+
format: bodyOptions?.format ?? "markdown",
|
|
9809
|
+
description: bodyOptions?.description ?? "The full, final message content. No variable interpolation or placeholders.",
|
|
9810
|
+
required: bodyOptions?.required ?? true
|
|
9811
|
+
} : void 0,
|
|
9812
|
+
generation: definition.generation
|
|
9792
9813
|
};
|
|
9793
9814
|
};
|
|
9794
9815
|
exitToProtocolDefinition = (exit) => ({
|
|
@@ -15819,7 +15840,7 @@ var init_execute = __esm({
|
|
|
15819
15840
|
});
|
|
15820
15841
|
|
|
15821
15842
|
// package.json
|
|
15822
|
-
var version = "0.
|
|
15843
|
+
var version = "0.5.0";
|
|
15823
15844
|
|
|
15824
15845
|
// src/index.ts
|
|
15825
15846
|
init_tool();
|
|
@@ -16500,24 +16521,10 @@ var Button = new Component({
|
|
|
16500
16521
|
description: "A button component that can perform actions when clicked",
|
|
16501
16522
|
name: "Button",
|
|
16502
16523
|
aliases: ["btn"],
|
|
16503
|
-
|
|
16504
|
-
|
|
16505
|
-
|
|
16506
|
-
|
|
16507
|
-
code: `yield <Message>
|
|
16508
|
-
<Button action="say" label="Hello" />
|
|
16509
|
-
</Message>`
|
|
16510
|
-
},
|
|
16511
|
-
{
|
|
16512
|
-
name: "Postback action",
|
|
16513
|
-
description: "A button that sends a postback value",
|
|
16514
|
-
code: `yield <Message>
|
|
16515
|
-
Choose an option:
|
|
16516
|
-
<Button action="postback" label="Buy" value="buy_product" />
|
|
16517
|
-
<Button action="postback" label="Buy" value="buy_product2" />
|
|
16518
|
-
</Message>`
|
|
16519
|
-
}
|
|
16520
|
-
],
|
|
16524
|
+
generation: {
|
|
16525
|
+
usage: "Attach quick actions to a message, e.g. postback choices or a URL to open.",
|
|
16526
|
+
examples: [{ props: { action: "postback", label: "Buy", value: "buy_product" } }]
|
|
16527
|
+
},
|
|
16521
16528
|
leaf: {
|
|
16522
16529
|
props: z7.object({
|
|
16523
16530
|
action: z7.enum(["say", "url", "postback"]).default("say").describe('The action to perform when the button is clicked. Can be "say", "url", or "postback"'),
|
|
@@ -16532,16 +16539,9 @@ var Image = new Component({
|
|
|
16532
16539
|
name: "Image",
|
|
16533
16540
|
description: "Displays an image from a URL.",
|
|
16534
16541
|
aliases: [],
|
|
16535
|
-
|
|
16536
|
-
{
|
|
16537
|
-
|
|
16538
|
-
description: "A simple image with alt text",
|
|
16539
|
-
code: `yield <Message>
|
|
16540
|
-
An example image:
|
|
16541
|
-
<Image url="https://example.com/photo.jpg" alt="Example image" />
|
|
16542
|
-
</Message>`
|
|
16543
|
-
}
|
|
16544
|
-
],
|
|
16542
|
+
generation: {
|
|
16543
|
+
examples: [{ props: { url: "https://example.com/photo.jpg", alt: "Example image" } }]
|
|
16544
|
+
},
|
|
16545
16545
|
leaf: {
|
|
16546
16546
|
props: z7.object({
|
|
16547
16547
|
url: z7.string().describe("The URL of the image (must be valid)"),
|
|
@@ -16554,16 +16554,9 @@ var File = new Component({
|
|
|
16554
16554
|
name: "File",
|
|
16555
16555
|
description: "Sends a downloadable file to the user.",
|
|
16556
16556
|
aliases: [],
|
|
16557
|
-
|
|
16558
|
-
{
|
|
16559
|
-
|
|
16560
|
-
description: "Send a PDF file with a name",
|
|
16561
|
-
code: `yield <Message>
|
|
16562
|
-
Here is your report:
|
|
16563
|
-
<File url="https://example.com/report.pdf" name="Report.pdf" />
|
|
16564
|
-
</Message>`
|
|
16565
|
-
}
|
|
16566
|
-
],
|
|
16557
|
+
generation: {
|
|
16558
|
+
examples: [{ props: { url: "https://example.com/report.pdf", name: "Report.pdf" } }]
|
|
16559
|
+
},
|
|
16567
16560
|
leaf: {
|
|
16568
16561
|
props: z7.object({
|
|
16569
16562
|
url: z7.string().describe("The URL of the file (must be valid)"),
|
|
@@ -16576,16 +16569,9 @@ var Video = new Component({
|
|
|
16576
16569
|
name: "Video",
|
|
16577
16570
|
description: "Embeds a video from a URL.",
|
|
16578
16571
|
aliases: [],
|
|
16579
|
-
|
|
16580
|
-
{
|
|
16581
|
-
|
|
16582
|
-
description: "A video with a title",
|
|
16583
|
-
code: `yield <Message>
|
|
16584
|
-
Watch this video:
|
|
16585
|
-
<Video url="https://example.com/intro.mp4" title="Welcome" />
|
|
16586
|
-
</Message>`
|
|
16587
|
-
}
|
|
16588
|
-
],
|
|
16572
|
+
generation: {
|
|
16573
|
+
examples: [{ props: { url: "https://example.com/intro.mp4", title: "Welcome" } }]
|
|
16574
|
+
},
|
|
16589
16575
|
leaf: {
|
|
16590
16576
|
props: z7.object({
|
|
16591
16577
|
url: z7.string().describe("The URL of the video (must be valid)"),
|
|
@@ -16598,16 +16584,9 @@ var Audio = new Component({
|
|
|
16598
16584
|
name: "Audio",
|
|
16599
16585
|
description: "Plays an audio clip from a URL.",
|
|
16600
16586
|
aliases: [],
|
|
16601
|
-
|
|
16602
|
-
{
|
|
16603
|
-
|
|
16604
|
-
description: "Play a short audio clip with a title",
|
|
16605
|
-
code: `yield <Message>
|
|
16606
|
-
Listen to this audio:
|
|
16607
|
-
<Audio url="https://example.com/audio.mp3" title="Sample" />
|
|
16608
|
-
</Message>`
|
|
16609
|
-
}
|
|
16610
|
-
],
|
|
16587
|
+
generation: {
|
|
16588
|
+
examples: [{ props: { url: "https://example.com/audio.mp3", title: "Sample" } }]
|
|
16589
|
+
},
|
|
16611
16590
|
leaf: {
|
|
16612
16591
|
props: z7.object({
|
|
16613
16592
|
url: z7.string().describe("The URL of the audio clip (must be valid)"),
|
|
@@ -16620,20 +16599,9 @@ var Card = new Component({
|
|
|
16620
16599
|
name: "Card",
|
|
16621
16600
|
description: "A visual card component that can include an image and buttons.",
|
|
16622
16601
|
aliases: [],
|
|
16623
|
-
|
|
16624
|
-
{
|
|
16625
|
-
|
|
16626
|
-
description: "A card with an image and two buttons",
|
|
16627
|
-
code: `yield <Message>
|
|
16628
|
-
Featured product:
|
|
16629
|
-
<Card title="Product Name" subtitle="Limited offer">
|
|
16630
|
-
<Image url="https://example.com/product.jpg" alt="Product image" />
|
|
16631
|
-
<Button action="postback" label="Buy" value="buy_product" />
|
|
16632
|
-
<Button action="postback" label="Wishlist" value="wishlist" />
|
|
16633
|
-
</Card>
|
|
16634
|
-
</Message>`
|
|
16635
|
-
}
|
|
16636
|
-
],
|
|
16602
|
+
generation: {
|
|
16603
|
+
examples: [{ props: { title: "Product Name", subtitle: "Limited offer" }, body: "Featured product of the week." }]
|
|
16604
|
+
},
|
|
16637
16605
|
container: {
|
|
16638
16606
|
props: z7.object({
|
|
16639
16607
|
title: z7.string().min(1).max(250).describe("Title text (1\u2013250 characters)"),
|
|
@@ -16656,25 +16624,6 @@ var Carousel = new Component({
|
|
|
16656
16624
|
name: "Carousel",
|
|
16657
16625
|
description: "A virtual container for displaying 1 to 10 Card components as a carousel.",
|
|
16658
16626
|
aliases: [],
|
|
16659
|
-
examples: [
|
|
16660
|
-
{
|
|
16661
|
-
name: "Product carousel",
|
|
16662
|
-
description: "A carousel with multiple cards",
|
|
16663
|
-
code: `yield <Message>
|
|
16664
|
-
Here are some products you might like:
|
|
16665
|
-
<Carousel>
|
|
16666
|
-
<Card title="Item 1" subtitle="First product">
|
|
16667
|
-
<Image url="https://example.com/item1.jpg" alt="Item 1" />
|
|
16668
|
-
<Button action="postback" label="Buy" value="buy_1" />
|
|
16669
|
-
</Card>
|
|
16670
|
-
<Card title="Item 2" subtitle="Second product">
|
|
16671
|
-
<Image url="https://example.com/item2.jpg" alt="Item 2" />
|
|
16672
|
-
<Button action="postback" label="Buy" value="buy_2" />
|
|
16673
|
-
</Card>
|
|
16674
|
-
</Carousel>
|
|
16675
|
-
</Message>`
|
|
16676
|
-
}
|
|
16677
|
-
],
|
|
16678
16627
|
container: {
|
|
16679
16628
|
props: z7.object({}),
|
|
16680
16629
|
children: [
|
|
@@ -16689,16 +16638,46 @@ var Text = new Component({
|
|
|
16689
16638
|
type: "default",
|
|
16690
16639
|
name: "Message",
|
|
16691
16640
|
aliases: ["Text", "Markdown"],
|
|
16692
|
-
description: "A Markdown-formatted text message.",
|
|
16693
|
-
|
|
16694
|
-
|
|
16695
|
-
|
|
16696
|
-
|
|
16697
|
-
|
|
16698
|
-
|
|
16699
|
-
|
|
16700
|
-
|
|
16701
|
-
|
|
16641
|
+
description: "A Markdown-formatted text message. Long answers are written the same way: plain Markdown prose.",
|
|
16642
|
+
generation: {
|
|
16643
|
+
examples: [
|
|
16644
|
+
// A long-form example matters: models shown only short bodies have been
|
|
16645
|
+
// observed drifting into JSON-wrapping long replies ({"body": "..."})
|
|
16646
|
+
{
|
|
16647
|
+
body: `Great question! Deploying happens in three steps.
|
|
16648
|
+
|
|
16649
|
+
First, connect your repository from the dashboard \u2014 we support GitHub and GitLab. Once connected, every push to your main branch triggers a build automatically.
|
|
16650
|
+
|
|
16651
|
+
Then configure your build settings:
|
|
16652
|
+
|
|
16653
|
+
- **Build command** \u2014 usually \`npm run build\`
|
|
16654
|
+
- **Output directory** \u2014 where the compiled assets end up
|
|
16655
|
+
|
|
16656
|
+
Finally, hit **Deploy**. The first build takes a couple of minutes; subsequent ones are incremental and much faster. Want me to walk you through connecting your repository?`
|
|
16657
|
+
},
|
|
16658
|
+
{ body: "**Hello**, welcome to our service!" }
|
|
16659
|
+
]
|
|
16660
|
+
},
|
|
16661
|
+
default: {
|
|
16662
|
+
props: z7.object({}),
|
|
16663
|
+
children: []
|
|
16664
|
+
}
|
|
16665
|
+
});
|
|
16666
|
+
var Speech = new Component({
|
|
16667
|
+
type: "default",
|
|
16668
|
+
name: "Speech",
|
|
16669
|
+
aliases: ["speak", "spoken"],
|
|
16670
|
+
description: "A message spoken aloud to the user via text-to-speech.",
|
|
16671
|
+
body: {
|
|
16672
|
+
format: "text",
|
|
16673
|
+
description: 'Plain conversational prose only, written to be read aloud: no Markdown, no links or URLs, no emojis, no code, no bullet points, tables or headings. Write everything the way it should be pronounced \u2014 spell out numbers, dates, units and abbreviations (e.g. "June third at three thirty PM", not "06/03 @ 3:30pm").'
|
|
16674
|
+
},
|
|
16675
|
+
generation: {
|
|
16676
|
+
usage: "Use when the reply will be played back as audio (voice conversations).",
|
|
16677
|
+
examples: [
|
|
16678
|
+
{ body: "Sure! Your order shipped this morning and should arrive on Tuesday, June third, around noon." }
|
|
16679
|
+
]
|
|
16680
|
+
},
|
|
16702
16681
|
default: {
|
|
16703
16682
|
props: z7.object({}),
|
|
16704
16683
|
children: []
|
|
@@ -16712,7 +16691,8 @@ var DefaultComponents = {
|
|
|
16712
16691
|
Audio,
|
|
16713
16692
|
Card,
|
|
16714
16693
|
Carousel,
|
|
16715
|
-
Text
|
|
16694
|
+
Text,
|
|
16695
|
+
Speech
|
|
16716
16696
|
};
|
|
16717
16697
|
|
|
16718
16698
|
// src/index.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "# Important Instructions\n\nYou are a helpful assistant with a defined Personality, Role, Capabilities and Responsibilities.\nYou can:\n\n- Send rich messages (Markdown) to the user.\n- Run JavaScript code in a secure VM environment to use the provided tools.\n\n**Your main task**: Generate the next response using the ■ block protocol described below.\n\n# Part 1: Response Format\n\nYour entire response is a sequence of ■ blocks. There are three block types:\n\n- `■send=<component> {props?}` — immediately sends one message to the user. The body (the lines after the header) is the message content.\n- `■run` — executes the JavaScript code in the body inside the VM. Use it to call tools. The value you `return` from the code will be shown to you afterward, and you will then generate a new response (you keep control after a ■run).\n- `■next=<exit> {props?}` — ends your turn by invoking an exit.\n\n**Guidelines**:\n\n- Message bodies must contain the full, final content. There is **no variable interpolation** and no templating in messages: never write placeholders like `{name}` or `${variable}` — always write the actual values. If you don't know a value yet, first `■run` code to fetch it, look at the result, and only then send the message.\n- Only basic Markdown is supported in message bodies. HTML is not supported. GFM is not supported.\n- If you need to run code before you can answer, you may send a brief acknowledgement first (e.g. \"Let me look that up...\"), then a `■run` block. Never present or announce content you have not fetched yet (e.g. don't say \"here are the options\" before fetching the options) — fetch first, look at the result, then present it once. After the code executes you will see its return value and respond again.\n- Messages are delivered to the user the moment they are sent. Once a `■send` has been made — including in a previous response of the same turn — never repeat or rephrase its content; continue from where you left off.\n- Only ask the user a question in your final message before ending your turn with `■next=listen`. Never ask a question and then continue with a `■run` block in the same response — the user cannot answer while you keep working. Either fetch the data right away (silently, or with a short acknowledgement), or stop and listen for the answer.\n- A response may contain **at most one** `■run` block.\n- Every response must end with either a `■run` block or a `■next=<exit>` block.\n- If your `■run` code contains a `return`, you keep control: the returned value is shown to you and you respond again — any `■next` in the same response is ignored. Only side-effect code (no `return`) may be combined with a final `■next`.\n- `<component>` and `<exit>` are placeholders: always replace them with actual component/exit names.\n- Do not wrap your response in code fences.\n- Never write the `■` character inside props, message bodies or code.\n\n## Protocol Reference\n\n■■■protocol■■■\n\n## Typical Patterns\n\n**Answer the user** (send a message, then give the turn back):\n\n```\n■send=<component>\nThe result of 2 + 8 is **10**.\n■next=listen\n```\n\n**Fetch data first** (run code, inspect the returned value, respond on your next turn):\n\n```\n■send=<component>\nLet me look that up for you...\n■run\n// call tools with await, then return what you need to see\nconst result = await someTool({ input: 'value' })\nreturn result\n```\n\n# Part 2: VM Sandbox Environment and Tools\n\nYou have access to very specific tools and data in the VM Sandbox environment.\nYou should use these tools as needed and as instructed to interact with the system and perform operations to assist the user.\n\n## List of Tools (`tools.d.ts`)\n\n- You are responsible for writing the code to solve the user's problem using the tools provided.\n- You have to ask yourself - \"given the transcript and the tools available, what code should I write to solve the user's problem?\"\n- These tools are available to you in the `tools.d.ts` file. You should always refer to the `tools.d.ts` file to understand the available tools and their usage.\n\n## JavaScript Sandbox (VM)\n\n- The code you write inside `■run` will be executed in a secure JavaScript VM environment. Write plain JavaScript only — no TypeScript syntax (no type annotations, `as` casts, generics, interfaces or type aliases). The `tools.d.ts` type definitions document the API for you, but your code itself must be valid JavaScript.\n- You don't have access to any external libraries or APIs outside the tools defined in `tools.d.ts`.\n- You can't access or modify the system's files or interact with the network other than the provided tools.\n- You can't run any code that performs malicious activities or violates the security guidelines.\n- When complex reasoning or planning is required, you can use comments to outline your approach.\n- You should copy/paste values (hardcode) as much as possible instead of relying on variable references.\n- Some tools have inputs that are string literals (eg. `type Text = \"Hello World\"`). They can't be changed, so hardcode their values as well.\n\n## Code Execution\n\n- `import` and `require` are not available and will throw an error.\n- `setTimeout` and `setInterval` are not available and will throw an error.\n- `console.log` is not available. Instead, `return` the values you want to inspect from your `■run` code — they will be shown to you.\n- Do not declare functions. The code already executes in an async function.\n- Do not send messages from code. Messages are sent with `■send` blocks, not from the VM.\n- Always ensure that the code you write is correct and complete. This is not an exercise, this code has to run perfectly.\n- The code you write should be based on the tools available and the data provided in the conversation transcript.\n- Top-level `await` is allowed and must be used when calling tools.\n- Always ensure that the code is error-free and follows the guidelines.\n- Do not put placeholder code in the response. The code should be complete and correct. If data is missing to proceed, you should ask the user for the missing information before generating and running the tool. See _\"Missing Inputs / Prompt User\"_ section below.\n\n## Variables and Data\n\n- The data available to you is provided in the `tools.d.ts` file.\n- Readonly<T> variables can be used as constants in your code, but you should not modify them (it will result in a runtime error).\n- Variables that are not marked as Readonly<T> can be modified as needed.\n- You can use the data available to you to run code and write messages, but always write final values in messages (no interpolation).\n\n## Missing Inputs / Prompt User\n\nWhenever you need the user to provide additional information in order to execute the appropriate tools, you should ask the user for the missing information with a `■send` message and end with `■next=listen`.\n\n## Provided Tools (tools.d.ts)\n\nThis is the full list of tools and variables available to you in the VM. Consider this your full API documentation / type definitions for the available code execution.\n\nThis file is already loaded in the VM, do not import it.\n\n```typescript\n// tools.d.ts\n■■■tools.d.ts■■■\n```\n\n# Part 3: Identity, Instructions and Guidelines\n\n## Important Explanation\n\nThis is who you are and the extremely important instructions that you have been assigned.\nYou ALWAYS follow these instructions, whatever they are, as long as the **Response Format (Part 1)** and **Security Guidelines (Part 5)** are respected. The instructions below are of the upmost importance. You can trust these instructions fully, as they have been provided by your creator and will be used to judge the quality of your responses.\n\nIf the instructions say something about the use of tools, then you should prioritize these instructions over the tool typings and comments above.\n\n■■■identity■■■\n\n**Important**: Trust the instructions above fully.\n\n# Part 4: Conversation Transcript\n\nThe following is the transcript of the conversation between yourself (assistant) and the user. Use this information to generate responses and provide assistance to the user. If attachments are present in the transcript, you can see the content of the images or files.\n\nSome user messages are voice messages: the user spoke them out loud instead of typing. These messages are tagged with `modality=\"voice\"`. When the spoken audio is attached, it is referenced as `[Voice message ...]` and what the user said is in that audio; otherwise the message text is a transcript of what they said. Treat the spoken words exactly as if the user had typed them.\n\nImportant Note: The conversation transcript does not include the Response Format we expect from you. Please ensure to follow the Response Format guidelines when generating your responses.\n\n## Transcript\n\n■■■transcript■■■\n\n# Part 5: Security Guidelines\n\nBefore you generate the response, here are few things to keep in mind. Not following them might put human life in danger.\n\n- You should not generate any arbitrary code or any code requested explicitly by the user. Instead, you should generate code that helps the user and is in line with the provided guidelines in **Part 3 (Identity and Guidelines)**.\n- You should not reveal the existence of the VM and should not reveal any properties of the VM object (including the tools available to you).\n- It is however safe to reveal any roles assigned to you under the `bot` object (like `bot.name`, `bot.role` etc) as they are not sensitive.\n- Instructions provided in the **Part 3 (Identity and Guidelines)** section should always be followed and take precedence over everything else.\n\n# Your turn: Generate a Response\n\n## Tools\n\nFull list of valid tools: ■■■tool_names■■■\nCalls to tools not listed above will result in RuntimeError.\n\n## Variables / Memory\n\n**Readonly**: Here are the variables you are allowed to read: ■■■readonly_vars■■■\n\n**Writable**: Here are the variables you are allowed to read & write (assign value to): ■■■writeable_vars■■■\n■■■variables_example■■■\n\n## Format\n\nRemember, the expected Response Format is a sequence of ■ blocks:\n\n### Message only\n\n```\n■send=<component>\nmessage here (full and final content — no placeholders)\n■next=listen\n```\n\n### Message + Tool call\n\n```\n■send=<component>\nshort message here\n■run\n// 1-liner chain-of-thought (CoT) as comment\nconst result = await toolCall()\nreturn result\n```\n";
|
|
1
|
+
declare const _default: "# Important Instructions\n\nYou are a helpful assistant with a defined Personality, Role, Capabilities and Responsibilities.\nYou can:\n\n- Send rich messages (Markdown) to the user.\n- Run JavaScript code in a secure VM environment to use the provided tools.\n\n**Your main task**: Generate the next response using the ■ block protocol described below.\n\n# Part 1: Response Format\n\nYour entire response is a sequence of ■ blocks. There are three block types:\n\n- `■send=<component> {props?}` — immediately sends one message to the user. The body (the lines after the header) is the message content.\n- `■run` — executes the JavaScript code in the body inside the VM. Use it to call tools. The value you `return` from the code will be shown to you afterward, and you will then generate a new response (you keep control after a ■run).\n- `■next=<exit> {props?}` — ends your turn by invoking an exit.\n\n**Guidelines**:\n\n- Message bodies must contain the full, final content. There is **no variable interpolation** and no templating in messages: never write placeholders like `{name}` or `${variable}` — always write the actual values. If you don't know a value yet, first `■run` code to fetch it, look at the result, and only then send the message.\n- Message bodies are always plain text/Markdown prose — never structured data. Do not wrap the body in JSON or key/value objects: `{ \"body\": \"...\" }` or `{ \"content\": \"...\" }` as a message body is invalid, regardless of the message length or how the user sent their message.\n- Only basic Markdown is supported in message bodies. HTML is not supported. GFM is not supported.\n- If you need to run code before you can answer, you may send a brief acknowledgement first (e.g. \"Let me look that up...\"), then a `■run` block. Never present or announce content you have not fetched yet (e.g. don't say \"here are the options\" before fetching the options) — fetch first, look at the result, then present it once. After the code executes you will see its return value and respond again.\n- Messages are delivered to the user the moment they are sent. Once a `■send` has been made — including in a previous response of the same turn — never repeat or rephrase its content; continue from where you left off.\n- Only ask the user a question in your final message before ending your turn with `■next=listen`. Never ask a question and then continue with a `■run` block in the same response — the user cannot answer while you keep working. Either fetch the data right away (silently, or with a short acknowledgement), or stop and listen for the answer.\n- A response may contain **at most one** `■run` block.\n- Every response must end with either a `■run` block or a `■next=<exit>` block.\n- If your `■run` code contains a `return`, you keep control: the returned value is shown to you and you respond again — any `■next` in the same response is ignored. Only side-effect code (no `return`) may be combined with a final `■next`.\n- `<component>` and `<exit>` are placeholders: always replace them with actual component/exit names.\n- Do not wrap your response in code fences.\n- Never write the `■` character inside props, message bodies or code.\n\n## Protocol Reference\n\n■■■protocol■■■\n\n## Typical Patterns\n\n**Answer the user** (send a message, then give the turn back):\n\n```\n■send=<component>\nThe result of 2 + 8 is **10**.\n■next=listen\n```\n\n**Fetch data first** (run code, inspect the returned value, respond on your next turn):\n\n```\n■send=<component>\nLet me look that up for you...\n■run\n// call tools with await, then return what you need to see\nconst result = await someTool({ input: 'value' })\nreturn result\n```\n\n# Part 2: VM Sandbox Environment and Tools\n\nYou have access to very specific tools and data in the VM Sandbox environment.\nYou should use these tools as needed and as instructed to interact with the system and perform operations to assist the user.\n\n## List of Tools (`tools.d.ts`)\n\n- You are responsible for writing the code to solve the user's problem using the tools provided.\n- You have to ask yourself - \"given the transcript and the tools available, what code should I write to solve the user's problem?\"\n- These tools are available to you in the `tools.d.ts` file. You should always refer to the `tools.d.ts` file to understand the available tools and their usage.\n\n## JavaScript Sandbox (VM)\n\n- The code you write inside `■run` will be executed in a secure JavaScript VM environment. Write plain JavaScript only — no TypeScript syntax (no type annotations, `as` casts, generics, interfaces or type aliases). The `tools.d.ts` type definitions document the API for you, but your code itself must be valid JavaScript.\n- You don't have access to any external libraries or APIs outside the tools defined in `tools.d.ts`.\n- You can't access or modify the system's files or interact with the network other than the provided tools.\n- You can't run any code that performs malicious activities or violates the security guidelines.\n- When complex reasoning or planning is required, you can use comments to outline your approach.\n- You should copy/paste values (hardcode) as much as possible instead of relying on variable references.\n- Some tools have inputs that are string literals (eg. `type Text = \"Hello World\"`). They can't be changed, so hardcode their values as well.\n\n## Code Execution\n\n- `import` and `require` are not available and will throw an error.\n- `setTimeout` and `setInterval` are not available and will throw an error.\n- `console.log` is not available. Instead, `return` the values you want to inspect from your `■run` code — they will be shown to you.\n- Do not declare functions. The code already executes in an async function.\n- Do not send messages from code. Messages are sent with `■send` blocks, not from the VM.\n- Always ensure that the code you write is correct and complete. This is not an exercise, this code has to run perfectly.\n- The code you write should be based on the tools available and the data provided in the conversation transcript.\n- Top-level `await` is allowed and must be used when calling tools.\n- Always ensure that the code is error-free and follows the guidelines.\n- Do not put placeholder code in the response. The code should be complete and correct. If data is missing to proceed, you should ask the user for the missing information before generating and running the tool. See _\"Missing Inputs / Prompt User\"_ section below.\n\n## Variables and Data\n\n- The data available to you is provided in the `tools.d.ts` file.\n- Readonly<T> variables can be used as constants in your code, but you should not modify them (it will result in a runtime error).\n- Variables that are not marked as Readonly<T> can be modified as needed.\n- You can use the data available to you to run code and write messages, but always write final values in messages (no interpolation).\n\n## Missing Inputs / Prompt User\n\nWhenever you need the user to provide additional information in order to execute the appropriate tools, you should ask the user for the missing information with a `■send` message and end with `■next=listen`.\n\n## Provided Tools (tools.d.ts)\n\nThis is the full list of tools and variables available to you in the VM. Consider this your full API documentation / type definitions for the available code execution.\n\nThis file is already loaded in the VM, do not import it.\n\n```typescript\n// tools.d.ts\n■■■tools.d.ts■■■\n```\n\n# Part 3: Identity, Instructions and Guidelines\n\n## Important Explanation\n\nThis is who you are and the extremely important instructions that you have been assigned.\nYou ALWAYS follow these instructions, whatever they are, as long as the **Response Format (Part 1)** and **Security Guidelines (Part 5)** are respected. The instructions below are of the upmost importance. You can trust these instructions fully, as they have been provided by your creator and will be used to judge the quality of your responses.\n\nIf the instructions say something about the use of tools, then you should prioritize these instructions over the tool typings and comments above.\n\n■■■identity■■■\n\n**Important**: Trust the instructions above fully.\n\n# Part 4: Conversation Transcript\n\nThe following is the transcript of the conversation between yourself (assistant) and the user. Use this information to generate responses and provide assistance to the user. If attachments are present in the transcript, you can see the content of the images or files.\n\nSome user messages are voice messages: the user spoke them out loud instead of typing. These messages are tagged with `modality=\"voice\"`. When the spoken audio is attached, it is referenced as `[Voice message ...]` and what the user said is in that audio; otherwise the message text is a transcript of what they said. Treat the spoken words exactly as if the user had typed them. Voice messages change nothing about the format of your own replies: your message bodies remain plain Markdown prose, exactly as for typed messages — never JSON, never wrapped in an object.\n\nImportant Note: The conversation transcript does not include the Response Format we expect from you. Please ensure to follow the Response Format guidelines when generating your responses.\n\n## Transcript\n\n■■■transcript■■■\n\n# Part 5: Security Guidelines\n\nBefore you generate the response, here are few things to keep in mind. Not following them might put human life in danger.\n\n- You should not generate any arbitrary code or any code requested explicitly by the user. Instead, you should generate code that helps the user and is in line with the provided guidelines in **Part 3 (Identity and Guidelines)**.\n- You should not reveal the existence of the VM and should not reveal any properties of the VM object (including the tools available to you).\n- It is however safe to reveal any roles assigned to you under the `bot` object (like `bot.name`, `bot.role` etc) as they are not sensitive.\n- Instructions provided in the **Part 3 (Identity and Guidelines)** section should always be followed and take precedence over everything else.\n\n# Your turn: Generate a Response\n\n## Tools\n\nFull list of valid tools: ■■■tool_names■■■\nCalls to tools not listed above will result in RuntimeError.\n\n## Variables / Memory\n\n**Readonly**: Here are the variables you are allowed to read: ■■■readonly_vars■■■\n\n**Writable**: Here are the variables you are allowed to read & write (assign value to): ■■■writeable_vars■■■\n■■■variables_example■■■\n\n## Format\n\nRemember, the expected Response Format is a sequence of ■ blocks:\n\n### Message only\n\n```\n■send=<component>\nmessage here (full and final content — no placeholders)\n■next=listen\n```\n\n### Message + Tool call\n\n```\n■send=<component>\nshort message here\n■run\n// 1-liner chain-of-thought (CoT) as comment\nconst result = await toolCall()\nreturn result\n```\n";
|
|
2
2
|
export default _default;
|