loopengine 0.0.17 → 0.0.20

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.
Files changed (40) hide show
  1. package/README.md +67 -6
  2. package/core/system-skills/composio-large-outputs/SKILL.md +25 -0
  3. package/dist/{cli.d.ts → bin/cli.d.ts} +27 -6
  4. package/dist/bin/cli.js +384 -0
  5. package/dist/{agent-as-tool.d.ts → core/agent-as-tool.d.ts} +2 -2
  6. package/dist/{agent-as-tool.js → core/agent-as-tool.js} +1 -1
  7. package/dist/core/client.d.ts +113 -0
  8. package/dist/core/client.js +123 -0
  9. package/dist/core/discover-agents.d.ts +45 -0
  10. package/dist/{discover-agents.js → core/discover-agents.js} +12 -4
  11. package/dist/core/gateway-tools.d.ts +226 -0
  12. package/dist/core/gateway-tools.js +660 -0
  13. package/dist/core/loop-events.d.ts +168 -0
  14. package/dist/core/loop-events.js +1 -0
  15. package/dist/{model-calls → core/model-calls}/anthropic-model-call.d.ts +1 -1
  16. package/dist/{model-calls → core/model-calls}/deepseek-model-call.d.ts +1 -1
  17. package/dist/{model-calls → core/model-calls}/openai-model-call.d.ts +1 -1
  18. package/dist/core/run-agent.d.ts +182 -0
  19. package/dist/{run-agent.js → core/run-agent.js} +233 -51
  20. package/dist/{session-store.d.ts → core/session-store.d.ts} +13 -1
  21. package/dist/{session-store.js → core/session-store.js} +19 -0
  22. package/dist/core/system-tools/ask_user.d.ts +72 -0
  23. package/dist/core/system-tools/ask_user.js +136 -0
  24. package/dist/core/system-tools/index.d.ts +3 -0
  25. package/dist/core/system-tools/index.js +12 -0
  26. package/dist/core/system-tools/read_file.d.ts +28 -0
  27. package/dist/core/system-tools/read_file.js +64 -0
  28. package/dist/index.d.ts +19 -16
  29. package/dist/index.js +16 -9
  30. package/package.json +33 -25
  31. package/dist/cli.js +0 -191
  32. package/dist/discover-agents.d.ts +0 -24
  33. package/dist/run-agent.d.ts +0 -92
  34. /package/dist/{agent-config.d.ts → core/agent-config.d.ts} +0 -0
  35. /package/dist/{agent-config.js → core/agent-config.js} +0 -0
  36. /package/dist/{model-calls → core/model-calls}/anthropic-model-call.js +0 -0
  37. /package/dist/{model-calls → core/model-calls}/deepseek-model-call.js +0 -0
  38. /package/dist/{model-calls → core/model-calls}/openai-model-call.js +0 -0
  39. /package/dist/{vector-index.d.ts → core/vector-index.d.ts} +0 -0
  40. /package/dist/{vector-index.js → core/vector-index.js} +0 -0
