foldkit-agent-native 0.9.0 → 0.11.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 +33 -37
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -9,24 +9,11 @@ already exposes. The generated action delegates validation, availability,
|
|
|
9
9
|
authorization, dispatch, and completion back to a bound `AgentRuntime`; it does
|
|
10
10
|
not reimplement application behavior.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
|
18
|
-
| AgentBuilder.bind(...)
|
|
19
|
-
v
|
|
20
|
-
AgentRuntime live Model + dispatch + policy
|
|
21
|
-
^
|
|
22
|
-
|
|
|
23
|
-
resolveRuntime(ctx)
|
|
24
|
-
|
|
|
25
|
-
foldkit-agent-native adapter
|
|
26
|
-
|
|
|
27
|
-
v
|
|
28
|
-
Agent Native action registry
|
|
29
|
-
```
|
|
12
|
+
The application's `AssistantAgent` is the protocol-neutral contract.
|
|
13
|
+
`AgentBuilder.bind(...)` binds it to an `AgentRuntime`, which holds the live Model,
|
|
14
|
+
dispatch and policy. `foldkit-agent-native` is the adapter: it gives Agent Native
|
|
15
|
+
an action registry, and each invocation reaches the runtime through
|
|
16
|
+
`resolveRuntime(ctx)`.
|
|
30
17
|
|
|
31
18
|
Application behavior still ends in the existing Foldkit Message and `update`.
|
|
32
19
|
This package is an adapter, not a second agent architecture.
|
|
@@ -52,6 +39,30 @@ Agent Native needs a static action registry, but the live Model and principal
|
|
|
52
39
|
belong to the caller. Register the contract once and resolve the bound runtime
|
|
53
40
|
per invocation:
|
|
54
41
|
|
|
42
|
+
<!-- docs-check
|
|
43
|
+
import { Agent } from 'foldkit-agent'
|
|
44
|
+
import { Option, Schema } from 'effect'
|
|
45
|
+
import { defineMessageUnion } from 'foldkit/message'
|
|
46
|
+
const Message = defineMessageUnion({ RequestedCreateTodo: { title: Schema.String } })
|
|
47
|
+
type Message = typeof Message.Type
|
|
48
|
+
interface Model {
|
|
49
|
+
readonly selectedTodoId: Option.Option<string>
|
|
50
|
+
}
|
|
51
|
+
import type { ActionRunContext as HostContext } from 'foldkit-agent-native'
|
|
52
|
+
interface Caller {
|
|
53
|
+
readonly email: string
|
|
54
|
+
}
|
|
55
|
+
const AgentBuilder = Agent.forModel<Model>()
|
|
56
|
+
const AssistantAgent = AgentBuilder.make({
|
|
57
|
+
messages: AgentBuilder.expose(Message, { RequestedCreateTodo: 'Create a todo' }),
|
|
58
|
+
})
|
|
59
|
+
declare const hostFor: (context: HostContext) => {
|
|
60
|
+
readonly model: () => Model
|
|
61
|
+
readonly dispatch: (message: Message) => void
|
|
62
|
+
}
|
|
63
|
+
declare const principalFor: (context: HostContext) => Caller
|
|
64
|
+
-->
|
|
65
|
+
|
|
55
66
|
```ts
|
|
56
67
|
import { AgentNative } from 'foldkit-agent-native'
|
|
57
68
|
import { registerPackageActions } from '@agent-native/core/server'
|
|
@@ -78,25 +89,10 @@ const runtimeFor = (context: HostContext) =>
|
|
|
78
89
|
|
|
79
90
|
That distinction is the heart of this adapter:
|
|
80
91
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
v
|
|
86
|
-
Agent Native action descriptions
|
|
87
|
-
|
|
88
|
-
per invocation
|
|
89
|
-
verified host caller/context
|
|
90
|
-
|
|
|
91
|
-
v
|
|
92
|
-
resolveRuntime(ctx)
|
|
93
|
-
|
|
|
94
|
-
v
|
|
95
|
-
AgentRuntime
|
|
96
|
-
|
|
|
97
|
-
v
|
|
98
|
-
availability -> authorization -> Message -> update
|
|
99
|
-
```
|
|
92
|
+
Statically, the `AssistantAgent` becomes Agent Native action descriptions. Per
|
|
93
|
+
invocation, a verified host caller and context go to `resolveRuntime(ctx)`, which
|
|
94
|
+
returns the `AgentRuntime`; that checks availability, then authorization, then
|
|
95
|
+
dispatches the Message to `update`.
|
|
100
96
|
|
|
101
97
|
The registry describes capabilities. The bound runtime decides whether a
|
|
102
98
|
particular caller may use one **right now**.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit-agent-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Agent Native adapter for foldkit-agent. Compiles an exposed Foldkit contract into Agent Native actions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foldkit",
|
|
@@ -41,16 +41,16 @@
|
|
|
41
41
|
"@agent-native/core": "0.214.0",
|
|
42
42
|
"effect": "^4.1.0",
|
|
43
43
|
"foldkit": "^0.170.0",
|
|
44
|
-
"foldkit-agent": "^0.
|
|
44
|
+
"foldkit-agent": "^0.13.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@agent-native/core": "0.214.0",
|
|
48
|
-
"@effect/platform-browser": "
|
|
49
|
-
"effect": "
|
|
48
|
+
"@effect/platform-browser": "4.1.4",
|
|
49
|
+
"effect": "4.1.4",
|
|
50
50
|
"foldkit": "0.170.0",
|
|
51
51
|
"tsdown": "^0.23.1",
|
|
52
52
|
"typescript": "7.0.2",
|
|
53
|
-
"foldkit-agent": "0.
|
|
53
|
+
"foldkit-agent": "0.13.0"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "node ../../scripts/declarations.mjs . && tsdown && node ../../scripts/declared-any.mjs .",
|