introsio 0.4.0 → 0.5.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/CHANGELOG.md CHANGED
@@ -6,6 +6,39 @@ project uses [semantic versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.5.0] - Unreleased draft
10
+
11
+ Run `int setup` again after updating, then `int doctor`, to refresh the installed
12
+ hook engine. Managed execution requires an authorized host and an eligible server
13
+ rollout; vendor adapters currently retain manual launch.
14
+
15
+ ### Added
16
+ - Local runner identity (`int runner init|status`), explicit project checkout
17
+ links (`int project link|inspect|verify`) and provider discovery (`int agent list`).
18
+ - Managed attempt inspection and reconciliation (`int workspace list|reconcile`),
19
+ pinned worktrees, durable attempt/process journals and conservative recovery.
20
+ - File activity reporting (`int workspace watch`) with independent reporting
21
+ sessions and workspace provenance.
22
+ - Immutable committed checkpoints, structured handovers and explicit protected
23
+ checkpoint publication through trusted host APIs.
24
+ - A protocol-v2 runner transport and trusted host loop that waits outside the
25
+ model, checks capabilities, fetches exact dependency commits and retains work
26
+ when authority or process termination is uncertain.
27
+ - Packaged managed-workspace and release guides, standalone GitHub CI and an npm
28
+ trusted-publishing workflow in the CLI mirror.
29
+
30
+ ### Changed
31
+ - Worker execution procedures use server-issued sessions, fenced attempt identity
32
+ and stable request IDs for retries. Managed input hooks use integration evidence.
33
+ - README installation, update instructions and command reference describe current
34
+ capabilities. Service architecture links work from npm and the GitHub mirror.
35
+ - npm publishing moves to the standalone repository so provenance matches package
36
+ metadata; monorepo release tags validate without publishing.
37
+
38
+ ### Fixed
39
+ - Standalone clone tests use an Execute toolset snapshot, checked against the
40
+ server contract when running inside the monorepo.
41
+
9
42
  ## [0.4.0]
10
43
 
11
44
  Parallel agents on one project. Run `int setup` again after updating: the
package/README.md CHANGED
@@ -1,16 +1,18 @@
1
- # int — connect any coding agent to Introsio
1
+ # Introsio CLI - connect coding agents to Introsio
2
2
 
3
3
  One command connects your coding agents to Introsio, gives them
4
4
  `/introsio-execute` for running a Developer Mode project, `/introsio-pause` and
5
5
  `/introsio-resume` for stopping anywhere and continuing exactly, and installs
6
6
  hooks that keep Introsio in step with what the agent actually did.
7
7
 
