agents-dojo 0.1.8 → 0.1.9
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/dist/claude-bridge.js
CHANGED
|
@@ -5,9 +5,12 @@ import { query } from '@anthropic-ai/claude-agent-sdk';
|
|
|
5
5
|
export async function* runClaude(params) {
|
|
6
6
|
const { agent, contentBlocks, onEvent, abortController } = params;
|
|
7
7
|
const m = agent.manifest;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
// If context.md exists, use it as a custom system prompt (replaces SDK default).
|
|
9
|
+
// If not, omit systemPrompt entirely — SDK uses its built-in Claude Code prompt.
|
|
10
|
+
const hasCustomPrompt = !!agent.fixedContextContent;
|
|
11
|
+
const systemPrompt = hasCustomPrompt
|
|
12
|
+
? (m.systemPromptAppend ? `${agent.fixedContextContent}\n\n${m.systemPromptAppend}` : agent.fixedContextContent)
|
|
13
|
+
: undefined;
|
|
11
14
|
const env = {
|
|
12
15
|
// Preserve system PATH so agents can use curl, python3, node etc.
|
|
13
16
|
PATH: process.env.PATH,
|
|
@@ -31,10 +34,12 @@ export async function* runClaude(params) {
|
|
|
31
34
|
catch { /* race or permission — ignore */ }
|
|
32
35
|
}
|
|
33
36
|
const options = {
|
|
34
|
-
systemPrompt,
|
|
35
37
|
cwd: agent.agentDir,
|
|
36
38
|
env,
|
|
37
39
|
};
|
|
40
|
+
if (systemPrompt) {
|
|
41
|
+
options.systemPrompt = systemPrompt;
|
|
42
|
+
}
|
|
38
43
|
// Session continuity: resume an existing session if provided
|
|
39
44
|
if (params.resume) {
|
|
40
45
|
options.resume = params.resume;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare class ContextLoadError extends Error {
|
|
2
2
|
constructor(message: string);
|
|
3
3
|
}
|
|
4
|
-
export declare function loadContext(agentDir: string, relativePath
|
|
4
|
+
export declare function loadContext(agentDir: string, relativePath?: string): string;
|
|
5
5
|
export declare function resolveConfigDir(agentDir: string, override?: string): string;
|
package/dist/context-manager.js
CHANGED
|
@@ -8,6 +8,8 @@ export class ContextLoadError extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
export function loadContext(agentDir, relativePath) {
|
|
11
|
+
if (!relativePath)
|
|
12
|
+
return '';
|
|
11
13
|
const resolved = isAbsolute(relativePath) ? relativePath : join(agentDir, relativePath);
|
|
12
14
|
const normalized = resolve(resolved);
|
|
13
15
|
// Reject path traversal
|
|
@@ -15,9 +17,8 @@ export function loadContext(agentDir, relativePath) {
|
|
|
15
17
|
if (!normalized.startsWith(agentAbs + '/') && normalized !== agentAbs) {
|
|
16
18
|
throw new ContextLoadError(`Path "${relativePath}" escapes agent directory`);
|
|
17
19
|
}
|
|
18
|
-
if (!existsSync(normalized))
|
|
19
|
-
|
|
20
|
-
}
|
|
20
|
+
if (!existsSync(normalized))
|
|
21
|
+
return '';
|
|
21
22
|
return readFileSync(normalized, 'utf-8');
|
|
22
23
|
}
|
|
23
24
|
export function resolveConfigDir(agentDir, override) {
|
|
@@ -43,7 +43,7 @@ export declare const AgentManifestSchema: z.ZodObject<{
|
|
|
43
43
|
name: z.ZodString;
|
|
44
44
|
description: z.ZodString;
|
|
45
45
|
version: z.ZodString;
|
|
46
|
-
fixedContext: z.ZodString
|
|
46
|
+
fixedContext: z.ZodOptional<z.ZodString>;
|
|
47
47
|
systemPromptAppend: z.ZodOptional<z.ZodString>;
|
|
48
48
|
model: z.ZodOptional<z.ZodString>;
|
|
49
49
|
fallbackModel: z.ZodOptional<z.ZodString>;
|
package/dist/manifest-schema.js
CHANGED
|
@@ -28,7 +28,7 @@ export const AgentManifestSchema = z.object({
|
|
|
28
28
|
version: z
|
|
29
29
|
.string()
|
|
30
30
|
.regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?(?:\+[0-9A-Za-z-.]+)?$/, 'Must be semver'),
|
|
31
|
-
fixedContext: z.string().min(1),
|
|
31
|
+
fixedContext: z.string().min(1).optional(),
|
|
32
32
|
systemPromptAppend: z.string().optional(),
|
|
33
33
|
model: z.string().optional(),
|
|
34
34
|
fallbackModel: z.string().optional(),
|
package/dist/types.d.ts
CHANGED