将您的代理与任何东西连接起来。让您的工具具有可组合性。秘密信息保持在代理上下文之外。
Most agent and tool integrations end up in one of two weak shapes:
Harbor SDK keeps the public package surface small while still exposing the real building blocks:
@hrbr/client,@hrbr/sdk,This repo is the publish-shaped package repo. Source generation still happens in the Harbor monorepo; this repository stores the npm artifacts and runnable examples in the shape external developers consume.
| Package | Purpose |
|---|---|
@hrbr/client |
Promise-first Harbor API client for application, browser, integration, CLI, and server authors. Includes @hrbr/client/effect for Effect-native hosts. |
@hrbr/sdk |
Composite system SDK facade for Harbor runtime, platform, inspect, plugin, protocol, registry, Orbit, and control-plane contracts. |
harbor-sdk |
Python client SDK from packages/python, with sync and async clients over the same generated Harbor protocol. |
The intended public TypeScript surface is two package identities. The Python
surface is one distribution package named harbor-sdk with import package
harbor_sdk. In the current pre-release lane, all three packages are
distributed as GitHub release artifacts rather than npm or PyPI registry
publishes. Leaf runtime/protocol/platform packages stay behind @hrbr/sdk
unless there is a concrete reason to expose a new public product.
| Capability | What you get |
|---|---|
| Promise-first client | createHarborClient() returns ordinary Promises for app and integration code. |
| Effect variant | @hrbr/client/effect exposes the same client surface as Effect values and a layer. |
| Python client | HarborClient and AsyncHarborClient expose sync/async Python calls with typed runtime content blocks. |
| Generated protocol client | harbor.api and @hrbr/client/generated/harbor expose generated Harbor API resources and types. |
| Explicit auth modes | Workspace API keys, bearer tokens, token providers, OAuth authorize URL helpers, and device-login helpers. |
| Runtime results | runtime.execute preserves raw result and typed content blocks, including explicit skill bundles. |
| System namespaces | @hrbr/sdk exports Agents, Core, Inspect, Orbit, Platform, Plugins, Protocol, Registry, and Runtime. |
| Focused subpaths | Narrow imports such as @hrbr/sdk/inspect, @hrbr/sdk/core/trigger, @hrbr/sdk/registry, and @hrbr/sdk/platform/local. |
| Local server | @hrbr/sdk/platform/local can initialize a local project, serve Harbor-compatible routes, record runs, and host a small frontend. |
| Packaged artifacts | Package directories contain dist, declaration files, modern exports, and release metadata. |
…Prerequisites: Bun 1.3+ and Node 22+.
git clone https://github.com/zonko-ai/harbor-sdk.git
cd harbor-sdk
bun install
bun run typecheck
bun run smoke
bun run python:sdk:testRun the local frontend example:
bun run --filter local-platform-example serveOpen the printed http://127.0.0.1: URL. The example uses
local-token as its bearer token when the frontend asks for auth.
Install the current release artifacts directly from GitHub:
npm install https://github.com/zonko-ai/harbor-sdk/releases/download/v0.1.2/hrbr-client-0.1.2.tgz
npm install https://github.com/zonko-ai/harbor-sdk/releases/download/v0.1.2/hrbr-sdk-0.1.2.tgz
python -m pip install https://github.com/zonko-ai/harbor-sdk/releases/download/v0.1.2/harbor_sdk-0.1.2-py3-none-any.whlimport { createHarborClient } from '@hrbr/client'
const harbor = createHarborClient({
baseUrl: 'https://api.tryharbor.ai',
workspaceId: process.env.HARBOR_WORKSPACE_ID!,
auth: { kind: 'api_key', key: process.env.HARBOR_API_KEY! },
})
const exec = await harbor.runtime.execute({
code: 'return "hello from Harbor"',
})
console.log(exec.result)
console.log(exec.content?.[0])For browser and app-owned OAuth flows, keep token storage in the application and pass a provider into the client:
const harbor = createHarborClient({
baseUrl: 'https://api.tryharbor.ai',
auth: {
kind: 'bearer',
tokenProvider: async () => await getCurrentAccessToken(),
},
})
const workspaces = await harbor.workspaces.list({ limit: 25 })Use @hrbr/client/effect when the host application wants Effect-native calls
instead of Promises.
from harbor_sdk import HarborClient
client = HarborClient(
api_key="hrbr_...",
workspace_id="workspace_...",
)
run = client.runtime.execute(code='return "hello from Harbor"')
print(run.result)
for block in run.content or []:
if block.type == "text":
print(block.text)
elif block.type == "json":
print(block.json_)
elif block.type == "skill_bundle":
print(block.skill.slug)Async hosts use the same shape:
from harbor_sdk import AsyncHarborClient
client = AsyncHarborClient(
api_key="hrbr_...",
workspace_id="workspace_...",
)
run = await client.runtime.execute(code='return "hello from Harbor"')api_key defaults to HARBOR_API_KEY, workspace_id defaults to
HARBOR_WORKSPACE_ID, and base_url defaults to https://api.tryharbor.ai.
The generated protocol layer is exposed as harbor_sdk_generated; application
code should prefer the public harbor_sdk facade.
@hrbr/sdk/platform/local is the SDK-local infrastructure surface. It is not
the full hosted Harbor dashboard, but it is enough to exercise a local
Harbor-compatible server and frontend.
…The server exposes the SDK-local frontend at /, the frontend script at
/local/frontend.js, health at /healthz, and Harbor-compatible JSON
routes for the local workspace/run flow used by the examples.
| Example | What it shows |
|---|---|
examples/browser-client |
Browser/app integration with caller-owned bearer token state. |
examples/client-promise |
Promise runtime execution and content blocks for text plus explicit skill bundles. |
examples/python-client |
Offline Python client call showing text, JSON, and skill-bundle content blocks. |
examples/sdk-system |
Root namespace imports, the inspect namespace, and focused subpaths from @hrbr/sdk. |
examples/local-platform |
Local project, local server, SDK client call, and built-in frontend. |
Run all examples through the smoke command:
bun run smokeharbor-sdk/
├── docs/assets/ # logo and demo media used by this README
├── examples/
│ ├── browser-client/
│ ├── client-promise/
│ ├── python-client/
│ ├── local-platform/
│ └── sdk-system/
├── packages/
│ ├── client/ # generated @hrbr/client package
│ ├── python/ # Python harbor-sdk package
│ └── sdk/ # generated @hrbr/sdk package
├── LICENSE
├── package.json
└── README.mdbun install
bun run typecheck
bun run smoke
bun run pack:dry-run
bun run python:sdk:testThe package directories are generated artifacts. For broad source changes, refresh them from the Harbor monorepo publish pipeline, then re-run the checks above in this repository.
@hrbr/client does not own browser cookies, OAuth refresh storage, or app
sessions. The host application owns credentials and passes a token or provider.workspaceId before runtime
and workspace-scoped helper calls.authToken when exposing the frontend.The current release flow builds GitHub release artifacts from the package directories after generated artifacts have been refreshed and verified:
bun run python:sdk:pack
npm pack ./packages/client --pack-destination tmp/release-artifacts
npm pack ./packages/sdk --pack-destination tmp/release-artifacts
cp tmp/python-dist/harbor_sdk-*.whl tmp/release-artifacts/Upload the three files in tmp/release-artifacts to the matching GitHub
release tag. Do not publish to npm or PyPI unless the registry release lane has
explicitly been opened.
@hrbr/client and @hrbr/sdk.harbor-sdk.Released under the MIT License.
暂无开放 Issues,或尚未同步最近议题。