npm.io
1.1.1 • Published 2h ago

@taskclan/sdk

Licence
UNLICENSED
Version
1.1.1
Deps
2
Size
110 kB
Vulns
0
Weekly
0

@taskclan/sdk

The typed client for Taskclan Intelligence.

Quickstart — the T1 client

Run a goal against the metered T1 API. The t1-flow profile picks the model, tools, and reasoning depth for you (t1-core for fast/high-volume, t1-max for deep reasoning). Spend debits your key's credit wallet.

import { Taskclan } from "@taskclan/sdk";

const taskclan = new Taskclan({ apiKey: process.env.TASKCLAN_API_KEY });

const result = await taskclan.run({
  profile: "t1-flow",
  goal: "Draft a friendly reply to this review",
  input: { text: "The app is great but sign-in is slow." },
});

console.log(result.output);

The API key comes from TASKCLAN_API_KEY when not passed. Create one in the console at /t1 (Developer API keys). The default profile can also be set on the client: new Taskclan({ profile: "t1-flow" }).

Stream

const stream = await taskclan.run.stream({ profile: "t1-flow", goal: "Explain vector databases" });
for await (const event of stream) {
  if (event.type === "text") process.stdout.write(event.delta);
}

run.stream yields { type: "text", delta } per token, then a final { type: "done", creditsCharged, balance, model }.


The L3 agentic layer

The rest of this client is the Taskclan L3 agentic layer. Built on @taskclan/platform, it adds the agent / skill / memory surface so any product can:

  • runAgent — run a named agent's capability (dispatch one of its Hive intents)
  • runSkill — run a named skill's capability
  • remember / recall / listMemories / forget — read & write shared memory
  • listAgents / getAgent / listSkills / listWorkflows — discover the registry

It reuses the platform client's transport, so everything goes through Hive's one endpoint (POST /api/hive/v1/intent). You also get client.platform for events, entitlements, identity, and roles.

Install

Published privately to GitHub Packages under the taskclan org. Point the @taskclan scope at GitHub's registry (one line covers both @taskclan/platform and @taskclan/sdk) and authenticate with a read:packages token:

# .npmrc (in the consuming repo)
@taskclan:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
npm install @taskclan/sdk

Usage

import { createTaskclanClient } from '@taskclan/sdk';

const hive = createTaskclanClient({
  baseUrl: 'https://engine.taskclan.com',
  product: 'nani',
  getToken: () => supabase.auth.getSession().then((s) => s.data.session?.access_token ?? null),
});

// Discover an agent's intents, then run one
const { agents } = await hive.listAgents();
const creator = agents.find((a) => a.id === 'gamenova-creator');
if (creator) {
  const result = await hive.runAgent(creator.id, creator.intents[0], { /* input */ });
}

// Shared memory (household-scoped family vault)
await hive.remember({ householdId, type: 'allergy', key: 'peanuts', value: 'severe' });
const { memories } = await hive.listMemories({ householdId, type: 'allergy' });

// Escape hatch + the full platform client
await hive.platform.trackEvent('nani.household_created');

Pass { validate: true } to runAgent / runSkill to first check (against the public registry) that the intent really belongs to that agent/skill.

Publishing

Bump version in package.json, then push a tag:

git tag taskclan-sdk-v1.0.0 && git push origin taskclan-sdk-v1.0.0

The Publish @taskclan/sdk GitHub Action builds and publishes to GitHub Packages using the built-in GITHUB_TOKEN — no secret to configure.

Keywords