@jive-sh/jive 0.6.0-latest-darwin-arm64 → 0.6.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/README.md ADDED
@@ -0,0 +1,286 @@
1
+ # Jive
2
+
3
+ Jive is a **developer platform** and an **agentic workforce platform**. It takes the manual steps out of building,
4
+ shipping and running software, and the infrastructure behind it. A few ideas run through all of it:
5
+
6
+ - **Agents in the cloud** (planned). Agentic workflows run on cloud compute with a session Jive gives them, not on a laptop that
7
+ has to stay on.
8
+ - **Composable agentic workflows** (planned). A workflow is a package built from steps, and a workforce is built from workflows.
9
+ - **Minimal configuration.** A package extends an abstract for its kind and gets its pipeline, its config schema and
10
+ its scaffold from it.
11
+ - **Composable software.** Packages declare the resources they need instead of sharing code, so independent
12
+ repositories work together without a monorepo.
13
+
14
+ - **Developer platform:** the `jive` CLI (this repository), the CI/CD pipeline every Jive package runs (its
15
+ [reusable workflow](.github/workflows/reusable-pipeline.yml), contract in [CICD_API.md](CICD_API.md)), and resource
16
+ provisioning, which makes sure every resource a package needs exists in its organization.
17
+ - **Agentic workforce platform:** workforces of agents and code that run an organization's work. A software factory
18
+ is one kind of workforce, binary decompilation another, a business and its operations another.
19
+
20
+ <picture>
21
+ <source media="(prefers-color-scheme: dark)" srcset="docs/jive-platforms-dark.svg">
22
+ <img alt="Agentic workforce, the outer circle, holding three separate circles: software factory, binary decompilation, and a business and its operations" src="docs/jive-platforms-light.svg" width="480">
23
+ </picture>
24
+
25
+ ## Agentic workflows, not skills
26
+
27
+ A **skill** is instructions an agent reads: it may follow them, skip a step, or forget them after a long session, and
28
+ nothing records whether it did. An **agentic workflow** is a process defined in code: each step is deterministic code
29
+ or a call to an agent for one bounded task; triggers (a schedule, a commit, a message, a threshold) start it; its
30
+ state is saved at every step, so a failed or interrupted step is retried rather than the whole run; and every step
31
+ records its start, end, outcome and cost. What must happen is enforced by the workflow, not hoped for from the agent.
32
+
33
+ So a business process in Jive is "a running, inspectable, maintainable workflow instead of a fragile chain of manual
34
+ procedures" ([architecture §3.3](docs/jive_architecture_discussion.md#33-arbitrary-durable-workflows)), and agents
35
+ are called for bounded tasks rather than kept as long-running conversations
36
+ ([§2.A](docs/jive_architecture_discussion.md#a-workflows-versus-long-lived-claude-channels)). A workforce is a set of
37
+ such workflows, the agents they call, and the connectors they act through
38
+ ([§3.2](docs/jive_architecture_discussion.md#32-agentic-workforces)). *Planned:* agentic workflows as a package kind
39
+ (`jive-abstract-resource-agentic-workflow`) and workforces built from them.
40
+
41
+ ## A marketplace of package kinds
42
+
43
+ Everything in Jive is an npm package, and **every kind of package is itself a package**: an *abstract*,
44
+ `jive-abstract-<kind>`, implements the six CI/CD hooks for that kind, owns its manifest schema, and scaffolds new
45
+ packages of the kind. Extending one gives a package a working pipeline with no CI configuration of its own. Kinds
46
+ built today: `jive-abstract-library` (npm libraries and CLIs, this one included), `jive-abstract-backend-convex`,
47
+ `jive-abstract-app-expo`, `jive-abstract-docker-image`, `jive-abstract-backend-spacetimedb`, and
48
+ `jive-abstract-abstraction`, which creates new abstracts. Anyone can publish an abstract, so the set of kinds grows
49
+ like a marketplace. *Planned:* `jive create <kind>` finds every `jive-abstract-*` package and offers them as a menu
50
+ (`jive create agentic workflow` resolves `jive-abstract-agentic-workflow`).
51
+
52
+ **Resources** are the same idea for what packages use. A resource kind is an abstract defining a contract
53
+ (`jive-abstract-resource-connector-package-registry`), and an implementation is a package on one system
54
+ (`jive-resource-connector-package-registry-npm`). An organization configures one implementation per kind, and callers
55
+ name only the kind: `jive provision connector-package-registry @scope/name` makes sure that package exists on
56
+ whichever registry the organization uses. Public *ecosystem* packages (abstracts, connectors) are shared; a *usage*
57
+ package is someone's own use of them.
58
+
59
+ ## No monorepo needed
60
+
61
+ Jive began as a way to make independent repositories work like a monorepo
62
+ ([§1](docs/jive_architecture_discussion.md#1-executive-framing)). Each package keeps its own repository, version and
63
+ pipeline, and Jive supplies what a monorepo would:
64
+
65
+ - **One checkout for local work:** `jive init` makes any repository a workspace and `jive load` adds repos to it as
66
+ submodules, all signing and pushing the same way, and the packages in it are linked to each other, so each one runs
67
+ its workspace dependencies from their checkouts while its own lockfile and CI stay as they are ([Workspace
68
+ links](#workspace-links)).
69
+ - **One way to ship:** every repository runs the same reusable pipeline through its abstract.
70
+ - **Connectors instead of shared code:** a package declares the resources it needs and the organization's connectors
71
+ provide them, so nothing has to live in the same repository to work together. *Planned:* the code-repository
72
+ connector (`jive-abstract-resource-connector-code-repository`, GitHub for jive-sh), so a package's repository and
73
+ its URLs come from the organization rather than from paths or a hard-coded host.
74
+
75
+ ## What Jive borrows from Brazil and Version Sets
76
+
77
+ Amazon builds its services with an internal system called **Brazil**, organised around many small repositories
78
+ rather than one. Public descriptions of it are second-hand: a former Amazon build-team engineer's account
79
+ ([gist, 2017](https://gist.github.com/terabyte/15a2d3d407285b8b5a0a7964dd6283b0)) and
80
+ [ByteByteGo's guide](https://bytebytego.com/guides/how-does-amazon-build-system-work/). In them:
81
+
82
+ - code is broken into **packages**, each team owning its own repositories;
83
+ - a **version set** is "a list of package versions that are known to be consistent together", and every build runs
84
+ "in a version set";
85
+ - a default version set, **live**, is where anyone publishes, and each team keeps its own version set, so "no one team
86
+ is blocked on" another's builds;
87
+ - minor versions are non-breaking, and major versions are "picked up by request only".
88
+
89
+ Jive takes the same shape: independent packages in independent repositories and, *planned*, **version sets**: a
90
+ pinned set of package versions known to work together, built and tested as a whole before it is promoted, with
91
+ dependents updated when a dependency publishes and versions derived from API changes
92
+ ([§15.2](docs/jive_architecture_discussion.md#152-versioning-and-version-sets)). Today each package pins the exact
93
+ versions it builds with.
94
+
95
+ ## Install
96
+
97
+ ```sh
98
+ bun add -g @jive-sh/jive
99
+ ```
100
+
101
+ Installing registers `jive-signing-agent` and `jive-extension-daemon` to start at login (a LaunchAgent on macOS, a
102
+ `systemctl --user` unit on Linux, a scheduled task on Windows).
103
+
104
+ ## Commands
105
+
106
+ | Command | What it does |
107
+ | --- | --- |
108
+ | `jive login` | Opens `https://jive.sh/login?request=…`, where you sign in with your jive.sh passkey, and waits; then fetches your account's public key (`ssh:publicKey`) into `~/.jive/ssh/account.pub`. |
109
+ | `jive login --cicd` | In a GitHub Actions job with `id-token: write`: exchanges the job's ID token for a session of its pipeline. |
110
+ | `jive whoami` | Prints the handle of the Jive account this machine is signed in as. |
111
+ | `jive init` | In the git repository you are in, rewrites every .gitmodules at every depth to `https://github.com/<owner>/<repo>`, syncs them, checks out every submodule not yet checked out (one already checked out keeps its HEAD), and configures the root, every submodule and every untracked repository inside it: `gpg.format=ssh`, `user.signingKey` (the account key's public half), `commit.gpgSign=true`, `gpg.ssh.program=jive-ssh-keygen`, `core.sshCommand` through `jive-signing-agent`, and `url."git@github.com:".insteadOf "https://github.com/"` so https URLs fetch and push over SSH. Then links the packages among those repositories with each other, as `jive link` does. Nothing else, and no GitHub sign-in. |
112
+ | `jive load <org> <repo>` | Adds a GitHub repo to the workspace as a submodule by its https URL, fetches its submodules, configures it and them as `jive init` does, runs `bun install` in it, then links it with the workspace's packages: its workspace dependencies into it, and it into every workspace package that depends on it. |
113
+ | `jive unload <org> <repo>` | Removes every workspace link into the repo, running `bun install` in each package that had one so it gets its registry copy back, then removes the repo. |
114
+ | `jive link [<directory>]` | Links the workspace's packages with each other again (a `bun install` in a package puts its registry copies back); with a package's directory, links only into that package. Prints each link made or left, and why. |
115
+ | `jive on <org> <repo> -- <command…>` | Runs a command in a loaded repo's directory; its exit code is jive's. |
116
+ | `jive provision <kind> <name>` | Makes sure a resource instance exists, e.g. `jive provision connector-package-registry @scope/name`. The instance is `./package.json`'s `jive.resources.<kind>.<name>`, or `--instance '<json>'`. Needs a pipeline session. |
117
+ | `jive daemons` | Lists every Jive daemon registered on this machine, with its state, executable and log. |
118
+ | `jive upgrade` | Upgrades jive with the package manager that installed it. |
119
+
120
+ `--help`, `--version` and Tab completion (`jive --setup-completion`) work as for every command built with
121
+ `jive-abstract-library`'s `Cli`.
122
+
123
+ ## Workspace links
124
+
125
+ A workspace's packages are separate repositories, each with its own `package.json`, `bun.lock` and pipeline. Linking
126
+ makes them use each other the way a monorepo's members do, without changing what any of them installs in CI.
127
+
128
+ Every repository in the workspace whose `package.json` names a package is a member. Wherever one member depends on
129
+ another, `jive link` (and `jive load`, `jive init`) replaces the dependent's `node_modules/<name>` with a relative
130
+ symlink to the dependency's checkout:
131
+
132
+ ```
133
+ $ jive link packages/@jive-sh/jive
134
+ Linked effective-modules into @jive-sh/jive: packages/effective-modules/dist/base (0.3.6)
135
+ Left jive-abstract-library into @jive-sh/jive: jive-abstract-library's build is 0.7.0-local and its checkout 0.13.1; run `bun run jive:cicd:build` in it, then `jive link`
136
+ 1 workspace link in place; 1 left as installed
137
+ ```
138
+
139
+ - **What a link points at.** A package whose source `package.json` names an entry point (`exports`, `main` or
140
+ `module`) is linked at its checkout. A package built by a Jive abstract names none, since its build writes
141
+ `exports`, so it is linked at the build in its `dist/base`, which must be of its checkout's version; after editing
142
+ it, rebuild it (`bun run jive:cicd:build`) and the link serves the new build.
143
+ - **The checkout wins over the pin.** A link is made whatever version the dependent pins, and the line says when the
144
+ checkout's version is outside the pin, since CI will install the pin.
145
+ - **Nothing in any repository changes.** No `package.json` or `bun.lock` is written, so each repository installs alone
146
+ from its own lockfile, locally and in CI, exactly as before.
147
+ - **Left as installed:** a dependency the dependent names locally itself (`link:`, `file:`, `workspace:`), one `bun
148
+ install` didn't install there (a peer dependency), one with no build or a build of another version, and a name two
149
+ members share.
150
+ - **A `bun install` or `bun add` in a dependent puts the registry copies back.** Run `jive link` again afterwards.
151
+ - **Shared peers.** A linked package resolves its own imports from its checkout, so a peer it shares with the
152
+ dependent (`effect`) is a second copy there. TypeScript needs `"preserveSymlinks": true` in the dependent's
153
+ tsconfig to type-check against one copy, as jive's has; at run time Bun has no such option, so two copies load.
154
+
155
+ Why not bun's own mechanisms: a root `workspaces` list links a member only when its version satisfies the dependent's
156
+ range (a pin of `0.3.6` against a checkout at `0.3.7` installs the registry copy), and a `bun install` run inside a
157
+ member then writes the root lockfile instead of the member's own. `bun link` registers each package in bun's global
158
+ folder, where it replaces any globally installed package of the same name (a checkout of jive would replace the jive
159
+ you run), and its links are undone by the same `bun install`.
160
+
161
+ ## How signing works
162
+
163
+ Your SSH key lives with your Jive account on [`@jive-sh/server`](https://github.com/jive-sh/server); this machine keeps
164
+ only its public key (`~/.jive/ssh/account.pub`). A session comes only from your passkey (`jive login`) or, for a
165
+ pipeline, its GitHub OIDC token (`jive login --cicd`), and is kept in `~/.jive/session.json` (owner-only). A passkey
166
+ session ends a day after its last use: each signature moves its end a day on, on the server, so a machine that signs at
167
+ least daily stays signed in, and jive asks you to sign in again only when the server refuses the session. A pipeline's
168
+ session lasts an hour.
169
+ `jive-signing-agent` serves the SSH agent protocol on `~/.jive/signing-agent.sock`: it lists the public key and sends
170
+ each request's bytes to the server's `ssh:sign`, opening the sign-in page itself when no session is live. That covers
171
+ git commit signatures and GitHub's SSH authentication alike: each repository `jive init` or `jive load` configures signs
172
+ through `jive-ssh-keygen` (ssh-keygen pointed at the agent), and fetches and pushes over SSH with `core.sshCommand`
173
+ through the agent. jive holds no GitHub token and never signs in to GitHub; GitHub must know the account key's public
174
+ half as an SSH and signing key. Signing needs `ssh-keygen` (OpenSSH) on PATH.
175
+
176
+ jive never writes to `~/.ssh`: no key file and no `~/.ssh/config` block. Everything it sets up is per repository.
177
+
178
+ ## Using your Jive key for other SSH
179
+
180
+ Your Jive key works for anything that takes an SSH key, not only git and GitHub. Point the tool at two files jive
181
+ keeps: the public key, `~/.jive/ssh/account.pub`, and the agent's socket, `~/.jive/signing-agent.sock`. The agent
182
+ signs any request for that key, opening the sign-in page when no session is live, and refuses requests for any other
183
+ key. `jive-signing-agent` must be running (`jive daemons`).
184
+
185
+ **Sign in to an SSH server.** Add the contents of `~/.jive/ssh/account.pub` to `~/.ssh/authorized_keys` on the server,
186
+ then:
187
+
188
+ ```sh
189
+ ssh -o IdentityAgent=~/.jive/signing-agent.sock -o IdentityFile=~/.jive/ssh/account.pub -o IdentitiesOnly=yes user@host
190
+ ```
191
+
192
+ To skip the flags, add a block like this to your own `~/.ssh/config`:
193
+
194
+ ```
195
+ Host myserver
196
+ HostName host
197
+ User user
198
+ IdentityAgent ~/.jive/signing-agent.sock
199
+ IdentityFile ~/.jive/ssh/account.pub
200
+ IdentitiesOnly yes
201
+ ```
202
+
203
+ **Sign a file, or anything else.** Use `ssh-keygen -Y sign` with your own namespace (`-n`), and `ssh-keygen -Y verify`
204
+ with an `allowed_signers` file to check it:
205
+
206
+ ```sh
207
+ SSH_AUTH_SOCK=~/.jive/signing-agent.sock ssh-keygen -Y sign -n file -f ~/.jive/ssh/account.pub release.tar
208
+ ```
209
+
210
+ This writes `release.tar.sig`.
211
+
212
+ What is tested, in [`src/modules/signing-agent/signing-agent.test.ts`](src/modules/signing-agent/signing-agent.test.ts)
213
+ on macOS, with a scratch home and a fake Jive server that signs with a key the test makes:
214
+ - `ssh` logs in to an sshd on the same machine and runs a command there. The sshd runs as the person running the
215
+ test, and only the account key is in its `authorized_keys`. The test passes the `ssh` options above with absolute
216
+ paths, and with `-F /dev/null`, so no `~/.ssh/config` is read.
217
+ - `ssh-keygen -Y sign -n file` signs a file through the agent, and `ssh-keygen -Y verify -n file` accepts the
218
+ signature.
219
+
220
+ Not tested: a remote server, the `~/.ssh/config` block (it sets the same options as the command), and Linux.
221
+
222
+ ## The Jive browser extension
223
+
224
+ The Jive browser extension (`@jive-sh/extension`, a proof of concept) signs this machine in to Jive and collects
225
+ credentials from the person's own signed-in browser, such as an npm token. It never holds the session: it asks
226
+ `jive-extension-daemon`, which uses the same session `jive login` keeps in `~/.jive/session.json`. The session goes
227
+ from Jive to the daemon and never passes through the browser or the extension.
228
+
229
+ - **Native host.** Chrome starts a program when the extension calls `chrome.runtime.connectNative("sh.jive.daemon")`.
230
+ Chrome can only start a host, never attach to a running process, so `jive-native-host` relays each message to the
231
+ daemon's socket, `~/.jive/extension-daemon.sock` (owner-only), without reading it.
232
+ - **Registration with Chrome.** At each start the daemon writes the host manifest,
233
+ `~/Library/Application Support/{Google/Chrome,Chromium}/NativeMessagingHosts/sh.jive.daemon.json` on macOS and
234
+ `~/.config/{google-chrome,chromium}/NativeMessagingHosts/` on Linux, only where that browser is installed. It allows
235
+ only the Jive extension's id, which Chrome derives from the extension's public key. Windows (the registry) is not
236
+ done yet.
237
+
238
+ ### The protocol
239
+
240
+ [`src/modules/extension-daemon/protocol.ts`](src/modules/extension-daemon/protocol.ts) is the one definition, and the
241
+ extension imports it from jive's source (jive exports no library yet). Every request carries `protocolVersion`, and a
242
+ mismatch is refused with which side to upgrade.
243
+
244
+ | Request | Response |
245
+ | --- | --- |
246
+ | `GetSession` | `SignedOut`, `SigningIn { loginUrl, expiresAt }` or `SignedIn { expiresAt }` |
247
+ | `StartSignIn` | `SigningIn`, or `SignInFailed { reason }` when Jive can't be reached |
248
+ | `SignOut` | `SignedOut`. Forgets this machine's session, so `jive` and `jive-signing-agent` sign in again too. |
249
+ | `GetNpmConnectionReadiness` | `Ready` or `NotReady { reason }`. The extension asks this before it changes anything on npm. |
250
+ | `PostNpmCredential { credential: { npmUser, token, totpSecret } }` | `Posted` or `Refused { reason }` |
251
+
252
+ No response carries the session token, the claim secret or a credential.
253
+
254
+ ### How the extension signs in
255
+
256
+ 1. The extension's Sign in button sends `StartSignIn`.
257
+ 2. The daemon signs in the way `jive login` does: it opens a sign-in request on `@jive-sh/server` and answers with its
258
+ page, `https://jive.sh/login?request=…`.
259
+ 3. The extension opens the page, and the person signs in there with their jive.sh passkey.
260
+ 4. The daemon claims the request every 2 seconds. Once the person has approved it, the claim returns a session, which
261
+ the daemon stores in `~/.jive/session.json`. The extension sees `SignedIn` on its next `GetSession`.
262
+
263
+ A daemon restart drops a sign-in still waiting, because the claim secret is kept in memory only. A stored session
264
+ survives restarts until it expires.
265
+
266
+ **Not decided yet: who accepts the npm credential.** Either jive.sh or `@jive-sh/server`, which holds npm connections,
267
+ could. Posting is behind `INpmCredentialPoster` ([`src/modules/npm-credential-poster/interface.ts`](src/modules/npm-credential-poster/interface.ts)).
268
+ Until the decision, the daemon ships `NpmCredentialPosterNotDecidedImpl`, which answers `NotReady` with that reason,
269
+ so the extension stops before it touches npm.
270
+
271
+ ## Developing
272
+
273
+ ```sh
274
+ bun install
275
+ bun run jive:cicd:audit # type check and tests
276
+ bun run install:local # build with the jive-abstract-library checkout beside this one, install globally
277
+ ```
278
+
279
+ Tests never reach jive.sh, the server or GitHub. The signing agent's tests run the real `ssh-keygen` and `ssh-add`
280
+ against a fake server; `src/workspace-cutover.test.ts` runs `jive init` on a scratch workspace with nested submodules,
281
+ signs a commit through the agent and pushes it over SSH to a local sshd. The extension daemon's tests
282
+ ([`src/modules/extension-daemon/extension-daemon.test.ts`](src/modules/extension-daemon/extension-daemon.test.ts)) run the
283
+ daemon against a fake server and speak Chrome's framing to the native host started from the manifest the daemon
284
+ wrote: sign-in end to end into `~/.jive/session.json`, a session `jive login` stored, a restart, posting, sign-out,
285
+ protocol refusal, a second daemon standing down, and the native host reporting a stopped daemon. Not covered by tests:
286
+ registration with the OS service manager, the compiled binary under a real Chrome, Linux, and Windows.