Skip to content

feat(core): add defineKind and createKind for custom types - #6

Merged
dylnslck merged 1 commit into
ByteSliceHQ:mainfrom
reachjalil:feat/define-kind
Sep 24, 2026
Merged

dylnslck merged 1 commit into
ByteSliceHQ:mainfrom
reachjalil:feat/define-kind

Conversation

@reachjalil

@reachjalil reachjalil commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Stack (1/2) — merge this first

Order PR What it ships
1/2 (this) #6 Shared { kind, name } definition builder
2/2 #5 Generic evaluator kind built with that builder

GitHub cannot use this fork branch as #5’s base, so #5 also targets main and will list these files until this merges. After this lands, rebase #5 (one evaluator commit remains).

Delivered value

A custom startable type no longer has to be a hand-built { kind: 'auction' as const, name, input }.

const auction = createKind('auction')
export const vintageWatch = auction.define({ name: 'vintage-watch', input: AuctionInput })

defineKind('auction', def) is the same stamp without binding a builder. That is the whole runtime change: typing the definition you pass to looms.start. defineModule / m.thread still implement the kind.

This is a small helper (~26 lines). It is a separate PR so #5 can be “the evaluator consumes defineKind,” not “one model invents a one-off kind API.”

In this diff

  • packages/core/src/kind.ts — defineKind, createKind
  • Auction example + custom-kind docs switched onto createKind('auction')
  • Minor changeset

Not in this PR

Review

  1. packages/core/src/kind.ts and packages/core/src/kind.test.ts
  2. examples/custom-thread.ts
  3. bun run --filter @looms/examples custom-thread

@reachjalil

Copy link
Copy Markdown
Contributor Author

Stack 1/2. Merge this, then #5 (Jev as a defineKind('jev') consumer).

@dylnslck

Copy link
Copy Markdown
Contributor

Rebased onto main. This PR is still only defineKind / createKind.

The follow-up in #5 now uses that helper for a generic evaluator kind. TypeSafe Jev is a model preset (defineJev, vercelJev) on that kind, not its own thread type.

Let custom thread kinds stamp { kind, name } with the same
builder shape as defineAgent and defineWorkflow.

Co-authored-by: Cursor <[email protected]>
@dylnslck
dylnslck merged commit 2176eac into ByteSliceHQ:main Sep 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants