@uchibeke/gallivant 0.0.0-stage → 0.2.1

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.
Files changed (168) hide show
  1. package/CONTRIBUTING.md +26 -0
  2. package/LICENSE +204 -0
  3. package/README.md +239 -2
  4. package/SECURITY.md +19 -0
  5. package/bin/gallivant.mjs +261 -0
  6. package/bin/package-plugin.mjs +16 -0
  7. package/bin/release-live.mjs +29 -0
  8. package/bin/release-package.mjs +23 -0
  9. package/bin/session-runtime.mjs +13 -0
  10. package/bin/task-delivery-state.mjs +12 -0
  11. package/docs/README.md +72 -0
  12. package/docs/agent-setup.md +228 -0
  13. package/docs/app.md +111 -0
  14. package/docs/architecture.md +265 -0
  15. package/docs/chains.md +102 -0
  16. package/docs/codex-cloud.md +284 -0
  17. package/docs/commands.md +649 -0
  18. package/docs/config.md +437 -0
  19. package/docs/execution.md +796 -0
  20. package/docs/guardrails.md +311 -0
  21. package/docs/install.md +398 -0
  22. package/docs/launch.md +45 -0
  23. package/docs/learning.md +369 -0
  24. package/docs/network-recovery.md +101 -0
  25. package/docs/openai-agents.md +457 -0
  26. package/docs/prd.md +246 -0
  27. package/docs/preparation.md +110 -0
  28. package/docs/release-qualification.md +196 -0
  29. package/docs/releasing.md +149 -0
  30. package/docs/runtime-environment.md +113 -0
  31. package/docs/task-delivery.md +476 -0
  32. package/docs/tasks.md +739 -0
  33. package/lib/aport.mjs +95 -0
  34. package/lib/attribution.mjs +95 -0
  35. package/lib/block.mjs +89 -0
  36. package/lib/capabilities.mjs +3 -0
  37. package/lib/chains.mjs +222 -0
  38. package/lib/codex_cloud.mjs +160 -0
  39. package/lib/codex_cloud_config.mjs +20 -0
  40. package/lib/codex_cloud_input.mjs +49 -0
  41. package/lib/codex_cloud_result.mjs +74 -0
  42. package/lib/commands/doctor.mjs +466 -0
  43. package/lib/commands/init.mjs +245 -0
  44. package/lib/commands/learn.mjs +54 -0
  45. package/lib/commands/new.mjs +47 -0
  46. package/lib/commands/ready.mjs +45 -0
  47. package/lib/commands/register.mjs +249 -0
  48. package/lib/commands/resume.mjs +224 -0
  49. package/lib/commands/serve.mjs +349 -0
  50. package/lib/commands/start.mjs +247 -0
  51. package/lib/commands/start_services.mjs +22 -0
  52. package/lib/commands/status.mjs +150 -0
  53. package/lib/commands/task.mjs +73 -0
  54. package/lib/commands/up.mjs +228 -0
  55. package/lib/commands/why.mjs +143 -0
  56. package/lib/config.mjs +461 -0
  57. package/lib/context.mjs +102 -0
  58. package/lib/control.mjs +202 -0
  59. package/lib/control_contract.mjs +16 -0
  60. package/lib/coordinator.mjs +19 -0
  61. package/lib/credential.mjs +161 -0
  62. package/lib/daemon.mjs +156 -0
  63. package/lib/deliverable.mjs +357 -0
  64. package/lib/events.mjs +261 -0
  65. package/lib/executable.mjs +31 -0
  66. package/lib/execution.mjs +707 -0
  67. package/lib/execution_contract.mjs +15 -0
  68. package/lib/execution_input.mjs +4 -0
  69. package/lib/execution_io.mjs +94 -0
  70. package/lib/execution_journal.mjs +69 -0
  71. package/lib/execution_preparation.mjs +29 -0
  72. package/lib/execution_result.mjs +266 -0
  73. package/lib/fs.mjs +140 -0
  74. package/lib/gh.mjs +289 -0
  75. package/lib/git.mjs +434 -0
  76. package/lib/harness.mjs +521 -0
  77. package/lib/harness_log.mjs +432 -0
  78. package/lib/hash.mjs +16 -0
  79. package/lib/identity.mjs +98 -0
  80. package/lib/learning.mjs +654 -0
  81. package/lib/learning_contract.mjs +2 -0
  82. package/lib/learning_data.mjs +135 -0
  83. package/lib/learning_input.mjs +111 -0
  84. package/lib/learning_qualification.mjs +67 -0
  85. package/lib/learning_signer.mjs +151 -0
  86. package/lib/learning_store.mjs +88 -0
  87. package/lib/log.mjs +53 -0
  88. package/lib/network_diagnostics.mjs +64 -0
  89. package/lib/network_recovery.mjs +42 -0
  90. package/lib/notify.mjs +58 -0
  91. package/lib/openai_agents.mjs +373 -0
  92. package/lib/openai_agents_config.mjs +14 -0
  93. package/lib/openai_agents_http.mjs +87 -0
  94. package/lib/openai_agents_input.mjs +15 -0
  95. package/lib/openai_agents_sources.mjs +112 -0
  96. package/lib/owner_delivery.mjs +443 -0
  97. package/lib/plugin_package.mjs +340 -0
  98. package/lib/prd.mjs +635 -0
  99. package/lib/preparation_agents.mjs +33 -0
  100. package/lib/preparation_codex.mjs +212 -0
  101. package/lib/probe.mjs +126 -0
  102. package/lib/prompt.mjs +238 -0
  103. package/lib/provider_health.mjs +55 -0
  104. package/lib/public-format.mjs +31 -0
  105. package/lib/public_output.mjs +49 -0
  106. package/lib/release_package.mjs +154 -0
  107. package/lib/repository_files.mjs +86 -0
  108. package/lib/run.mjs +385 -0
  109. package/lib/run_log.mjs +94 -0
  110. package/lib/runtime-environment.mjs +87 -0
  111. package/lib/runtime_dependencies.mjs +15 -0
  112. package/lib/runtime_node.mjs +107 -0
  113. package/lib/runtime_state.mjs +174 -0
  114. package/lib/sources/index.mjs +27 -0
  115. package/lib/sources/prd.mjs +50 -0
  116. package/lib/start_contract.mjs +37 -0
  117. package/lib/state.mjs +246 -0
  118. package/lib/task_allowance.mjs +31 -0
  119. package/lib/task_completion.mjs +61 -0
  120. package/lib/task_contract.mjs +450 -0
  121. package/lib/task_delivery.mjs +219 -0
  122. package/lib/task_delivery_cancel.mjs +34 -0
  123. package/lib/task_delivery_contract.mjs +61 -0
  124. package/lib/task_delivery_mcp.mjs +40 -0
  125. package/lib/task_delivery_store.mjs +43 -0
  126. package/lib/task_delivery_view.mjs +88 -0
  127. package/lib/task_environment.mjs +281 -0
  128. package/lib/task_prepare.mjs +224 -0
  129. package/lib/task_store.mjs +38 -0
  130. package/lib/tasks.mjs +513 -0
  131. package/lib/tick.mjs +1654 -0
  132. package/lib/time.mjs +36 -0
  133. package/lib/tracker/assets.mjs +43 -0
  134. package/lib/tracker/pages.mjs +320 -0
  135. package/lib/tracker/runs.mjs +102 -0
  136. package/lib/tracker/stream.mjs +74 -0
  137. package/lib/tracker_process.mjs +107 -0
  138. package/lib/verification_sandbox.mjs +181 -0
  139. package/node_modules/smol-toml/LICENSE +24 -0
  140. package/node_modules/smol-toml/README.md +605 -0
  141. package/node_modules/smol-toml/dist/date.d.ts +41 -0
  142. package/node_modules/smol-toml/dist/date.js +156 -0
  143. package/node_modules/smol-toml/dist/error.d.ts +37 -0
  144. package/node_modules/smol-toml/dist/error.js +67 -0
  145. package/node_modules/smol-toml/dist/extract.js +289 -0
  146. package/node_modules/smol-toml/dist/index.cjs +770 -0
  147. package/node_modules/smol-toml/dist/index.d.ts +44 -0
  148. package/node_modules/smol-toml/dist/index.js +34 -0
  149. package/node_modules/smol-toml/dist/parse.d.ts +73 -0
  150. package/node_modules/smol-toml/dist/parse.js +164 -0
  151. package/node_modules/smol-toml/dist/primitive.js +151 -0
  152. package/node_modules/smol-toml/dist/stringify.d.ts +32 -0
  153. package/node_modules/smol-toml/dist/stringify.js +219 -0
  154. package/node_modules/smol-toml/dist/struct.js +156 -0
  155. package/node_modules/smol-toml/dist/util.d.ts +43 -0
  156. package/node_modules/smol-toml/dist/util.js +57 -0
  157. package/node_modules/smol-toml/package.json +68 -0
  158. package/npm-shrinkwrap.json +1823 -0
  159. package/package.json +105 -4
  160. package/templates/claude-settings.json +18 -0
  161. package/templates/passport.gallivant.json +83 -0
  162. package/templates/plugin/bundled-runtime.json +26 -0
  163. package/templates/plugin/schemas/mcp.schema.json +120 -0
  164. package/templates/plugin/schemas/plugin.schema.json +65 -0
  165. package/templates/plugin/task-delivery.SKILL.md +60 -0
  166. package/templates/prd.md +32 -0
  167. package/templates/tracker/tracker.css +301 -0
  168. package/templates/tracker/tracker.js +721 -0
