open-index/open-npm huggingface dataset:
npm package: @loopstack/create-chat-message-tool
Description: A tool to create chat messages from in a workflow
Author: Jakob Klippel
Latest version: 0.21.1

# @loopstack/create-chat-message-tool

> A module for the [Loopstack AI](https://loopstack.ai) automation framework.

This module provides a tool for creating chat messages within workflows, enabling conversational interfaces and message-based interactions.

## Overview

The Create Chat Message Tool enables workflows to generate chat messages programmatically. It supports creating single or multiple messages in one operation, making it ideal for building conversational workflows, chatbots, and interactive assistants.

By using this tool, you'll be able to:

- Create single or multiple chat messages in one operation
- Define message roles (user, assistant, system, etc.)
- Build conversational workflows with proper message formatting
- Display workflow responses in a chat-like interface
- Integrate seamlessly with AI-powered chat workflows

This tool is essential for workflows that need to communicate with users through a conversational interface or build AI-powered assistants.

## Installation

See [SETUP.md](./SETUP.md) for installation and setup instructions.

## Usage

Inject the tool in your workflow class using the `@InjectTool()` decorator:

```typescript
import { BaseWorkflow, Final, Initial, InjectTool, Transition, Workflow } from '@loopstack/common';
import { CreateChatMessage } from '@loopstack/create-chat-message-tool';

@Workflow({
  uiConfig: __dirname + '/my.ui.yaml',
})
export class MyWorkflow extends BaseWorkflow {
  @InjectTool() createChatMessage: CreateChatMessage;

  @Initial({ to: 'ready' })
  async sendWelcome() {
    // Create a single message
    await this.createChatMessage.call({
      role: 'assistant',
      content: "Hello! I'm your assistant. How can I help you today?",
    });
  }

  @Transition({ from: 'ready', to: 'waiting', wait: true })
  async userInput() {
    // Wait for user input
  }

  @Final({ from: 'waiting' })
  async sendResponse() {
    // Create multiple messages at once
    await this.createChatMessage.call([
      { role: 'assistant', content: 'Thanks for your message!' },
      { role: 'assistant', content: 'Here is your response.' },
    ]);
  }
}
```

## About

Author: Jakob Klippel

License: Apache-2.0

### Additional Resources:

- [Loopstack Documentation](https://loopstack.ai/docs)
- [Getting Started with Loopstack](https://loopstack.ai/docs/getting-started)
- For more examples how to use this tool look for `@loopstack/create-chat-message-tool` in the [Loopstack Registry](https://loopstack.ai/registry)
npm package: @loopstack/create-value-tool
Description: A simple tool that logs and returns a value of a loopstack workflow. This is useful for debugging or initializing workflow context variables.
Author: Jakob Klippel
Latest version: 0.21.1

# @loopstack/create-value-tool

> A module for the [Loopstack AI](https://loopstack.ai) automation framework.

This module provides a tool for creating and debugging values in Loopstack workflows with built-in logging and flexible type support.

## Overview

The Create Value Tool enables workflows to create, transform, and debug values during execution. It accepts any valid JSON-compatible value type and returns it, making it invaluable for debugging template expressions and reassigning values.

By using this tool, you'll be able to:

- Debug template expressions by logging their evaluated results
- Initialize workflow state variables with computed values
- Transform and reassign values using template expressions
- Verify data structures at any point in your workflow
- Support all JSON-compatible types (strings, numbers, objects, arrays, booleans, null)

This tool is essential for workflows that need to debug complex expressions, initialize context variables, or transform data between workflow steps.

## Installation

See [SETUP.md](./SETUP.md) for installation and setup instructions.

## Usage

Inject the tool in your workflow class using the `@InjectTool()` decorator:

```typescript
import { z } from 'zod';
import { BaseWorkflow, Final, Initial, InjectTool, ToolResult, Workflow } from '@loopstack/common';
import { CreateValue } from '@loopstack/create-value-tool';

@Workflow({
  uiConfig: __dirname + '/my.ui.yaml',
  schema: z
    .object({
      userId: z.string(),
    })
    .strict(),
})
export class MyWorkflow extends BaseWorkflow<{ userId: string }> {
  @InjectTool() createValue: CreateValue;

  config?: Record<string, unknown>;

  @Initial({ to: 'processed' })
  async initialize(args: { userId: string }) {
    // Debug a value
    await this.createValue.call({ input: args.userId });

    // Create a complex object
    const result: ToolResult = await this.createValue.call({
      input: {
        environment: 'production',
        timeout: 30,
        retries: 3,
        endpoints: ['https://api.example.com', 'https://backup.example.com'],
      },
    });

    this.config = result.data as Record<string, unknown>;
  }

  @Final({ from: 'processed' })
  async done() {
    // Use the config value
  }
}
```

## About

Author: Jakob Klippel

License: Apache-2.0

### Additional Resources:

- [Loopstack Documentation](https://loopstack.ai/docs)
- [Getting Started with Loopstack](https://loopstack.ai/docs/getting-started)
- For more examples how to use this tool look for `@loopstack/create-value-tool` in the [Loopstack Registry](https://loopstack.ai/registry)