@treeport/treeport 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 +12 -0
- package/bin/treeport.mjs +2 -0
- package/dist/dist-CUkImh2W.js +254 -0
- package/dist/node/cli/index.js +865 -0
- package/dist/node/server/core/launcher.js +189 -0
- package/dist/node/server/index.js +5489 -0
- package/dist/shell-integration-7aBNr-p0.js +256 -0
- package/dist/web/assets/index-C2QPZrxe.js +146 -0
- package/dist/web/assets/index-CC-O69aQ.css +2 -0
- package/dist/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/web/favicon.svg +1 -0
- package/dist/web/icon-192.png +0 -0
- package/dist/web/icon-512.png +0 -0
- package/dist/web/index.html +19 -0
- package/dist/web/manifest.webmanifest +13 -0
- package/drizzle/0000_public_baseline.sql +89 -0
- package/drizzle/meta/0000_snapshot.json +579 -0
- package/drizzle/meta/_journal.json +13 -0
- package/package.json +101 -0
- package/skills/treeport/SKILL.md +153 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: treeport
|
|
3
|
+
description: Understand Treeport-managed terminal context and safely create persistent, observable terminals and child worktrees with the Treeport CLI. Use when an agent or extension needs to inspect its Treeport environment, open another session, or spawn work in a separate worktree.
|
|
4
|
+
compatibility: Requires the treeport CLI on PATH and a reachable Treeport daemon. Creation commands also require the requested child executable to be installed.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Treeport
|
|
8
|
+
|
|
9
|
+
Treeport is a generic terminal and worktree layer. Its terminals are persistent tmux sessions that appear in the Treeport UI. A user can open a created terminal, take control of the normal application TUI, and continue working in the same session.
|
|
10
|
+
|
|
11
|
+
Treeport does not define task sources, planning or approval states, agent tool policies, or provider-specific workflows. The caller owns names, commands, prompts, and higher-level orchestration.
|
|
12
|
+
|
|
13
|
+
## Operating rules
|
|
14
|
+
|
|
15
|
+
- Use normal CLI output when you are reading the result. Use `--json` only for programmatic extraction or branching.
|
|
16
|
+
- Treat command arguments after `--` as an argv array. Do not turn them into a shell command string.
|
|
17
|
+
- Do not use `eval` or an implicit `sh -lc`. Launch a shell explicitly only when the caller intentionally requests shell semantics.
|
|
18
|
+
- Do not place untrusted titles, prompts, or other external text into interpolated shell fragments. Pass each value as one argument or use a caller-managed file when the child supports file arguments.
|
|
19
|
+
- Never delete a terminal or remove a worktree unless the user explicitly asks.
|
|
20
|
+
- Do not restrict a launched agent's normal tools or make it ephemeral unless the caller explicitly asks. The persistent interactive session is intended to remain useful when the user takes over.
|
|
21
|
+
|
|
22
|
+
## Understand the current context
|
|
23
|
+
|
|
24
|
+
Run:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
treeport context
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Inside a managed terminal, this reports the current project, worktree, terminal, paths, statuses, IDs, and daemon URL. It resolves the injected IDs strictly; it does not guess identity from the current path.
|
|
31
|
+
|
|
32
|
+
Outside Treeport it reports that the terminal is not managed and exits successfully. `TREEPORT_API_URL` may be configured outside a managed terminal; if any context ID is present, however, all injected values are required. Partial IDs or IDs that no longer belong together fail instead of falling back to path inference.
|
|
33
|
+
|
|
34
|
+
Use the exact IDs from this command for subsequent operations. `.` is a convenient shorthand for the current project or worktree, but exact IDs are clearer once context has been resolved.
|
|
35
|
+
|
|
36
|
+
## Create a terminal in the current worktree
|
|
37
|
+
|
|
38
|
+
Create a persistent login shell:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
treeport terminal create --worktree <worktree-id> --name <terminal-name>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Launch a program directly:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
treeport terminal create --worktree <worktree-id> --name <terminal-name> -- <program> <arg> ...
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The command returns after Treeport creates the tmux session. The program continues independently of the browser and of the caller that created it.
|
|
51
|
+
|
|
52
|
+
## Create a child worktree and terminal
|
|
53
|
+
|
|
54
|
+
Create a linked worktree and its first persistent terminal together:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
treeport spawn \
|
|
58
|
+
--project <project-id> \
|
|
59
|
+
--worktree-name <worktree-name> \
|
|
60
|
+
--name <terminal-name> \
|
|
61
|
+
-- <program> <arg> ...
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The child program and its arguments are entirely caller-owned. Treeport preserves them but does not add prompts, modes, capability restrictions, or lifecycle policy.
|
|
65
|
+
|
|
66
|
+
By default, Treeport bases the worktree on the fetched remote default branch. Add `--from-current` only when the caller wants the current worktree's committed `HEAD` as the base. Uncommitted changes are not copied.
|
|
67
|
+
|
|
68
|
+
Treeport serializes worktree mutations per project. If a caller needs several child worktrees, create them one at a time; their terminal programs can run concurrently after creation.
|
|
69
|
+
|
|
70
|
+
## Interpret creation results
|
|
71
|
+
|
|
72
|
+
A successful `terminal create` means the tmux session was created. The requested program can still exit later.
|
|
73
|
+
|
|
74
|
+
`spawn` is intentionally non-atomic after Git creates the worktree:
|
|
75
|
+
|
|
76
|
+
- A terminal ID means the persistent session was created.
|
|
77
|
+
- `terminalError` means the worktree remains but its initial terminal could not be created.
|
|
78
|
+
- `setupError` means worktree setup could not be prepared. A retained terminal may display that error and exit without launching the requested program.
|
|
79
|
+
- Setup tasks can also fail after the create response. Their output and failure remain visible in the retained terminal.
|
|
80
|
+
|
|
81
|
+
Report partial creation with the returned worktree and terminal IDs. Do not blindly rerun `spawn`: the worktree may already exist. Do not remove retained resources automatically.
|
|
82
|
+
|
|
83
|
+
Inspect terminal inventory later with:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
treeport terminal list --worktree <worktree-id>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Inspect one terminal's refreshed process status and volatile runtime metadata with:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
treeport terminal inspect <terminal-id>
|
|
93
|
+
treeport terminal inspect <terminal-id> --json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Runtime metadata includes the title, current OSC `9;4` progress, last progress start and clear timestamps, and latest daemon-observed real BEL. BEL metadata also reports daemon-lifetime unread attention shared by every browser; inspection and waits never acknowledge it, while viewing the terminal acknowledges the exact observed BEL sequence. `.` resolves to the exact `TREEPORT_TERMINAL_ID` inside a managed terminal; it is not a name or path lookup.
|
|
97
|
+
|
|
98
|
+
Read recent terminal contents with:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
treeport terminal capture <terminal-id>
|
|
102
|
+
treeport terminal capture <terminal-id> --lines 500
|
|
103
|
+
treeport terminal capture <terminal-id> --json
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Capture returns up to 200 pane rows by default. Plain output is the terminal text; JSON output includes the terminal ID, capture time, line limit, and content. `.` can be used for the current managed terminal.
|
|
107
|
+
|
|
108
|
+
Wait for raw terminal conditions without polling or scraping output:
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
treeport terminal wait <terminal-id> --until working
|
|
112
|
+
treeport terminal wait <terminal-id> --until idle --timeout 30m
|
|
113
|
+
treeport terminal wait <terminal-id> --until bell
|
|
114
|
+
treeport terminal wait <terminal-id> --until exit
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
- `idle` means no daemon-owned OSC progress is currently observed and can return immediately.
|
|
118
|
+
- `working` means daemon-owned OSC progress is currently present and can return immediately. Every valid active progress frame renews a five-minute inactivity lease; an explicit clear or terminal/observer shutdown clears immediately.
|
|
119
|
+
- `bell` means the next real BEL after the event subscription is established.
|
|
120
|
+
- `exit` means the retained terminal process has exited.
|
|
121
|
+
- Waits have no default timeout. Use a positive `ms`, `s`, `m`, or `h` duration when a deadline is required; Ctrl+C cancels.
|
|
122
|
+
|
|
123
|
+
Treeport does not infer agent settlement. An orchestrator can inspect first, wait for `working` if no progress cycle has been observed, and then wait for `idle`. Progress depends on the child application emitting OSC `9;4`; for Pi, `terminal.showTerminalProgress` must be enabled. Applications should clear progress or refresh active progress more frequently than the five-minute lease. A null progress value is not proof that every application supports progress reporting.
|
|
124
|
+
|
|
125
|
+
## Automation and integrations
|
|
126
|
+
|
|
127
|
+
Extensions and scripts should add `--json` before the `--` command separator:
|
|
128
|
+
|
|
129
|
+
```sh
|
|
130
|
+
treeport context --json
|
|
131
|
+
|
|
132
|
+
treeport terminal create \
|
|
133
|
+
--worktree <worktree-id> \
|
|
134
|
+
--name <terminal-name> \
|
|
135
|
+
--json -- <program> <arg> ...
|
|
136
|
+
|
|
137
|
+
treeport spawn \
|
|
138
|
+
--project <project-id> \
|
|
139
|
+
--worktree-name <worktree-name> \
|
|
140
|
+
--name <terminal-name> \
|
|
141
|
+
--json -- <program> <arg> ...
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
JSON success output is written to stdout. JSON errors use `{ "error": { "code", "message", "details"? } }` on stderr. Relevant exit codes are:
|
|
145
|
+
|
|
146
|
+
- `0`: command completed; for `spawn`, still inspect `terminal`, `terminalError`, and `setupError`.
|
|
147
|
+
- `2`: invalid CLI usage.
|
|
148
|
+
- `3`: the daemon could not be reached or its event stream failed.
|
|
149
|
+
- `4`: a terminal wait timed out.
|
|
150
|
+
- `5`: API, domain, or invalid-context refusal.
|
|
151
|
+
- `130`: a terminal wait was interrupted with Ctrl+C.
|
|
152
|
+
|
|
153
|
+
Treeport currently has no authentication. Use it only through a trusted local or private-network listener; do not invent credentials or put secrets in command arguments or URLs.
|