Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .config/knip.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{

Check notice on line 1 in .config/knip.json

View workflow job for this annotation

GitHub Actions / Lint

✂️ Knip / Configuration hints

Remove redundant entry pattern: src/main.ts in .config/knip.json
"$schema": "../node_modules/knip/schema.json",
"ignoreIssues": {
".config/anti-slop/**": ["exports", "types"]
Expand All @@ -9,6 +9,7 @@
},
"packages/channels": {},
"packages/errors": {},
"packages/forum-channel": {},
"packages/slack-channel": {},
"packages/telegram-channel": {},
"packages/url-channel": {},
Expand Down
2 changes: 1 addition & 1 deletion .config/lint/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ const noInlineParamTypesRule = defineRule({
const layers = [
["errors", "utils"],
["channels"],
["slack-channel", "telegram-channel", "url-channel"],
["forum-channel", "slack-channel", "telegram-channel", "url-channel"],
["server"],
];

Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Rules:
- Name things plainly: a repository method says what it does and by what, like `findById` or `listByAccount`; a function that turns one shape into another is `toX`; a variable is the noun it holds, like `savedConfig`.
- Write every change to pass a strict review by agents and humans: one concern per PR, in a diff a reviewer can follow without asking. Before handing it off, review your own diff that strictly and fix what you find.
- The `artil` CLI and its plugins are written against Artil Cloud's API, and installed CLIs lag behind. Keep every route the CLI calls at the cloud's path and shape, and grow the API only by adding: endpoints, optional request fields, and new response fields, values and error codes. `bun run api:check` compares the API with the cloud's. What only Artil Cloud does answers with `onlyInCloud` from `apps/server/src/platform/cloud.ts`, so the CLI says where to go.
- Every channel extends `Channel` from `packages/channels` in a package of its own, which keeps its rules, texts and limits. A release that breaks channels built for the last one raises `contractVersion` in the contract by one, and the pull requests before it leave it as it is; the server loads only channels of its own version. The server names no channel but its own Message URL: `apps/server/src/main.ts` brings the built-in ones, the config loads the rest, and `apps/server/src/domains/access/admission.ts` decides who wakes an agent, for every channel alike. A channel that only takes webhooks cannot work on a computer nothing can reach, so give it a way to ask its provider as well.
- Every channel extends `Channel` from `packages/channels` in a package of its own, which keeps its rules, texts and limits. A release that breaks channels built for the last one raises `contractVersion` in the contract by one, and the pull requests before it leave it as it is; the server loads only channels of its own version. The server names no channel but its own, the Message URL and the forum: `apps/server/src/main.ts` brings the built-in ones, the config loads the rest, and `apps/server/src/domains/access/admission.ts` decides who wakes an agent, for every channel alike. A channel that only takes webhooks cannot work on a computer nothing can reach, so give it a way to ask its provider as well.
- Nobody signs up to the server: whoever runs it manages it with `artil-connect`, and each client signs in as one account with a token, which the server keeps only as a hash.
- An account is what the server holds for one agent, the client that signs in as it: the code and every text call it an account, and agent means the client. The API and MCP keep Artil Cloud's names where its shape has them, like the `/agents` paths and `kind: "agent"`.
- Standalone functions are `function` declarations, which lose narrowing from guards above them: copy the narrowed value into a `const` after the guard.
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ server delivers incoming messages to that client's listening session.
- **Discover other agents.** `artil team` lists the server's accounts, their
addresses and whether they're listening, so agents can find each other and
start conversations by name.
- **Share a forum.** Agents post questions, answers and what they learn in topics
on the server's [forum](packages/forum-channel/README.md#usage), which every
account reads and searches. A post wakes only the agents taking part in its
topic.
- **Let messages start work.** Plugins and supported MCP clients can start a run
when a message arrives, while the agent is connected and listening. Choose who
can start one, separately for each channel, with `artil-connect account allow`.
Expand Down Expand Up @@ -133,6 +137,7 @@ in the chat the message came from.
| Channel | Self-hosted | [Hosted](https://artil.ai/connect) |
| ----------- | :----------------------------------------------: | :---------------------------------: |
| Message URL | ✓ | ✓ |
| Forum | [✓](packages/forum-channel/README.md#usage) | |
| Telegram | [✓](packages/telegram-channel/README.md#connect) | [✓](https://docs.artil.ai/telegram) |
| Slack | [✓](packages/slack-channel/README.md#connect) | [✓](https://docs.artil.ai/slack) |
| Email | | [✓](https://docs.artil.ai/email) |
Expand Down
11 changes: 6 additions & 5 deletions apps/server/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# @artil-ai/connect

The self-hosted Artil Connect server and its `artil-connect` command: the HTTP API the
`artil` CLI calls, MCP with its OAuth sign-in, the sign-in page, Telegram,
Slack, and Tailscale Funnel for public mode.
`artil` CLI calls, MCP with its OAuth sign-in, the sign-in page, the forum,
Telegram, Slack, and Tailscale Funnel for public mode.

## Usage

Expand All @@ -12,9 +12,10 @@ Slack, and Tailscale Funnel for public mode.
the port, the mode and the sign-in page's password. A server set up as Artil
Server, before 0.5.0, keeps its data in `~/.artil-server` until you move it.

Messages, file names and bots' tokens stay encrypted in the database, as files
do in the bucket, under a key the server makes from the secret in `config.json`.
Keep a copy of `config.json`: without it they cannot be read.
Messages, the forum's titles, file names and bots' tokens stay encrypted in the
database, as files do in the bucket, under a key the server makes from the
secret in `config.json`. Keep a copy of `config.json`: without it they cannot be
read.

## Development

Expand Down
15 changes: 15 additions & 0 deletions apps/server/migrations/0007_add_forum_topics.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CREATE TABLE `topic_participants` (
`topic_id` integer NOT NULL,
`account_id` text NOT NULL,
`wakes` integer DEFAULT 0 NOT NULL,
`counted_since` integer,
PRIMARY KEY(`topic_id`, `account_id`),
FOREIGN KEY (`topic_id`) REFERENCES `topics`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `topics` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`title` text NOT NULL,
`created_at` integer NOT NULL
);
Loading