Commit graph

3 commits

Author SHA1 Message Date
3a590d775e clients/typescript: v0.2 multi-turn Session API
- Session class with Symbol.asyncDispose for `await using` ergonomics (ES2024)
- forge.session({ agent }) preferred form; forge.createSession() explicit
- forge.listSessions() / forge.getSession()
- TurnResult / TurnEvent / SessionState types + turnText() helper
- Idempotent Session.close() (200 on re-close server-side)
- tests/sessions.test.ts: 13 tests covering disposal/idempotency/throw/list/state/404/regression
- README "Multi-turn / Sessions (v0.2)" section + fallback try/finally docs

tsconfig.json: lib bumped to add ES2023 + ESNext.Disposable so the
Symbol.asyncDispose / AsyncDisposable types resolve under TS 5.9. Target
stays ES2022 — the disposable runtime hooks are TS-erasable, no runtime
polyfill needed; consumers just need Node 20.4+ at runtime to use the
`await using` form (documented in the README; the v0.1 surface and the
explicit createSession + try/finally fallback continue to work on Node 18+).

package.json: bumped to 0.2.0; engines.node stays >=18 since the v0.1
surface is unchanged. v0.1 /run path unchanged (regression test added).

Spec: memory/spec-clawdforge-v0.2.md
Server core: 940861f
2026-04-29 06:38:55 -07:00
e9d5e0ea16 clients/typescript: apply audit findings — uploadFile streaming + metadata + validation (15de6e7cc54cfb)
HIGH:
- H1: uploadFile streams via createReadStream, validates is_file, caps size (configurable, default 100MB)

MEDIUM:
- M1: LICENSE file added
- M2: package.json repository/bugs/homepage/author fields
- M3: ESM-only doc + engines.node>=18
- M4: defaultTimeoutMs negative validation
- M5: baseUrl validated as URL in constructor

LOW:
- L1: empty 200 body throws ForgeAPIError instead of {} as T
- L2: DOMException("timeout", "TimeoutError") for symmetry with AbortSignal.timeout()
- L4: package-lock.json committed
- L5: 6 new tests (500-not-502, Blob upload, invalid source, empty revokeToken, JSON error body, double-signal race)
- L7: defensive raw.ok === true check in run()

Audit: memory/clawdforge-audits/typescript-15de6e7.md
2026-04-28 23:12:27 -07:00
15de6e765f clients/typescript: initial TypeScript SDK for clawdforge
Drop-in Node 18+ client with strict types, native fetch, AbortSignal
support, and a typed error hierarchy (ForgeAuthError / ForgeAPIError /
ForgeTransportError). Mirrors the existing Python client surface but
stays generic — no Sulkta-specific assumptions, suitable for anyone
running their own clawdforge instance.

- camelCase TS, snake_case wire — converted at the boundary
- node:test suite (17 tests) covering healthz, run success/error paths,
  502 envelopes, abort/timeout, file upload, and admin token CRUD
- tsc --noEmit clean with strict mode + Node16 module resolution
2026-04-28 22:42:46 -07:00