@uchibeke/gallivant 0.0.0-stage → 0.2.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.
Files changed (168) hide show
  1. package/CONTRIBUTING.md +26 -0
  2. package/LICENSE +204 -0
  3. package/README.md +201 -2
  4. package/SECURITY.md +19 -0
  5. package/bin/gallivant.mjs +257 -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 +70 -0
  12. package/docs/agent-setup.md +214 -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 +620 -0
  18. package/docs/config.md +430 -0
  19. package/docs/execution.md +796 -0
  20. package/docs/guardrails.md +311 -0
  21. package/docs/install.md +338 -0
  22. package/docs/launch.md +42 -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 +140 -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 +457 -0
  43. package/lib/commands/init.mjs +34 -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 +195 -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 +100 -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 +631 -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 +133 -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 +1635 -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,140 @@
1
+ # Releasing
2
+
3
+ The package name is `@uchibeke/gallivant`; the executable is `gallivant`. The repository is
4
+ `uchibeke/gallivant`. Before announcing a version, confirm npm publication and a
5
+ passing consumer smoke check. A public GitHub repository alone does not make the
6
+ npm command work.
7
+
8
+ ## One-time launch setup
9
+
10
+ 1. Review all branches and Git history, author metadata, issues, PR discussions,
11
+ Actions logs and artifacts for private material before changing visibility.
12
+ Removing a file from the current checkout does not remove historical copies.
13
+ Retain history unless a specific disclosure requires cleanup; coordinate any
14
+ rewrite with open PRs and active runs that reference existing commits. After
15
+ the owner accepts the reviewed exposure, make the repository public and enable
16
+ GitHub private vulnerability reporting. These are owner actions, not effects
17
+ of a PR merge.
18
+ 2. Create a GitHub Actions environment named `npm`, restricted to release tags
19
+ and `main`, with a required maintainer reviewer. Only release jobs receive
20
+ publishing authority; pull-request tests get read-only permissions.
21
+ Enable the `main` ruleset with pull requests, the four portability checks,
22
+ and protection against deletion and force pushes. Read back both settings:
23
+ merely referencing `environment: npm` in YAML does not create protection.
24
+ 3. For a package that does not exist yet, arrange the initial npm publication
25
+ credential with the npm owner. If needed, set a short-lived granular
26
+ `NPM_TOKEN` in the protected `npm` environment, scoped as narrowly as npm
27
+ permits. Never put it in the repository or a PR.
28
+ A local `npm login` is not authentication for GitHub Actions. Do not publish
29
+ the release locally to bypass this setup: the release's provenance is
30
+ generated in supported CI, not by the developer's terminal.
31
+ 4. Once the package exists, configure its npm trusted publisher for GitHub owner
32
+ `uchibeke`, repository `gallivant`, workflow `release.yml`, environment `npm`.
33
+ Permit direct `npm publish`, which is what this workflow runs. Validate a new
34
+ trusted publisher within two days or recreate it after expiry; configure it
35
+ shortly before the next planned release. An identical-version rerun skips
36
+ publication and does not validate OIDC. Remove the
37
+ bootstrap token after a successful OIDC release, then require 2FA and disallow
38
+ traditional token publishing in the package settings. Trusted publishing
39
+ needs npm 11.5.1+ and Node 22.14+; the workflow uses Node 24 and npm 11. See
40
+ [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/) and
41
+ [provenance](https://docs.npmjs.com/generating-provenance-statements/).
42
+ 5. Merge the reviewed release changes, verify CI, then publish. Repository
43
+ visibility, npm ownership and environment protection must be checked in their
44
+ respective settings; a workflow file alone does not configure them.
45
+
46
+ Read-only preflight (authenticated repository administration access is required
47
+ for environment and ruleset details):
48
+
49
+ ```sh
50
+ gh repo view uchibeke/gallivant --json visibility,defaultBranchRef
51
+ gh api repos/uchibeke/gallivant/environments/npm
52
+ gh api repos/uchibeke/gallivant/environments/npm/deployment-branch-policies
53
+ gh api repos/uchibeke/gallivant/branches/main --jq '{protected,protection}'
54
+ gh api repos/uchibeke/gallivant/rulesets
55
+ npm whoami --registry=https://registry.npmjs.org
56
+ npm view @uchibeke/gallivant version --registry=https://registry.npmjs.org
57
+ ```
58
+
59
+ An absent package is expected before the first publication. An absent `npm`
60
+ environment or disabled branch protection is unfinished release setup.
61
+
62
+ ### Staged publishing is a different workflow
63
+
64
+ npm now supports `npm stage publish` and explicit maintainer approval with 2FA.
65
+ It requires npm 11.15+ and Node 22.14+. Staging a new package creates a **public
66
+ `0.0.0-stage` placeholder**; it is not a dry run. The staged version's contents
67
+ remain private until approval. See [npm staged publishing](https://docs.npmjs.com/staged-publishing/).
68
+
69
+ This repository's release workflow publishes directly after the GitHub
70
+ environment approval. It does not stage, approve, or poll staged versions.
71
+ Do not configure its trusted publisher as stage-only or use staging as an
72
+ implicit bootstrap step. Adopting that route requires a separately reviewed
73
+ workflow that records the stage ID and waits for approval before creating the
74
+ GitHub release. Until then, use the documented CI bootstrap credential route.
75
+
76
+ ## Release a version
77
+
78
+ Update the version with `npm version patch --no-git-tag-version` (or `minor`),
79
+ which updates `package.json` and `npm-shrinkwrap.json`. Include release notes in
80
+ the PR and merge it after CI passes. Do not bump the version for a retry.
81
+
82
+ The workflow follows the guardrails repository's pattern: validate the release
83
+ ref, test before publishing, and permit recovery without replacing published
84
+ versions. This single-package project does not need its multi-registry dispatcher.
85
+
86
+ Choose one trigger:
87
+
88
+ ```sh
89
+ # From an up-to-date main checkout; replace the example with package.json's version.
90
+ git tag -a v0.2.0 -m 'Release 0.2.0'
91
+ git push origin v0.2.0
92
+
93
+ # Or dispatch against main; the workflow uses main's package version.
94
+ gh workflow run release.yml --repo uchibeke/gallivant --ref main
95
+ ```
96
+
97
+ Every release runs the Node 22/24 × Linux/macOS matrix: lint, the offline test
98
+ suite, native isolation checks, and a clean installation of the actual tarball.
99
+ Publishing requires a public repository, an exact tag/version match (or manual
100
+ dispatch from `main`), and a commit reachable from `main`. An existing tag must
101
+ point to that exact commit. The protected environment gates publication.
102
+
103
+ The workflow packs the tested source, publishes to npm with provenance, then
104
+ creates a GitHub release with the tarball. No publish occurs on an ordinary PR
105
+ or version edit. A rerun accepts an existing npm version only when its SHA-512
106
+ integrity matches the freshly packed artifact. A registry error fails closed;
107
+ an existing version must also advertise provenance. Missing provenance is not
108
+ repaired by rerunning this workflow, and different bytes require a new version.
109
+ For an older tagged release, rerun its
110
+ original workflow rather than dispatching newer `main` with the old version.
111
+
112
+ ## Verify before announcing
113
+
114
+ ```sh
115
+ npm view @uchibeke/gallivant version dist.integrity dist.attestations
116
+ npm install -g @uchibeke/gallivant
117
+ gallivant --version
118
+ gallivant --help
119
+ ```
120
+
121
+ Compare the registry's integrity with the workflow tarball and inspect the
122
+ attestation's source repository, commit and workflow. Run `npm audit signatures`
123
+ in a clean project that installed the released version to verify registry
124
+ signatures and available provenance. Metadata presence alone is not signature
125
+ verification; see [npm provenance verification](https://docs.npmjs.com/generating-provenance-statements/#verifying-provenance-attestations).
126
+
127
+ After publication is verified, update the README and installation guide to put
128
+ the tested npm install command first and remove the first-release-pending notes
129
+ (including this page). Keep the source-install alternative.
130
+
131
+ Use a clean test account/home and the [getting-started guide](install.md) for one
132
+ small real PR. Confirm implementation, feedback-driven continuation, CI and the
133
+ completion receipt; automated installation checks use fixtures and do not prove
134
+ paid-provider access. Recheck anonymous GitHub access and all README links.
135
+ Announcement drafts are in [launch.md](launch.md).
136
+
137
+ For local validation without publishing: `npm run lint`, `npm test`, and
138
+ `npm run test:install`. The last command packs and installs under a disposable
139
+ directory, exercises setup and PRD commands outside the source tree, and imports
140
+ every declared module export. It 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.