pirc-extension 0.0.0-stage → 0.3.8
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.
- pirc-extension-0.3.8/LICENSE +21 -0
- pirc-extension-0.3.8/NOTICE +78 -0
- pirc-extension-0.3.8/README.md +131 -0
- pirc-extension-0.3.8/loader.js +15 -0
- pirc-extension-0.3.8/package.json +27 -0
- pirc-extension-0.3.8/pi-parts.js +13 -0
- pirc-extension-0.3.8/pirc.js +9973 -0
- pirc-extension-0.3.8/third_party/bufbuild-protobuf/LICENSE +48 -0
- pirc-extension-0.3.8/third_party/bufbuild-protobuf/LICENSE-Apache-2.0 +202 -0
- pirc-extension-0.3.8/third_party/ws/LICENSE +20 -0
- package/README.md +0 -3
- package/package.json +0 -6
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Justino Ltd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
PiRC
|
|
2
|
+
Copyright (c) 2026 Justino Ltd
|
|
3
|
+
|
|
4
|
+
PiRC is open source, under three licences by part:
|
|
5
|
+
|
|
6
|
+
- MIT (LICENSE): the pi extension (extension/), the code it shares
|
|
7
|
+
with clients (proto/, protocol/, relay-client/, cases/), the push
|
|
8
|
+
gateway (relay/cmd/pirc-gateway, relay/internal/gateway), and the
|
|
9
|
+
rest of the repository.
|
|
10
|
+
- AGPL-3.0 only: the relay (relay/cmd/pirc-relay, relay/internal/server,
|
|
11
|
+
relay/internal/registry) and the web app (web/). Each directory has
|
|
12
|
+
the licence as LICENSE and its notice as COPYRIGHT.
|
|
13
|
+
- GPL-3.0 only: the mobile app (app/; app/LICENSE, app/COPYRIGHT).
|
|
14
|
+
|
|
15
|
+
The name PiRC and its icon are Justino Ltd's marks, which the licences
|
|
16
|
+
do not cover (TRADEMARKS.md).
|
|
17
|
+
|
|
18
|
+
Code adapted from other projects
|
|
19
|
+
--------------------------------
|
|
20
|
+
|
|
21
|
+
None yet. Anything adapted keeps its project's copyright notice and is
|
|
22
|
+
listed here and in docs/design.md, section 11, with the upstream commit it
|
|
23
|
+
came from.
|
|
24
|
+
|
|
25
|
+
Third-party code in PiRC's releases
|
|
26
|
+
-----------------------------------
|
|
27
|
+
|
|
28
|
+
The relay's and the gateway's binaries and the JavaScript bundles include code from the projects
|
|
29
|
+
below. A bundle or binary does not keep their source headers, so their
|
|
30
|
+
licences are reproduced in full under third_party/, and every release
|
|
31
|
+
carries the ones that apply to it.
|
|
32
|
+
|
|
33
|
+
pirc-relay (Go):
|
|
34
|
+
- The Go standard library, Copyright 2009 The Go Authors.
|
|
35
|
+
BSD-3-Clause, with a patent grant: third_party/go/
|
|
36
|
+
- golang.org/x/crypto, net and text, as vendored by the Go standard
|
|
37
|
+
library, Copyright 2009 The Go Authors. BSD-3-Clause:
|
|
38
|
+
third_party/golang.org-x/
|
|
39
|
+
- github.com/coder/websocket 1.8.15, Copyright (c) 2025 Coder. ISC:
|
|
40
|
+
third_party/coder-websocket/
|
|
41
|
+
- google.golang.org/protobuf 1.36.12, Copyright (c) 2018 The Go
|
|
42
|
+
Authors. BSD-3-Clause, with a patent grant: third_party/go-protobuf/
|
|
43
|
+
- rsc.io/qr 0.2.0, Copyright (c) 2009 The Go Authors. BSD-3-Clause:
|
|
44
|
+
third_party/rsc-qr/
|
|
45
|
+
|
|
46
|
+
pirc-gateway (Go): the Go standard library and golang.org/x, as for
|
|
47
|
+
pirc-relay above; no other module.
|
|
48
|
+
|
|
49
|
+
The pi extension (a JavaScript bundle):
|
|
50
|
+
- @bufbuild/protobuf 2.16.0, Copyright 2021-2026 Buf Technologies, Inc.
|
|
51
|
+
Apache-2.0; parts Copyright 2008 Google Inc., BSD-3-Clause:
|
|
52
|
+
third_party/bufbuild-protobuf/
|
|
53
|
+
- ws 8.22.0, Copyright (c) 2011 Einar Otto Stangvik, (c) 2013 Arnout
|
|
54
|
+
Kazemier and contributors, (c) 2016 Luigi Pinca and contributors. MIT:
|
|
55
|
+
third_party/ws/
|
|
56
|
+
|
|
57
|
+
The web app (its server's JavaScript bundle and its page): far more
|
|
58
|
+
packages, so each build lists those it carries, with every licence in
|
|
59
|
+
full, in a file written from the bundle itself (sh/licenses.ts): the
|
|
60
|
+
release's third-party-licenses.txt for the server, and
|
|
61
|
+
page/third-party-licenses.txt for the page, which the server also serves
|
|
62
|
+
at /third-party-licenses.txt to every browser it sends the page to.
|
|
63
|
+
The page's fonts, Literata, Atkinson Hyperlegible Next, JetBrains Mono,
|
|
64
|
+
Geist, Geist Mono and IBM Plex Sans, are under the SIL Open Font License
|
|
65
|
+
1.1 and are listed there with it.
|
|
66
|
+
|
|
67
|
+
The mobile app (app/): its Dart and Flutter packages, among them image,
|
|
68
|
+
re_highlight, mobile_scanner and qr, and Flutter's engine and framework,
|
|
69
|
+
each with its licence in full, are listed in the NOTICES file that
|
|
70
|
+
Flutter's build writes from the packages themselves and ships inside every
|
|
71
|
+
build of the app (flutter_assets/NOTICES.Z, read by the framework's
|
|
72
|
+
LicenseRegistry). The Android libraries Gradle adds (AndroidX, Firebase
|
|
73
|
+
Cloud Messaging, ML Kit's barcode scanning, Kotlin's coroutines and what
|
|
74
|
+
they bring in), which that file leaves out, are listed with their
|
|
75
|
+
licences in full in a file each Android release build writes from its own
|
|
76
|
+
dependencies (app/android/app/build.gradle.kts, the texts in
|
|
77
|
+
app/android/notices/), shipped in the app as pirc/android_notices.json
|
|
78
|
+
and shown on the same Licences page.
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# pirc-extension
|
|
2
|
+
|
|
3
|
+
The [pi](https://github.com/earendil-works/pi) extension of
|
|
4
|
+
[PiRC](https://pirc.dev): it puts every interactive pi session on a PiRC
|
|
5
|
+
relay, so that you can follow and drive it from a phone or another
|
|
6
|
+
client. You need a relay of your own; PiRC's self-hosting guide covers
|
|
7
|
+
running one,
|
|
8
|
+
[`docs/self-hosting.md`](https://github.com/pirc-dev/pirc/blob/master/docs/self-hosting.md).
|
|
9
|
+
|
|
10
|
+
This repository holds releases only: the extension built into one file
|
|
11
|
+
(`pirc.js`); `loader.js`, which loads it; and `pi-parts.js`, which hands it
|
|
12
|
+
the parts of pi it draws images with. Its source is in PiRC's repository,
|
|
13
|
+
[pirc-dev/pirc](https://github.com/pirc-dev/pirc), where issues go too.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
It is tested with pi 1.0.0 and the current pi on every change, and expects
|
|
18
|
+
pi 1.0.0 or later in 1.x; outside that, `/pirc status` says so.
|
|
19
|
+
|
|
20
|
+
From 0.3.8 it is on npm, as `pirc-extension`, published from each
|
|
21
|
+
release's own archive. Pin it to a release:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
pi install npm:pirc-extension@X.Y.Z
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
To upgrade, upgrade your relay first, then install the newer version the
|
|
28
|
+
same way. `pi update` keeps a pinned install where it is.
|
|
29
|
+
|
|
30
|
+
Or from this repository, with `git` and `npm`:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
pi install git:github.com/pirc-dev/pirc-extension@vX.Y.Z
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
pi counts the two as different packages, so installed both ways it loads
|
|
37
|
+
two copies; the one loaded second does nothing but say so. To move from git
|
|
38
|
+
to npm, `pi remove git:github.com/pirc-dev/pirc-extension` first.
|
|
39
|
+
|
|
40
|
+
Installing without a version follows the latest release instead, on npm
|
|
41
|
+
or on this repository's default branch, which moves only when a release
|
|
42
|
+
is published: `pi update` then installs the latest release as soon as it
|
|
43
|
+
is out, before you have read it. The extension runs in pi, with pi's
|
|
44
|
+
access to your machine, so that is the publisher's next release running
|
|
45
|
+
there unseen, possibly ahead of your relay. Pin it, unless following along
|
|
46
|
+
is what you want.
|
|
47
|
+
|
|
48
|
+
## Enrol
|
|
49
|
+
|
|
50
|
+
In pi:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
/pirc enrol wss://<relay-address>:<port>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The footer reads "pirc: awaiting approval" until the host is approved: in
|
|
57
|
+
PiRC's web app, which lists the hosts asking to join, or on the relay,
|
|
58
|
+
where `pirc-relay pending` lists them and `pirc-relay approve <key>` admits
|
|
59
|
+
one. Compare the key with the one `/pirc status` shows here: the label is
|
|
60
|
+
whatever the host claims.
|
|
61
|
+
|
|
62
|
+
Or, to skip the approval, issue a host token on the relay first
|
|
63
|
+
(`pirc-relay add-host --label <name>`) and give it to the command:
|
|
64
|
+
`/pirc enrol wss://<relay-address>:<port> <token>`.
|
|
65
|
+
|
|
66
|
+
`/pirc status` shows the connection, and `/pirc reconnect` reconnects.
|
|
67
|
+
The enrolment is saved in `~/.config/pirc/host.json` (or the file
|
|
68
|
+
`PIRC_CONFIG` names), with the host's key beside it in `host.key`; every pi
|
|
69
|
+
process on the host uses the same key. `PIRC_RELAY` overrides the relay
|
|
70
|
+
URL, and `PIRC_TOKEN` supplies a registration token, so a host can be
|
|
71
|
+
enrolled without the command; a relay URL without a token asks for approval.
|
|
72
|
+
|
|
73
|
+
If the relay's certificate is self-signed or from a private CA, set
|
|
74
|
+
`NODE_EXTRA_CA_CERTS` to the CA's PEM file in the environment pi starts in.
|
|
75
|
+
|
|
76
|
+
## Where pi runs
|
|
77
|
+
|
|
78
|
+
Clients name a session by the terminal it runs in. In tmux, that is the
|
|
79
|
+
tmux session and window (found through `$TMUX_PANE`); in
|
|
80
|
+
[herdr](https://herdr.dev), the workspace and tab (through its socket).
|
|
81
|
+
The names are checked again whenever pi does something: a prompt, a turn
|
|
82
|
+
starting or ending, a client's request. So a window renamed while pi sits
|
|
83
|
+
idle shows its new name after pi's next turn.
|
|
84
|
+
|
|
85
|
+
For any other terminal, or to name sessions your own way, another pi
|
|
86
|
+
extension can say where pi runs:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
pi.events.emit("pirc:place", { kind: "zellij", group: "work", window: "api" });
|
|
90
|
+
pi.events.emit("pirc:place", { display: "deploys" }); // shown as it is
|
|
91
|
+
pi.events.emit("pirc:place", {}); // show nothing
|
|
92
|
+
pi.events.emit("pirc:place", null); // back to PiRC's own detection
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Fields: `kind`, `group` (a tmux session, a workspace), `groupNumber`,
|
|
96
|
+
`window` (a window, a tab), `windowNumber`, `pane` and `display`, each
|
|
97
|
+
optional; names are cut to 128 bytes. A place given this way stands until
|
|
98
|
+
the next one, so the extension can update it whenever it likes.
|
|
99
|
+
|
|
100
|
+
## Questions
|
|
101
|
+
|
|
102
|
+
A dialog another extension shows in pi's terminal (`ctx.ui.select`,
|
|
103
|
+
`confirm`, `input`) is asked of PiRC's clients too, and whichever answers
|
|
104
|
+
first wins: an answer from a client closes the terminal's dialog. An
|
|
105
|
+
editor or a custom dialog is shown to clients as waiting, and answered
|
|
106
|
+
only in the terminal. This wraps pi's `ui` object, which pi does not
|
|
107
|
+
document; if a pi version stops allowing it, `/pirc status` says so.
|
|
108
|
+
|
|
109
|
+
## Opening new agents
|
|
110
|
+
|
|
111
|
+
A client can stop a pi, and open a new one beside it: in tmux, a window
|
|
112
|
+
after pi's; in herdr, a tab in its workspace, named as the client asks. The
|
|
113
|
+
new pi runs in the folder the client chose, with this pi's `PI_*` and
|
|
114
|
+
`PIRC_*` settings. Elsewhere,
|
|
115
|
+
or to open it your own way, another pi extension can give the launcher:
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
pi.events.emit("pirc:launcher", {
|
|
119
|
+
name: "kitty",
|
|
120
|
+
// command is the pi to run; env, the variables to add; name, the
|
|
121
|
+
// window's ("" for none).
|
|
122
|
+
launch: async ({ cwd, command, env, name }) => { /* open it */ },
|
|
123
|
+
});
|
|
124
|
+
pi.events.emit("pirc:launcher", false); // no launching from this pi
|
|
125
|
+
pi.events.emit("pirc:launcher", null); // back to PiRC's own
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Licence
|
|
129
|
+
|
|
130
|
+
MIT; see `LICENSE`. The bundle includes third-party code, listed in
|
|
131
|
+
`NOTICE`, under the licences in `third_party/`.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// The published extension's entry point. pi's /reload imports the
|
|
2
|
+
// extension again, but Node keeps every JavaScript module it has imported,
|
|
3
|
+
// so a bundle updated in place would not run until pi restarted. This file
|
|
4
|
+
// imports the bundle beside it by a URL that changes when the file does,
|
|
5
|
+
// so a reload after an update runs the new code, and is the same in every
|
|
6
|
+
// version, so that its own copy, which Node keeps, is never stale. Not
|
|
7
|
+
// index.js: versions before it had their bundle there, which Node would
|
|
8
|
+
// still hold after updating from one of them.
|
|
9
|
+
import { statSync } from "node:fs";
|
|
10
|
+
|
|
11
|
+
export default async function (pi) {
|
|
12
|
+
const bundle = new URL("./pirc.js", import.meta.url);
|
|
13
|
+
const { default: factory } = await import(`${bundle.href}?t=${statSync(bundle).mtimeMs}`);
|
|
14
|
+
return factory(pi);
|
|
15
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pirc-extension",
|
|
3
|
+
"version": "0.3.8",
|
|
4
|
+
"description": "PiRC: puts every interactive pi session on a PiRC relay",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://pirc.dev",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/pirc-dev/pirc.git",
|
|
10
|
+
"directory": "extension"
|
|
11
|
+
},
|
|
12
|
+
"type": "module",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"pi-package"
|
|
15
|
+
],
|
|
16
|
+
"pi": {
|
|
17
|
+
"extensions": [
|
|
18
|
+
"./pi-parts.js",
|
|
19
|
+
"./loader.js"
|
|
20
|
+
],
|
|
21
|
+
"image": "https://pirc.dev/shots/web-dark.webp"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
25
|
+
"@earendil-works/pi-tui": "*"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The published extension's first entry, before loader.js: what the bundle
|
|
2
|
+
// cannot import of pi, left for it on globalThis (docs/design.md, section
|
|
3
|
+
// 8). pi's loader resolves pi's packages for a file with a static import of
|
|
4
|
+
// one, as here, but not for the bundle, which Node imports. These are pi-tui
|
|
5
|
+
// and pi's conversion to PNG, the very modules pi draws with; whole modules,
|
|
6
|
+
// so that a name one lacks fails nothing. Set in the factory, which pi runs
|
|
7
|
+
// at every load, /reload included.
|
|
8
|
+
import * as piCodingAgent from "@earendil-works/pi-coding-agent";
|
|
9
|
+
import * as piTui from "@earendil-works/pi-tui";
|
|
10
|
+
|
|
11
|
+
export default function () {
|
|
12
|
+
globalThis[Symbol.for("pirc.piParts")] = { tui: piTui, convertToPng: piCodingAgent.convertToPng };
|
|
13
|
+
}
|