Publish with one call
Send an app's source and it's in your workspace, just for you. No npm, no build, no key.
apps.publish builds an app from its source on Coline and installs it for the person calling, in their workspace. An assistant connected to Coline calls it as publish_app, Kairo builds small apps with it, and from a terminal it's npx coline-app publish. Nobody else sees the app until its person shares it.
Send the files
One file is enough. Tools can be exported on their own, and they may keep data with coline.storage.kv: Coline wraps them into an app with its own store.
import { defineTool } from "@colineapp/sdk/app";
import { z } from "zod";
export const addEntry = defineTool({
name: "standup.add_entry",
description: "Adds your standup entry for today.",
input: z.object({ text: z.string().min(1).max(500) }),
effect: "write",
execute: async ({ text }, { coline }) => {
const day = new Date().toISOString().slice(0, 10);
const entries = ((await coline.storage.kv.get(day)) as string[] | null) ?? [];
await coline.storage.kv.set(day, [...entries, text]);
return { output: { day, entries: entries.length + 1 } };
},
});
export const listEntries = defineTool({
name: "standup.list_entries",
description: "Lists today's standup entries.",
input: z.object({}),
effect: "read",
execute: async (_input, { coline }) => ({
output: { entries: ((await coline.storage.kv.get(new Date().toISOString().slice(0, 10))) as string[] | null) ?? [] },
}),
});Publish it with key: "standup" and name: "Standup" (or leave the key out: it is the tools' common prefix).
When the app reads or changes Coline, or runs on a schedule, export defineApp and name what it needs:
import { defineApp, defineTool } from "@colineapp/sdk/app";
import { z } from "zod";
const openTasks = defineTool({
name: "triage.open_tasks",
description: "Counts my open tasks on a board.",
input: z.object({ taskboardId: z.string() }),
effect: "read",
execute: async ({ taskboardId }, { coline }) => {
const { tasks } = await coline.actions.tasks.list({ taskboardId });
return { output: { open: tasks.length } };
},
});
export default defineApp({
key: "triage",
name: "Triage",
description: "Keeps an eye on my boards.",
permissions: ["taskboards.read"],
tools: [openTasks],
});The call:
POST /api/v1/actions/apps.publish
{
"workspace": "acme",
"files": { "standup.ts": "import { defineTool } from ..." },
"key": "standup",
"name": "Standup"
}| Field | |
|---|---|
files | Path ā file text. Relative paths with forward slashes, at most 200 files and 2 MB in all. Nothing may start with __coline. |
entry | The file to build from. Default: app.config.ts, or the only file when you send one. |
key, name | For a file that exports tools rather than defineApp. The key defaults to the tools' common prefix. |
Rules the build checks:
- Every tool name starts with the app's key and a dot:
standup.add_entry. When one doesn't, the error says which names to change to what. - Imports may be files you send,
@colineapp/sdkand its subpaths, andzod. A screen (main.tsx) may also importreact,@colineapp/uiand@tabler/icons-react, and its own Tailwind classes are compiled. An app that needs other npm packages is pushed withnpx coline-app push. - A site isn't published this way. Put it online with
npx coline-app deploy. - Errors name the file and line where they can and say what to change. Fix it and publish again.
Publishing again with the same key makes a new version (0.0.1, 0.0.2, ā¦) and moves your install to it at once.
What it can do, and what waits
What stays inside the workspace is granted at once: the app's own storage, drive, jobs, tools, commands and events, and the Coline access the caller already has. An assistant's app never gets more than the assistant's own connection holds, and a coline-app sign-in holds only the right to publish, so everything else an app published from a terminal asks for waits for you.
Every door to the outside waits for the person, whoever publishes:
endpoints.receive: a public address that can run the appnetwork.external: each outside hostconnections.use: accounts on other servicesai.generate: Coline AI, billed to the workspace
The app runs meanwhile. A call that needs a waiting permission fails with permission_not_granted, and a public address answers 404 until it's approved. A new version that asks for more is the same again: more waits, nothing granted is lost.
{
"data": {
"app": { "key": "standup", "name": "Standup", "version": "0.0.1", "scope": "user", "url": "https://coline.app/acme/apps/standup" },
"tools": [
{ "name": "standup.add_entry", "description": "Adds your standup entry for today.", "effect": "write" },
{ "name": "standup.list_entries", "description": "Lists today's standup entries.", "effect": "read" }
],
"access": {
"granted": [
{ "permission": "storage.app", "label": "Store app data (key-value state and records) in the workspace." },
{ "permission": "ai.tools", "label": "Offer tools that Kairo and agents can run." }
],
"waiting": [],
"approveUrl": null
},
"exposes": [],
"warnings": [],
"source": "9f2cā¦"
}
}When anything waits, approveUrl opens the install's permissions in Coline, where its person approves it. Give that link to the person; nothing approves itself.
Use it
The app's tools are in Kairo for its person, and in every assistant through list_app_tools and run_app_tool. Its screen, if it has one, is at app.url.
Share it
A published app stays its person's until they share it with the workspace, in Coline. Sharing runs the workspace's app policy and the full consent for everything the app declares, by someone allowed to install apps; it then becomes the workspace's install with the same data. Your own bindings of workspace services are removed, since an admin binds those for the team. An assistant can't share an app.
Copy an app
apps.source.get (get_app_source) reads a version's files. To make your own copy, change the key (and the key at the start of each tool name and file type key) and publish it.
From a terminal
npx coline-app login # once
npx coline-app publish # from the app's folderAny member can sign in and publish; signing in only asks to publish apps just for you in the workspace you pick (an admin also gets to manage its apps and sites). It sends app.config.ts (or --entry <file>), main.tsx and every file they import from the folder, and prints where the app is, its tools, what it can do and what waits, with the link. --json prints the answer as { ok, data }. --key and --name are for a file that exports tools.
It sends only ordinary files inside the app's folder: never a file reached through a link, anything whose path has a part starting with a dot (.env.json, .coline/) or __coline, an absolute import, or a file that isn't text. Publishing is always a signed-in person's, so it takes no --api-key.
Which command:
publish | For yourself, in one step |
push | An app with its own npm packages, one whose logic runs on its own server, or one headed to the store |
deploy | A site |