Skip to content

Commit 79db731

Browse files
committed
Split http-pool from http-client
1 parent 445c296 commit 79db731

File tree

369 files changed

+3110
-2708
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

369 files changed

+3110
-2708
lines changed

.github/workflows/split.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ jobs:
8383
- local: 'packages/http-client'
8484
repo: 'cognesy/instructor-http-client'
8585
name: 'instructor-http-client'
86+
- local: 'packages/http-pool'
87+
repo: 'cognesy/instructor-http-pool'
88+
name: 'instructor-http-pool'
8689
- local: 'packages/hub'
8790
repo: 'cognesy/instructor-hub'
8891
name: 'instructor-hub'

.github/workflows/split.yml.bak

Lines changed: 0 additions & 178 deletions
This file was deleted.

ADDING-PACKAGE.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Adding a Package
2+
3+
This monorepo treats each package as a first-class split package.
4+
5+
Use this checklist when adding a new package.
6+
7+
## 1. Create The Package
8+
9+
Create the package directory under `packages/<name>` with:
10+
11+
- `src/`
12+
- `tests/`
13+
- `composer.json`
14+
- `README.md`
15+
- `CHEATSHEET.md`
16+
- `docs/`
17+
18+
For docs, keep the initial structure small:
19+
20+
- `docs/_meta.yaml`
21+
- `docs/overview.md`
22+
- `docs/quickstart.md`
23+
24+
## 2. Register It In The Monorepo
25+
26+
Add the package to [packages.json](/Users/ddebowczyk/projects/instructor-php/packages.json):
27+
28+
```json
29+
{
30+
"local": "packages/http-pool",
31+
"repo": "cognesy/instructor-http-pool",
32+
"github_name": "instructor-http-pool",
33+
"composer_name": "cognesy/instructor-http-pool"
34+
}
35+
```
36+
37+
Then update:
38+
39+
- root `composer.json` autoload and autoload-dev
40+
- root `README.md`
41+
- [CONTENTS.md](/Users/ddebowczyk/projects/instructor-php/CONTENTS.md)
42+
- [CONTRIBUTOR_GUIDE.md](/Users/ddebowczyk/projects/instructor-php/CONTRIBUTOR_GUIDE.md)
43+
- any docs registries under `packages/*/resources/config/docs.yaml` or `.yml`
44+
45+
If the package adds public docs, give it:
46+
47+
- a description in each docs config
48+
- a stable place in package order
49+
50+
## 3. Regenerate Split Workflow
51+
52+
Run:
53+
54+
```bash
55+
./scripts/update-split-yml.sh .
56+
```
57+
58+
This regenerates the package matrix in `.github/workflows/split.yml` from `packages.json`.
59+
60+
## 4. Create The GitHub Repo
61+
62+
Create the split repository with `gh`:
63+
64+
```bash
65+
gh repo create cognesy/instructor-http-pool \
66+
--public \
67+
--description "Concurrent HTTP request execution for Instructor"
68+
```
69+
70+
Verify it exists:
71+
72+
```bash
73+
gh repo view cognesy/instructor-http-pool --json name,url,visibility
74+
```
75+
76+
## 5. Add The Package To Packagist
77+
78+
Default path: manual.
79+
80+
1. Open `https://packagist.org/packages/submit`
81+
2. Submit the split repository URL, for example:
82+
`https://github.com/cognesy/instructor-http-pool`
83+
3. Confirm the package name from `composer.json`
84+
4. In Packagist package settings, enable the GitHub hook or auto-update
85+
86+
If you want to automate this later, use a Packagist token and their API. That is not part of the current default workflow.
87+
88+
## 6. Verify The Package Is Discoverable
89+
90+
Check:
91+
92+
- docs autodiscovery sees `packages/<name>/docs`
93+
- split workflow contains the package
94+
- root Composer autoload includes the namespace
95+
- package `composer.json` is valid
96+
97+
Useful checks:
98+
99+
```bash
100+
composer validate packages/http-pool/composer.json
101+
rg "http-pool" packages.json .github/workflows/split.yml packages/*/resources/config
102+
```
103+
104+
## 7. Run Focused QA
105+
106+
At minimum:
107+
108+
```bash
109+
composer validate packages/http-pool/composer.json
110+
php vendor/bin/pest packages/http-pool/tests
111+
```
112+
113+
If the package changes shared infrastructure, also run:
114+
115+
```bash
116+
composer test
117+
```
118+
119+
## Notes
120+
121+
- `packages.json` is the source of truth for split-package registration.
122+
- `update-split-yml.sh` should be used instead of editing `.github/workflows/split.yml` by hand.
123+
- Keep package docs minimal at first. Add more only when the API stabilizes.

CONTENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Contains all independent PHP packages that make up the Instructor ecosystem. Eac
1313
- **Agents SDK**: `agents` - SDK for building custom AI agents
1414
- **Observability**: `metrics`, `logging`
1515
- **HTTP client**: `http-client`
16+
- **HTTP pooling**: `http-pool`
1617
- **Pipeline processing**: `pipeline`
1718
- **Sandbox**: `sandbox` - Safe code execution environment
1819

CONTRIBUTOR_GUIDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This is a monorepo containing multiple independent packages under the `packages/
1212
- **Agent control**: `agent-ctrl` - Unified CLI bridge for code agents
1313
- **Observability**: `metrics` - metrics collection and export
1414
- **HTTP client**: `http-client`
15+
- **HTTP pooling**: `http-pool`
1516
- **Pipeline processing**: `pipeline`
1617

1718
Each package is independently publishable to Packagist with its own `composer.json`, tests, and documentation.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ Links to read-only repositories of the standalone package distributions:
377377
- [instructor-evals](https://github.com/cognesy/instructor-evals) - LLM output evaluation tools
378378
- [instructor-events](https://github.com/cognesy/instructor-events) - events and event listeners for Instructor
379379
- [instructor-http-client](https://github.com/cognesy/instructor-http-client) - easily switch between underlying HTTP client libraries (out-of-the-box support for Guzzle, Symfony, Laravel)
380+
- [instructor-http-pool](https://github.com/cognesy/instructor-http-pool) - concurrent HTTP request execution for fan-out workloads
380381
- [instructor-hub](https://github.com/cognesy/instructor-hub) - CLI tool for browsing and running Instructor examples
381382
- [instructor-messages](https://github.com/cognesy/instructor-messages) - chat message sequence handling for Instructor
382383
- [instructor-polyglot](https://github.com/cognesy/instructor-polyglot) - use single API for inference and embeddings across most of LLM providers, easily switch between them (e.g., develop on Ollama, switch to Groq in production)

builds/docs-build/packages/agent-ctrl/10-opencode-bridge.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ $result = SandboxCommandExecutor::forOpenCode()->execute($spec);
2525
$response = (new ResponseParser())->parse($result, OutputFormat::Json);
2626

2727
echo $response->messageText();
28-
// @doctest id="8cd5"
28+
// @doctest id="5913"
2929
```
3030

3131
## Session Handling

builds/docs-build/packages/agent-ctrl/2-getting-started.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: 'Run your first prompt with AgentCtrl.'
77

88
```bash
99
composer require cognesy/agent-ctrl
10-
# @doctest id="746d"
10+
# @doctest id="4be1"
1111
```
1212

1313
You need at least one CLI binary installed and authenticated (`claude`, `codex`, or `opencode`).
@@ -20,7 +20,7 @@ use Cognesy\AgentCtrl\AgentCtrl;
2020
$response = AgentCtrl::codex()->execute('Summarize this repository.');
2121

2222
echo $response->text();
23-
// @doctest id="e800"
23+
// @doctest id="6a9a"
2424
```
2525

2626
## Runtime Agent Selection
@@ -31,5 +31,5 @@ use Cognesy\AgentCtrl\Enum\AgentType;
3131

3232
$agent = AgentType::from('codex');
3333
$response = AgentCtrl::make($agent)->execute('List top risks in this code.');
34-
// @doctest id="69f2"
34+
// @doctest id="1033"
3535
```

builds/docs-build/packages/agent-ctrl/3-streaming.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $response = AgentCtrl::openCode()
1515
->onComplete(fn(AgentResponse $response) => print("\n[done]\n"))
1616
->onError(fn(string $message, ?string $code) => print("\n[error:$message]\n"))
1717
->executeStreaming('Explain this package architecture.');
18-
// @doctest id="4c1c"
18+
// @doctest id="846c"
1919
```
2020

2121
`execute()` is a non-streaming convenience method.

builds/docs-build/packages/agent-ctrl/4-session-management.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use Cognesy\AgentCtrl\AgentCtrl;
1313
$response = AgentCtrl::codex()
1414
->continueSession()
1515
->execute('Continue from the previous plan and apply step 2.');
16-
// @doctest id="8963"
16+
// @doctest id="2c93"
1717
```
1818

1919
## Resume Specific Session
@@ -29,7 +29,7 @@ if ($sessionId !== null) {
2929
->resumeSession((string) $sessionId)
3030
->execute('Now implement the first migration.');
3131
}
32-
// @doctest id="9a67"
32+
// @doctest id="800c"
3333
```
3434

3535
`sessionId()` returns `AgentSessionId|null`.

0 commit comments

Comments
 (0)