@hanfani/core 0.1.1 → 0.1.3
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/LICENSE +1 -1
- package/README.md +32 -38
- package/package.json +14 -4
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -2,46 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
Headless engine and types for the Hanfani agent framework.
|
|
4
4
|
|
|
5
|
-
Pure logic — no I/O, no server, no
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
>
|
|
9
|
-
|
|
10
|
-
`defineAgent` refuses any
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## Exports
|
|
15
|
-
|
|
16
|
-
- **Definitions:** `defineAgent`, `defineWorkflow`, `definePrompt`,
|
|
17
|
-
`defineProviders`, `AgentDefinitionSchema`.
|
|
18
|
-
- **Messages:** `isAssistant`, `isToolMessage`, `toolCallsOf`,
|
|
19
|
-
`hasPendingApproval`, `pairToolResults`, `lastApprovalArgs`,
|
|
20
|
-
`resolvedApprovalCount`, `approvalResolved`.
|
|
21
|
-
- **Handoffs:** `encodeHandoff`, `decodeHandoff`, `handoffNote`,
|
|
22
|
-
`HandoffPayloadSchema`, `TicketHandoffPayloadSchema`.
|
|
23
|
-
- **Gates & events:** `gateOpened`, `readGateOpened`, `GATE_OPENED`,
|
|
24
|
-
`GateOpenedValueSchema`, `lifecycleNote`, `LIFECYCLE_NOTE_TEXT`,
|
|
25
|
-
`foldEventsToMessages`.
|
|
26
|
-
- **Lifecycle & delivery:** `lifecycle`, `hasLiveDescendant`, `resolveDelivery`,
|
|
27
|
-
`instanceId`, `composeInstructions`.
|
|
28
|
-
- **Providers & integration:** `providerConformanceChecks`, `aggregateHealth`,
|
|
29
|
-
`isOk`, `isOAuth2`.
|
|
30
|
-
- Plus the full type surface (`WorkflowDescriptor`, `Outcome`, `Phase`,
|
|
31
|
-
`Provider`, `EffectFn`, `AuthSpec`, `ResolvedCredential`, …).
|
|
32
|
-
|
|
33
|
-
## Build & test
|
|
34
|
-
|
|
35
|
-
Built with the native TypeScript 7 compiler (`tsc` / tsgo) — no bundler, no
|
|
36
|
-
compiler-API tooling, so nothing here breaks on the TS 7 upgrade.
|
|
5
|
+
Pure logic — no I/O, no server, no UI. It defines what a workflow and an agent
|
|
6
|
+
*are* and enforces one rule:
|
|
7
|
+
|
|
8
|
+
> **The agent proposes, a human approves, the server acts.**
|
|
9
|
+
|
|
10
|
+
`defineAgent` refuses any side effect that isn't behind a human-approval gate,
|
|
11
|
+
and `providerConformanceChecks` proves any model provider honors that at runtime.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
37
14
|
|
|
38
15
|
```bash
|
|
39
|
-
pnpm
|
|
40
|
-
pnpm typecheck # tsc -p tsconfig.json --noEmit
|
|
41
|
-
pnpm test # vitest smoke suite
|
|
16
|
+
pnpm add @hanfani/core
|
|
42
17
|
```
|
|
43
18
|
|
|
44
|
-
##
|
|
19
|
+
## Quick look
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { defineAgent } from '@hanfani/core'
|
|
23
|
+
|
|
24
|
+
const reply = defineAgent({
|
|
25
|
+
id: 'reply',
|
|
26
|
+
name: 'Reply',
|
|
27
|
+
provider: 'claude',
|
|
28
|
+
instructions: 'Draft a reply for the human to approve.',
|
|
29
|
+
tools: ['saveDraft'],
|
|
30
|
+
approvals: ['saveDraft'], // saveDraft only fires after a human approves
|
|
31
|
+
renders: { saveDraft: 'DraftCard' },
|
|
32
|
+
})
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Docs
|
|
36
|
+
|
|
37
|
+
Full API reference and guides are coming soon in the Hanfani framework docs.
|
|
38
|
+
|
|
39
|
+
## License
|
|
45
40
|
|
|
46
|
-
|
|
47
|
-
declared as regular dependencies.
|
|
41
|
+
[MIT](./LICENSE) License © [Fruitizz](https://github.com/fruitizz)
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanfani/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Headless engine and types for the Hanfani agent framework.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"author": "
|
|
6
|
+
"author": "Fruitizz",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"files": [
|
|
@@ -19,10 +19,13 @@
|
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
|
+
"homepage": "https://github.com/fruitizz/hanfani-core#readme",
|
|
22
23
|
"repository": {
|
|
23
24
|
"type": "git",
|
|
24
|
-
"url": "git+https://github.com/
|
|
25
|
-
|
|
25
|
+
"url": "git+https://github.com/fruitizz/hanfani-core.git"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/fruitizz/hanfani-core/issues"
|
|
26
29
|
},
|
|
27
30
|
"keywords": [
|
|
28
31
|
"hanfani",
|
|
@@ -35,6 +38,13 @@
|
|
|
35
38
|
"@ag-ui/client": "^0.0.55",
|
|
36
39
|
"zod": "^3.25.76"
|
|
37
40
|
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=20.19"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"typescript": "^7.0.2",
|
|
46
|
+
"vitest": "^2.1.0"
|
|
47
|
+
},
|
|
38
48
|
"scripts": {
|
|
39
49
|
"build": "tsc -p tsconfig.build.json",
|
|
40
50
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|