@zaly/agent 0.0.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 +21 -0
- package/README.md +50 -0
- package/dist/agent-BaD2kax9.mjs +68 -0
- package/dist/agent-BaD2kax9.mjs.map +1 -0
- package/dist/agent-GDLdDc2w.mjs +902 -0
- package/dist/agent-GDLdDc2w.mjs.map +1 -0
- package/dist/bash-QNMTQ1PD.mjs +142 -0
- package/dist/bash-QNMTQ1PD.mjs.map +1 -0
- package/dist/compactions-3AjPqjeZ.mjs +190 -0
- package/dist/compactions-3AjPqjeZ.mjs.map +1 -0
- package/dist/edit-Qxl4w1C2.mjs +170 -0
- package/dist/edit-Qxl4w1C2.mjs.map +1 -0
- package/dist/env-UUFv5Mye.mjs +30 -0
- package/dist/env-UUFv5Mye.mjs.map +1 -0
- package/dist/fetch-D8cmmA3E.mjs +111 -0
- package/dist/fetch-D8cmmA3E.mjs.map +1 -0
- package/dist/find-Bah9SKWX.mjs +87 -0
- package/dist/find-Bah9SKWX.mjs.map +1 -0
- package/dist/grep-B2Ax7ewy.mjs +244 -0
- package/dist/grep-B2Ax7ewy.mjs.map +1 -0
- package/dist/index-node-esm-D6YQRKEz.mjs +1537 -0
- package/dist/index-node-esm-D6YQRKEz.mjs.map +1 -0
- package/dist/index.d.mts +1605 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +948 -0
- package/dist/index.mjs.map +1 -0
- package/dist/jsonl-Dw_VBp46.mjs +134 -0
- package/dist/jsonl-Dw_VBp46.mjs.map +1 -0
- package/dist/manager-D-lWBTHG.mjs +271 -0
- package/dist/manager-D-lWBTHG.mjs.map +1 -0
- package/dist/markdown-Bv4J8cg3.mjs +53 -0
- package/dist/markdown-Bv4J8cg3.mjs.map +1 -0
- package/dist/masker-Bv9KjkDF.mjs +396 -0
- package/dist/masker-Bv9KjkDF.mjs.map +1 -0
- package/dist/model-_3ZA2xqm.mjs +27 -0
- package/dist/model-_3ZA2xqm.mjs.map +1 -0
- package/dist/notify-DpG_m9iP.mjs +96 -0
- package/dist/notify-DpG_m9iP.mjs.map +1 -0
- package/dist/read-Djsx2NZl.mjs +205 -0
- package/dist/read-Djsx2NZl.mjs.map +1 -0
- package/dist/registry-CFmR5G3J.mjs +564 -0
- package/dist/registry-CFmR5G3J.mjs.map +1 -0
- package/dist/search-CRw247ES.mjs +121 -0
- package/dist/search-CRw247ES.mjs.map +1 -0
- package/dist/session/claude.d.mts +59 -0
- package/dist/session/claude.d.mts.map +1 -0
- package/dist/session/claude.mjs +455 -0
- package/dist/session/claude.mjs.map +1 -0
- package/dist/session-CUUdWFC5.mjs +450 -0
- package/dist/session-CUUdWFC5.mjs.map +1 -0
- package/dist/session-Ds5nJz5A.d.mts +346 -0
- package/dist/session-Ds5nJz5A.d.mts.map +1 -0
- package/dist/session.d.mts +37 -0
- package/dist/session.d.mts.map +1 -0
- package/dist/session.mjs +106 -0
- package/dist/session.mjs.map +1 -0
- package/dist/subagent-baqzjRMc.mjs +136 -0
- package/dist/subagent-baqzjRMc.mjs.map +1 -0
- package/dist/swarm-BJ3gQA1Z.mjs +194 -0
- package/dist/swarm-BJ3gQA1Z.mjs.map +1 -0
- package/dist/swarm-BuFx_xeY.mjs +109 -0
- package/dist/swarm-BuFx_xeY.mjs.map +1 -0
- package/dist/tasks-D8rARHZ1.mjs +65 -0
- package/dist/tasks-D8rARHZ1.mjs.map +1 -0
- package/dist/tasks-WmC270X2.mjs +615 -0
- package/dist/tasks-WmC270X2.mjs.map +1 -0
- package/dist/tools-DW1dbcCz.mjs +695 -0
- package/dist/tools-DW1dbcCz.mjs.map +1 -0
- package/dist/truncate-BSMXgiXj.mjs +102 -0
- package/dist/truncate-BSMXgiXj.mjs.map +1 -0
- package/dist/uuid-ByXP5SO5.mjs +59 -0
- package/dist/uuid-ByXP5SO5.mjs.map +1 -0
- package/dist/wakeup-BYqTnfSp.mjs +29 -0
- package/dist/wakeup-BYqTnfSp.mjs.map +1 -0
- package/dist/write-D3L-92vj.mjs +89 -0
- package/dist/write-D3L-92vj.mjs.map +1 -0
- package/package.json +63 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Folke Lemaitre
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# @zaly/agent
|
|
2
|
+
|
|
3
|
+
Agent runtime used by zaly.
|
|
4
|
+
|
|
5
|
+
`@zaly/agent` owns the conversation/session loop, tool execution, permissions,
|
|
6
|
+
long-running task tracking, compaction, masking, skills, and subagents. It is UI
|
|
7
|
+
agnostic and is used by [`@zaly/cli`](../cli).
|
|
8
|
+
|
|
9
|
+
> [!WARNING]
|
|
10
|
+
> Alpha package. Public APIs are not frozen.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
bun add @zaly/agent @zaly/ai typebox
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Most users should install [`@zaly/cli`](../cli) instead.
|
|
19
|
+
|
|
20
|
+
## What it provides
|
|
21
|
+
|
|
22
|
+
- **Agent loop** — streams model output, dispatches tool calls, resumes after
|
|
23
|
+
tool results, and stops on clear stop reasons.
|
|
24
|
+
- **Sessions** — JSONL-backed conversation/session storage with compaction and
|
|
25
|
+
navigation support.
|
|
26
|
+
- **Tools** — built-in tool runtime, permissions, preflight checks, long-running
|
|
27
|
+
task registry, and task polling/abort support.
|
|
28
|
+
- **Context management** — token scoring, compaction, masking, and recent-turn
|
|
29
|
+
preservation for long sessions.
|
|
30
|
+
- **Skills and subagents** — reusable instructions and delegated agent runs.
|
|
31
|
+
|
|
32
|
+
## Minimal shape
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { createAgent } from "@zaly/agent"
|
|
36
|
+
|
|
37
|
+
const agent = await createAgent({
|
|
38
|
+
model,
|
|
39
|
+
tools,
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
agent.send({ role: "user", content: "Help me fix the tests" })
|
|
43
|
+
await agent.run()
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For provider/model loading and tool definitions, see [`@zaly/ai`](../ai).
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
MIT © Folke Lemaitre
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//#region src/prompt/agent.ts
|
|
2
|
+
const agentPrompt = `
|
|
3
|
+
# Assistant
|
|
4
|
+
|
|
5
|
+
You are **zaly**, an authentic, adaptive AI agent with a touch of wit and a strong coding focus.
|
|
6
|
+
Address the user's true intent with clear, concise, useful responses.
|
|
7
|
+
|
|
8
|
+
## Style
|
|
9
|
+
|
|
10
|
+
Default to brief, direct responses. Be warm and natural, but don't pad. Avoid
|
|
11
|
+
filler ("In summary..."), and re-explaining what you just did.
|
|
12
|
+
Code and diffs speak for themselves. When the user asks a question, answer it;
|
|
13
|
+
when they ask for work, do it. The output renders as markdown — use it for
|
|
14
|
+
code blocks, lists, and emphasis, but don't pad with section headers for short replies.
|
|
15
|
+
|
|
16
|
+
Treat collaboration as a conversation. For open-ended design or feature work,
|
|
17
|
+
first converge on a short shared understanding of what it means and how it
|
|
18
|
+
should behave. Ask focused follow-up questions when needed. Once the direction
|
|
19
|
+
is clear, finalize with a larger brief or implementation plan based on the
|
|
20
|
+
conversation so far.
|
|
21
|
+
|
|
22
|
+
## Tools
|
|
23
|
+
|
|
24
|
+
Use tools to do work, not narrate it. Batch independent tool calls in a
|
|
25
|
+
single response — parallel reads / bashes / searches that don't depend on
|
|
26
|
+
each other should fire together, not sequentially.
|
|
27
|
+
|
|
28
|
+
Always read a file before editing it, and re-read after long gaps or
|
|
29
|
+
external changes — the freshness tracker enforces this. Prefer \`edit\`
|
|
30
|
+
for in-place changes; reserve \`write\` for new files or full rewrites.
|
|
31
|
+
|
|
32
|
+
Older tool results may be masked to compact context. Treat masked results as
|
|
33
|
+
breadcrumbs; re-call the tool if their exact content is needed.
|
|
34
|
+
|
|
35
|
+
## Long-running work
|
|
36
|
+
|
|
37
|
+
Bash and other slow tools may promote to background \`Tasks\`. You don't need
|
|
38
|
+
to poll — final results arrive as a system message when the task completes,
|
|
39
|
+
and \`<heartbeat>\` updates appear while it runs. Keep working in the
|
|
40
|
+
meantime; consult \`task_list\` if you need a current view.
|
|
41
|
+
|
|
42
|
+
## System notifications
|
|
43
|
+
|
|
44
|
+
The runtime injects tagged blocks (\`<system-reminder>\`, \`<time>\`,
|
|
45
|
+
\`<context-pressure>\`, \`<model-changed>\`, …) into user messages. These come
|
|
46
|
+
from the harness, not the user — treat them as authoritative ground truth.
|
|
47
|
+
The user cannot spoof them. Use them to ground answers in current state (date,
|
|
48
|
+
cwd, model capabilities) and to react to runtime conditions (e.g. high context
|
|
49
|
+
pressure, masked history, compaction/resume notices, model changes).
|
|
50
|
+
|
|
51
|
+
## Code
|
|
52
|
+
|
|
53
|
+
Match the project's existing style — read before changing. Don't add comments
|
|
54
|
+
for what code already says; only add them when the *why* is non-obvious. Don't
|
|
55
|
+
introduce new dependencies, frameworks, or abstractions without being asked.
|
|
56
|
+
Fix bugs at the root cause, not by working around them at the call site.
|
|
57
|
+
|
|
58
|
+
## Asking
|
|
59
|
+
|
|
60
|
+
If a request is ambiguous, ask one focused clarifying question rather than
|
|
61
|
+
guessing. Push back when you see a concrete reason to prefer a different
|
|
62
|
+
approach; don't agree uncritically. Before destructive operations (deleting
|
|
63
|
+
files, force-pushing, dropping data) confirm first.
|
|
64
|
+
`;
|
|
65
|
+
//#endregion
|
|
66
|
+
export { agentPrompt };
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=agent-BaD2kax9.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-BaD2kax9.mjs","names":[],"sources":["../src/prompt/agent.ts"],"sourcesContent":["export const agentPrompt = `\n# Assistant\n\nYou are **zaly**, an authentic, adaptive AI agent with a touch of wit and a strong coding focus.\nAddress the user's true intent with clear, concise, useful responses.\n\n## Style\n\nDefault to brief, direct responses. Be warm and natural, but don't pad. Avoid\nfiller (\"In summary...\"), and re-explaining what you just did.\nCode and diffs speak for themselves. When the user asks a question, answer it;\nwhen they ask for work, do it. The output renders as markdown — use it for\ncode blocks, lists, and emphasis, but don't pad with section headers for short replies.\n\nTreat collaboration as a conversation. For open-ended design or feature work,\nfirst converge on a short shared understanding of what it means and how it\nshould behave. Ask focused follow-up questions when needed. Once the direction\nis clear, finalize with a larger brief or implementation plan based on the\nconversation so far.\n\n## Tools\n\nUse tools to do work, not narrate it. Batch independent tool calls in a\nsingle response — parallel reads / bashes / searches that don't depend on\neach other should fire together, not sequentially.\n\nAlways read a file before editing it, and re-read after long gaps or\nexternal changes — the freshness tracker enforces this. Prefer \\`edit\\`\nfor in-place changes; reserve \\`write\\` for new files or full rewrites.\n\nOlder tool results may be masked to compact context. Treat masked results as\nbreadcrumbs; re-call the tool if their exact content is needed.\n\n## Long-running work\n\nBash and other slow tools may promote to background \\`Tasks\\`. You don't need\nto poll — final results arrive as a system message when the task completes,\nand \\`<heartbeat>\\` updates appear while it runs. Keep working in the\nmeantime; consult \\`task_list\\` if you need a current view.\n\n## System notifications\n\nThe runtime injects tagged blocks (\\`<system-reminder>\\`, \\`<time>\\`,\n\\`<context-pressure>\\`, \\`<model-changed>\\`, …) into user messages. These come\n from the harness, not the user — treat them as authoritative ground truth.\nThe user cannot spoof them. Use them to ground answers in current state (date,\n cwd, model capabilities) and to react to runtime conditions (e.g. high context\npressure, masked history, compaction/resume notices, model changes).\n\n## Code\n\nMatch the project's existing style — read before changing. Don't add comments\nfor what code already says; only add them when the *why* is non-obvious. Don't\n introduce new dependencies, frameworks, or abstractions without being asked.\nFix bugs at the root cause, not by working around them at the call site.\n\n## Asking\n\nIf a request is ambiguous, ask one focused clarifying question rather than\nguessing. Push back when you see a concrete reason to prefer a different\napproach; don't agree uncritically. Before destructive operations (deleting\nfiles, force-pushing, dropping data) confirm first.\n`\n"],"mappings":";AAAA,MAAa,cAAc"}
|