Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.2.34 #163

Merged
merged 26 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
run: corepack enable
- name: Install dependencies
run: yarn
- name: Build
run: yarn build:agent
- name: Build
run: yarn build:message-kit
- name: Test parsing
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This is the official repository for [MessageKit](https://message-kit.org/). Powe
- [`message-kit`](/packages/message-kit): A kit for quickly building messaging apps
- [`create-message-kit`](/packages/create-message-kit): A CLI for creating new apps easily
- [`framekit`](/packages/framekit): A suite for backend frames
- ['agentsdk](/packages/agent/): A secure agent sdk
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix markdown syntax in package link.

There's a syntax error in the markdown link for the agentsdk package.

Apply this fix:

- ['agentsdk](/packages/agent/): A secure agent sdk
+ [`agentsdk`](/packages/agent/): A secure agent sdk
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- ['agentsdk](/packages/agent/): A secure agent sdk
[`agentsdk`](/packages/agent/): A secure agent sdk

- [`docs`](/packages/docs): Documentation for MessageKit

## Contributing
Expand Down
7 changes: 7 additions & 0 deletions community/plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@
"icon": "📒",
"author": "humanagent"
},
{
"href": "/plugins/xmtp",
"title": "Xmtp",
"description": "Use Xmtp to send secure messages.",
"icon": "💬",
"author": "ephemeraHQ"
},
{
"href": "/plugins/gpt",
"title": "GPT",
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "message-kit-monorepo",
"version": "1.2.33",
"version": "patch",
humanagent marked this conversation as resolved.
Show resolved Hide resolved
"private": true,
"type": "module",
"workspaces": [
Expand All @@ -9,7 +9,8 @@
"shared/*"
],
"scripts": {
"build": "yarn build:message-kit && yarn build:packages && yarn build:templates",
"build": "yarn build:agent && yarn build:message-kit && yarn build:packages && yarn build:templates",
"build:agent": "turbo run build --filter=./packages/agent --force",
humanagent marked this conversation as resolved.
Show resolved Hide resolved
"build:message-kit": "turbo run build --filter=./packages/message-kit --force",
"build:packages": "turbo run build --filter='./packages/*' --filter='!./packages/message-kit'",
"build:templates": "turbo run build --filter='./templates/*'",
Expand All @@ -18,7 +19,7 @@
"clean": "turbo run clean && rm -rf node_modules && rm -rf .turbo && rm -rf packages/message-kit/dist && rm -rf packages/message-kit/.turbo && rm -rf packages/docs/dist && yarn cache clean",
"cli": "node packages/create-message-kit/index.js",
"copy": "node scripts/copyTemplates.js",
"dev": "cd packages/message-kit && yarn build:watch",
"dev": "yarn build:agent && cd packages/message-kit && yarn build:watch",
"docs": "cd packages/docs && yarn dev",
"domain": "ngrok http --hostname=frames.ngrok.app 3000",
"format": "turbo run format",
Expand All @@ -27,7 +28,7 @@
"publish": "node scripts/publish.js",
"templates": "node scripts/devTemplates.js",
"test": "FORCE_COLOR=1 turbo run test --force --concurrency=1",
"test:client": "cd packages/message-kit/tests && yarn test:client",
"test:client": "cd packages/agent/tests && yarn test:client",
"test:flow": "cd packages/message-kit/tests && yarn test:flow",
"test:framekit": "cd packages/message-kit/tests && yarn test:framekit",
"test:intent": "cd packages/message-kit/tests && yarn test:intent",
Expand Down
13 changes: 13 additions & 0 deletions packages/agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# @xmtp/secure

A secure XMTP client implementation with built-in encryption and key management.

## Features

- Secure key management
- Support for both v2 and v3 XMTP clients
- Built-in encryption
- Support for multiple content types
- Group messaging capabilities

## Installation
62 changes: 62 additions & 0 deletions packages/agent/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"name": "xmtp-agent",
"version": "1.0.1",
"license": "MIT",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.js"
}
},
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist/**/*"
],
"scripts": {
"build": "rollup -c",
"build:watch": "yarn build -w",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
"publish": "npm publish",
"test": "yarn build && vitest",
"test:client": "vitest run tests/client"
},
"dependencies": {
"@changesets/changelog-git": "^0.2.0",
"@changesets/cli": "^2.27.5",
"@xmtp/content-type-primitives": "^1.0.2",
"@xmtp/content-type-reaction": "^1.1.10-beta.1",
"@xmtp/content-type-read-receipt": "^2.0.0",
"@xmtp/content-type-remote-attachment": "1.1.11",
"@xmtp/content-type-reply": "^1.1.11",
"@xmtp/content-type-text": "^1.0.0",
"@xmtp/grpc-api-client": "^0.2.8",
"@xmtp/node-sdk": "^0.0.31",
"@xmtp/xmtp-js": "^13.0.3",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Update dependency constraints to use stable versions

The version check reveals that stable versions are available for all dependencies:

  • @xmtp/content-type-reaction has stable v1.1.12 (currently using beta)
  • @xmtp/content-type-remote-attachment is correctly pinned at v1.1.11
  • @xmtp/content-type-reply has v1.1.12 available
  • @xmtp/xmtp-js has v13.0.4 available

Recommendations:

  • Replace @xmtp/content-type-reaction@^1.1.10-beta.1 with @xmtp/content-type-reaction@^1.1.12
  • Consider updating other dependencies to their latest stable versions
  • Maintain consistent version constraint style (recommend using ^ for minor updates)
🔗 Analysis chain

Review dependency version constraints

Several @xmtp dependencies have specific version constraints that might need review:

  • @xmtp/content-type-reaction uses beta version
  • Some packages use ^ while others use exact versions
    Consider standardizing version constraints and avoiding beta dependencies in production.

Run this script to check for potential version conflicts:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for version compatibility issues in @xmtp dependencies
echo "Checking @xmtp dependencies versions..."
npm info '@xmtp/content-type-reaction@^1.1.10-beta.1' version
npm info '@xmtp/[email protected]' version
npm info '@xmtp/content-type-reply@^1.1.11' version
npm info '@xmtp/xmtp-js@^13.0.3' version

Length of output: 593

"dotenv": "^16.4.5",
"typescript": "^5.4.5",
"viem": "^2.16.3"
},
"devDependencies": {
"@rollup/plugin-typescript": "^11.1.6",
"@types/node": "^20.14.2",
"@vitest/coverage-v8": "^2.1.4",
"prettier": "^3.3.1",
"rollup": "^4.18.0",
"rollup-plugin-dts": "^6.1.1",
"ts-node": "^10.9.2",
"turbo": "^2.2.3",
"vitest": "^2.1.4"
},
"packageManager": "[email protected]",
"engines": {
"node": ">=20"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}
68 changes: 68 additions & 0 deletions packages/agent/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import typescript from "@rollup/plugin-typescript";
import { defineConfig } from "rollup";
import { dts } from "rollup-plugin-dts";

const external = [
"@xmtp/content-type-primitives",
"@xmtp/content-type-text",
"@xmtp/content-type-reaction",
"@xmtp/content-type-reply",
"@xmtp/content-type-remote-attachment",
"@xmtp/node-sdk",
"@xmtp/message-kit",
"@xmtp/xmtp-js",
"@redis/client",
"@xmtp/proto",
"@xmtp/node-bindings",
"@xmtp/grpc-api-client",
"@xmtp/content-type-read-receipt",
"cross-fetch",
"path",
"crypto",
"viem",
"dotenv",
"openai",
"viem/accounts",
"fs/promises",
"fs",
"viem/chains",
"dotenv/config",
];

const plugins = [
typescript({
declaration: false,
declarationMap: false,
}),
];

export default defineConfig([
{
input: "src/index.ts",
output: {
file: "dist/index.js",
format: "es",
sourcemap: true,
},
plugins,
external,
},
{
input: "src/index.ts",
output: {
file: "dist/index.cjs",
format: "cjs",
sourcemap: true,
},
plugins,
external,
},
{
input: "src/index.ts",
output: {
file: "dist/index.d.ts",
format: "es",
},
plugins: [dts()],
},
]);
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// A test of this content type can be found in the following PR: https://github.com/xmtp/xmtp-js/pull/509/files
import { ContentTypeId } from "@xmtp/content-type-primitives";
import type {
ContentCodec,
Expand Down
3 changes: 3 additions & 0 deletions packages/agent/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./lib/xmtp.js";
export * from "./lib/types.js";
export * from "./content-types/agent-message.js";
65 changes: 65 additions & 0 deletions packages/agent/src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { privateKeyToAccount } from "viem/accounts";
import { ContentTypeId } from "@xmtp/content-type-primitives";
import { createWalletClient } from "viem";
import { ClientOptions } from "@xmtp/node-sdk";
import { Client as V3Client } from "@xmtp/node-sdk";
import { Client as V2Client } from "@xmtp/xmtp-js";

export interface XmtpClient {
inboxId: string;
address: string;
client: V3Client;
v2client: V2Client;
}
export { Client as V3Client } from "@xmtp/node-sdk";
export { Client as V2Client } from "@xmtp/xmtp-js";

export interface UserReturnType {
key: string;
account: ReturnType<typeof privateKeyToAccount>;
wallet: ReturnType<typeof createWalletClient>;
}
export type xmtpConfig = {
privateKey?: string;
client?: any;
gptModel?: string;
} & ClientOptions;
humanagent marked this conversation as resolved.
Show resolved Hide resolved

export type Message = {
id: string; // Unique identifier for the message
sent: Date; // Date when the message was sent
content: {
text?: string | undefined; // Text content of the message
reply?: string | undefined; // Reply content if the message is a reply
previousMsg?: string | undefined; // Reference to the previous message
react?: string | undefined; // Reaction content if the message is a reaction
content?: any | undefined; // Any other content
params?: any | undefined; // Parameters for the message
reference?: string | undefined; // Reference ID for the message
skill?: string | undefined; // Skill associated with the message
};
sender: User; // Sender of the message
typeId: string; // Type identifier for the message
};
export type Group = {
id: string;
sync: () => Promise<void>;
addMembers: (addresses: string[]) => Promise<void>;
addMembersByInboxId: (inboxIds: string[]) => Promise<void>;
send: (content: string, contentType?: ContentTypeId) => Promise<string>;
isAdmin: (inboxId: string) => boolean;
isSuperAdmin: (inboxId: string) => boolean;
admins: string[];
superAdmins: string[];
createdAt: Date;
members: User[];
};

export interface User {
inboxId: string;
address: string;
accountAddresses: string[];
installationIds?: string[];
username?: string;
ensDomain?: string;
}
Loading
Loading