@taskclan/sdk 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -1
- package/dist/engine.d.ts +111 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +144 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/t1.d.ts +237 -0
- package/dist/t1.d.ts.map +1 -0
- package/dist/t1.js +378 -0
- package/dist/t1.js.map +1 -0
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
# @taskclan/sdk
|
|
2
2
|
|
|
3
|
-
The typed client for
|
|
3
|
+
The typed client for **Taskclan Intelligence**.
|
|
4
|
+
|
|
5
|
+
## Quickstart — the T1 client
|
|
6
|
+
|
|
7
|
+
Run a goal against the metered T1 API. The `t1-flow` profile picks the model,
|
|
8
|
+
tools, and reasoning depth for you (`t1-core` for fast/high-volume, `t1-max` for
|
|
9
|
+
deep reasoning). Spend debits your key's credit wallet.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { Taskclan } from "@taskclan/sdk";
|
|
13
|
+
|
|
14
|
+
const taskclan = new Taskclan({ apiKey: process.env.TASKCLAN_API_KEY });
|
|
15
|
+
|
|
16
|
+
const result = await taskclan.run({
|
|
17
|
+
profile: "t1-flow",
|
|
18
|
+
goal: "Draft a friendly reply to this review",
|
|
19
|
+
input: { text: "The app is great but sign-in is slow." },
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
console.log(result.output);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The API key comes from `TASKCLAN_API_KEY` when not passed. Create one in the
|
|
26
|
+
console at [`/t1`](https://engine.taskclan.com/t1) (Developer API keys). The
|
|
27
|
+
default profile can also be set on the client: `new Taskclan({ profile: "t1-flow" })`.
|
|
28
|
+
|
|
29
|
+
### Stream
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
const stream = await taskclan.run.stream({ profile: "t1-flow", goal: "Explain vector databases" });
|
|
33
|
+
for await (const event of stream) {
|
|
34
|
+
if (event.type === "text") process.stdout.write(event.delta);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`run.stream` yields `{ type: "text", delta }` per token, then a final
|
|
39
|
+
`{ type: "done", creditsCharged, balance, model }`.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## The L3 agentic layer
|
|
44
|
+
|
|
45
|
+
The rest of this client is the **Taskclan L3 agentic layer**. Built on
|
|
4
46
|
[`@taskclan/platform`](../hive-sdk-ts), it adds the agent / skill / memory surface
|
|
5
47
|
so any product can:
|
|
6
48
|
|
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Taskclan Engine — deterministic workflows over the T1 primitives.
|
|
3
|
+
*
|
|
4
|
+
* A workflow is an ordered set of steps run CLIENT-SIDE by the SDK: each step
|
|
5
|
+
* calls a real metered surface (step.run → /api/t1/complete, step.generate →
|
|
6
|
+
* /api/t1/studio, step.evaluate → an LLM-judge run) or a local tool, threading
|
|
7
|
+
* one step's output into the next and gating side-effecting steps on evaluation.
|
|
8
|
+
* "Deterministic structure around adaptive intelligence" — the structure is the
|
|
9
|
+
* ordered, conditional step graph; the intelligence is the T1 calls inside it.
|
|
10
|
+
*/
|
|
11
|
+
import type { RunInput, RunResult, StudioNamespace, ToolDefinition, T1Profile } from './t1';
|
|
12
|
+
/** What the engine needs from a Taskclan client (the real client satisfies this). */
|
|
13
|
+
export interface EngineClient {
|
|
14
|
+
run(input: RunInput): Promise<RunResult>;
|
|
15
|
+
studio: StudioNamespace;
|
|
16
|
+
}
|
|
17
|
+
export type WorkflowStep = {
|
|
18
|
+
kind: 'run';
|
|
19
|
+
id: string;
|
|
20
|
+
goal: string;
|
|
21
|
+
profile?: T1Profile;
|
|
22
|
+
tools?: ToolDefinition[];
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'generate';
|
|
25
|
+
id: string;
|
|
26
|
+
modality?: 'image' | 'video' | 'audio' | 'threeD';
|
|
27
|
+
/** Static prompt … */
|
|
28
|
+
prompt?: string;
|
|
29
|
+
/** … or use another step's text output as the prompt. */
|
|
30
|
+
promptFrom?: string;
|
|
31
|
+
size?: string;
|
|
32
|
+
quality?: 'low' | 'medium' | 'high';
|
|
33
|
+
} | {
|
|
34
|
+
kind: 'evaluate';
|
|
35
|
+
id: string;
|
|
36
|
+
/** Step whose output to judge (default: the most recent text output). */
|
|
37
|
+
from?: string;
|
|
38
|
+
quality?: boolean;
|
|
39
|
+
policy?: string[];
|
|
40
|
+
rights?: boolean;
|
|
41
|
+
/** A custom business check, in plain language. */
|
|
42
|
+
outcome?: string;
|
|
43
|
+
} | {
|
|
44
|
+
kind: 'tool';
|
|
45
|
+
id: string;
|
|
46
|
+
tool: ToolDefinition;
|
|
47
|
+
/** Gate: `"stepId.field"` (e.g. "check.passed"); optional leading `!`. */
|
|
48
|
+
when?: string;
|
|
49
|
+
/** Args for the tool; defaults to `{ input, steps }` (the workflow context). */
|
|
50
|
+
args?: Record<string, unknown>;
|
|
51
|
+
};
|
|
52
|
+
export interface Workflow {
|
|
53
|
+
name: string;
|
|
54
|
+
steps: WorkflowStep[];
|
|
55
|
+
}
|
|
56
|
+
/** Define a workflow. Pass it to `taskclan.engine.run(workflow, { input })`. */
|
|
57
|
+
export declare function workflow(def: {
|
|
58
|
+
name: string;
|
|
59
|
+
steps: WorkflowStep[];
|
|
60
|
+
}): Workflow;
|
|
61
|
+
type StepInput<K extends WorkflowStep['kind']> = Omit<Extract<WorkflowStep, {
|
|
62
|
+
kind: K;
|
|
63
|
+
}>, 'kind'>;
|
|
64
|
+
/** Typed step constructors. */
|
|
65
|
+
export declare const step: {
|
|
66
|
+
run: (o: StepInput<"run">) => WorkflowStep;
|
|
67
|
+
generate: (o: StepInput<"generate">) => WorkflowStep;
|
|
68
|
+
evaluate: (o: StepInput<"evaluate">) => WorkflowStep;
|
|
69
|
+
tool: (o: StepInput<"tool">) => WorkflowStep;
|
|
70
|
+
};
|
|
71
|
+
export interface StepResult {
|
|
72
|
+
id: string;
|
|
73
|
+
type: WorkflowStep['kind'];
|
|
74
|
+
/** Text output (run / tool). */
|
|
75
|
+
output?: string;
|
|
76
|
+
/** Hosted asset URL (generate). */
|
|
77
|
+
url?: string;
|
|
78
|
+
/** Whether an evaluate gate passed. */
|
|
79
|
+
passed?: boolean;
|
|
80
|
+
/** Structured payload (tool return, evaluate verdict, generated asset id). */
|
|
81
|
+
data?: unknown;
|
|
82
|
+
/** True when a `when:` gate skipped this step. */
|
|
83
|
+
skipped?: boolean;
|
|
84
|
+
error?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface EngineRunOptions {
|
|
87
|
+
/** Structured input every step can reference (goals see it; tools get it as context). */
|
|
88
|
+
input?: Record<string, unknown>;
|
|
89
|
+
}
|
|
90
|
+
export interface EngineRunResult {
|
|
91
|
+
status: 'completed' | 'failed';
|
|
92
|
+
/** Results keyed by step id — e.g. `run.steps.publish.output`. */
|
|
93
|
+
steps: Record<string, StepResult>;
|
|
94
|
+
/** The step that failed, if status is 'failed'. */
|
|
95
|
+
failedStep?: string;
|
|
96
|
+
usage: {
|
|
97
|
+
inputTokens: number;
|
|
98
|
+
outputTokens: number;
|
|
99
|
+
};
|
|
100
|
+
/** Total credits across every metered step. */
|
|
101
|
+
creditsCharged: number;
|
|
102
|
+
/** Wallet balance after the run. */
|
|
103
|
+
balance: number;
|
|
104
|
+
}
|
|
105
|
+
/** taskclan.engine — deterministic workflow execution. */
|
|
106
|
+
export interface EngineNamespace {
|
|
107
|
+
run(wf: Workflow, opts?: EngineRunOptions): Promise<EngineRunResult>;
|
|
108
|
+
}
|
|
109
|
+
export declare function createEngine(client: EngineClient): EngineNamespace;
|
|
110
|
+
export {};
|
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AAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC/B,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAClC,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,+CAA+C;IAC/C,cAAc,EAAE,MAAM,CAAC;IACvB,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,0DAA0D;AAC1D,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACtE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,eAAe,CAElE"}
|
package/dist/engine.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Taskclan Engine — deterministic workflows over the T1 primitives.
|
|
4
|
+
*
|
|
5
|
+
* A workflow is an ordered set of steps run CLIENT-SIDE by the SDK: each step
|
|
6
|
+
* calls a real metered surface (step.run → /api/t1/complete, step.generate →
|
|
7
|
+
* /api/t1/studio, step.evaluate → an LLM-judge run) or a local tool, threading
|
|
8
|
+
* one step's output into the next and gating side-effecting steps on evaluation.
|
|
9
|
+
* "Deterministic structure around adaptive intelligence" — the structure is the
|
|
10
|
+
* ordered, conditional step graph; the intelligence is the T1 calls inside it.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.step = void 0;
|
|
14
|
+
exports.workflow = workflow;
|
|
15
|
+
exports.createEngine = createEngine;
|
|
16
|
+
/** Define a workflow. Pass it to `taskclan.engine.run(workflow, { input })`. */
|
|
17
|
+
function workflow(def) {
|
|
18
|
+
return { name: def.name, steps: def.steps };
|
|
19
|
+
}
|
|
20
|
+
/** Typed step constructors. */
|
|
21
|
+
exports.step = {
|
|
22
|
+
run: (o) => ({ kind: 'run', ...o }),
|
|
23
|
+
generate: (o) => ({ kind: 'generate', ...o }),
|
|
24
|
+
evaluate: (o) => ({ kind: 'evaluate', ...o }),
|
|
25
|
+
tool: (o) => ({ kind: 'tool', ...o }),
|
|
26
|
+
};
|
|
27
|
+
function createEngine(client) {
|
|
28
|
+
return { run: (wf, opts) => runWorkflow(client, wf, opts) };
|
|
29
|
+
}
|
|
30
|
+
// ── internals ────────────────────────────────────────────────────────────────
|
|
31
|
+
/** Resolve a `when:` gate like "check.passed" (optional leading "!") against results. */
|
|
32
|
+
function resolveWhen(expr, steps) {
|
|
33
|
+
let e = expr.trim();
|
|
34
|
+
let negate = false;
|
|
35
|
+
if (e.startsWith('!')) {
|
|
36
|
+
negate = true;
|
|
37
|
+
e = e.slice(1).trim();
|
|
38
|
+
}
|
|
39
|
+
const [id, field = 'passed'] = e.split('.');
|
|
40
|
+
const truthy = Boolean(steps[id]?.[field]);
|
|
41
|
+
return negate ? !truthy : truthy;
|
|
42
|
+
}
|
|
43
|
+
/** The most recent step that produced text output (for evaluate's default target). */
|
|
44
|
+
function lastOutput(order, steps) {
|
|
45
|
+
for (let i = order.length - 1; i >= 0; i--) {
|
|
46
|
+
const r = steps[order[i]];
|
|
47
|
+
if (r?.output)
|
|
48
|
+
return r.output;
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
function buildJudgePrompt(target, checks) {
|
|
53
|
+
return [
|
|
54
|
+
'You are a strict evaluation gate in a workflow. Assess the CONTENT below against every check.',
|
|
55
|
+
`Checks: ${checks.join('; ') || 'general quality'}.`,
|
|
56
|
+
'',
|
|
57
|
+
'CONTENT:',
|
|
58
|
+
target && target.trim() ? target : '(no content was produced)',
|
|
59
|
+
'',
|
|
60
|
+
'Respond with ONLY a JSON object: {"passed": boolean, "reason": "one sentence"}.',
|
|
61
|
+
'"passed" is true only if the content satisfies ALL checks.',
|
|
62
|
+
].join('\n');
|
|
63
|
+
}
|
|
64
|
+
function parseVerdict(text) {
|
|
65
|
+
const m = text.match(/\{[\s\S]*\}/);
|
|
66
|
+
if (m) {
|
|
67
|
+
try {
|
|
68
|
+
const j = JSON.parse(m[0]);
|
|
69
|
+
return { passed: j.passed === true, reason: typeof j.reason === 'string' ? j.reason : '' };
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
/* fall through */
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return { passed: /"?passed"?\s*[:=]\s*true/i.test(text), reason: '' };
|
|
76
|
+
}
|
|
77
|
+
async function runWorkflow(client, wf, opts) {
|
|
78
|
+
const input = opts?.input ?? {};
|
|
79
|
+
const steps = {};
|
|
80
|
+
const order = [];
|
|
81
|
+
let inTok = 0;
|
|
82
|
+
let outTok = 0;
|
|
83
|
+
let credits = 0;
|
|
84
|
+
let balance = 0;
|
|
85
|
+
const acc = (r) => {
|
|
86
|
+
inTok += r.usage?.inputTokens ?? 0;
|
|
87
|
+
outTok += r.usage?.outputTokens ?? 0;
|
|
88
|
+
credits += r.creditsCharged ?? 0;
|
|
89
|
+
if (typeof r.balance === 'number')
|
|
90
|
+
balance = r.balance;
|
|
91
|
+
};
|
|
92
|
+
for (const s of wf.steps) {
|
|
93
|
+
order.push(s.id);
|
|
94
|
+
// Conditional gate (tool steps).
|
|
95
|
+
if (s.kind === 'tool' && s.when && !resolveWhen(s.when, steps)) {
|
|
96
|
+
steps[s.id] = { id: s.id, type: 'tool', skipped: true };
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
if (s.kind === 'run') {
|
|
101
|
+
const r = await client.run({ goal: s.goal, input, profile: s.profile, tools: s.tools });
|
|
102
|
+
acc(r);
|
|
103
|
+
steps[s.id] = { id: s.id, type: 'run', output: r.output, data: r.steps };
|
|
104
|
+
}
|
|
105
|
+
else if (s.kind === 'generate') {
|
|
106
|
+
const prompt = s.prompt ?? (s.promptFrom ? String(steps[s.promptFrom]?.output ?? '') : '');
|
|
107
|
+
const asset = await client.studio.generate({ modality: s.modality ?? 'image', prompt, size: s.size, quality: s.quality });
|
|
108
|
+
acc(asset);
|
|
109
|
+
steps[s.id] = { id: s.id, type: 'generate', url: asset.url, data: { assetId: asset.id } };
|
|
110
|
+
}
|
|
111
|
+
else if (s.kind === 'evaluate') {
|
|
112
|
+
const target = s.from ? steps[s.from]?.output : lastOutput(order.slice(0, -1), steps);
|
|
113
|
+
const checks = [
|
|
114
|
+
...(s.quality ? ['quality: meets a quality bar for the task'] : []),
|
|
115
|
+
...(s.policy ?? []).map((p) => `policy: complies with the "${p}" policy`),
|
|
116
|
+
...(s.rights ? ['rights: generated media is safe to use'] : []),
|
|
117
|
+
...(s.outcome ? [`outcome: ${s.outcome}`] : []),
|
|
118
|
+
];
|
|
119
|
+
const judge = await client.run({ goal: buildJudgePrompt(target, checks), profile: 't1-core' });
|
|
120
|
+
acc(judge);
|
|
121
|
+
const verdict = parseVerdict(judge.output);
|
|
122
|
+
steps[s.id] = { id: s.id, type: 'evaluate', passed: verdict.passed, data: verdict };
|
|
123
|
+
}
|
|
124
|
+
else if (s.kind === 'tool') {
|
|
125
|
+
const args = s.args ?? { input, steps: mapOutputs(steps) };
|
|
126
|
+
const out = await s.tool.run(args);
|
|
127
|
+
steps[s.id] = { id: s.id, type: 'tool', output: typeof out === 'string' ? out : JSON.stringify(out), data: out };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
steps[s.id] = { id: s.id, type: s.kind, error: e.message };
|
|
132
|
+
return { status: 'failed', steps, failedStep: s.id, usage: { inputTokens: inTok, outputTokens: outTok }, creditsCharged: credits, balance };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return { status: 'completed', steps, usage: { inputTokens: inTok, outputTokens: outTok }, creditsCharged: credits, balance };
|
|
136
|
+
}
|
|
137
|
+
/** A compact { stepId: output } map handed to tool steps as context. */
|
|
138
|
+
function mapOutputs(steps) {
|
|
139
|
+
const out = {};
|
|
140
|
+
for (const [id, r] of Object.entries(steps))
|
|
141
|
+
out[id] = r.output ?? r.url ?? r.data ?? null;
|
|
142
|
+
return out;
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAkDH,4BAEC;AAmDD,oCAEC;AAxDD,gFAAgF;AAChF,SAAgB,QAAQ,CAAC,GAA4C;IACnE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC;AAC9C,CAAC;AAID,+BAA+B;AAClB,QAAA,IAAI,GAAG;IAClB,GAAG,EAAE,CAAC,CAAmB,EAAgB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;IACnE,QAAQ,EAAE,CAAC,CAAwB,EAAgB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,CAAC;IAClF,QAAQ,EAAE,CAAC,CAAwB,EAAgB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,CAAC;IAClF,IAAI,EAAE,CAAC,CAAoB,EAAgB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;CACvE,CAAC;AAyCF,SAAgB,YAAY,CAAC,MAAoB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AC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;YACnH,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAG,CAAW,CAAC,OAAO,EAAE,CAAC;YACtE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;QAC9I,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC/H,CAAC;AAED,wEAAwE;AACxE,SAAS,UAAU,CAAC,KAAiC;IACnD,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC;IAC3F,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export { Taskclan, TaskclanError, tool } from './t1';
|
|
2
|
+
export { workflow, step, createEngine } from './engine';
|
|
3
|
+
export type { Workflow, WorkflowStep, EngineClient, EngineNamespace, EngineRunOptions, EngineRunResult, StepResult, } from './engine';
|
|
4
|
+
export type { TaskclanConfig, RunInput, RunResult, RunStreamEvent, RunFn, T1Profile, ToolDefinition, ZodLike, StepTrace, TaskclanErrorType, StudioAsset, StudioGenerateInput, StudioEditInput, StudioNamespace, } from './t1';
|
|
1
5
|
export { createTaskclanClient } from './client';
|
|
2
6
|
export type { TaskclanClient, RunOptions } from './client';
|
|
3
7
|
export { PlatformError } from '@taskclan/platform';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxD,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,UAAU,GACX,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,cAAc,EACd,QAAQ,EACR,SAAS,EACT,cAAc,EACd,KAAK,EACL,SAAS,EACT,cAAc,EACd,OAAO,EACP,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,eAAe,GAChB,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAGjB,qDAAqD;AACrD,OAAO,EAAE,oBAAoB,IAAI,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACxE,+CAA+C;AAC/C,YAAY,EAAE,cAAc,IAAI,cAAc,EAAE,MAAM,UAAU,CAAC;AACjE,qDAAqD;AACrD,YAAY,EAAE,oBAAoB,IAAI,oBAAoB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createHivemindClient = exports.PlatformError = exports.createTaskclanClient = void 0;
|
|
3
|
+
exports.createHivemindClient = exports.PlatformError = exports.createTaskclanClient = exports.createEngine = exports.step = exports.workflow = exports.tool = exports.TaskclanError = exports.Taskclan = void 0;
|
|
4
|
+
// --- T1 developer client (the docs' `new Taskclan(...).run(...)` surface) ---
|
|
5
|
+
var t1_1 = require("./t1");
|
|
6
|
+
Object.defineProperty(exports, "Taskclan", { enumerable: true, get: function () { return t1_1.Taskclan; } });
|
|
7
|
+
Object.defineProperty(exports, "TaskclanError", { enumerable: true, get: function () { return t1_1.TaskclanError; } });
|
|
8
|
+
Object.defineProperty(exports, "tool", { enumerable: true, get: function () { return t1_1.tool; } });
|
|
9
|
+
var engine_1 = require("./engine");
|
|
10
|
+
Object.defineProperty(exports, "workflow", { enumerable: true, get: function () { return engine_1.workflow; } });
|
|
11
|
+
Object.defineProperty(exports, "step", { enumerable: true, get: function () { return engine_1.step; } });
|
|
12
|
+
Object.defineProperty(exports, "createEngine", { enumerable: true, get: function () { return engine_1.createEngine; } });
|
|
13
|
+
// --- L3 agentic client (named agents/skills, memory, insights, registries) ---
|
|
4
14
|
var client_1 = require("./client");
|
|
5
15
|
Object.defineProperty(exports, "createTaskclanClient", { enumerable: true, get: function () { return client_1.createTaskclanClient; } });
|
|
6
16
|
// Re-export the platform error class so consumers can `instanceof PlatformError`
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAAgD;AAAvC,8GAAA,oBAAoB,OAAA;AAE7B,iFAAiF;AACjF,sDAAsD;AACtD,+CAAmD;AAA1C,yGAAA,aAAa,OAAA;AAmBtB,oFAAoF;AACpF,qDAAqD;AACrD,mCAAwE;AAA/D,8GAAA,oBAAoB,OAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+EAA+E;AAC/E,2BAAqD;AAA5C,8FAAA,QAAQ,OAAA;AAAE,mGAAA,aAAa,OAAA;AAAE,0FAAA,IAAI,OAAA;AACtC,mCAAwD;AAA/C,kGAAA,QAAQ,OAAA;AAAE,8FAAA,IAAI,OAAA;AAAE,sGAAA,YAAY,OAAA;AA2BrC,gFAAgF;AAChF,mCAAgD;AAAvC,8GAAA,oBAAoB,OAAA;AAE7B,iFAAiF;AACjF,sDAAsD;AACtD,+CAAmD;AAA1C,yGAAA,aAAa,OAAA;AAmBtB,oFAAoF;AACpF,qDAAqD;AACrD,mCAAwE;AAA/D,8GAAA,oBAAoB,OAAwB"}
|
package/dist/t1.d.ts
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Taskclan — the T1 developer client.
|
|
3
|
+
*
|
|
4
|
+
* import { Taskclan } from "@taskclan/sdk";
|
|
5
|
+
* const taskclan = new Taskclan({ apiKey: process.env.TASKCLAN_API_KEY });
|
|
6
|
+
* const result = await taskclan.run({ profile: "t1-flow", goal: "…", input: {…} });
|
|
7
|
+
* console.log(result.output);
|
|
8
|
+
*
|
|
9
|
+
* A run takes a goal (+ optional structured input) and returns a verified result.
|
|
10
|
+
* The profile picks the model/reasoning depth: t1-core (fast), t1-flow (balanced,
|
|
11
|
+
* default), t1-max (deep). Backed by the metered T1 API — spend debits the key's
|
|
12
|
+
* wallet. `run.stream(...)` yields tokens as they generate.
|
|
13
|
+
*/
|
|
14
|
+
import { type EngineNamespace } from './engine';
|
|
15
|
+
/** A T1 profile. The t1-* slugs are canonical; core|flow|max are accepted too. */
|
|
16
|
+
export type T1Profile = 't1-core' | 't1-flow' | 't1-max' | 'core' | 'flow' | 'max' | (string & {});
|
|
17
|
+
export interface TaskclanConfig {
|
|
18
|
+
/** Your Taskclan API key (sk_t1_…). Defaults to process.env.TASKCLAN_API_KEY. */
|
|
19
|
+
apiKey?: string;
|
|
20
|
+
/** Default profile for runs when one isn't passed to run(). Defaults to t1-flow. */
|
|
21
|
+
profile?: T1Profile;
|
|
22
|
+
/** API base URL. Defaults to TASKCLAN_BASE_URL or https://engine.taskclan.com. */
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
/** Inject a fetch implementation (tests / non-global-fetch runtimes). */
|
|
25
|
+
fetch?: typeof fetch;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A Zod-like schema — structurally what `tool({ input })` accepts. Any Zod v3
|
|
29
|
+
* schema satisfies this (zod is a peer dependency; the SDK never imports it).
|
|
30
|
+
*/
|
|
31
|
+
export interface ZodLike<T = unknown> {
|
|
32
|
+
_def: unknown;
|
|
33
|
+
safeParse(v: unknown): {
|
|
34
|
+
success: true;
|
|
35
|
+
data: T;
|
|
36
|
+
} | {
|
|
37
|
+
success: false;
|
|
38
|
+
error: unknown;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** A typed tool the model may call. The handler runs on the CALLER, not the server. */
|
|
42
|
+
export interface ToolDefinition<T = any> {
|
|
43
|
+
/** Unique, snake_case identifier the model calls by. */
|
|
44
|
+
name: string;
|
|
45
|
+
/** What the tool does — the model reads this to decide when to use it. */
|
|
46
|
+
description: string;
|
|
47
|
+
/** Zod schema; validates the model's arguments before your handler runs. */
|
|
48
|
+
input: ZodLike<T>;
|
|
49
|
+
/** Your handler. Return anything JSON-serializable; it's fed back to the model. */
|
|
50
|
+
run: (input: T) => Promise<unknown> | unknown;
|
|
51
|
+
}
|
|
52
|
+
/** Define a typed tool. Pass the returned object to `run({ tools: [...] })`. */
|
|
53
|
+
export declare function tool<T = any>(def: ToolDefinition<T>): ToolDefinition<T>;
|
|
54
|
+
/** A single step in a run's trace (tool calls + their results). */
|
|
55
|
+
export type StepTrace = {
|
|
56
|
+
type: 'tool_call';
|
|
57
|
+
name: string;
|
|
58
|
+
input: unknown;
|
|
59
|
+
} | {
|
|
60
|
+
type: 'tool_result';
|
|
61
|
+
name: string;
|
|
62
|
+
output: string;
|
|
63
|
+
isError: boolean;
|
|
64
|
+
};
|
|
65
|
+
export interface RunInput {
|
|
66
|
+
/** What you want done, in plain language. */
|
|
67
|
+
goal: string;
|
|
68
|
+
/** Profile override for this run (else the client default). */
|
|
69
|
+
profile?: T1Profile;
|
|
70
|
+
/** Structured context the model should use (JSON-serialized into the prompt). */
|
|
71
|
+
input?: unknown;
|
|
72
|
+
/** Extra system guidance prepended to the run. */
|
|
73
|
+
system?: string;
|
|
74
|
+
/** Cap output tokens for this run. */
|
|
75
|
+
maxTokens?: number;
|
|
76
|
+
/** Sampling temperature (0–2). */
|
|
77
|
+
temperature?: number;
|
|
78
|
+
/** Typed tools the run may call. Handlers run locally; each round-trip is metered. */
|
|
79
|
+
tools?: ToolDefinition[];
|
|
80
|
+
/** Max model turns in a tool loop before stopping (default 8). */
|
|
81
|
+
maxSteps?: number;
|
|
82
|
+
/** Reserved — the evaluation layer isn't enforced yet (accepted, no-op). */
|
|
83
|
+
verify?: boolean;
|
|
84
|
+
}
|
|
85
|
+
export interface RunResult {
|
|
86
|
+
/** The model's answer. */
|
|
87
|
+
output: string;
|
|
88
|
+
/** Profile that ran (resolved T1 slug). */
|
|
89
|
+
profile: string;
|
|
90
|
+
/** Underlying model. */
|
|
91
|
+
model?: string;
|
|
92
|
+
/** Aggregate token usage across every turn of the run. */
|
|
93
|
+
usage?: {
|
|
94
|
+
inputTokens: number;
|
|
95
|
+
outputTokens: number;
|
|
96
|
+
};
|
|
97
|
+
/** Credits this run cost (summed across tool-loop turns). */
|
|
98
|
+
creditsCharged: number;
|
|
99
|
+
/** Wallet balance after this run. */
|
|
100
|
+
balance: number;
|
|
101
|
+
finishReason?: string;
|
|
102
|
+
/** Tool calls + results, in order (present when the run used tools). */
|
|
103
|
+
steps?: StepTrace[];
|
|
104
|
+
/** True if a tool loop hit maxSteps without a final answer. */
|
|
105
|
+
maxStepsReached?: boolean;
|
|
106
|
+
}
|
|
107
|
+
export type RunStreamEvent = {
|
|
108
|
+
type: 'text';
|
|
109
|
+
delta: string;
|
|
110
|
+
} | {
|
|
111
|
+
type: 'tool_call';
|
|
112
|
+
name: string;
|
|
113
|
+
input: unknown;
|
|
114
|
+
} | {
|
|
115
|
+
type: 'tool_result';
|
|
116
|
+
name: string;
|
|
117
|
+
output: string;
|
|
118
|
+
isError: boolean;
|
|
119
|
+
} | {
|
|
120
|
+
type: 'done';
|
|
121
|
+
model?: string;
|
|
122
|
+
usage?: {
|
|
123
|
+
inputTokens: number;
|
|
124
|
+
outputTokens: number;
|
|
125
|
+
};
|
|
126
|
+
creditsCharged: number;
|
|
127
|
+
balance: number;
|
|
128
|
+
finishReason?: string;
|
|
129
|
+
steps?: StepTrace[];
|
|
130
|
+
/** Internal: set by the server on a tool turn so the stream loop can continue. */
|
|
131
|
+
toolCalls?: Array<{
|
|
132
|
+
id: string;
|
|
133
|
+
name: string;
|
|
134
|
+
input: Record<string, unknown>;
|
|
135
|
+
}>;
|
|
136
|
+
} | {
|
|
137
|
+
type: 'error';
|
|
138
|
+
error: string;
|
|
139
|
+
};
|
|
140
|
+
/** Coarse failure class, derived from the HTTP status. */
|
|
141
|
+
export type TaskclanErrorType = 'authentication' | 'insufficient_credits' | 'invalid_request' | 'rate_limit' | 'api';
|
|
142
|
+
export declare class TaskclanError extends Error {
|
|
143
|
+
/** Coarse failure class (see TaskclanErrorType). */
|
|
144
|
+
readonly type: TaskclanErrorType;
|
|
145
|
+
readonly status: number;
|
|
146
|
+
readonly code?: string;
|
|
147
|
+
/** Correlate with server logs (from the X-Request-Id header / body). */
|
|
148
|
+
readonly requestId?: string;
|
|
149
|
+
/** True for transient failures (429 / 5xx) worth retrying. */
|
|
150
|
+
readonly retryable: boolean;
|
|
151
|
+
/** Wallet balance at failure time, when the API reported it (e.g. 402). */
|
|
152
|
+
readonly balance?: number;
|
|
153
|
+
constructor(message: string, status: number, code?: string, balance?: number, requestId?: string);
|
|
154
|
+
}
|
|
155
|
+
/** Callable run(): `taskclan.run(input)`, with `taskclan.run.stream(input)`. */
|
|
156
|
+
export interface RunFn {
|
|
157
|
+
(input: RunInput): Promise<RunResult>;
|
|
158
|
+
stream(input: RunInput): Promise<AsyncIterable<RunStreamEvent>>;
|
|
159
|
+
}
|
|
160
|
+
/** A Studio asset — a created image with a stable id + hosted url you can iterate on. */
|
|
161
|
+
export interface StudioAsset {
|
|
162
|
+
/** Stable id — pass to `studio.edit({ assetId })` to iterate. */
|
|
163
|
+
id: string;
|
|
164
|
+
/** Hosted URL of the generated asset. */
|
|
165
|
+
url: string;
|
|
166
|
+
modality: string;
|
|
167
|
+
prompt?: string | null;
|
|
168
|
+
model?: string | null;
|
|
169
|
+
/** The asset this was edited from (present on variations). */
|
|
170
|
+
parentId?: string | null;
|
|
171
|
+
createdAt?: string;
|
|
172
|
+
/** Credits this creation cost. */
|
|
173
|
+
creditsCharged: number;
|
|
174
|
+
/** Wallet balance after this creation. */
|
|
175
|
+
balance: number;
|
|
176
|
+
}
|
|
177
|
+
export interface StudioGenerateInput {
|
|
178
|
+
prompt: string;
|
|
179
|
+
/** Only `image` is wired today (video/audio/threeD are documented, not yet live). */
|
|
180
|
+
modality?: 'image' | 'video' | 'audio' | 'threeD';
|
|
181
|
+
size?: string;
|
|
182
|
+
quality?: 'low' | 'medium' | 'high';
|
|
183
|
+
/** Ground the output in a brand's rules (accepted; not yet enforced). */
|
|
184
|
+
brandId?: string;
|
|
185
|
+
}
|
|
186
|
+
export interface StudioEditInput {
|
|
187
|
+
/** Id of the asset to iterate on (from a previous generate/edit). */
|
|
188
|
+
assetId: string;
|
|
189
|
+
instruction: string;
|
|
190
|
+
size?: string;
|
|
191
|
+
quality?: 'low' | 'medium' | 'high';
|
|
192
|
+
}
|
|
193
|
+
/** taskclan.studio — the multimodal creation surface. */
|
|
194
|
+
export interface StudioNamespace {
|
|
195
|
+
/** Create an asset (image today). Metered against your wallet. */
|
|
196
|
+
generate(input: StudioGenerateInput): Promise<StudioAsset>;
|
|
197
|
+
/** Iterate on an existing asset by id → a new variation asset. Metered. */
|
|
198
|
+
edit(input: StudioEditInput): Promise<StudioAsset>;
|
|
199
|
+
}
|
|
200
|
+
export declare class Taskclan {
|
|
201
|
+
private readonly apiKey;
|
|
202
|
+
private readonly baseUrl;
|
|
203
|
+
private readonly defaultProfile;
|
|
204
|
+
private readonly fetchImpl;
|
|
205
|
+
readonly run: RunFn;
|
|
206
|
+
/** Multimodal creation — `studio.generate()` / `studio.edit()`. */
|
|
207
|
+
readonly studio: StudioNamespace;
|
|
208
|
+
/** Deterministic workflows — `engine.run(workflow, { input })`. */
|
|
209
|
+
readonly engine: EngineNamespace;
|
|
210
|
+
constructor(config?: TaskclanConfig);
|
|
211
|
+
/** Turn a goal (+ optional structured input) into the single prompt string. */
|
|
212
|
+
private buildPrompt;
|
|
213
|
+
/** Build the (toolless) request body the T1 API expects from a run input. */
|
|
214
|
+
private buildBody;
|
|
215
|
+
private headers;
|
|
216
|
+
/** POST JSON to a T1 endpoint; throw TaskclanError on non-2xx; return the parsed body. */
|
|
217
|
+
private _post;
|
|
218
|
+
private _run;
|
|
219
|
+
/**
|
|
220
|
+
* Client-orchestrated tool loop. Tools run on the CALLER, so each turn: ask the
|
|
221
|
+
* model (with the tool schemas); if it requests tools, run them locally and
|
|
222
|
+
* replay the results as tool_use/tool_result messages; repeat until it answers
|
|
223
|
+
* (or maxSteps). Usage + credits are summed across every metered turn.
|
|
224
|
+
*/
|
|
225
|
+
private _runWithTools;
|
|
226
|
+
/** POST to /api/t1/stream and return the SSE event iterator (throws on non-2xx). */
|
|
227
|
+
private _openStream;
|
|
228
|
+
private _stream;
|
|
229
|
+
/**
|
|
230
|
+
* Streaming tool loop: stream each turn's text; when a turn ends in tool calls,
|
|
231
|
+
* emit tool_call events, run the handlers LOCALLY, emit tool_result events, and
|
|
232
|
+
* open the next streaming turn with the results — until a final answer. Emits
|
|
233
|
+
* text / tool_call / tool_result / done / error. Each turn is metered.
|
|
234
|
+
*/
|
|
235
|
+
private _streamWithTools;
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=t1.d.ts.map
|
package/dist/t1.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"t1.d.ts","sourceRoot":"","sources":["../src/t1.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAU9D,kFAAkF;AAClF,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEnG,MAAM,WAAW,cAAc;IAC7B,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC,GAAG,OAAO;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,CAAC,EAAE,OAAO,GAAG;QAAE,OAAO,EAAE,IAAI,CAAC;QAAC,IAAI,EAAE,CAAC,CAAA;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,CAAC,SAAS,CAAe;IACzC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC;IACpB,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;gBAErB,MAAM,GAAE,cAAmB;IAwBvC,+EAA+E;IAC/E,OAAO,CAAC,WAAW;IAOnB,6EAA6E;IAC7E,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,OAAO;IAOf,0FAA0F;YAC5E,KAAK;YAmBL,IAAI;IAalB;;;;;OAKG;YACW,aAAa;IAkG3B,oFAAoF;YACtE,WAAW;IAmBzB,OAAO,CAAC,OAAO;IAKf;;;;;OAKG;YACY,gBAAgB;CAiGhC"}
|
package/dist/t1.js
ADDED
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Taskclan — the T1 developer client.
|
|
4
|
+
*
|
|
5
|
+
* import { Taskclan } from "@taskclan/sdk";
|
|
6
|
+
* const taskclan = new Taskclan({ apiKey: process.env.TASKCLAN_API_KEY });
|
|
7
|
+
* const result = await taskclan.run({ profile: "t1-flow", goal: "…", input: {…} });
|
|
8
|
+
* console.log(result.output);
|
|
9
|
+
*
|
|
10
|
+
* A run takes a goal (+ optional structured input) and returns a verified result.
|
|
11
|
+
* The profile picks the model/reasoning depth: t1-core (fast), t1-flow (balanced,
|
|
12
|
+
* default), t1-max (deep). Backed by the metered T1 API — spend debits the key's
|
|
13
|
+
* wallet. `run.stream(...)` yields tokens as they generate.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.Taskclan = exports.TaskclanError = void 0;
|
|
17
|
+
exports.tool = tool;
|
|
18
|
+
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
19
|
+
const engine_1 = require("./engine");
|
|
20
|
+
const DEFAULT_BASE_URL = 'https://engine.taskclan.com';
|
|
21
|
+
/** Read an env var without depending on @types/node (works in Node, edge, browser). */
|
|
22
|
+
function readEnv(name) {
|
|
23
|
+
const g = globalThis;
|
|
24
|
+
return g.process?.env?.[name];
|
|
25
|
+
}
|
|
26
|
+
/** Define a typed tool. Pass the returned object to `run({ tools: [...] })`. */
|
|
27
|
+
function tool(def) {
|
|
28
|
+
return def;
|
|
29
|
+
}
|
|
30
|
+
class TaskclanError extends Error {
|
|
31
|
+
constructor(message, status, code, balance, requestId) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.name = 'TaskclanError';
|
|
34
|
+
this.status = status;
|
|
35
|
+
this.code = code;
|
|
36
|
+
this.balance = balance;
|
|
37
|
+
this.requestId = requestId;
|
|
38
|
+
this.retryable = status === 429 || status >= 500;
|
|
39
|
+
this.type =
|
|
40
|
+
status === 401 ? 'authentication'
|
|
41
|
+
: status === 402 ? 'insufficient_credits'
|
|
42
|
+
: status === 400 ? 'invalid_request'
|
|
43
|
+
: status === 429 ? 'rate_limit'
|
|
44
|
+
: 'api';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.TaskclanError = TaskclanError;
|
|
48
|
+
class Taskclan {
|
|
49
|
+
constructor(config = {}) {
|
|
50
|
+
this.apiKey = config.apiKey ?? readEnv('TASKCLAN_API_KEY') ?? '';
|
|
51
|
+
this.baseUrl = (config.baseUrl ?? readEnv('TASKCLAN_BASE_URL') ?? DEFAULT_BASE_URL).replace(/\/$/, '');
|
|
52
|
+
this.defaultProfile = config.profile ?? 't1-flow';
|
|
53
|
+
const f = config.fetch ?? (typeof fetch !== 'undefined' ? fetch : undefined);
|
|
54
|
+
if (!f)
|
|
55
|
+
throw new Error('No fetch implementation available — pass { fetch } to the Taskclan constructor.');
|
|
56
|
+
this.fetchImpl = f;
|
|
57
|
+
const run = ((input) => input.tools?.length ? this._runWithTools(input) : this._run(input));
|
|
58
|
+
run.stream = (input) => this._stream(input);
|
|
59
|
+
this.run = run;
|
|
60
|
+
this.studio = {
|
|
61
|
+
generate: (input) => this._post('/api/t1/studio/generate', input),
|
|
62
|
+
edit: (input) => this._post('/api/t1/studio/edit', input),
|
|
63
|
+
};
|
|
64
|
+
// The engine orchestrates workflows over this client's own run + studio.
|
|
65
|
+
this.engine = (0, engine_1.createEngine)({ run: this.run, studio: this.studio });
|
|
66
|
+
}
|
|
67
|
+
/** Turn a goal (+ optional structured input) into the single prompt string. */
|
|
68
|
+
buildPrompt(input) {
|
|
69
|
+
if (!input?.goal)
|
|
70
|
+
throw new Error('run() requires a `goal`.');
|
|
71
|
+
return input.input !== undefined
|
|
72
|
+
? `${input.goal}\n\nInput:\n${typeof input.input === 'string' ? input.input : JSON.stringify(input.input, null, 2)}`
|
|
73
|
+
: input.goal;
|
|
74
|
+
}
|
|
75
|
+
/** Build the (toolless) request body the T1 API expects from a run input. */
|
|
76
|
+
buildBody(input) {
|
|
77
|
+
return {
|
|
78
|
+
tier: input.profile ?? this.defaultProfile,
|
|
79
|
+
prompt: this.buildPrompt(input),
|
|
80
|
+
...(input.system ? { system: input.system } : {}),
|
|
81
|
+
...(input.maxTokens ? { maxTokens: input.maxTokens } : {}),
|
|
82
|
+
...(input.temperature !== undefined ? { temperature: input.temperature } : {}),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
headers() {
|
|
86
|
+
if (!this.apiKey) {
|
|
87
|
+
throw new TaskclanError('Missing API key — set TASKCLAN_API_KEY or pass { apiKey }.', 401, 'no_api_key');
|
|
88
|
+
}
|
|
89
|
+
return { 'Content-Type': 'application/json', Authorization: `Bearer ${this.apiKey}` };
|
|
90
|
+
}
|
|
91
|
+
/** POST JSON to a T1 endpoint; throw TaskclanError on non-2xx; return the parsed body. */
|
|
92
|
+
async _post(path, body) {
|
|
93
|
+
const res = await this.fetchImpl(`${this.baseUrl}${path}`, {
|
|
94
|
+
method: 'POST',
|
|
95
|
+
headers: this.headers(),
|
|
96
|
+
body: JSON.stringify(body),
|
|
97
|
+
});
|
|
98
|
+
const data = (await res.json().catch(() => ({})));
|
|
99
|
+
if (!res.ok) {
|
|
100
|
+
throw new TaskclanError(String(data.error ?? `request failed (${res.status})`), res.status, typeof data.error === 'string' ? data.error : undefined, typeof data.balance === 'number' ? data.balance : undefined, res.headers.get('x-request-id') ?? (typeof data.requestId === 'string' ? data.requestId : undefined));
|
|
101
|
+
}
|
|
102
|
+
return data;
|
|
103
|
+
}
|
|
104
|
+
async _run(input) {
|
|
105
|
+
const data = await this._post('/api/t1/complete', this.buildBody(input));
|
|
106
|
+
return {
|
|
107
|
+
output: String(data.text ?? ''),
|
|
108
|
+
profile: String(data.tier ?? input.profile ?? this.defaultProfile),
|
|
109
|
+
model: data.model,
|
|
110
|
+
usage: data.usage,
|
|
111
|
+
creditsCharged: Number(data.creditsCharged ?? 0),
|
|
112
|
+
balance: Number(data.balance ?? 0),
|
|
113
|
+
finishReason: data.finishReason,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Client-orchestrated tool loop. Tools run on the CALLER, so each turn: ask the
|
|
118
|
+
* model (with the tool schemas); if it requests tools, run them locally and
|
|
119
|
+
* replay the results as tool_use/tool_result messages; repeat until it answers
|
|
120
|
+
* (or maxSteps). Usage + credits are summed across every metered turn.
|
|
121
|
+
*/
|
|
122
|
+
async _runWithTools(input) {
|
|
123
|
+
const tools = input.tools ?? [];
|
|
124
|
+
const apiTools = tools.map((t) => ({ name: t.name, description: t.description, inputSchema: toInputSchema(t.input) }));
|
|
125
|
+
const byName = new Map(tools.map((t) => [t.name, t]));
|
|
126
|
+
const messages = [{ role: 'user', content: this.buildPrompt(input) }];
|
|
127
|
+
const steps = [];
|
|
128
|
+
const maxSteps = input.maxSteps ?? 8;
|
|
129
|
+
let inTok = 0;
|
|
130
|
+
let outTok = 0;
|
|
131
|
+
let credits = 0;
|
|
132
|
+
let model;
|
|
133
|
+
let balance = 0;
|
|
134
|
+
let profile = String(input.profile ?? this.defaultProfile);
|
|
135
|
+
for (let step = 0; step < maxSteps; step++) {
|
|
136
|
+
const data = await this._post('/api/t1/complete', {
|
|
137
|
+
tier: input.profile ?? this.defaultProfile,
|
|
138
|
+
messages,
|
|
139
|
+
...(input.system ? { system: input.system } : {}),
|
|
140
|
+
tools: apiTools,
|
|
141
|
+
...(input.maxTokens ? { maxTokens: input.maxTokens } : {}),
|
|
142
|
+
...(input.temperature !== undefined ? { temperature: input.temperature } : {}),
|
|
143
|
+
});
|
|
144
|
+
const usage = data.usage;
|
|
145
|
+
inTok += usage?.inputTokens ?? 0;
|
|
146
|
+
outTok += usage?.outputTokens ?? 0;
|
|
147
|
+
credits += Number(data.creditsCharged ?? 0);
|
|
148
|
+
model = data.model ?? model;
|
|
149
|
+
balance = Number(data.balance ?? balance);
|
|
150
|
+
profile = String(data.tier ?? profile);
|
|
151
|
+
const toolCalls = data.toolCalls ?? [];
|
|
152
|
+
if (toolCalls.length === 0) {
|
|
153
|
+
return {
|
|
154
|
+
output: String(data.text ?? ''),
|
|
155
|
+
profile,
|
|
156
|
+
model,
|
|
157
|
+
usage: { inputTokens: inTok, outputTokens: outTok },
|
|
158
|
+
creditsCharged: credits,
|
|
159
|
+
balance,
|
|
160
|
+
finishReason: data.finishReason,
|
|
161
|
+
steps,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
// Record the model's tool-call turn.
|
|
165
|
+
messages.push({
|
|
166
|
+
role: 'assistant',
|
|
167
|
+
content: [
|
|
168
|
+
...(data.text ? [{ type: 'text', text: String(data.text) }] : []),
|
|
169
|
+
...toolCalls.map((tc) => ({ type: 'tool_use', id: tc.id, name: tc.name, input: tc.input })),
|
|
170
|
+
],
|
|
171
|
+
});
|
|
172
|
+
// Run each requested tool locally; collect results to feed back.
|
|
173
|
+
const resultParts = [];
|
|
174
|
+
for (const tc of toolCalls) {
|
|
175
|
+
steps.push({ type: 'tool_call', name: tc.name, input: tc.input });
|
|
176
|
+
const def = byName.get(tc.name);
|
|
177
|
+
let content;
|
|
178
|
+
let isError = false;
|
|
179
|
+
if (!def) {
|
|
180
|
+
content = `Unknown tool "${tc.name}".`;
|
|
181
|
+
isError = true;
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
const parsed = def.input?.safeParse ? def.input.safeParse(tc.input) : { success: true, data: tc.input };
|
|
185
|
+
if (!parsed.success) {
|
|
186
|
+
content = `Invalid input for "${tc.name}": ${JSON.stringify(parsed.error)}`;
|
|
187
|
+
isError = true;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
try {
|
|
191
|
+
const out = await def.run(parsed.data);
|
|
192
|
+
content = typeof out === 'string' ? out : JSON.stringify(out);
|
|
193
|
+
}
|
|
194
|
+
catch (e) {
|
|
195
|
+
content = `Error: ${e.message}`;
|
|
196
|
+
isError = true;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
steps.push({ type: 'tool_result', name: tc.name, output: content, isError });
|
|
201
|
+
resultParts.push({ type: 'tool_result', toolUseId: tc.id, content, isError });
|
|
202
|
+
}
|
|
203
|
+
messages.push({ role: 'user', content: resultParts });
|
|
204
|
+
}
|
|
205
|
+
// Hit maxSteps with tools still pending.
|
|
206
|
+
return {
|
|
207
|
+
output: '',
|
|
208
|
+
profile,
|
|
209
|
+
model,
|
|
210
|
+
usage: { inputTokens: inTok, outputTokens: outTok },
|
|
211
|
+
creditsCharged: credits,
|
|
212
|
+
balance,
|
|
213
|
+
steps,
|
|
214
|
+
maxStepsReached: true,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
/** POST to /api/t1/stream and return the SSE event iterator (throws on non-2xx). */
|
|
218
|
+
async _openStream(body) {
|
|
219
|
+
const res = await this.fetchImpl(`${this.baseUrl}/api/t1/stream`, {
|
|
220
|
+
method: 'POST',
|
|
221
|
+
headers: this.headers(),
|
|
222
|
+
body: JSON.stringify(body),
|
|
223
|
+
});
|
|
224
|
+
if (!res.ok || !res.body) {
|
|
225
|
+
const data = (await res.json().catch(() => ({})));
|
|
226
|
+
throw new TaskclanError(String(data.error ?? `request failed (${res.status})`), res.status, typeof data.error === 'string' ? data.error : undefined, typeof data.balance === 'number' ? data.balance : undefined, res.headers.get('x-request-id') ?? (typeof data.requestId === 'string' ? data.requestId : undefined));
|
|
227
|
+
}
|
|
228
|
+
return parseSSE(res.body);
|
|
229
|
+
}
|
|
230
|
+
_stream(input) {
|
|
231
|
+
if (input.tools?.length)
|
|
232
|
+
return Promise.resolve(this._streamWithTools(input));
|
|
233
|
+
return this._openStream(this.buildBody(input));
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Streaming tool loop: stream each turn's text; when a turn ends in tool calls,
|
|
237
|
+
* emit tool_call events, run the handlers LOCALLY, emit tool_result events, and
|
|
238
|
+
* open the next streaming turn with the results — until a final answer. Emits
|
|
239
|
+
* text / tool_call / tool_result / done / error. Each turn is metered.
|
|
240
|
+
*/
|
|
241
|
+
async *_streamWithTools(input) {
|
|
242
|
+
const tools = input.tools ?? [];
|
|
243
|
+
const apiTools = tools.map((t) => ({ name: t.name, description: t.description, inputSchema: toInputSchema(t.input) }));
|
|
244
|
+
const byName = new Map(tools.map((t) => [t.name, t]));
|
|
245
|
+
const messages = [{ role: 'user', content: this.buildPrompt(input) }];
|
|
246
|
+
const steps = [];
|
|
247
|
+
const maxSteps = input.maxSteps ?? 8;
|
|
248
|
+
let inTok = 0;
|
|
249
|
+
let outTok = 0;
|
|
250
|
+
let credits = 0;
|
|
251
|
+
let model;
|
|
252
|
+
let balance = 0;
|
|
253
|
+
let finishReason;
|
|
254
|
+
for (let step = 0; step < maxSteps; step++) {
|
|
255
|
+
const events = await this._openStream({
|
|
256
|
+
tier: input.profile ?? this.defaultProfile,
|
|
257
|
+
messages,
|
|
258
|
+
...(input.system ? { system: input.system } : {}),
|
|
259
|
+
tools: apiTools,
|
|
260
|
+
...(input.maxTokens ? { maxTokens: input.maxTokens } : {}),
|
|
261
|
+
...(input.temperature !== undefined ? { temperature: input.temperature } : {}),
|
|
262
|
+
});
|
|
263
|
+
let turnText = '';
|
|
264
|
+
let done = null;
|
|
265
|
+
for await (const ev of events) {
|
|
266
|
+
if (ev.type === 'text') {
|
|
267
|
+
turnText += ev.delta;
|
|
268
|
+
yield ev;
|
|
269
|
+
}
|
|
270
|
+
else if (ev.type === 'done') {
|
|
271
|
+
done = ev;
|
|
272
|
+
}
|
|
273
|
+
else if (ev.type === 'error') {
|
|
274
|
+
yield ev;
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (!done) {
|
|
279
|
+
yield { type: 'error', error: 'stream ended without a done event' };
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
credits += done.creditsCharged ?? 0;
|
|
283
|
+
balance = done.balance ?? balance;
|
|
284
|
+
model = done.model ?? model;
|
|
285
|
+
finishReason = done.finishReason ?? finishReason;
|
|
286
|
+
inTok += done.usage?.inputTokens ?? 0;
|
|
287
|
+
outTok += done.usage?.outputTokens ?? 0;
|
|
288
|
+
const toolCalls = done.toolCalls ?? [];
|
|
289
|
+
if (toolCalls.length === 0) {
|
|
290
|
+
yield { type: 'done', model, usage: { inputTokens: inTok, outputTokens: outTok }, creditsCharged: credits, balance, finishReason, steps };
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
// Record the model's (streamed) tool-call turn, run each tool, feed results back.
|
|
294
|
+
messages.push({
|
|
295
|
+
role: 'assistant',
|
|
296
|
+
content: [
|
|
297
|
+
...(turnText ? [{ type: 'text', text: turnText }] : []),
|
|
298
|
+
...toolCalls.map((tc) => ({ type: 'tool_use', id: tc.id, name: tc.name, input: tc.input })),
|
|
299
|
+
],
|
|
300
|
+
});
|
|
301
|
+
const resultParts = [];
|
|
302
|
+
for (const tc of toolCalls) {
|
|
303
|
+
yield { type: 'tool_call', name: tc.name, input: tc.input };
|
|
304
|
+
steps.push({ type: 'tool_call', name: tc.name, input: tc.input });
|
|
305
|
+
const def = byName.get(tc.name);
|
|
306
|
+
let content;
|
|
307
|
+
let isError = false;
|
|
308
|
+
if (!def) {
|
|
309
|
+
content = `Unknown tool "${tc.name}".`;
|
|
310
|
+
isError = true;
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
const parsed = def.input?.safeParse ? def.input.safeParse(tc.input) : { success: true, data: tc.input };
|
|
314
|
+
if (!parsed.success) {
|
|
315
|
+
content = `Invalid input for "${tc.name}": ${JSON.stringify(parsed.error)}`;
|
|
316
|
+
isError = true;
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
try {
|
|
320
|
+
const out = await def.run(parsed.data);
|
|
321
|
+
content = typeof out === 'string' ? out : JSON.stringify(out);
|
|
322
|
+
}
|
|
323
|
+
catch (e) {
|
|
324
|
+
content = `Error: ${e.message}`;
|
|
325
|
+
isError = true;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
steps.push({ type: 'tool_result', name: tc.name, output: content, isError });
|
|
330
|
+
yield { type: 'tool_result', name: tc.name, output: content, isError };
|
|
331
|
+
resultParts.push({ type: 'tool_result', toolUseId: tc.id, content, isError });
|
|
332
|
+
}
|
|
333
|
+
messages.push({ role: 'user', content: resultParts });
|
|
334
|
+
}
|
|
335
|
+
yield { type: 'done', model, usage: { inputTokens: inTok, outputTokens: outTok }, creditsCharged: credits, balance, steps };
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
exports.Taskclan = Taskclan;
|
|
339
|
+
/** A Zod schema → JSON Schema (for the API). Falls through for plain schema objects. */
|
|
340
|
+
function toInputSchema(input) {
|
|
341
|
+
if (input && typeof input._def !== 'undefined') {
|
|
342
|
+
const js = (0, zod_to_json_schema_1.zodToJsonSchema)(input, { $refStrategy: 'none' });
|
|
343
|
+
delete js.$schema;
|
|
344
|
+
return js;
|
|
345
|
+
}
|
|
346
|
+
if (input && typeof input === 'object')
|
|
347
|
+
return input;
|
|
348
|
+
return { type: 'object', properties: {} };
|
|
349
|
+
}
|
|
350
|
+
/** Parse a text/event-stream body into RunStreamEvent objects. */
|
|
351
|
+
async function* parseSSE(body) {
|
|
352
|
+
const reader = body.getReader();
|
|
353
|
+
const decoder = new TextDecoder();
|
|
354
|
+
let buffer = '';
|
|
355
|
+
for (;;) {
|
|
356
|
+
const { value, done } = await reader.read();
|
|
357
|
+
if (done)
|
|
358
|
+
break;
|
|
359
|
+
buffer += decoder.decode(value, { stream: true });
|
|
360
|
+
const lines = buffer.split('\n');
|
|
361
|
+
buffer = lines.pop() ?? '';
|
|
362
|
+
for (const line of lines) {
|
|
363
|
+
const trimmed = line.trim();
|
|
364
|
+
if (!trimmed.startsWith('data:'))
|
|
365
|
+
continue;
|
|
366
|
+
const payload = trimmed.slice(5).trim();
|
|
367
|
+
if (payload === '[DONE]' || !payload)
|
|
368
|
+
continue;
|
|
369
|
+
try {
|
|
370
|
+
yield JSON.parse(payload);
|
|
371
|
+
}
|
|
372
|
+
catch {
|
|
373
|
+
// ignore malformed keepalive chunk
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
//# sourceMappingURL=t1.js.map
|
package/dist/t1.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"t1.js","sourceRoot":"","sources":["../src/t1.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAkDH,oBAEC;AAlDD,2DAAqD;AAErD,qCAA8D;AAE9D,MAAM,gBAAgB,GAAG,6BAA6B,CAAC;AAEvD,uFAAuF;AACvF,SAAS,OAAO,CAAC,IAAY;IAC3B,MAAM,CAAC,GAAG,UAAwE,CAAC;IACnF,OAAO,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAqCD,gFAAgF;AAChF,SAAgB,IAAI,CAAU,GAAsB;IAClD,OAAO,GAAG,CAAC;AACb,CAAC;AAyED,MAAa,aAAc,SAAQ,KAAK;IAWtC,YAAY,OAAe,EAAE,MAAc,EAAE,IAAa,EAAE,OAAg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AC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taskclan/sdk",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Typed client for
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Typed client for Taskclan Intelligence. The T1 developer client — new Taskclan({apiKey}).run({goal}) against the metered T1 API (core/flow/max profiles, streaming) — plus the L3 agentic layer (named agents/skills, shared memory, insights, registries) built on @taskclan/platform.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Taskclan",
|
|
7
7
|
"private": false,
|
|
8
|
-
"publishConfig": {
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
9
11
|
"repository": {
|
|
10
12
|
"type": "git",
|
|
11
13
|
"url": "git+https://github.com/taskclan/taskclan-monorepo.git",
|
|
@@ -41,9 +43,13 @@
|
|
|
41
43
|
"node": ">=18"
|
|
42
44
|
},
|
|
43
45
|
"dependencies": {
|
|
44
|
-
"@taskclan/platform": "^0.2.0"
|
|
46
|
+
"@taskclan/platform": "^0.2.0",
|
|
47
|
+
"zod-to-json-schema": "^3.25.2"
|
|
45
48
|
},
|
|
46
49
|
"devDependencies": {
|
|
47
50
|
"typescript": "^5.5.4"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"zod": "^3.25.76"
|
|
48
54
|
}
|
|
49
55
|
}
|