@pmndrs/pine 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +180 -2
- package/bin/pine.js +27 -0
- package/docs/SKILL.md +189 -0
- package/docs/references/agents.md +368 -0
- package/docs/references/coding.md +126 -0
- package/docs/references/configuration.md +229 -0
- package/docs/references/events.md +263 -0
- package/docs/references/mcp.md +257 -0
- package/docs/references/operations.md +280 -0
- package/docs/references/overview.md +186 -0
- package/docs/references/security.md +489 -0
- package/docs/references/setup.md +181 -0
- package/docs/references/sources.md +768 -0
- package/docs/references/stack.md +105 -0
- package/docs/references/tui.md +348 -0
- package/examples/home/.env.example +5 -0
- package/examples/home/USER.md +4 -0
- package/examples/home/agents/main/agent.json +4 -0
- package/examples/home/agents/main/workspace/AGENTS.md +14 -0
- package/examples/home/agents/main/workspace/MEMORY.md +4 -0
- package/examples/home/agents/main/workspace/SOUL.md +4 -0
- package/examples/home/models.json +62 -0
- package/examples/home/pine.json +30 -0
- package/examples/home/skills/README.txt +7 -0
- package/examples/launchd/com.pine.daemon.plist +32 -0
- package/mcp/browser.d.ts +34 -0
- package/mcp/browser.js +228 -0
- package/mcp/commands.d.ts +20 -0
- package/mcp/commands.js +88 -0
- package/mcp/lib.d.ts +13 -0
- package/mcp/lib.js +50 -0
- package/mcp/web.d.ts +6 -0
- package/mcp/web.js +140 -0
- package/package.json +32 -4
- package/src/agent-admin.d.ts +24 -0
- package/src/agent-admin.js +55 -0
- package/src/agents.d.ts +343 -0
- package/src/agents.js +1587 -0
- package/src/cli.d.ts +2 -0
- package/src/cli.js +526 -0
- package/src/config.d.ts +351 -0
- package/src/config.js +514 -0
- package/src/dev/claude-model.d.ts +28 -0
- package/src/dev/claude-model.js +174 -0
- package/src/env-file.d.ts +4 -0
- package/src/env-file.js +40 -0
- package/src/http.d.ts +46 -0
- package/src/http.js +407 -0
- package/src/limiter.d.ts +32 -0
- package/src/limiter.js +84 -0
- package/src/login.d.ts +21 -0
- package/src/login.js +126 -0
- package/src/manual.d.ts +61 -0
- package/src/manual.js +425 -0
- package/src/mcp-config.d.ts +40 -0
- package/src/mcp-config.js +132 -0
- package/src/net.d.ts +36 -0
- package/src/net.js +122 -0
- package/src/pine.d.ts +32 -0
- package/src/pine.js +142 -0
- package/src/router.d.ts +56 -0
- package/src/router.js +164 -0
- package/src/sandbox-fs.d.ts +27 -0
- package/src/sandbox-fs.js +172 -0
- package/src/security.d.ts +121 -0
- package/src/security.js +363 -0
- package/src/skills.d.ts +67 -0
- package/src/skills.js +163 -0
- package/src/source-types.d.ts +61 -0
- package/src/source-types.js +1 -0
- package/src/sources/command.d.ts +4 -0
- package/src/sources/command.js +77 -0
- package/src/sources/folder.d.ts +6 -0
- package/src/sources/folder.js +116 -0
- package/src/sources/ftp.d.ts +4 -0
- package/src/sources/ftp.js +307 -0
- package/src/sources/http.d.ts +4 -0
- package/src/sources/http.js +201 -0
- package/src/sources/mqtt.d.ts +18 -0
- package/src/sources/mqtt.js +97 -0
- package/src/sources/telegram.d.ts +22 -0
- package/src/sources/telegram.js +269 -0
- package/src/sources/webhook.d.ts +4 -0
- package/src/sources/webhook.js +52 -0
- package/src/sources.d.ts +339 -0
- package/src/sources.js +955 -0
- package/src/store.d.ts +89 -0
- package/src/store.js +251 -0
- package/src/timers.d.ts +83 -0
- package/src/timers.js +318 -0
- package/src/tools.d.ts +6 -0
- package/src/tools.js +777 -0
- package/src/tui/app.d.ts +209 -0
- package/src/tui/app.js +2223 -0
- package/src/tui/client.d.ts +178 -0
- package/src/tui/client.js +116 -0
- package/src/tui/code-pane.d.ts +51 -0
- package/src/tui/code-pane.js +398 -0
- package/src/tui/highlight.d.ts +8 -0
- package/src/tui/highlight.js +86 -0
- package/src/tui/picture.d.ts +141 -0
- package/src/tui/picture.js +571 -0
- package/src/tui/run.d.ts +8 -0
- package/src/tui/run.js +97 -0
- package/src/tui/theme.d.ts +32 -0
- package/src/tui/theme.js +128 -0
- package/src/types.d.ts +124 -0
- package/src/types.js +1 -0
- package/src/update.d.ts +25 -0
- package/src/update.js +110 -0
- package/src/util.d.ts +32 -0
- package/src/util.js +116 -0
- package/src/watching.d.ts +20 -0
- package/src/watching.js +68 -0
- package/src/workspace-view.d.ts +38 -0
- package/src/workspace-view.js +160 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Changing the setup: tool calls, not files
|
|
2
|
+
|
|
3
|
+
pine's configuration is a few small JSON files, and they stay small because agents never write
|
|
4
|
+
them. In every mode, bypass included, pine's home folder is closed to an agent's shell and file
|
|
5
|
+
tools. What an agent may set up, it sets up by calling a tool. The tool checks what it is given,
|
|
6
|
+
asks you where that matters, and writes exactly the lines that are needed; when the thing is
|
|
7
|
+
removed, those lines go again and nothing is left behind (no empty lists, no stale access).
|
|
8
|
+
|
|
9
|
+
Four things reach an agent from outside its conversation, and all four are set up the same
|
|
10
|
+
way, with the same three scopes:
|
|
11
|
+
|
|
12
|
+
- **Events**: what happens elsewhere wakes the agent ([sources.md](sources.md)).
|
|
13
|
+
- **Schedules**: the time wakes the agent, with a task ([events.md](events.md)).
|
|
14
|
+
- **MCP servers**: tools the agent can call ([mcp.md](mcp.md)).
|
|
15
|
+
- **Skills**: how something is done, written down once ([agents.md](agents.md)).
|
|
16
|
+
|
|
17
|
+
The main agent can set each of them up for one conversation, for itself, or for all agents.
|
|
18
|
+
Every other agent can do so for one conversation or for itself.
|
|
19
|
+
|
|
20
|
+
You can still edit the files yourself, and the `pine` command changes them for you. This page
|
|
21
|
+
is about what agents can do.
|
|
22
|
+
|
|
23
|
+
## Who can set up what
|
|
24
|
+
|
|
25
|
+
| What | For one conversation | For the agent | For all agents |
|
|
26
|
+
|---|---|---|---|
|
|
27
|
+
| An event source (folder, MQTT, web address, command, webhook, FTP, Telegram) | any agent (`add_source`) | any agent, when you say so | **only the main agent** |
|
|
28
|
+
| A subscription to a source | any agent (`subscribe`) | any agent, when you say so | **only the main agent** |
|
|
29
|
+
| A schedule | any agent (`add_schedule`) | any agent, when you say so | **only the main agent** |
|
|
30
|
+
| A remote MCP server | any agent (`add_mcp_server`) | any agent, when you say so | **only the main agent** |
|
|
31
|
+
| A skill | any agent (`add_skill`) | any agent, when you say so | **only the main agent** |
|
|
32
|
+
| A new agent | | | **only the main agent** (`create_agent`) |
|
|
33
|
+
| A new type of event source (a program) | | | **only the main agent** (`add_source_type`), you confirm every time |
|
|
34
|
+
|
|
35
|
+
The main agent is the one `pine.json` names with `"main"`; without that entry it is the agent
|
|
36
|
+
called `main`, or else the first one. The other agents do not have `create_agent` or
|
|
37
|
+
`add_source_type`, and they are refused when they ask for the global scope. Their instructions tell them who can do it, so
|
|
38
|
+
an agent you ask for something that is not its to do sends you to the main agent instead of
|
|
39
|
+
trying.
|
|
40
|
+
|
|
41
|
+
## Three scopes
|
|
42
|
+
|
|
43
|
+
| Scope | Who gets it | It lasts |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| **conversation** (`local`, the default) | The conversation it was asked for in, and the sub-agents that conversation starts. Other conversations of the same agent do not see it. | Until that conversation is removed (by you, or by itself when unused; see [tui.md](tui.md)). Subscriptions also end when its tab is closed or it is reset. |
|
|
46
|
+
| **agent** | Every conversation of that agent. A subscription wakes its main conversation. | Until it is removed. |
|
|
47
|
+
| **global** | Every agent. | Until the main agent or you remove it. |
|
|
48
|
+
|
|
49
|
+
When a conversation is removed, everything that was set up for it alone is removed with it:
|
|
50
|
+
its event sources and subscriptions, its schedules, its MCP servers and its skills. When it is
|
|
51
|
+
renamed, all of that follows it to the new name. What was set up for the agent or for all
|
|
52
|
+
agents is not touched by either.
|
|
53
|
+
|
|
54
|
+
"Connect this server", "watch that folder", "subscribe to it", "remind me at five", "make a
|
|
55
|
+
skill for this", said in any conversation, means that conversation. An agent passes a wider scope only when you say so in so many words ("for
|
|
56
|
+
you as an agent", "always"; "for all agents"). In an agent's main conversation there is no
|
|
57
|
+
difference between the first two: the main conversation is the agent.
|
|
58
|
+
|
|
59
|
+
## What you are asked
|
|
60
|
+
|
|
61
|
+
| An agent wants to | You are asked |
|
|
62
|
+
|---|---|
|
|
63
|
+
| Add an MCP server | Always, in every mode. The dialog names the server, its URL and who gets it. |
|
|
64
|
+
| Add a source that opens something new (a folder outside its workspace, a broker, a port), is to be trusted as yours, or is for all agents | Yes, with what it will do in plain words. A folder inside its own workspace is not asked about. |
|
|
65
|
+
| Subscribe the conversation it is in | No. |
|
|
66
|
+
| Subscribe the agent as such from another conversation, or all agents | Yes. Deny it if you meant this conversation only. |
|
|
67
|
+
| End a subscription of its own agent | No. |
|
|
68
|
+
| Schedule something for the conversation it is in, or for itself from its main conversation | No. |
|
|
69
|
+
| Schedule something for the agent from another conversation, or for all agents | Yes, with the times and the task. |
|
|
70
|
+
| Add or replace a skill for the conversation it is in, or for itself from its main conversation | No. Its instructions are its own to write, as its `AGENTS.md` is. |
|
|
71
|
+
| Add or replace a skill for the agent from another conversation, or for all agents | Yes. The dialog shows the description and the instructions. |
|
|
72
|
+
| Remove a server, a source, a schedule or a skill that is the conversation's own | No. |
|
|
73
|
+
| Remove a server, a source, a schedule or a skill of the agent (from another conversation than its main one) or of all agents | Yes. |
|
|
74
|
+
| Create an agent | Always. The dialog shows its id, description, model, tools and instructions. |
|
|
75
|
+
| Register a new type of event source | Always, in every mode. The dialog says that it is a program, how long it is, what it imports and where the file is. |
|
|
76
|
+
| Take a source type out again | Yes. |
|
|
77
|
+
| End a subscription for all agents | No (the main agent only). |
|
|
78
|
+
|
|
79
|
+
In manual mode, and in a conversation that has read outside content, the questions that are
|
|
80
|
+
otherwise skipped are asked too (ending a subscription: in manual mode only).
|
|
81
|
+
|
|
82
|
+
Two things are not asked but refused in a conversation that has read outside content, because
|
|
83
|
+
what they write is read back as instructions or runs as a program: `add_skill` and
|
|
84
|
+
`add_source_type`. Start a new conversation for them.
|
|
85
|
+
Runs with the
|
|
86
|
+
reduced tool set, which outside events start through a route or a subscription marked
|
|
87
|
+
`separate`, have none of these tools, and neither have sub-agents.
|
|
88
|
+
|
|
89
|
+
## The tools
|
|
90
|
+
|
|
91
|
+
| Tool | Does |
|
|
92
|
+
|---|---|
|
|
93
|
+
| **Events** | |
|
|
94
|
+
| `sources` | Lists the event sources this conversation can use and who is subscribed. |
|
|
95
|
+
| `add_source` `name` `type` `description` [`options`] [`scope`] [`note`] [`throttle`] [`own`] [`ask`] | Sets up a source; with a note it subscribes at once. `options` is an object with the options of the chosen type ([sources.md](sources.md)). `own: true` marks it as your own device or folder, whose events are trusted. `ask` names secret options that you are to type into the dialog. |
|
|
96
|
+
| `subscribe` `source` [`scope`] [`note`] [`when`] [`throttle`], `unsubscribe` `source` [`scope`] | Starts or ends being woken by a source. For `unsubscribe` the scope can also be `all`: everything the agent has on that source. |
|
|
97
|
+
| `send` `source` [`text`] [`data`] | Sends something out through a source that can send (Telegram, MQTT). |
|
|
98
|
+
| `remove_source` `name` | Stops a source, unsubscribes everyone from it and deletes it. For a watched folder, the read access that came with it goes too. |
|
|
99
|
+
| `add_source_type` `name` `file`, `remove_source_type` `name` | Main agent only. Registers a module the agent wrote as a new type of source, or takes one out. |
|
|
100
|
+
| **Schedules** | |
|
|
101
|
+
| `schedules` | Lists what is scheduled for the agent and when each is next due. |
|
|
102
|
+
| `add_schedule` `name` `task` + one of `cron`, `every`, `at`, `in` [`scope`] | Does the task at set times, every so often, or once. One that happens once removes itself. |
|
|
103
|
+
| `remove_schedule` `name` | Ends a schedule. |
|
|
104
|
+
| **MCP servers** | |
|
|
105
|
+
| `add_mcp_server` `name` `url` [`description`] [`scope`] | Proposes a remote MCP server (https). A local one, a program that runs with your rights, is yours to add: `pine mcp add`. |
|
|
106
|
+
| `remove_mcp_server` `name` | Takes a server out again. |
|
|
107
|
+
| **Skills** | |
|
|
108
|
+
| `add_skill` `name` `description` `instructions` [`files`] [`scope`] | Writes a skill; the same name in the same place replaces it. `files` is a folder in the agent's workspace whose contents go along. |
|
|
109
|
+
| `remove_skill` `name` | Deletes a skill in pine's own skill folders (`skills/`, `agents/<id>/skills/`, a conversation's), also one you put there by hand. A skill in a folder named under `skills` in a configuration file is yours to remove. |
|
|
110
|
+
| **Agents** | |
|
|
111
|
+
| `create_agent` `id` `description` `instructions` [`model`] [`tools`] | Main agent only. See below. |
|
|
112
|
+
|
|
113
|
+
Everything takes effect without a restart. An agent has new MCP tools and new skills from its
|
|
114
|
+
next message on.
|
|
115
|
+
|
|
116
|
+
## Creating an agent
|
|
117
|
+
|
|
118
|
+
Ask the main agent: "create an agent that keeps my books". It calls `create_agent` with an id,
|
|
119
|
+
one line on what the agent is for, its instructions, and optionally a model and a list of
|
|
120
|
+
built-in tools (`read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`; all of them by default).
|
|
121
|
+
What cannot work (a bad id, a name that is taken, an unknown tool or model) is said before you
|
|
122
|
+
are asked anything. After your yes:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
agents/books/
|
|
126
|
+
agent.json { "description": "...", "tools": [...] } and "model" if one was named
|
|
127
|
+
workspace/
|
|
128
|
+
AGENTS.md the instructions; the new agent can change them itself from then on
|
|
129
|
+
SOUL.md a stub
|
|
130
|
+
MEMORY.md a stub
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Nothing else is written into `agent.json`; every other setting is pine's default. The agent
|
|
134
|
+
exists at once: it is in the terminal UI's agent list (`/agent books`), `pine send books ...`
|
|
135
|
+
reaches it, and the main agent can hand it work with `delegate`. It starts with no MCP servers
|
|
136
|
+
and no event sources of its own, and sets those up itself when you ask it to.
|
|
137
|
+
|
|
138
|
+
Agents are not removed by tool call: an agent's folder holds its workspace and everything said
|
|
139
|
+
to it. To remove one, stop pine and delete `agents/<id>`.
|
|
140
|
+
|
|
141
|
+
## What is written
|
|
142
|
+
|
|
143
|
+
These are the only entries the tools make. A thing made for one conversation carries that
|
|
144
|
+
conversation's name as `session`, which is how pine knows whose it is and when to remove it.
|
|
145
|
+
|
|
146
|
+
```jsonc
|
|
147
|
+
// agents/main/agent.json after: a server and a schedule for the agent, a source and a subscription for the conversation "taxes"
|
|
148
|
+
{
|
|
149
|
+
"description": "Your main agent",
|
|
150
|
+
"mcp": { "notes": { "url": "https://mcp.example.com/mcp", "approve": "tainted" } },
|
|
151
|
+
"sources": { "scans": { "type": "folder", "description": "what the scanner saves", "session": "taxes", "dir": "/Users/me/Scans" } },
|
|
152
|
+
"sandbox": { "read": ["/Users/me/Scans"] },
|
|
153
|
+
"subscribe": [{ "source": "scans", "note": "Say which document arrived.", "session": "taxes" }],
|
|
154
|
+
"schedules": [{ "name": "brief", "cron": "30 7 * * 1-5", "task": "Prepare the morning brief." }]
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Remove the conversation "taxes" and the source, the subscription and the read access are gone;
|
|
159
|
+
the file is as it was before, with the server and the schedule left. Rename the conversation and the entries
|
|
160
|
+
follow its new name.
|
|
161
|
+
|
|
162
|
+
A skill needs no entry at all. Where its folder lies says whom it is for:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
~/.pine/
|
|
166
|
+
skills/<name>/ all agents
|
|
167
|
+
agents/<id>/skills/<name>/ that agent
|
|
168
|
+
agents/<id>/conversations/<session>/skills/<name>/ that one conversation
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Each holds a `SKILL.md` and the files that went along. Agents read these folders and cannot
|
|
172
|
+
write them; pine writes them when `add_skill` is called. Removing a skill deletes its folder,
|
|
173
|
+
and the folders above it that it leaves empty. `pine skills` lists every skill with whom it is
|
|
174
|
+
for.
|
|
175
|
+
|
|
176
|
+
## What stays yours
|
|
177
|
+
|
|
178
|
+
An agent's built-in tools, model, its sandbox settings, routes, local MCP
|
|
179
|
+
servers, source types you write yourself, and removing agents: these are changed in the files
|
|
180
|
+
or with the `pine` command, and most need a restart. See [configuration.md](configuration.md),
|
|
181
|
+
[agents.md](agents.md), [mcp.md](mcp.md) and [sources.md](sources.md).
|