@tomradex/agent 0.0.0-stage → 0.15.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/LICENSE ADDED
@@ -0,0 +1,204 @@
1
+ Copyright 2026 Haoyuan Tang
2
+
3
+
4
+ Apache License
5
+ Version 2.0, January 2004
6
+ http://www.apache.org/licenses/
7
+
8
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
9
+
10
+ 1. Definitions.
11
+
12
+ "License" shall mean the terms and conditions for use, reproduction,
13
+ and distribution as defined by Sections 1 through 9 of this document.
14
+
15
+ "Licensor" shall mean the copyright owner or entity authorized by
16
+ the copyright owner that is granting the License.
17
+
18
+ "Legal Entity" shall mean the union of the acting entity and all
19
+ other entities that control, are controlled by, or are under common
20
+ control with that entity. For the purposes of this definition,
21
+ "control" means (i) the power, direct or indirect, to cause the
22
+ direction or management of such entity, whether by contract or
23
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
24
+ outstanding shares, or (iii) beneficial ownership of such entity.
25
+
26
+ "You" (or "Your") shall mean an individual or Legal Entity
27
+ exercising permissions granted by this License.
28
+
29
+ "Source" form shall mean the preferred form for making modifications,
30
+ including but not limited to software source code, documentation
31
+ source, and configuration files.
32
+
33
+ "Object" form shall mean any form resulting from mechanical
34
+ transformation or translation of a Source form, including but
35
+ not limited to compiled object code, generated documentation,
36
+ and conversions to other media types.
37
+
38
+ "Work" shall mean the work of authorship, whether in Source or
39
+ Object form, made available under the License, as indicated by a
40
+ copyright notice that is included in or attached to the work
41
+ (an example is provided in the Appendix below).
42
+
43
+ "Derivative Works" shall mean any work, whether in Source or Object
44
+ form, that is based on (or derived from) the Work and for which the
45
+ editorial revisions, annotations, elaborations, or other modifications
46
+ represent, as a whole, an original work of authorship. For the purposes
47
+ of this License, Derivative Works shall not include works that remain
48
+ separable from, or merely link (or bind by name) to the interfaces of,
49
+ the Work and Derivative Works thereof.
50
+
51
+ "Contribution" shall mean any work of authorship, including
52
+ the original version of the Work and any modifications or additions
53
+ to that Work or Derivative Works thereof, that is intentionally
54
+ submitted to Licensor for inclusion in the Work by the copyright owner
55
+ or by an individual or Legal Entity authorized to submit on behalf of
56
+ the copyright owner. For the purposes of this definition, "submitted"
57
+ means any form of electronic, verbal, or written communication sent
58
+ to the Licensor or its representatives, including but not limited to
59
+ communication on electronic mailing lists, source code control systems,
60
+ and issue tracking systems that are managed by, or on behalf of, the
61
+ Licensor for the purpose of discussing and improving the Work, but
62
+ excluding communication that is conspicuously marked or otherwise
63
+ designated in writing by the copyright owner as "Not a Contribution."
64
+
65
+ "Contributor" shall mean Licensor and any individual or Legal Entity
66
+ on behalf of whom a Contribution has been received by Licensor and
67
+ subsequently incorporated within the Work.
68
+
69
+ 2. Grant of Copyright License. Subject to the terms and conditions of
70
+ this License, each Contributor hereby grants to You a perpetual,
71
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
72
+ copyright license to reproduce, prepare Derivative Works of,
73
+ publicly display, publicly perform, sublicense, and distribute the
74
+ Work and such Derivative Works in Source or Object form.
75
+
76
+ 3. Grant of Patent License. Subject to the terms and conditions of
77
+ this License, each Contributor hereby grants to You a perpetual,
78
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
79
+ (except as stated in this section) patent license to make, have made,
80
+ use, offer to sell, sell, import, and otherwise transfer the Work,
81
+ where such license applies only to those patent claims licensable
82
+ by such Contributor that are necessarily infringed by their
83
+ Contribution(s) alone or by combination of their Contribution(s)
84
+ with the Work to which such Contribution(s) was submitted. If You
85
+ institute patent litigation against any entity (including a
86
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
87
+ or a Contribution incorporated within the Work constitutes direct
88
+ or contributory patent infringement, then any patent licenses
89
+ granted to You under this License for that Work shall terminate
90
+ as of the date such litigation is filed.
91
+
92
+ 4. Redistribution. You may reproduce and distribute copies of the
93
+ Work or Derivative Works thereof in any medium, with or without
94
+ modifications, and in Source or Object form, provided that You
95
+ meet the following conditions:
96
+
97
+ (a) You must give any other recipients of the Work or
98
+ Derivative Works a copy of this License; and
99
+
100
+ (b) You must cause any modified files to carry prominent notices
101
+ stating that You changed the files; and
102
+
103
+ (c) You must retain, in the Source form of any Derivative Works
104
+ that You distribute, all copyright, patent, trademark, and
105
+ attribution notices from the Source form of the Work,
106
+ excluding those notices that do not pertain to any part of
107
+ the Derivative Works; and
108
+
109
+ (d) If the Work includes a "NOTICE" text file as part of its
110
+ distribution, then any Derivative Works that You distribute must
111
+ include a readable copy of the attribution notices contained
112
+ within such NOTICE file, excluding those notices that do not
113
+ pertain to any part of the Derivative Works, in at least one
114
+ of the following places: within a NOTICE text file distributed
115
+ as part of the Derivative Works; within the Source form or
116
+ documentation, if provided along with the Derivative Works; or,
117
+ within a display generated by the Derivative Works, if and
118
+ wherever such third-party notices normally appear. The contents
119
+ of the NOTICE file are for informational purposes only and
120
+ do not modify the License. You may add Your own attribution
121
+ notices within Derivative Works that You distribute, alongside
122
+ or as an addendum to the NOTICE text from the Work, provided
123
+ that such additional attribution notices cannot be construed
124
+ as modifying the License.
125
+
126
+ You may add Your own copyright statement to Your modifications and
127
+ may provide additional or different license terms and conditions
128
+ for use, reproduction, or distribution of Your modifications, or
129
+ for any such Derivative Works as a whole, provided Your use,
130
+ reproduction, and distribution of the Work otherwise complies with
131
+ the conditions stated in this License.
132
+
133
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
134
+ any Contribution intentionally submitted for inclusion in the Work
135
+ by You to the Licensor shall be under the terms and conditions of
136
+ this License, without any additional terms or conditions.
137
+ Notwithstanding the above, nothing herein shall supersede or modify
138
+ the terms of any separate license agreement you may have executed
139
+ with Licensor regarding such Contributions.
140
+
141
+ 6. Trademarks. This License does not grant permission to use the trade
142
+ names, trademarks, service marks, or product names of the Licensor,
143
+ except as required for reasonable and customary use in describing the
144
+ origin of the Work and reproducing the content of the NOTICE file.
145
+
146
+ 7. Disclaimer of Warranty. Unless required by applicable law or
147
+ agreed to in writing, Licensor provides the Work (and each
148
+ Contributor provides its Contributions) on an "AS IS" BASIS,
149
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
150
+ implied, including, without limitation, any warranties or conditions
151
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
152
+ PARTICULAR PURPOSE. You are solely responsible for determining the
153
+ appropriateness of using or redistributing the Work and assume any
154
+ risks associated with Your exercise of permissions under this License.
155
+
156
+ 8. Limitation of Liability. In no event and under no legal theory,
157
+ whether in tort (including negligence), contract, or otherwise,
158
+ unless required by applicable law (such as deliberate and grossly
159
+ negligent acts) or agreed to in writing, shall any Contributor be
160
+ liable to You for damages, including any direct, indirect, special,
161
+ incidental, or consequential damages of any character arising as a
162
+ result of this License or out of the use or inability to use the
163
+ Work (including but not limited to damages for loss of goodwill,
164
+ work stoppage, computer failure or malfunction, or any and all
165
+ other commercial damages or losses), even if such Contributor
166
+ has been advised of the possibility of such damages.
167
+
168
+ 9. Accepting Warranty or Additional Liability. While redistributing
169
+ the Work or Derivative Works thereof, You may choose to offer,
170
+ and charge a fee for, acceptance of support, warranty, indemnity,
171
+ or other liability obligations and/or rights consistent with this
172
+ License. However, in accepting such obligations, You may act only
173
+ on Your own behalf and on Your sole responsibility, not on behalf
174
+ of any other Contributor, and only if You agree to indemnify,
175
+ defend, and hold each Contributor harmless for any liability
176
+ incurred by, or claims asserted against, such Contributor by reason
177
+ of your accepting any such warranty or additional liability.
178
+
179
+ END OF TERMS AND CONDITIONS
180
+
181
+ APPENDIX: How to apply the Apache License to your work.
182
+
183
+ To apply the Apache License to your work, attach the following
184
+ boilerplate notice, with the fields enclosed by brackets "[]"
185
+ replaced with your own identifying information. (Don't include
186
+ the brackets!) The text should be enclosed in the appropriate
187
+ comment syntax for the file format. We also recommend that a
188
+ file or class name and description of purpose be included on the
189
+ same "printed page" as the copyright notice for easier
190
+ identification within third-party archives.
191
+
192
+ Copyright [yyyy] [name of copyright owner]
193
+
194
+ Licensed under the Apache License, Version 2.0 (the "License");
195
+ you may not use this file except in compliance with the License.
196
+ You may obtain a copy of the License at
197
+
198
+ http://www.apache.org/licenses/LICENSE-2.0
199
+
200
+ Unless required by applicable law or agreed to in writing, software
201
+ distributed under the License is distributed on an "AS IS" BASIS,
202
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
203
+ See the License for the specific language governing permissions and
204
+ limitations under the License.
@@ -0,0 +1,108 @@
1
+ import type { Block, Engine, TurnInput, TurnIO, TurnResult } from "./types.js";
2
+ /** Provider counters stay separate: cached tokens are context, not free input. */
3
+ export interface TurnMetrics {
4
+ transport: "sdk" | "app-server" | "rpc" | "acp" | "http";
5
+ runtime: "cold" | "warm";
6
+ readyMs?: number;
7
+ firstTokenMs?: number;
8
+ /** Unknown provider fields must remain absent, never fabricated as zero. */
9
+ cacheReadTokens?: number;
10
+ cacheWriteTokens?: number;
11
+ uncachedInputTokens?: number;
12
+ compactions?: number;
13
+ providerModel?: string;
14
+ toolCalls?: number;
15
+ }
16
+ export interface EvaluationObservation {
17
+ caseId: string;
18
+ repetition: number;
19
+ variant: "baseline" | "candidate";
20
+ turn: number;
21
+ engine: string;
22
+ elapsedMs: number;
23
+ firstVisibleTextMs: number | null;
24
+ /** Strict TTFT: only streamed text deltas count, final messages do not. */
25
+ firstTokenMs: number | null;
26
+ toolCalls: number;
27
+ toolFailures: number;
28
+ stop: TurnResult["stop"];
29
+ success: boolean;
30
+ checks: Record<string, boolean>;
31
+ inputTokens: number | null;
32
+ outputTokens: number | null;
33
+ cacheReadTokens: number | null;
34
+ cacheWriteTokens: number | null;
35
+ costUsd: number | null;
36
+ metrics?: TurnMetrics;
37
+ error?: string;
38
+ text: string;
39
+ }
40
+ /** Runs the production adapter with its real IO; the caller supplies isolated state. */
41
+ export declare function evaluateTurn(args: {
42
+ engine: Engine;
43
+ input: TurnInput;
44
+ io: TurnIO;
45
+ caseId: string;
46
+ repetition: number;
47
+ variant: EvaluationObservation["variant"];
48
+ turn: number;
49
+ check: (result: TurnResult, blocks: Block[]) => Record<string, boolean> | Promise<Record<string, boolean>>;
50
+ }): Promise<{
51
+ result: TurnResult;
52
+ observation: EvaluationObservation;
53
+ }>;
54
+ export declare function summarizeEvaluation(rows: EvaluationObservation[]): {
55
+ variant: string;
56
+ runtime: string;
57
+ samples: number;
58
+ successRate: number | null;
59
+ firstTokenMs: {
60
+ samples: number;
61
+ p50: number | null;
62
+ p95: number | null;
63
+ total: number | null;
64
+ };
65
+ firstVisibleTextMs: {
66
+ samples: number;
67
+ p50: number | null;
68
+ p95: number | null;
69
+ total: number | null;
70
+ };
71
+ elapsedMs: {
72
+ samples: number;
73
+ p50: number | null;
74
+ p95: number | null;
75
+ total: number | null;
76
+ };
77
+ toolCalls: {
78
+ samples: number;
79
+ p50: number | null;
80
+ p95: number | null;
81
+ total: number | null;
82
+ };
83
+ outputTokens: {
84
+ samples: number;
85
+ p50: number | null;
86
+ p95: number | null;
87
+ total: number | null;
88
+ };
89
+ cacheReadTokens: {
90
+ samples: number;
91
+ p50: number | null;
92
+ p95: number | null;
93
+ total: number | null;
94
+ };
95
+ cacheWriteTokens: {
96
+ samples: number;
97
+ p50: number | null;
98
+ p95: number | null;
99
+ total: number | null;
100
+ };
101
+ costUsd: {
102
+ samples: number;
103
+ p50: number | null;
104
+ p95: number | null;
105
+ total: number | null;
106
+ };
107
+ }[];
108
+ //# sourceMappingURL=evaluation.d.ts.map
@@ -0,0 +1,16 @@
1
+ /** Folded under the error line; past this the head and the tail are what anyone reads. */
2
+ export declare const DETAILS_MAX_CHARS = 12000;
3
+ /** Keys and tokens never reach a block the person may paste into a bug report. */
4
+ export declare const redactSecrets: (text: string) => string;
5
+ /**
6
+ * A provider's error body pasted into the message ("400 {"type":"error","error":{"message":…}}")
7
+ * read as its own words; anything else comes back unchanged.
8
+ */
9
+ export declare function readableError(text: string): string;
10
+ /**
11
+ * Everything known about a failed turn, in named sections — the error with its
12
+ * fields, causes and stack, the agent's own answer, its stderr — for the
13
+ * person to read and copy. Empty sections are left out; undefined when none remain.
14
+ */
15
+ export declare function describeFailure(sections: Record<string, unknown>): string | undefined;
16
+ //# sourceMappingURL=failure.d.ts.map
@@ -0,0 +1,16 @@
1
+ export { attachedMedia, claudeMediaInput, codexMediaInput, publishNativeImage } from "./native-media.js";
2
+ export { AgentMediaStore, MAX_MEDIA_BYTES, type MediaRef, type MediaUpload, type MediaContent } from "./media.js";
3
+ export { Agent, AgentConfig, AGENT_SECTION, type AgentActivity, type AgentSettings, type EngineUsage, type UsageSummary, type GeneralPreparation, type GeneralStartOptions, type NewThreadOptions, type PlaybookRecommendation, type ThreadDetail, type ThreadOrigins, type WorkdirStatus } from "./service.js";
4
+ export { Agent as default } from "./service.js";
5
+ export { AgentStore } from "./store.js";
6
+ export { frontmatter, loadPlaybookDir, resolvePlaybook, missingPlaybookCapabilities, type PlaybookVariants } from "./playbooks.js";
7
+ export { looksRateLimited, resetTime, untilLabel } from "./limits.js";
8
+ export { describeFailure, readableError, redactSecrets, DETAILS_MAX_CHARS } from "./failure.js";
9
+ export { conversationRecap, withRecap } from "./recap.js";
10
+ export { resultLine, stepHint, stepSummary } from "./steps.js";
11
+ export { HOUSE_RULES, RULES_INSTRUCTIONS_MAX, RULES_MAX_CHARS, rulesInstructions, rulesSection, attachmentsLine, focusSuffix, generalBrief, generalOpener, generalPrompt, playbookSection, promptSections, waitsOnLine } from "./prompt.js";
12
+ export { evaluateTurn, summarizeEvaluation, type TurnMetrics, type EvaluationObservation } from "./evaluation.js";
13
+ export { NO_TOKENS, addTokens, runTokens, type TokenBreakdown } from "./tokens.js";
14
+ export { carriedKits, deferredTools, kitLines } from "./kits.js";
15
+ export { isSuspended, PANEL_SURFACES, type AgentEvent, type AgentPolicy, type AgentRequest, type AgentRequestFailure, type AgentRetry, type AgentTurnInfo, type Block, type CardAction, type CardView, type ChecklistCard, type CliAttempt, type CliHookAnswer, type CliHookCall, type CliHookEvent, type CliCheck, type EngineMcpLink, type McpLinkView, type McpProjectApproval, type CliSource, type Engine, type EngineAvailability, type EngineCapability, type EngineDiagnostics, type EngineCommands, type CommandCheck, type CommandCheckOptions, type EngineNeed, type EnginePick, type EngineView, type EngineTry, type EngineSetup, type FindingCard, type FocusRef, type FollowUpStart, type GeneralExecution, type LocalCliStatus, type OpenDependency, type ParkView, type PendingView, type Playbook, type PlaybookIndexEntry, type PlaybookSource, type RunStatus, type RunView, type Suspended, type ThreadMessage, type ThreadSummary, type ThreadSurface, type TurnEnding, type TurnInput, type TurnFollowUp, type TurnIO, type RetryState, type TurnPurpose, type TurnResult, type UserInput, type WorkflowInfo, type WorkflowIO, type WorkflowQuestion, type WorkflowSpec, type WorkflowTransition } from "./types.js";
16
+ //# sourceMappingURL=index.d.ts.map
package/dist/kits.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import type { ToolDescriptor } from "@tomradex/tools";
2
+ import type { ThreadMessage, TurnPurpose } from "./types.js";
3
+ /** Kits a conversation carries from its first request: a coding session needs its ticket's tools; the rest wait until asked for. */
4
+ export declare function carriedKits(purpose: TurnPurpose): string[];
5
+ /**
6
+ * The tools a turn's model is not offered up front: those of a kit its kind
7
+ * does not carry, unless an earlier turn of the thread already used them.
8
+ */
9
+ export declare function deferredTools(tools: ToolDescriptor[], purpose: TurnPurpose, history?: readonly ThreadMessage[]): ToolDescriptor[];
10
+ /**
11
+ * "routines — recurring tickets on a schedule (create_template, list_templates)", one per kit: what
12
+ * the model reads to know what it can load. Without names when space is short.
13
+ */
14
+ export declare function kitLines(deferred: readonly ToolDescriptor[], purposes?: Record<string, string>, opts?: {
15
+ names?: boolean;
16
+ }): string[];
17
+ //# sourceMappingURL=kits.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Usage and rate limits, read from what an engine said when it stopped. Each
3
+ * agent words it differently — Claude Code's "resets 8pm (Asia/Shanghai)", an
4
+ * API's "retry after 20:00", Codex's "try again in 2 hours" — so this reads
5
+ * the shapes they use rather than any one of them.
6
+ */
7
+ import type { LanguageTag } from "@tomradex/domain";
8
+ /** The engine stopped on a limit that lifts by itself, as far as its words say. */
9
+ export declare const looksRateLimited: (text: string | null | undefined) => boolean;
10
+ /**
11
+ * When a limit lifts, read from an engine's words; null when they do not say.
12
+ * A bare clock time is the next time it comes round — "resets 1am" said at
13
+ * 11pm is two hours away, not twenty-two hours ago.
14
+ */
15
+ export declare function resetTime(text: string | null | undefined, now?: number): number | null;
16
+ /** When a limit lifts, as the person reads it on this machine: "20:00", "tomorrow 09:00", "Oct 15 09:00". */
17
+ export declare function untilLabel(t: number, locale: LanguageTag, now?: number): string;
18
+ //# sourceMappingURL=limits.d.ts.map
@@ -0,0 +1,29 @@
1
+ export interface MediaRef {
2
+ id: string;
3
+ name: string;
4
+ mime: string;
5
+ size: number;
6
+ source?: MediaRef;
7
+ }
8
+ export interface MediaUpload {
9
+ name: string;
10
+ mime: string;
11
+ base64: string;
12
+ }
13
+ export interface MediaContent extends MediaRef {
14
+ base64: string;
15
+ }
16
+ export declare const MAX_MEDIA_BYTES: number;
17
+ /** Conversation assets survive restart independently of a user's Files library. */
18
+ export declare class AgentMediaStore {
19
+ private readonly root;
20
+ constructor(root: string);
21
+ private directory;
22
+ private entry;
23
+ add(projectId: string, threadId: string, upload: MediaUpload): MediaRef;
24
+ reference(projectId: string, threadId: string, id: string): MediaRef;
25
+ read(projectId: string, threadId: string, id: string): MediaContent;
26
+ localPath(projectId: string, threadId: string, id: string): string;
27
+ removeThread(projectId: string, threadId: string): void;
28
+ }
29
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1,28 @@
1
+ import type { TurnIO, TurnInput } from "./types.js";
2
+ export declare function attachedMedia(input: TurnInput, io: TurnIO): import("./media.js").MediaContent[];
3
+ export declare function claudeMediaInput(input: TurnInput, io: TurnIO, text: string): ({
4
+ type: "document" | "image";
5
+ source: {
6
+ type: "base64";
7
+ media_type: string;
8
+ data: string;
9
+ };
10
+ } | {
11
+ type: "text";
12
+ text: string;
13
+ })[];
14
+ export declare function codexMediaInput(input: TurnInput, io: TurnIO, text: string): ({
15
+ type: string;
16
+ url: string;
17
+ } | {
18
+ type: string;
19
+ text: string;
20
+ text_elements: never[];
21
+ })[];
22
+ /** Codex app-server imageGeneration items contain final base64 image bytes. */
23
+ export declare function publishNativeImage(item: {
24
+ type?: string;
25
+ result?: string;
26
+ status?: string;
27
+ }, io: TurnIO): void;
28
+ //# sourceMappingURL=native-media.d.ts.map
@@ -0,0 +1,25 @@
1
+ import type { Playbook, PlaybookIndexEntry, PlaybookSource } from "./types.js";
2
+ /** Missing capabilities are visible to the caller; recommendations never hide a method. */
3
+ export declare function missingPlaybookCapabilities(playbook: Pick<Playbook, "requires">, available: readonly string[]): string[];
4
+ export declare const frontmatter: (raw: string) => {
5
+ meta: Record<string, unknown>;
6
+ body: string;
7
+ };
8
+ /**
9
+ * `<dir>/<name>/SKILL.md` — the same file format Claude Code skills use.
10
+ * Frontmatter: `name` → id, `description` → the when line, plus `title` and a
11
+ * Tomrade-only `tools` list. A file that fails to parse is reported and skipped,
12
+ * never fatal — one broken playbook must not take the rest down.
13
+ */
14
+ export declare function loadPlaybookDir(dir: string, onError?: (file: string, err: unknown) => void): Playbook[];
15
+ /** Same id from several sources is a conflict, not an error: every variant is kept and one wins. */
16
+ export interface PlaybookVariants {
17
+ plugin?: Playbook;
18
+ user?: Playbook;
19
+ project?: Playbook;
20
+ }
21
+ export declare function resolvePlaybook(variants: PlaybookVariants, choice?: PlaybookSource): {
22
+ winner: Playbook;
23
+ entry: PlaybookIndexEntry;
24
+ } | null;
25
+ //# sourceMappingURL=playbooks.d.ts.map
@@ -0,0 +1,66 @@
1
+ import type { FocusRef, GeneralExecution, OpenDependency, TurnInput, TurnIO } from "./types.js";
2
+ /**
3
+ * The house rules every model-driven engine puts in its system prompt. One
4
+ * copy on the platform, so a rule changed here reaches loop and CLI engines
5
+ * alike — the two lists had already drifted apart when they were maintained
6
+ * per engine. The identity line (who you are, how tools arrive) stays with
7
+ * each engine; these are the rules about how to behave once you have them.
8
+ */
9
+ export declare const HOUSE_RULES: string;
10
+ /** The "(viewing: …)" line engines append to a user message that carried focus refs. */
11
+ export declare const focusSuffix: (refs?: FocusRef[]) => string;
12
+ /** Tickets still open that this one waits on: the agent works ahead of them and says what has to wait. */
13
+ export declare const waitsOnLine: (waitsOn: OpenDependency[] | undefined) => string;
14
+ /** Said only where a ticket's description links files, so the links read as files rather than as broken URLs. */
15
+ export declare const attachmentsLine: (body: string | null | undefined) => string;
16
+ /** What every General delivery is told, whichever engine runs it: the outcome, the protocol, the place. */
17
+ export declare function generalBrief(ticket: {
18
+ key: string;
19
+ title: string;
20
+ body?: string | null;
21
+ waitsOn?: OpenDependency[];
22
+ }, cwd: string | undefined): string;
23
+ /** The one line that starts (or resumes) a General delivery. */
24
+ /** Past this a rules file is cut, so a long one cannot crowd out the work. */
25
+ export declare const RULES_MAX_CHARS = 8000;
26
+ /** Claude Code keeps 2048 characters of a server's instructions; longer rules go by tool instead. */
27
+ export declare const RULES_INSTRUCTIONS_MAX = 1200;
28
+ /** The rules as an agent Tomrade did not start reads them when it connects over MCP. */
29
+ export declare function rulesInstructions(rules: string): string;
30
+ /** The person's rules for every agent in the project, worded the same for every engine. */
31
+ export declare const rulesSection: (rules: string) => string;
32
+ export declare const generalOpener: (ticket: {
33
+ key: string;
34
+ title: string;
35
+ }, continued: boolean) => string;
36
+ export declare const playbookSection: (playbook: GeneralExecution["playbook"]) => string;
37
+ /**
38
+ * The whole brief for a CLI agent the user runs in a terminal: it gets no
39
+ * system prompt from Tomrade, only this file and the MCP tools, so the ticket,
40
+ * the protocol and the playbook all travel in it.
41
+ */
42
+ export declare function generalPrompt(input: {
43
+ ticket: {
44
+ key: string;
45
+ title: string;
46
+ body?: string | null;
47
+ waitsOn?: OpenDependency[];
48
+ };
49
+ cwd: string;
50
+ playbook: GeneralExecution["playbook"];
51
+ continued: boolean;
52
+ filesIndex?: string;
53
+ rules?: string;
54
+ }): string;
55
+ /**
56
+ * The shared tail of a system prompt: the playbook index, the project brief,
57
+ * the durable cards, and the waiting workflow. Engines prepend their identity
58
+ * and the house rules, then join these with blank lines.
59
+ */
60
+ /** What the main conversation can do with the code, and where that code is, so a limit is named instead of mistaken for an empty folder. */
61
+ export declare function mainConversationSection(repositories: TurnInput["repositories"]): string;
62
+ export declare function promptSections(input: TurnInput, io: TurnIO, opts?: {
63
+ playbooks?: boolean;
64
+ filesIndex?: boolean;
65
+ }): string[];
66
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1,12 @@
1
+ import type { ThreadMessage } from "./types.js";
2
+ /**
3
+ * The conversation so far, for an engine that keeps its own session and is
4
+ * starting a new one on a thread that already has history: its old session is
5
+ * gone, or the thread came from another engine. The newest lines win when it is
6
+ * long. Everything after the last answer is left out: the message being answered
7
+ * now (the turn carries it), and notes or unanswered tries of it before.
8
+ */
9
+ export declare function conversationRecap(messages: ThreadMessage[]): string;
10
+ /** The recap and the turn's own prompt, in that order; the prompt alone when there is nothing to recap. */
11
+ export declare const withRecap: (recap: string | undefined, prompt: string) => string;
12
+ //# sourceMappingURL=recap.d.ts.map
@@ -0,0 +1 @@
1
+ throw new Error("@tomradex/agent is Tomrade's own code: a full-mode plugin gets the running app's copy, so load the plugin in Tomrade");