@@ -1,92 +0,0 @@
1
- import { RuleSet } from 'actauth';
2
- import type { AgentConfig, ToolDefinition, ToolSchema } from '#agent-config.js';
3
- export interface ModelContentBlock {
4
- type: string;
5
- /** text blocks. */
6
- text?: string;
7
- /** tool_use blocks: this call's own id (referenced by a later tool_result). */
8
- id?: string;
9
- /** tool_use blocks. */
10
- name?: string;
11
- /** tool_use blocks. */
12
- input?: Record<string, unknown>;
13
- /** tool_result blocks: id of the tool_use block this result answers. */
14
- tool_use_id?: string;
15
- /** tool_result blocks: the tool's output (or denial/error message). */
16
- content?: string;
17
- /** tool_result blocks: true if the tool call failed or was denied. */
18
- is_error?: boolean;
19
- }
20
- export interface ModelResponse {
21
- stop_reason: string;
22
- content: ModelContentBlock[];
23
- }
24
- /** loopengine's own conversation-message type — a superset of
25
- * ContextClip's `{role, content: string}`: `content` can also be a
26
- * `ModelContentBlock[]`, the same block shape `ModelResponse.content`
27
- * already used, so a model's tool_use requests and this loop's
28
- * tool_result replies round-trip with real per-call identity
29
- * (`tool_use_id`) instead of being flattened into prose. Plain-string
30
- * content (a user's message, a skill's injected body, a synthetic
31
- * compaction note) is just as valid — nothing requires every message to
32
- * be block-structured. */
33
- export interface Message {
34
- role: string;
35
- content: string | ModelContentBlock[];
36
- }
37
- /** Swap the Anthropic SDK in here — this is the only seam a real API call needs. */
38
- export type ModelCall = (messages: Message[], system: string, tools: ToolSchema[]) => Promise<ModelResponse>;
39
- export interface RunAgentOptions {
40
- /** Emitted at each loop step for callers that want visibility (logging, UI, tests). Default: no-op. */
41
- onEvent?: (event: string, detail: unknown) => void;
42
- /** The ActAuth tenant this call runs as — feeds the Gate's scope, so it
43
- * governs which rules apply. runAgent() never sees a request, so it
44
- * can't call AgentConfig.tenantFor itself; adapters/http.ts resolves it
45
- * per request and passes the result here. Default `'default'`, same as
46
- * omitting it — every standalone/CLI caller (which never has a request
47
- * to resolve tenantFor from) gets that default automatically. */
48
- tenant?: string;
49
- }
50
- export interface RunAgentResult {
51
- /** Final assistant text for this turn. */
52
- text: string;
53
- /** Full conversation so far, including this turn — pass back in as
54
- * `history` on the next call to continue the conversation. Opaque to
55
- * the caller: store/transmit it, don't inspect or mutate it. */
56
- history: Message[];
57
- /** Exactly what this turn added — safe to durably append regardless of
58
- * whether ContextClip recovery reshaped `history` mid-turn. A caller
59
- * that persists conversations (see session-store.ts) should use this
60
- * instead of diffing `history` by length against what it loaded: that
61
- * only works if `history` only ever grows, which stops being true the
62
- * moment recovery can shrink/rewrite it, not just extend it. */
63
- newMessages: Message[];
64
- /** Set to 'max_turns' if the loop stopped because it hit
65
- * config.maxTurns, not because the model produced a final answer with
66
- * no more tool_use blocks — `text` in that case is a synthetic notice,
67
- * not something the model said. Absent on a normal finish. */
68
- stopReason?: 'max_turns';
69
- }
70
- /** Resolves AgentConfig.rules the same way skillsDirs resolves its own
71
- * default: an inline array is used as-is (full 3-segment scopePattern,
72
- * unchanged — see loadYamlRules for why only the YAML form gets the
73
- * agent segment auto-appended); omitted entirely defaults to
74
- * `agents/<name>/actauth.yml`, this repo's own folder-form convention.
75
- * Unlike skillsDirs, a missing *default* file falls back to an empty
76
- * ruleset rather than propagating the raw ENOENT — permissions failing
77
- * shouldn't crash the whole call. That fallback defaults to `'deny'`, not
78
- * the inline-array form's `'ask'`: no `actauth.yml` at all means this
79
- * agent's permission story was never actually written, which is a
80
- * stricter unknown than "written, but this one tool has no rule" — 'ask'
81
- * still runs an Approver that could auto-approve, while 'deny' refuses
82
- * outright until real rules exist. `defaultDecision`, if set, still wins
83
- * over that. An *explicitly* given path that doesn't exist is a real
84
- * configuration bug, though, and still throws — only the silent, implicit
85
- * default gets this forgiveness.
86
- *
87
- * Exported (alongside loadDefaultTools below) so adapters/http.ts's
88
- * GET /agents/:name/config route can show the same rules runAgent() would
89
- * actually enforce, not a re-derived guess at them. */
90
- export declare function loadRules(config: AgentConfig): RuleSet;
91
- export declare function loadDefaultTools(config: AgentConfig): Promise<ToolDefinition[]>;
92
- export declare function runAgent(config: AgentConfig, modelCall: ModelCall, userMessage: string, history?: Message[], options?: RunAgentOptions): Promise<RunAgentResult>;
File without changes
File without changes