@agentick/core 0.4.0 → 0.6.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 +39 -12
- package/dist/.tsbuildinfo.build +1 -1
- package/dist/agentick-instance.d.ts.map +1 -1
- package/dist/agentick-instance.js +2 -1
- package/dist/agentick-instance.js.map +1 -1
- package/dist/app/session.d.ts +5 -0
- package/dist/app/session.d.ts.map +1 -1
- package/dist/app/session.js +205 -106
- package/dist/app/session.js.map +1 -1
- package/dist/app/types.d.ts +20 -4
- package/dist/app/types.d.ts.map +1 -1
- package/dist/com/object-model.d.ts +12 -0
- package/dist/com/object-model.d.ts.map +1 -1
- package/dist/com/object-model.js +35 -3
- package/dist/com/object-model.js.map +1 -1
- package/dist/compiler/collector.d.ts.map +1 -1
- package/dist/compiler/collector.js +15 -5
- package/dist/compiler/collector.js.map +1 -1
- package/dist/compiler/fiber-compiler.d.ts +2 -0
- package/dist/compiler/fiber-compiler.d.ts.map +1 -1
- package/dist/compiler/fiber-compiler.js +29 -1
- package/dist/compiler/fiber-compiler.js.map +1 -1
- package/dist/compiler/index.d.ts +1 -1
- package/dist/compiler/index.d.ts.map +1 -1
- package/dist/compiler/index.js.map +1 -1
- package/dist/compiler/structure-renderer.d.ts.map +1 -1
- package/dist/compiler/structure-renderer.js +4 -15
- package/dist/compiler/structure-renderer.js.map +1 -1
- package/dist/compiler/types.d.ts +2 -10
- package/dist/compiler/types.d.ts.map +1 -1
- package/dist/compiler/types.js.map +1 -1
- package/dist/engine/tool-executor.d.ts +6 -1
- package/dist/engine/tool-executor.d.ts.map +1 -1
- package/dist/engine/tool-executor.js +16 -1
- package/dist/engine/tool-executor.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/knob.d.ts +12 -0
- package/dist/hooks/knob.d.ts.map +1 -1
- package/dist/hooks/knob.js +32 -2
- package/dist/hooks/knob.js.map +1 -1
- package/dist/hooks/knobs-component.d.ts +1 -0
- package/dist/hooks/knobs-component.d.ts.map +1 -1
- package/dist/hooks/knobs-component.js +5 -1
- package/dist/hooks/knobs-component.js.map +1 -1
- package/dist/hooks/lifecycle.d.ts +34 -43
- package/dist/hooks/lifecycle.d.ts.map +1 -1
- package/dist/hooks/lifecycle.js +46 -43
- package/dist/hooks/lifecycle.js.map +1 -1
- package/dist/hooks/runtime-context.d.ts +18 -8
- package/dist/hooks/runtime-context.d.ts.map +1 -1
- package/dist/hooks/runtime-context.js +39 -9
- package/dist/hooks/runtime-context.js.map +1 -1
- package/dist/hooks/types.d.ts +55 -14
- package/dist/hooks/types.d.ts.map +1 -1
- package/dist/hooks/types.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jsx/components/timeline.d.ts.map +1 -1
- package/dist/jsx/components/timeline.js +5 -10
- package/dist/jsx/components/timeline.js.map +1 -1
- package/dist/jsx/jsx-runtime.d.ts +6 -0
- package/dist/jsx/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx/jsx-runtime.js.map +1 -1
- package/dist/model/adapter-helpers.d.ts +0 -4
- package/dist/model/adapter-helpers.d.ts.map +1 -1
- package/dist/model/adapter-helpers.js +0 -9
- package/dist/model/adapter-helpers.js.map +1 -1
- package/dist/model/stream-accumulator.d.ts +4 -0
- package/dist/model/stream-accumulator.d.ts.map +1 -1
- package/dist/model/stream-accumulator.js +59 -0
- package/dist/model/stream-accumulator.js.map +1 -1
- package/dist/testing/compile-agent.d.ts +4 -3
- package/dist/testing/compile-agent.d.ts.map +1 -1
- package/dist/testing/compile-agent.js +2 -2
- package/dist/testing/compile-agent.js.map +1 -1
- package/dist/testing/mocks.d.ts +10 -0
- package/dist/testing/mocks.d.ts.map +1 -1
- package/dist/testing/mocks.js +30 -0
- package/dist/testing/mocks.js.map +1 -1
- package/dist/testing/render-agent.d.ts.map +1 -1
- package/dist/testing/render-agent.js +3 -11
- package/dist/testing/render-agent.js.map +1 -1
- package/dist/testing/test-runner.d.ts +7 -7
- package/dist/testing/test-runner.js +8 -8
- package/dist/tool/tool.d.ts +31 -1
- package/dist/tool/tool.d.ts.map +1 -1
- package/dist/tool/tool.js +53 -6
- package/dist/tool/tool.js.map +1 -1
- package/dist/utils/token-estimate.d.ts +4 -3
- package/dist/utils/token-estimate.d.ts.map +1 -1
- package/dist/utils/token-estimate.js +16 -15
- package/dist/utils/token-estimate.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -309,17 +309,11 @@ function MyComponent() {
|
|
|
309
309
|
});
|
|
310
310
|
|
|
311
311
|
// Control agent loop continuation (primary hook for agent behavior)
|
|
312
|
+
// result.shouldContinue shows framework default; return nothing to defer
|
|
312
313
|
useContinuation((result) => {
|
|
313
|
-
|
|
314
|
-
if (result.text?.includes("<DONE>")) return false;
|
|
314
|
+
if (result.text?.includes("<DONE>")) return { stop: true, reason: "done" };
|
|
315
315
|
if (result.tick >= 10) return false; // Safety limit
|
|
316
|
-
return
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
// Access COM when needed (always the last parameter)
|
|
320
|
-
useContinuation((result, ctx) => {
|
|
321
|
-
ctx.setState("lastTick", result.tick);
|
|
322
|
-
return !result.text?.includes("<DONE>");
|
|
316
|
+
// No return = defer to framework (continues if tool calls pending)
|
|
323
317
|
});
|
|
324
318
|
}
|
|
325
319
|
```
|
|
@@ -616,6 +610,39 @@ function App() {
|
|
|
616
610
|
}
|
|
617
611
|
```
|
|
618
612
|
|
|
613
|
+
### Prop Overrides
|
|
614
|
+
|
|
615
|
+
Customize pre-built tool metadata via JSX props without creating new tools:
|
|
616
|
+
|
|
617
|
+
```tsx
|
|
618
|
+
<WeatherTool description="Check weather. Always include units." />
|
|
619
|
+
<ShellTool name="bash" requiresConfirmation={true} />
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
### Tool Sources
|
|
623
|
+
|
|
624
|
+
Tools merge from four sources (lowest → highest priority):
|
|
625
|
+
|
|
626
|
+
```tsx
|
|
627
|
+
// 1. App-level — available to all sessions
|
|
628
|
+
const app = createApp(Agent, { tools: [SearchTool] });
|
|
629
|
+
|
|
630
|
+
// 2. Session-level — available for this session
|
|
631
|
+
const session = await app.session({ tools: [FileTool] });
|
|
632
|
+
|
|
633
|
+
// 3. Per-execution — available only during this send()
|
|
634
|
+
await session.send({ messages: [...], tools: [DynamicTool] });
|
|
635
|
+
|
|
636
|
+
// 4. JSX-reconciled — highest priority, re-evaluated each tick
|
|
637
|
+
function Agent() {
|
|
638
|
+
return <SearchTool description="Custom desc" />;
|
|
639
|
+
}
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
On each tick, tools merge in order: app → session → execution → JSX. Last-in wins by name.
|
|
643
|
+
|
|
644
|
+
Spawned sessions (`session.spawn()`) start fresh — they do **not** inherit parent tools. Each child defines its own toolset via JSX and app-level tools.
|
|
645
|
+
|
|
619
646
|
## App & Session
|
|
620
647
|
|
|
621
648
|
### Creating an App
|
|
@@ -983,9 +1010,9 @@ import { createApp, type ExecutionRunner } from "@agentick/core";
|
|
|
983
1010
|
const replRunner: ExecutionRunner = {
|
|
984
1011
|
name: "repl",
|
|
985
1012
|
|
|
986
|
-
// Transform
|
|
1013
|
+
// Transform the compiled structure — replace tool schemas with prose descriptions,
|
|
987
1014
|
// expose a single "execute" tool, restructure sections, anything.
|
|
988
|
-
|
|
1015
|
+
transformCompiled(compiled, tools) {
|
|
989
1016
|
const commandList = tools
|
|
990
1017
|
.map((t) => `- ${t.metadata?.name}: ${t.metadata?.description}`)
|
|
991
1018
|
.join("\n");
|
|
@@ -1031,7 +1058,7 @@ All methods are optional. Omitted methods use default behavior.
|
|
|
1031
1058
|
|
|
1032
1059
|
| Hook | Purpose | Timing |
|
|
1033
1060
|
| ------------------- | --------------------------------------------------- | ------------- |
|
|
1034
|
-
| `
|
|
1061
|
+
| `transformCompiled` | Transform compiled context before the model sees it | Per tick |
|
|
1035
1062
|
| `executeToolCall` | Intercept, transform, or replace tool execution | Per tool call |
|
|
1036
1063
|
| `onSessionInit` | Set up per-session resources (sandbox, workspace) | Once |
|
|
1037
1064
|
| `onPersist` | Add runner state to session snapshot | Per save |
|