8
+ [npm package](https://www.npmjs.com/package/introsio) | [GitHub](https://github.com/introsio/Introsio-cli) | [Changelog](CHANGELOG.md)
9
+
8
10
  ## Install
9
11
 
10
- Needs Node 18 or newer and one or more coding agents.
12
+ Needs Node 18 or newer and one or more coding agents. Worktree and managed workspace commands also need Git 2.31 or newer. The npm package is `introsio`; it provides both `int` and `introsio` commands.
11
13
 
12
14
  ```bash
13
- npx introsio setup # try it once, nothing stays installed
15
+ npx introsio@latest setup # run setup without a global npm install
14
16
  ```
15
17
 
16
18
  ```bash
@@ -42,15 +44,37 @@ hook engine to `~/.introsio/kit`, so the hooks never depend on this checkout.
42
44
  | VS Code (Copilot) | user `mcp.json` | prompt file | none |
43
45
  | Windsurf | `mcp_config.json` | `int print-execute` / `print-pause` / `print-resume` → paste as workflows | none |
44
46
 
45
- **Signing in.** No key is stored anywhere. Each agent signs in through its own MCP
46
- OAuth flow (Introsio supports dynamic client registration and PKCE). `setup` tells
47
+ **Signing in.** Setup does not ask for an API key. Each agent signs in through its own MCP
48
+ OAuth flow (Introsio supports dynamic client registration and PKCE) and manages its own credentials. `setup` tells
47
49
  you the exact step for each agent, for example `/mcp` in Claude Code or
48
50
  `codex mcp login introsio`.
49
51
 
52
+ ## Run a project
53
+
54
+ Create a Developer Mode project and its plan in [Introsio](https://introsio.app), then sign in through your coding agent. From your repository:
55
+
56
+ ```bash
57
+ int doctor
58
+ int gate set "npm test" # use the check command for your repository
59
+ ```
60
+
61
+ In the agent, run `/introsio-execute <project name or id>` (Codex: `/prompts:introsio-execute`). Use `/introsio-pause` before stopping and `/introsio-resume` to continue. Windsurf users can copy the procedure with `int print-execute`.
62
+
63
+ ## Update
64
+
65
+ ```bash
66
+ npm install -g introsio@latest
67
+ int setup
68
+ int doctor
69
+ ```
70
+
71
+ For an npx-only installation, run `npx introsio@latest setup` again. Setup copies a versioned hook engine onto this computer; updating the npm package alone does not replace those installed hooks. Restart or reload your agent after setup.
72
+
50
73
  ## How it works
51
74
 
52
75
  The agent runs a project with the server's loop: `claimTask` → work → `completeTask`
53
- with an outcome (ADR-0008). The hooks never call Introsio themselves; they have no
76
+ with an outcome ([execution protocol](https://github.com/RASAPALLI-MAHESH/Introsio/blob/main/docs/adr/0008-agent-execution-protocol.md)).
77
+ The command procedures register a protocol-v2 worker session, retain the server-issued attempt identity and use stable claim/completion request IDs when retrying a lost response. Worker credentials stay out of outcomes, handoffs and repository files. The hooks never call Introsio themselves; they have no
54
78
  credential. They watch the agent's own Introsio calls and make sure it finishes
55
79
  the loop.
56
80
 
@@ -184,7 +208,7 @@ server's `backend-node/src/tests/agentPause.test.js`.
184
208
  Several agents can run one project at the same time — any mix of Claude Code,
185
209
  Codex, Cursor and the rest. Introsio's server hands each ready task to exactly one
186
210
  worker (an atomic claim), passes each task the outcomes of the tasks it builds on,
187
- and orders the work so the longest chain starts first. On your computer, four rules
211
+ and orders the work so the longest chain starts first. For projects using the manual branch workflow, four rules
188
212
  keep the agents from getting in each other's way:
189
213
 
190
214
  1. **One folder per agent.** Two agents in one working tree share one branch and
@@ -225,8 +249,13 @@ keep the agents from getting in each other's way:
225
249
  depends on every task nothing else depends on: it merges all their branches,
226
250
  runs the whole test suite and fixes what breaks between the pieces.
227
251
 
228
- The Free plan runs one worker per project at a time (`parallelClaimsPerProject`);
229
- Pro runs five. Tests: `test/parallel.test.js`.
252
+ The server enforces the account's current worker limits. Tests: `test/parallel.test.js`.
253
+
254
+ ### Managed execution
255
+
256
+ Managed integration projects use pinned attempt workspaces and verified artifact inputs. Their trusted runner prepares the reserved base and exact dependency commits; manual branch-merging instructions above apply to the manual workflow. The `inputs` hook directs managed tasks to their runner.
257
+
258
+ The CLI supports runner registration, explicit project linking, provider discovery, attempt inspection and file activity reporting. Vendor adapters currently require manual launch; the trusted host APIs support execution and waiting outside the model. Read [Managed attempt workspaces](docs/managed-workspaces.md) for setup, authentication, checkpoint publication, recovery and current rollout limits.
230
259
 
231
260
  ## Edge cases (researched, reproduced, fixed)
232
261
 
@@ -287,6 +316,13 @@ int paused [--prune [--days 30]]
287
316
  int worktree add <name> [--base <ref>] [--branch <b>] [--dir <path>] | worktree list | worktree remove <name> [--force]
288
317
  int wait <seconds | ISO time> [--max 240]
289
318
  int stats [--since 7d] [--project <id>] [--json]
319
+ int project link <id> --root <repo> --repository <owner/name>
320
+ int project inspect|verify <id> [--json]
321
+ int runner init|status [--json]
322
+ int agent list [--json]
323
+ int workspace list|reconcile [--json]
324
+ int workspace watch <attempt> [--provider codex] [--api <base-url>] [--once] [--new-session]
325
+ int version
290
326
  int print-execute | print-pause | print-resume
291
327
  ```
292
328
 
@@ -295,9 +331,8 @@ int print-execute | print-pause | print-resume
295
331
  repo-relative paths.
296
332
  - `--toolset` chooses which Introsio tools the agents load, and is remembered.
297
333
  `developer` (the default) plans and executes. `execute` is the slim set for
298
- running a plan that already exists — the 13 tools of the claim → complete loop,
299
- pause / resume and the hand-off, about a third of the tool definitions an agent
300
- carries on every turn. It cannot create or edit a plan; switch back with
334
+ running a plan that already exists, including worker sessions, the execution loop,
335
+ workspace/artifact tools, pause / resume and the hand-off. It cannot create or edit a plan; switch back with
301
336
  `int setup --toolset developer`.
302
337
  - `--url` points the agents at another MCP server, such as a local backend; it is
303
338
  remembered.
@@ -306,7 +341,30 @@ int print-execute | print-pause | print-resume
306
341
 
307
342
  ## Layout
308
343
 
344
+ `int runner init` creates one local runner identity in
345
+ `~/.introsio/runner/registry.json`. `int runner status --json` reads it for
346
+ scripts. Initialization is safe to repeat and returns the same ID across
347
+ processes. Keep the registry with the host's local state when restoring it.
348
+
309
349
  - `cli.mjs` — the `int` command
350
+ - `runner/agentRegistry.mjs` — local runner identity and registry
351
+ - `runner/projectLinks.mjs` — explicit local GitHub checkout links, validated before use
352
+ - `runner/workspaceJournal.mjs` — durable attempt identity and provisioning journal
353
+ - `runner/workspaceManager.mjs` — internal authorized pinned-commit worktree provisioning and read-only recovery inspection
354
+ - `runner/providers/` — provider capability discovery, explicit manual launch/stop fallback, checkpoint and resume interface
355
+ - `runner/workspaceRecovery.mjs` — conservative reconciliation; unknown or superseded authority retains all work
356
+ - `runner/workspaceResources.mjs` — private per-attempt resource directories, allowlisted process environment and loopback socket reservations
357
+ - `runner/runnerTransport.mjs` — stateless authenticated MCP client and private protocol-v2 worker session; refuses legacy execution and unexpected endpoint/attempt changes.
358
+ - `runner/processJournal.mjs` — unresolved process launch journal blocks automatic relaunch after a crash without trusting persisted PIDs.
359
+ - `runner/supervisedProcess.mjs` — internal trusted executable supervision, timeout, cancellation and repeated lease checks. Windows termination is best effort; Job Objects, crash-time process containment, and provider-specific authentication are not certified. No automatic headless launch is exposed.
360
+
361
+ `int workspace reconcile --json` performs offline read-only reconciliation. Without a verified server transport, all authority is unknown and no work is removed. Port reservations remain exclusive only until released; providers must handle bind collisions. Resource directories are not OS confinement.
362
+
363
+ `int agent list --json` reports local provider availability without executing providers or inspecting their credentials. No headless provider is certified yet.
364
+
365
+ `int workspace list --json` inspects managed attempts. No force removal or automatic cleanup is offered. Provisioning is an internal API requiring a verified server-authorization adapter; the CLI deliberately cannot provision from an untrusted local packet. Worktrees isolate indices and files, not OS permissions. Windows directory ACL hardening and authenticated remote integration are separate release gates.
366
+
367
+ Local linking (no remote API call, fetch, checkout or push): `int project link <projectId> --root <checkout> --repository <owner/name>`. Use `int project verify <projectId>` to revalidate origin and local Git metadata. A link is not server authorization; provisioning must also validate the authorized repository identity and pinned commit. Existing links are never silently replaced. Git 2.31+ is required.
310
368
  - `agents/<agent>.mjs` — one adapter per agent: detect, connect, command, hooks, uninstall, status
311
369
  - `hook/introsio-hook.mjs` → `normalize.mjs` (each agent's payload into one shape) → `engine.mjs` (the decisions) → `respond.mjs` (each agent's output format)
312
370
  - `hook/features/*.mjs` — one pure module per feature
@@ -319,29 +377,15 @@ Tests: `npm test` in this folder. They use plain
319
377
  Hook formats follow each agent's documentation as of October 2026. Agents change
320
378
  these often: run `int doctor` after updating an agent.
321
379
 
322
- ## Publishing a release (maintainers)
323
-
324
- The package is `introsio` on npm (commands `int` and `introsio`).
380
+ ## Contributing and releases
325
381
 
326
- 1. Bump `version` in `package.json` and describe the release in `CHANGELOG.md` (`int doctor` tells users on older hooks to re-run `int setup`), and merge.
327
- 2. Add the repository secret `NPM_TOKEN` once (an npm Automation token that may publish `introsio`).
328
- 3. Tag the release; `.github/workflows/agent-kit-release.yml` runs the tests, checks the tag against the version, and publishes with provenance:
382
+ Edit the CLI in the Introsio monorepo's `agent-kit/` folder. The standalone
383
+ [Introsio-cli repository](https://github.com/introsio/Introsio-cli) mirrors that
384
+ folder. Both checkouts can run `npm test` without installing dependencies.
329
385
 
330
- ```bash
331
- git tag agent-kit-v0.4.0 && git push origin agent-kit-v0.4.0
332
- ```
333
-
334
- To publish by hand instead: `npm login`, then `npm publish` from this folder (the tests run first via `prepublishOnly`).
335
-
336
- The code is edited only in the Introsio monorepo's `agent-kit/` folder. The
337
- standalone [Introsio-cli](https://github.com/introsio/Introsio-cli) repository is
338
- a mirror of that folder, updated from the monorepo root (never edited directly):
339
-
340
- ```bash
341
- git fetch cli
342
- git subtree split --prefix=agent-kit -b cli-only
343
- git push cli cli-only:main
344
- ```
386
+ See [Releasing to GitHub and npm](docs/releasing.md) for the local review checks,
387
+ mirror update, version tags and publishing workflow. npm publishes run from the
388
+ standalone repository so provenance matches the package's repository URL.
345
389
 
346
390
  ## License
347
391
 
package/cli.mjs CHANGED
@@ -19,6 +19,11 @@ import { runGateCommand } from './hook/features/gates.mjs';
19
19
  import { listLocalPauses, removeLocalPause } from './hook/features/pause.mjs';
20
20
  import { sessionIsLive } from './hook/features/workerId.mjs';
21
21
  import { treeKey, WAIT_STEP_SEC } from './hook/features/parallel.mjs';
22
+ import { readRunner, registerRunner } from './runner/agentRegistry.mjs';
23
+ import { linkProject, readProjectLink, verifyProjectLink } from './runner/projectLinks.mjs';
24
+ import { listWorkspaces } from './runner/workspaceManager.mjs';
25
+ import { reconcileWorkspaces } from './runner/workspaceRecovery.mjs';
26
+ import { discoverProviders } from './runner/providers/index.mjs';
22
27
 
23
28
  const KIT_SOURCE = path.dirname(fileURLToPath(import.meta.url));
24
29
  const DEFAULT_URL = 'https://api.introsio.app/mcp?toolset=developer';
@@ -573,6 +578,24 @@ function doctor(flags) {
573
578
  if (problems) process.exitCode = 1;
574
579
  }
575
580
 
581
+ async function runner(positional, flags) {
582
+ const action = positional[1];
583
+ if (!['init', 'status'].includes(action) || positional.length !== 2) {
584
+ return fail('usage: int runner init|status [--json]');
585
+ }
586
+ const record = action === 'init' ? await registerRunner() : readRunner();
587
+ if (flags.json) return out(JSON.stringify({ registered: Boolean(record), ...record }));
588
+ if (!record) return out('Local runner is unregistered. Run int runner init.');
589
+ return out(`Local runner ${record.runnerId} on ${record.hostname} (${record.platform}/${record.arch})`);
590
+ }
591
+
592
+ async function projectLink(positional, flags) {
593
+ const [, action, id] = positional;
594
+ if (positional.length !== 3 || !['link', 'inspect', 'verify'].includes(action)) return fail('usage: int project link <id> --root <repo> --repository <owner/name> | inspect|verify <id>');
595
+ const record = action === 'link' ? await linkProject({ id, root: flags.root, repository: flags.repository }) : action === 'verify' ? verifyProjectLink(id) : readProjectLink(id);
596
+ return out(JSON.stringify(record ?? { linked: false }, null, flags.json ? 0 : 2));
597
+ }
598
+
576
599
  function help() {
577
600
  out(`int ${VERSION} — the Introsio agent kit: connect coding agents to Introsio and keep it updated while they execute
578
601
 
@@ -587,10 +610,16 @@ function help() {
587
610
  int claims | claims clear tasks your agents hold on this computer
588
611
  int stats [--since 7d] [--project <id>] [--json]
589
612
  int paused [--prune [--days 30]] work paused or interrupted on this computer, and how to resume it
613
+ int project link <id> --root <repo> --repository <owner/name>
614
+ int project inspect|verify <id> [--json]
615
+ int agent list [--json] discover supported manual coding-agent adapters
616
+ int workspace list|reconcile [--json] inspect managed attempts without deleting work
617
+ int runner init|status [--json] create or inspect this computer's local runner identity
590
618
 
591
619
  int worktree add <name> [--base <ref>] [--branch <b>] [--dir <path>]
592
620
  a folder of its own for one more parallel agent (branch agent/<name>)
593
621
  int worktree list | remove <name> [--force]
622
+ int workspace watch <attempt> [--provider codex] [--api <base-url>] [--once] [--new-session]
594
623
  int wait <seconds | ISO time> [--max 240]
595
624
  what an agent runs when other workers hold the ready work, before claiming again
596
625
  int print-execute | print-pause | print-resume
@@ -624,6 +653,20 @@ async function run(command, positional, flags) {
624
653
  case 'claims': return claims(positional);
625
654
  case 'stats': return stats(flags);
626
655
  case 'paused': return paused(flags);
656
+ case 'runner': return runner(positional, flags);
657
+ case 'project': return projectLink(positional, flags);
658
+ case 'agent': {
659
+ if (positional.length !== 2 || positional[1] !== 'list') return fail('usage: int agent list [--json]');
660
+ return out(JSON.stringify(discoverProviders(), null, flags.json ? 0 : 2));
661
+ }
662
+ case 'workspace': {
663
+ if (positional[1] === 'watch') {
664
+ const { watchManagedActivity } = await import('./runner/managedActivity.mjs');
665
+ return out(JSON.stringify(await watchManagedActivity(positional[2], flags)));
666
+ }
667
+ if (positional.length !== 2 || !['list','reconcile'].includes(positional[1])) return fail('usage: int workspace list|reconcile [--json]');
668
+ return out(JSON.stringify(positional[1] === 'reconcile' ? await reconcileWorkspaces() : listWorkspaces(), null, flags.json ? 0 : 2));
669
+ }
627
670
  case 'worktree': case 'worktrees': return worktree(positional, flags);
628
671
  case 'wait': return wait(positional, flags);
629
672
  case 'print-execute': case 'print-pause': case 'print-resume': {
@@ -0,0 +1,65 @@
1
+ # Managed attempt workspaces
2
+
3
+ These optional tools accompany the [agent setup and execution hooks](../README.md).
4
+ The CLI can link and inspect local state; provisioning and execution require an
5
+ authenticated trusted host. Current vendor adapters expose manual launch, and
6
+ live provider/staging acceptance remains pending.
7
+
8
+ ## Inspect local runner state
9
+
10
+ Run these from a terminal, replacing the project, checkout and repository values:
11
+
12
+ ```bash
13
+ int runner init
14
+ int project link PROJECT_ID --root /absolute/repository --repository OWNER/REPO
15
+ int project verify PROJECT_ID
16
+ int agent list --json
17
+ int workspace list --json
18
+ int workspace reconcile --json
19
+ ```
20
+
21
+ Use a Git 2.31+ checkout with the expected GitHub `origin`. Linking validates local
22
+ Git metadata and does not fetch, push or authorize remote execution. Existing
23
+ links are not silently replaced. `reconcile` is read-only; unknown authority
24
+ retains all work. There is no CLI provisioning, automatic launch or cleanup command.
25
+
26
+ ## Immutable checkpoints and handover
27
+
28
+ Before completing a managed task, a trusted executor can call its `captureArtifact({ handover, inputArtifactIds, publish })` callback. Commit the task's changes in the attempt worktree first. The handover requires a `summary` and accepts lists of `interfaces`, `decisions`, `verification` and `remaining` items. An optional `supersedes` ID records a rewritten checkpoint.
29
+
30
+ Local capture is the default. Pass `publish: true` to publish the exact committed SHA to a protected checkpoint branch. GitHub publication requires an active checkpoint ruleset on the linked repository. The runner verifies the branch tip and owned range, and retries reconcile the existing checkpoint. See [ADR-0019](https://github.com/RASAPALLI-MAHESH/Introsio/blob/main/docs/adr/0019-immutable-task-artifacts.md).
31
+
32
+ When the project selects a Phase 7 repository verification policy, checkpoint publication also requires the server's trusted workflow/credential preflight. The runner refuses changes to `.github/` and policy-protected source paths before pushing, preserving the local checkpoint for review. Candidate refs are independently checked by the server before publication and advancement. See [ADR-0022](https://github.com/RASAPALLI-MAHESH/Introsio/blob/main/docs/adr/0022-server-verification-engine.md) for the conservative supported CI profile and setup requirements.
33
+
34
+ ## Live file activity
35
+
36
+ With a task claimed in a prepared workspace, run `int workspace watch ATTEMPT_ID --provider codex` in another terminal. The collector reads `INTROSIO_ACTIVITY_ACCESS_TOKEN` from the host environment and registers an independently authenticated reporting session. Keep this credential outside model context. `--api` selects an HTTPS API base or loopback development endpoint. `--once` sends a single scan. After renewing a retired login, use `--new-session` to replace its reporting grant and retain the old pending metadata.
37
+
38
+ Execute → Agents shows sessions, last heartbeats, local commit observations and staged/unstaged file metadata. Observations have workspace provenance because people and other processes may also edit the files. The collector excludes known secret/generated paths and ignored files, batches filesystem notifications, rescans periodically and replays its journaled pending snapshot after a lost response. It sends metadata about at most 200 files per observation. Reporting credentials are omitted from CLI output.
39
+
40
+ The local runner stores its registry and attempt journals under `~/.introsio/runner` (or `INTROSIO_HOME/runner`). Link a project explicitly with `int project link PROJECT_ID --root /absolute/repository --repository OWNER/REPO`. Use `int runner init`, `int agent list` and `int workspace list|reconcile` to inspect local capabilities and retained attempts.
41
+
42
+ Trusted host integrations create a transport with `createRunnerTransport({ getAccessToken })`, open a project-scoped `openRunnerSession`, and call `runWorkerOnce` with a trusted executor. The server issues a private worker credential, authorizes the exact attempt and pins the linked repository commit. `runWorkspaceProcess` provides native executable supervision for a locally trusted adapter. Vendor adapters report manual launch capability. Workspaces are retained when authority is unavailable or termination is uncertain.
43
+
44
+ For managed integration runs, trusted hosts can use `runWorkerLoop` from `runner/runnerLoop.mjs`. Register actual capability tags, declared resources and launch/resume support in `openRunnerSession({ transport, projectId, profile })`, then pass the adapter's capabilities and executor to the loop. The host waits through `waitForWork` outside the model and launches only after a fresh claim. It fetches exact dependency SHAs and preserves the attempt's reserved base. Cancellation, idle timeout and offline retries are bounded. The executor must call the supplied `completeTask` and receive server confirmation to finish; otherwise the runner retains a checkpoint for review. Unsupported adapters return `manual_action_required`. See [ADR-0021](https://github.com/RASAPALLI-MAHESH/Introsio/blob/main/docs/adr/0021-dependency-scheduling-and-worker-wake.md).
45
+
46
+ The collector uses the same attempt journal and verifies repository, branch and base history before each scan. Reporting credentials stay in private local state and are removed from workspace listings. Integrations can supply `activityClient({ accessToken: async () => ... })` with a rotating credential source.
47
+
48
+ Hard CPU/RAM/disk isolation, supervision of escaped processes and provider-specific authentication require OS or provider adapters. Review retained work before removing any workspace.
49
+
50
+ ## Verification, integration and delivery
51
+
52
+ Managed tasks reserve an exact integration base and dependency artifacts. A local
53
+ test report or successful process exit does not establish server CI verification,
54
+ integration or delivery. The service verifies candidate-specific evidence before
55
+ advancing the shared integration ref. Delivery requires a separate owner-approved
56
+ plan and fresh server checks.
57
+
58
+ The production service defaults to observation mode. New managed work depends on
59
+ the deployment stage, project enrollment and owner pause state. Publishing this
60
+ CLI or running `int setup` does not change those settings. Existing uncertain
61
+ remote operations are reconciled while local attempt work is retained. See the
62
+ [managed execution rollout ADR](https://github.com/RASAPALLI-MAHESH/Introsio/blob/main/docs/adr/0025-managed-execution-release.md)
63
+ and [operations runbook](https://github.com/RASAPALLI-MAHESH/Introsio/blob/main/docs/runbooks/managed-execution-release.md)
64
+ for service release evidence and recovery.
65
+
@@ -0,0 +1,118 @@
1
+ # Releasing to GitHub and npm
2
+
3
+ The npm package is [`introsio`](https://www.npmjs.com/package/introsio), with
4
+ `int` and `introsio` executable aliases. Its public source repository is
5
+ [`introsio/Introsio-cli`](https://github.com/introsio/Introsio-cli).
6
+ Edit source in the Introsio monorepo's `agent-kit/` folder and mirror that folder.
7
+
8
+ ## Prepare locally
9
+
10
+ 1. Update `package.json` and `CHANGELOG.md`. Use a new version for changed hooks
11
+ so `int doctor` can detect an older installed engine. The current draft is
12
+ **0.5.0**; it has not been published by preparing these files.
13
+ 2. From `agent-kit/` (or the root of a standalone clone), run:
14
+
15
+ ```bash
16
+ npm test
17
+ npm pack --dry-run
18
+ ```
19
+
20
+ No dependency installation is needed. Tests use isolated home directories and
21
+ scratch Git repositories. The npm allowlist includes runtime modules,
22
+ templates, README, guides, changelog and license; tests and workflows stay in
23
+ GitHub. The monorepo also checks `test/fixtures/execute-tools.json` against the
24
+ server's Execute toolset. Update the snapshot when that server contract changes.
25
+ 3. Review the diff and commit the intended CLI changes. `git subtree split`
26
+ exports committed history only, so uncommitted changes will not reach GitHub.
27
+ Test the exported standalone tree too; it must not require the backend folder.
28
+
29
+ ## Update the GitHub mirror
30
+
31
+ After the reviewed monorepo changes are committed, run from the monorepo root:
32
+
33
+ ```bash
34
+ git fetch cli
35
+ git subtree split --prefix=agent-kit -b cli-release-0.5.0
36
+ git push cli cli-release-0.5.0:main
37
+ ```
38
+
39
+ The `cli` remote must point to `https://github.com/introsio/Introsio-cli.git`.
40
+ Choose an unused local split branch name. If a push is rejected, inspect the
41
+ mirror's history and reconcile it in the monorepo before repeating the split.
42
+ The mirror's `.github/workflows/tests.yml` runs its dependency-free suite on
43
+ Linux, Windows and macOS.
44
+
45
+ ## Publish from the standalone repository
46
+
47
+ Publishing runs in **Introsio-cli**, matching the case-sensitive repository URL
48
+ in `package.json`. npm requires this match for
49
+ [provenance](https://docs.npmjs.com/generating-provenance-statements/).
50
+ The monorepo's `agent-kit-v*` workflow only validates a draft; it does not publish.
51
+
52
+ Configure the `introsio` package's npm
53
+ [trusted publisher](https://docs.npmjs.com/trusted-publishers/) before the first
54
+ automated release:
55
+
56
+ | Setting | Value |
57
+ | --- | --- |
58
+ | Provider | GitHub Actions |
59
+ | Organization | `introsio` |
60
+ | Repository | `Introsio-cli` |
61
+ | Workflow filename | `release.yml` |
62
+ | Environment | Leave empty (the workflow does not select one) |
63
+ | Allowed action | Direct publish with `npm publish` |
64
+
65
+ The workflow uses GitHub-hosted runners, Node 22 and npm 11, grants OIDC permission
66
+ and publishes with provenance. It does not use an `NPM_TOKEN` secret. This npm
67
+ account configuration must be performed separately; adding the workflow does
68
+ not create the trust relationship.
69
+
70
+ After the mirror's tests pass, from a standalone clone at the reviewed commit:
71
+
72
+ ```bash
73
+ git tag v0.5.0
74
+ git push origin v0.5.0
75
+ ```
76
+
77
+ `release.yml` requires the tag to equal `v` plus `package.json`'s version, runs
78
+ the tests, inspects the package and publishes. These commands publish a public
79
+ release; run them only when the draft is approved. Create the matching GitHub
80
+ Release from that tag using the version's `CHANGELOG.md` entry as release notes.
81
+
82
+ For an interactive fallback, run these from the reviewed CLI checkout and
83
+ complete npm's browser authentication using an account that maintains `introsio`:
84
+
85
+ ```bash
86
+ npm login --auth-type=web --registry=https://registry.npmjs.org
87
+ npm whoami --registry=https://registry.npmjs.org
88
+ npm publish --access public --registry=https://registry.npmjs.org
89
+ ```
90
+
91
+ Check that `whoami` reports the intended maintainer before publishing.
92
+ `prepublishOnly` runs the test suite. Provenance is generated by the CI workflow.
93
+
94
+ ### Publishing returns 404
95
+
96
+ A `PUT .../introsio` 404 can indicate rejected credentials or missing publishing
97
+ access even when the package exists. Check authentication separately with
98
+ `npm whoami`, and read public ownership with `npm owner ls introsio`.
99
+ If `whoami` returns 401, sign in again using the commands above. If it succeeds
100
+ but publishing is refused, verify that the account has package write access and
101
+ that the package's publishing policy allows the selected method.
102
+
103
+ GitHub trusted publishing applies to the configured CI workflow; a local
104
+ PowerShell publish needs its own npm authentication. See
105
+ [npm login](https://docs.npmjs.com/cli/v11/commands/npm-login/) and
106
+ [trusted publishing](https://docs.npmjs.com/trusted-publishers/).
107
+
108
+ After publishing, verify `npm view introsio version`, inspect the GitHub Actions
109
+ result and test `npx introsio@0.5.0 version`. Tell existing users to update, run
110
+ `int setup` again and check `int doctor`.
111
+
112
+ ## Managed execution release limits
113
+
114
+ The CLI package includes managed workspace APIs and inspection commands. Publishing
115
+ it does not enable unattended vendor adapters or change the backend rollout stage.
116
+ Live GitHub, staging and independent acceptance remain separate gates. See
117
+ [managed workspace guidance](managed-workspaces.md) and the
118
+ [service release runbook](https://github.com/RASAPALLI-MAHESH/Introsio/blob/main/docs/runbooks/managed-execution-release.md).
@@ -56,6 +56,7 @@ function lostClaim(session, { name, args = {}, result }) {
56
56
  if (Number(data.status) === 404) return true;
57
57
  // The person reset the project's execution while this session held the task (its work no longer counts).
58
58
  if (data.code === REVOKED_BY_RESET) return true;
59
+ if (data.code === 'STALE_ATTEMPT' || data.code === 'STALE_LEASE') return true;
59
60
  const holder = data.claimedBy?.workerId ?? data.details?.claimedBy?.workerId;
60
61
  return Number(data.status) === 409 && !!holder && holder !== claim.workerId && holder !== args.workerId;
61
62
  }
@@ -63,6 +64,7 @@ function lostClaim(session, { name, args = {}, result }) {
63
64
  const lostReason = (data) => {
64
65
  if (Number(data.status) === 404) return 'the task no longer exists';
65
66
  if (data.code === REVOKED_BY_RESET) return "the project's execution was reset, so that work no longer counts";
67
+ if (data.code === 'STALE_ATTEMPT' || data.code === 'STALE_LEASE') return 'the execution attempt is stale or its lease expired';
66
68
  return `worker ${data.claimedBy?.workerId ?? data.details?.claimedBy?.workerId} holds it now`;
67
69
  };
68
70
 
@@ -109,6 +111,7 @@ export function applyIntrosioResult(session, { name, args = {}, result }, now) {
109
111
  taskId: id,
110
112
  title: data.task.title ?? previous?.title ?? id,
111
113
  workerId: data.workerId ?? previous?.workerId ?? null,
114
+ attempt: data.attempt ?? null,
112
115
  projectId,
113
116
  claimedAt: previous?.claimedAt ?? now,
114
117
  lastWriteAt: now,
@@ -116,6 +119,8 @@ export function applyIntrosioResult(session, { name, args = {}, result }, now) {
116
119
  leaseMs: expiresAt ? Math.max(60_000, expiresAt - now) : 30 * 60_000,
117
120
  nudgedAt: null,
118
121
  repository: data.repository ?? null,
122
+ integration: data.task.integration ?? null,
123
+ dependencySnapshot: data.dependencySnapshot ?? null,
119
124
  branch: data.task.outcome?.branch ?? previous?.branch ?? null,
120
125
  files: extractPaths(data.task.description),
121
126
  subtasks: countSubtasks(data.task),
@@ -147,6 +152,7 @@ export function applyIntrosioResult(session, { name, args = {}, result }, now) {
147
152
  const expiresAt = time(data.task.claim?.expiresAt);
148
153
  session.claims[id] = {
149
154
  taskId: id, title: data.task.title ?? id, workerId: data.task.claim?.workerId ?? args.workerId ?? null,
155
+ attempt: data.attempt ?? null,
150
156
  projectId, claimedAt: now, lastWriteAt: now, expiresAt,
151
157
  leaseMs: expiresAt ? Math.max(60_000, expiresAt - now) : 30 * 60_000,
152
158
  nudgedAt: null, repository: null, branch: args.outcome?.branch ?? null, files: [], subtasks: { total: 0, done: 0 },
@@ -54,6 +54,7 @@ export function recoveryNote(session) {
54
54
  for (const claim of claims) {
55
55
  const revision = claim.projectId != null ? session.contextRevision?.[claim.projectId] : undefined;
56
56
  const parts = [
57
+ claim.attempt ? `attempt ${JSON.stringify(claim.attempt)} (send unchanged on execution writes)` : null,
57
58
  claim.subtasks?.total ? `subtasks ${claim.subtasks.done}/${claim.subtasks.total} done` : null,
58
59
  revision !== undefined ? `context revision ${revision}` : null,
59
60
  claim.expiresAt ? `lease until ${clock(claim.expiresAt)}` : null,
@@ -68,6 +68,13 @@ export function sharedTreeDecision(session, others, { name, args = {} }, { root,
68
68
  * with the default branch (each task branches off it); local mode with HEAD.
69
69
  */
70
70
  export function inputsNote({ git, data, mode }) {
71
+ if (data?.task?.integration?.required) {
72
+ const managed = (data.inputs ?? []).filter(input => input.integration?.state === 'integrated');
73
+ const missing = managed.filter(input => !git.isAncestor(input.integration.headSha, 'HEAD'));
74
+ if (!missing.length) return null;
75
+ return 'Introsio: provision this task with the managed runner before editing. Its workspace pin includes the shared integration head. Required inputs are ' +
76
+ missing.map(input => `${input.taskId} at ${input.integration.headSha} (artifact ${input.integration.artifactId})`).join(', ') + '.';
77
+ }
71
78
  const inputs = (Array.isArray(data?.inputs) ? data.inputs : [])
72
79
  .filter((input) => typeof input?.outcome?.branch === 'string' && input.outcome.branch.trim());
73
80
  if (inputs.length === 0 || !git.root()) return null;
@@ -6,6 +6,7 @@
6
6
  /** Every Introsio MCP tool whose name alone identifies it, even under another server name. */
7
7
  export const DISTINCTIVE_TOOLS = new Set([
8
8
  'claimTask', 'pauseTask', 'completeTask', 'undoTaskCompletion', 'updateSubtask', 'getReadySubtasks', 'getReadyTasks',
9
+ 'waitForWork',
9
10
  'getExecutionWaves', 'getProjectPlan', 'createProjectPlan', 'getProjectState', 'updateProjectState',
10
11
  'getProjectContext', 'updateProjectContext', 'editProjectContextItems', 'recordProjectDecision',
11
12
  'exportProjectBlueprint', 'importProjectBlueprint', 'getTaskDependencies', 'addTaskDependency', 'removeTaskDependency',
package/lib/jsonFile.mjs CHANGED
@@ -66,7 +66,7 @@ const RENAME_RETRY_MS = 2_000;
66
66
  const TRANSIENT = new Set(['EPERM', 'EACCES', 'EBUSY']);
67
67
  const pause = (ms) => { Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms); };
68
68
 
69
- function renameWithRetry(from, to) {
69
+ export function renameWithRetry(from, to) {
70
70
  const deadline = Date.now() + RENAME_RETRY_MS;
71
71
  let delay = 5;
72
72
  for (;;) {
@@ -81,20 +81,28 @@ function renameWithRetry(from, to) {
81
81
  }
82
82
  }
83
83
 
84
- export function writeAtomic(file, text) {
84
+ export function writeAtomic(file, text, options) {
85
85
  fs.mkdirSync(path.dirname(file), { recursive: true });
86
86
  const tmp = `${file}.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2, 8)}.tmp`;
87
- fs.writeFileSync(tmp, text);
88
87
  try {
88
+ const fd = fs.openSync(tmp, 'wx', options?.mode);
89
+ try {
90
+ fs.writeFileSync(fd, text);
91
+ if (options?.durable) fs.fsyncSync(fd);
92
+ } finally { fs.closeSync(fd); }
89
93
  renameWithRetry(tmp, file);
94
+ if (options?.durable && process.platform !== 'win32') {
95
+ const dirFd = fs.openSync(path.dirname(file), 'r');
96
+ try { fs.fsyncSync(dirFd); } finally { fs.closeSync(dirFd); }
97
+ }
90
98
  } catch (error) {
91
99
  try { fs.rmSync(tmp, { force: true }); } catch { /* best effort */ }
92
100
  throw error;
93
101
  }
94
102
  }
95
103
 
96
- export function writeJson(file, value) {
97
- writeAtomic(file, `${JSON.stringify(value, null, 2)}\n`);
104
+ export function writeJson(file, value, options) {
105
+ writeAtomic(file, `${JSON.stringify(value, null, 2)}\n`, options);
98
106
  }
99
107
 
100
108
  export function appendLine(file, line) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "introsio",
3
- "version": "0.4.0",
4
- "description": "Connect any coding agent to Introsio, run a Developer Mode project with /introsio-execute, and keep Introsio updated with hooks.",
3
+ "version": "0.5.0",
4
+ "description": "Connect coding agents to Introsio with MCP, execution hooks, pause/resume, parallel worktrees and managed attempt workspace tooling.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "int": "cli.mjs",
@@ -13,11 +13,13 @@
13
13
  "files": [
14
14
  "cli.mjs",
15
15
  "lib",
16
+ "runner",
16
17
  "hook",
17
18
  "agents",
18
19
  "opencode",
19
20
  "templates",
20
21
  "README.md",
22
+ "docs",
21
23
  "LICENSE",
22
24
  "CHANGELOG.md"
23
25
  ],