@@ -0,0 +1,149 @@
1
+ # Releasing
2
+
3
+ The package name is `@uchibeke/gallivant`; the executable is `gallivant`. The repository is
4
+ `uchibeke/gallivant`. The first public release, 0.2.0, was published on
5
+ 2026-10-19; `npm view @uchibeke/gallivant version` reports the current one.
6
+ Before announcing a version, confirm its npm publication and a passing consumer
7
+ smoke check. A public GitHub repository alone does not make the npm command work.
8
+
9
+ The README and installation guide lead with
10
+ `npx --yes @uchibeke/gallivant init --harness codex`, which runs whatever
11
+ version npm serves as `latest`. When `init` or another documented command changes
12
+ behavior, release the version that carries it before, or together with, the
13
+ documentation that describes it.
14
+
15
+ ## One-time launch setup
16
+
17
+ 1. Review all branches and Git history, author metadata, issues, PR discussions,
18
+ Actions logs and artifacts for private material before changing visibility.
19
+ Removing a file from the current checkout does not remove historical copies.
20
+ Retain history unless a specific disclosure requires cleanup; coordinate any
21
+ rewrite with open PRs and active runs that reference existing commits. After
22
+ the owner accepts the reviewed exposure, make the repository public and enable
23
+ GitHub private vulnerability reporting. These are owner actions, not effects
24
+ of a PR merge.
25
+ 2. Create a GitHub Actions environment named `npm`, restricted to release tags
26
+ and `main`, with a required maintainer reviewer. Only release jobs receive
27
+ publishing authority; pull-request tests get read-only permissions.
28
+ Enable the `main` ruleset with pull requests, the four portability checks,
29
+ and protection against deletion and force pushes. Read back both settings:
30
+ merely referencing `environment: npm` in YAML does not create protection.
31
+ 3. The initial publication used a short-lived granular `NPM_TOKEN` in the
32
+ protected `npm` environment, scoped as narrowly as npm permits. Never put a
33
+ token in the repository or a PR. A local `npm login` is not authentication
34
+ for GitHub Actions. Do not publish a release locally to bypass this setup:
35
+ the release's provenance is generated in supported CI, not by the
36
+ developer's terminal.
37
+ 4. With the package published, configure its npm trusted publisher for GitHub owner
38
+ `uchibeke`, repository `gallivant`, workflow `release.yml`, environment `npm`.
39
+ Permit direct `npm publish`, which is what this workflow runs. Validate a new
40
+ trusted publisher within two days or recreate it after expiry; configure it
41
+ shortly before the next planned release. An identical-version rerun skips
42
+ publication and does not validate OIDC. Remove the
43
+ bootstrap token after a successful OIDC release, then require 2FA and disallow
44
+ traditional token publishing in the package settings. Trusted publishing
45
+ needs npm 11.5.1+ and Node 22.14+; the workflow uses Node 24 and npm 11. See
46
+ [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/) and
47
+ [provenance](https://docs.npmjs.com/generating-provenance-statements/).
48
+ 5. Merge the reviewed release changes, verify CI, then publish. Repository
49
+ visibility, npm ownership and environment protection must be checked in their
50
+ respective settings; a workflow file alone does not configure them.
51
+
52
+ Read-only preflight (authenticated repository administration access is required
53
+ for environment and ruleset details):
54
+
55
+ ```sh
56
+ gh repo view uchibeke/gallivant --json visibility,defaultBranchRef
57
+ gh api repos/uchibeke/gallivant/environments/npm
58
+ gh api repos/uchibeke/gallivant/environments/npm/deployment-branch-policies
59
+ gh api repos/uchibeke/gallivant/branches/main --jq '{protected,protection}'
60
+ gh api repos/uchibeke/gallivant/rulesets
61
+ npm whoami --registry=https://registry.npmjs.org
62
+ npm view @uchibeke/gallivant version --registry=https://registry.npmjs.org
63
+ ```
64
+
65
+ `npm view` should report the published version. An absent `npm` environment or
66
+ disabled branch protection is unfinished release setup.
67
+
68
+ ### Staged publishing is a different workflow
69
+
70
+ npm now supports `npm stage publish` and explicit maintainer approval with 2FA.
71
+ It requires npm 11.15+ and Node 22.14+. Staging a new package creates a **public
72
+ `0.0.0-stage` placeholder**; it is not a dry run. The staged version's contents
73
+ remain private until approval. See [npm staged publishing](https://docs.npmjs.com/staged-publishing/).
74
+
75
+ This repository's release workflow publishes directly after the GitHub
76
+ environment approval. It does not stage, approve, or poll staged versions.
77
+ Do not configure its trusted publisher as stage-only or use staging as an
78
+ implicit bootstrap step. Adopting that route requires a separately reviewed
79
+ workflow that records the stage ID and waits for approval before creating the
80
+ GitHub release. Until then, use the documented CI bootstrap credential route.
81
+
82
+ ## Release a version
83
+
84
+ Update the version with `npm version patch --no-git-tag-version` (or `minor`),
85
+ which updates `package.json` and `npm-shrinkwrap.json`. Include release notes in
86
+ the PR and merge it after CI passes. Do not bump the version for a retry.
87
+
88
+ The workflow follows the guardrails repository's pattern: validate the release
89
+ ref, test before publishing, and permit recovery without replacing published
90
+ versions. This single-package project does not need its multi-registry dispatcher.
91
+
92
+ Choose one trigger:
93
+
94
+ ```sh
95
+ # From an up-to-date main checkout; replace the example with package.json's version.
96
+ git tag -a v0.2.1 -m 'Release 0.2.1'
97
+ git push origin v0.2.1
98
+
99
+ # Or dispatch against main; the workflow uses main's package version.
100
+ gh workflow run release.yml --repo uchibeke/gallivant --ref main
101
+ ```
102
+
103
+ Every release runs the Node 22/24 × Linux/macOS matrix: lint, the offline test
104
+ suite, native isolation checks, and a clean installation of the actual tarball.
105
+ Publishing requires a public repository, an exact tag/version match (or manual
106
+ dispatch from `main`), and a commit reachable from `main`. An existing tag must
107
+ point to that exact commit. The protected environment gates publication.
108
+
109
+ The workflow packs the tested source, publishes to npm with provenance, then
110
+ creates a GitHub release with the tarball. No publish occurs on an ordinary PR
111
+ or version edit. A rerun accepts an existing npm version only when its SHA-512
112
+ integrity matches the freshly packed artifact. A registry error fails closed;
113
+ an existing version must also advertise provenance. Missing provenance is not
114
+ repaired by rerunning this workflow, and different bytes require a new version.
115
+ For an older tagged release, rerun its
116
+ original workflow rather than dispatching newer `main` with the old version.
117
+
118
+ ## Verify before announcing
119
+
120
+ ```sh
121
+ npm view @uchibeke/gallivant version dist.integrity dist.attestations
122
+ npx --yes @uchibeke/gallivant --version # the command the README leads with
123
+ npm install -g @uchibeke/gallivant # the documented persistent option
124
+ gallivant --version
125
+ gallivant --help
126
+ ```
127
+
128
+ Compare the registry's integrity with the workflow tarball and inspect the
129
+ attestation's source repository, commit and workflow. Run `npm audit signatures`
130
+ in a clean project that installed the released version to verify registry
131
+ signatures and available provenance. Metadata presence alone is not signature
132
+ verification; see [npm provenance verification](https://docs.npmjs.com/generating-provenance-statements/#verifying-provenance-attestations).
133
+
134
+ After publication is verified, check that the README's `npx` command and the
135
+ installation guide match the behavior of the released version, and keep the
136
+ source-install alternative for contributors.
137
+
138
+ Use a clean test account/home and the [getting-started guide](install.md) for one
139
+ small real PR. Confirm implementation, feedback-driven continuation, CI and the
140
+ completion receipt; automated installation checks use fixtures and do not prove
141
+ paid-provider access. Recheck anonymous GitHub access and all README links.
142
+ Announcement drafts are in [launch.md](launch.md).
143
+
144
+ For local validation without publishing: `npm run lint`, `npm test`, and
145
+ `npm run test:install`. The last command packs the tarball under a disposable
146
+ directory, runs the README's `npx` setup command against it from a fixture
147
+ repository with a throwaway home, installs it as a dependency, exercises PRD
148
+ commands outside the source tree, and imports every declared module export. It
149
+ makes registry requests but no model calls.
@@ -0,0 +1,113 @@
1
+ # Node runtime and harness shells
2
+
3
+ This contract covers local implementation through Claude, Codex, Gemini,
4
+ OpenCode and Goose, plus the coordinator's local tooling. Hosted Agents compute
5
+ uses its configured environment/packages instead; local paths are not uploaded
6
+ as runtime grants. Preparation has a separate limited-authority
7
+ [boundary](preparation.md). For setup start with [installation](install.md), then
8
+ use this guide when a harness shell selects a different Node or package manager.
9
+
10
+ ## Why this is needed
11
+
12
+ A harness executable and the Node used by its Bash tools are separate choices.
13
+ Earlier fixes made coordinator verification use a non-login POSIX shell and
14
+ named the exact configured harness executable in each session. Neither prevented
15
+ Claude's saved shell environment from selecting another Node installation.
16
+ On an ARM64 Mac, that selected an x64 Node under Rosetta while the checkout had
17
+ ARM64 native dependencies; sandbox reads also blocked the intended Node under
18
+ the operator's version-manager directory.
19
+
20
+ Native dependencies must match the Node process that installs and executes them,
21
+ including its platform, architecture and supported ABI. Hardware architecture or
22
+ a lockfile alone does not establish that match. Do not copy an alternative Rollup
23
+ binary into `node_modules` or change the lockfile to hide a mismatched interpreter.
24
+
25
+ ## Shared runtime contract
26
+
27
+ Gallivant's local implementation adapters prepend the directory containing the
28
+ Node executable that launched Gallivant to PATH. Start and resume share this
29
+ implementation. Executable discovery checks inherited PATH first, then the
30
+ operator's login shell with `command -v`, then non-login `/bin/sh -c`. The fallback
31
+ does not source login profiles, which may contain shell-specific syntax. Missing or empty PATH
32
+ gets `/usr/bin:/bin` for the fallback lookup. Relative PATH entries do not grant
33
+ executable discovery from the checkout. Linux does not require zsh. Paths with
34
+ spaces and apostrophes are shell-quoted.
35
+
36
+ Claude can rebuild PATH from a shell snapshot. Its SessionStart hook therefore
37
+ appends the runtime path to `CLAUDE_ENV_FILE`, which Claude applies to subsequent
38
+ Bash commands. This uses the documented
39
+ [session environment mechanism](https://code.claude.com/docs/en/hooks#persist-environment-variables).
40
+ The original settings and hooks are preserved. Building or rebuilding a launch
41
+ description creates no files. At actual dispatch the runner exclusively creates
42
+ `runtime-settings.json` (0600) in its private run directory (0700), outside the
43
+ agent checkout. Original settings are not edited. Exit and failed-launch handling
44
+ remove owned snapshots; coordinator observation, settlement and the next launch
45
+ also recover cleanup after a restart. Unknown process ownership or surviving tool
46
+ processes retain the file until absence is confirmed. Tool-free preparation never
47
+ receives this settings overlay or its hooks.
48
+
49
+ PATH alone is insufficient when `blockReadsOutsideWorkingDirectories` prevents
50
+ the shell from reaching a version-manager installation. The snapshot adds
51
+ [sandbox read allowances](https://code.claude.com/docs/en/sandboxing) for the exact
52
+ running Node executable and recognized npm, pnpm and Corepack package roots
53
+ resolved from sibling executables. It does not grant writes, permit network
54
+ destinations, expose the home directory, change model selection, or turn off
55
+ APort hooks. Existing denies remain in the settings. Administrators can still
56
+ prevent runtime access through managed policy; that requires operator correction,
57
+ not disabling the sandbox or replacing dependencies with another architecture.
58
+
59
+ Package-manager code is executable, operator-trusted tooling. Install Gallivant
60
+ using the Node version intended for its work, not a project-controlled Node
61
+ binary. Restart the daemon after changing installations. Repositories requiring
62
+ a different Node version must explicitly provision that toolchain; this change
63
+ does not infer one from untrusted repository files or run a version manager.
64
+
65
+ npm's upper- and lower-case cache variables point to
66
+ `.cache/gallivant/npm` inside the checkout, outside the directory that `npm ci`
67
+ removes. Actual dispatch creates an ignore file inside that cache so cache files
68
+ do not become repository changes; it refuses symlink paths and conflicting ignore
69
+ files. Building a launch description remains free of filesystem writes. The existing npm user
70
+ config isolation is retained. This does not grant access to home caches or copy
71
+ registry tokens. A custom package manager or native runtime with additional
72
+ libraries can still need operator-approved paths. Other harnesses receive the
73
+ same initial PATH/cache contract but retain their own native shell behavior.
74
+ Remote/cloud adapters run on another machine and are not assigned local paths.
75
+
76
+ ## Diagnosing a mismatch
77
+
78
+ Run this in the affected harness's tool shell before installing dependencies:
79
+
80
+ ```sh
81
+ command -v node npm npx pnpm
82
+ node -p 'JSON.stringify({execPath:process.execPath,platform:process.platform,arch:process.arch,version:process.version,abi:process.versions.modules,cache:process.env.npm_config_cache})'
83
+ ```
84
+
85
+ Compare the result with the selected runtime printed by the session hook. If it
86
+ differs or a read is denied, preserve the error and fix the host runtime/access
87
+ configuration first. Once the intended interpreter is accessible and selected,
88
+ use the repository's documented locked install to rebuild any dependencies left
89
+ by a different interpreter. This change does not repair existing `node_modules`
90
+ automatically. Already-running sessions retain their launch environment; after
91
+ installing the fix, restart the daemon and resume the same task through the normal
92
+ controls so the next session invocation receives the new setup.
93
+
94
+ ## Verification
95
+
96
+ `node --test test/runtime-environment.test.mjs` exercises actual shell execution
97
+ with a conflicting Node, all five local start/resume adapters, quoting, portable
98
+ discovery, preservation of security settings, actual child-process cleanup,
99
+ failed launches, restart recovery, and refusal of agent-writable snapshots.
100
+ `npm test` includes this file and all existing suites, including remote adapter
101
+ tests. The runtime-portability
102
+ workflow runs the full suite on Ubuntu and macOS with Node 22 and 24. CI installs
103
+ Bubblewrap and activates Ubuntu's packaged sandbox-helper AppArmor profile on
104
+ Linux, and selects Command Line Tools on macOS before running
105
+ `node test/verification-host.mjs`. This preflight must prove the real filesystem
106
+ and network boundary; failing isolation never becomes an unsandboxed fallback.
107
+
108
+ `GALLIVANT_RUNTIME_LIVE=yes node test/runtime-environment-live.mjs` is an opt-in
109
+ Claude probe using configured authentication and guards. It allows one run with
110
+ a $2 ceiling and verifies actual Bash-tool output rather than assistant claims.
111
+ It does not install packages, access customer data or weaken security settings.
112
+ Native checks for other providers and Linux are separate from local fixture
113
+ coverage; a green fixture does not prove their credentials or model access.