@agent-relay/config 0.1.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/dist/agent-config.d.ts +47 -0
- package/dist/agent-config.d.ts.map +1 -0
- package/dist/agent-config.js +119 -0
- package/dist/agent-config.js.map +1 -0
- package/dist/bridge-config.d.ts +52 -0
- package/dist/bridge-config.d.ts.map +1 -0
- package/dist/bridge-config.js +143 -0
- package/dist/bridge-config.js.map +1 -0
- package/dist/bridge-utils.d.ts +30 -0
- package/dist/bridge-utils.d.ts.map +1 -0
- package/dist/bridge-utils.js +54 -0
- package/dist/bridge-utils.js.map +1 -0
- package/dist/cli-auth-config.d.ts +110 -0
- package/dist/cli-auth-config.d.ts.map +1 -0
- package/dist/cli-auth-config.js +391 -0
- package/dist/cli-auth-config.js.map +1 -0
- package/dist/cloud-config.d.ts +75 -0
- package/dist/cloud-config.d.ts.map +1 -0
- package/dist/cloud-config.js +109 -0
- package/dist/cloud-config.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/project-namespace.d.ts +73 -0
- package/dist/project-namespace.d.ts.map +1 -0
- package/dist/project-namespace.js +280 -0
- package/dist/project-namespace.js.map +1 -0
- package/dist/relay-config.d.ts +25 -0
- package/dist/relay-config.d.ts.map +1 -0
- package/dist/relay-config.js +25 -0
- package/dist/relay-config.js.map +1 -0
- package/dist/relay-file-writer.d.ts +200 -0
- package/dist/relay-file-writer.d.ts.map +1 -0
- package/dist/relay-file-writer.js +407 -0
- package/dist/relay-file-writer.js.map +1 -0
- package/dist/schemas.d.ts +672 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +180 -0
- package/dist/schemas.js.map +1 -0
- package/dist/shadow-config.d.ts +87 -0
- package/dist/shadow-config.d.ts.map +1 -0
- package/dist/shadow-config.js +134 -0
- package/dist/shadow-config.js.map +1 -0
- package/dist/teams-config.d.ts +47 -0
- package/dist/teams-config.d.ts.map +1 -0
- package/dist/teams-config.js +100 -0
- package/dist/teams-config.js.map +1 -0
- package/dist/trajectory-config.d.ts +102 -0
- package/dist/trajectory-config.d.ts.map +1 -0
- package/dist/trajectory-config.js +185 -0
- package/dist/trajectory-config.js.map +1 -0
- package/package.json +98 -0
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
3
|
+
const withId = (schema, id) => Object.assign(schema, { $id: id });
|
|
4
|
+
// Relay connection defaults (used by daemon + wrapper)
|
|
5
|
+
export const ConnectionConfigSchema = z.object({
|
|
6
|
+
maxFrameBytes: z.number().int().positive(),
|
|
7
|
+
heartbeatMs: z.number().int().positive(),
|
|
8
|
+
heartbeatTimeoutMultiplier: z.number().int().positive(),
|
|
9
|
+
maxWriteQueueSize: z.number().int().nonnegative(),
|
|
10
|
+
writeQueueHighWaterMark: z.number().int().nonnegative(),
|
|
11
|
+
writeQueueLowWaterMark: z.number().int().nonnegative(),
|
|
12
|
+
});
|
|
13
|
+
export const TmuxWrapperConfigSchema = z.object({
|
|
14
|
+
pollInterval: z.number().int().positive(),
|
|
15
|
+
idleBeforeInjectMs: z.number().int().nonnegative(),
|
|
16
|
+
injectRetryMs: z.number().int().nonnegative(),
|
|
17
|
+
debug: z.boolean(),
|
|
18
|
+
debugLogIntervalMs: z.number().int().nonnegative(),
|
|
19
|
+
mouseMode: z.boolean(),
|
|
20
|
+
activityIdleThresholdMs: z.number().int().nonnegative(),
|
|
21
|
+
outputStabilityTimeoutMs: z.number().int().nonnegative(),
|
|
22
|
+
outputStabilityPollMs: z.number().int().nonnegative(),
|
|
23
|
+
streamLogs: z.boolean(),
|
|
24
|
+
});
|
|
25
|
+
export const RelayRuntimeConfigSchema = z.object({
|
|
26
|
+
trajectories: z
|
|
27
|
+
.object({
|
|
28
|
+
storeInRepo: z.boolean().optional(),
|
|
29
|
+
})
|
|
30
|
+
.optional(),
|
|
31
|
+
});
|
|
32
|
+
export const BridgeConfigSchema = z.object({
|
|
33
|
+
projects: z
|
|
34
|
+
.record(z.object({
|
|
35
|
+
lead: z.string().optional(),
|
|
36
|
+
cli: z.string().optional(),
|
|
37
|
+
}))
|
|
38
|
+
.optional(),
|
|
39
|
+
defaultCli: z.string().optional(),
|
|
40
|
+
});
|
|
41
|
+
export const TeamsConfigSchema = z.object({
|
|
42
|
+
team: z.string(),
|
|
43
|
+
agents: z
|
|
44
|
+
.array(z.object({
|
|
45
|
+
name: z.string(),
|
|
46
|
+
cli: z.string(),
|
|
47
|
+
role: z.string().optional(),
|
|
48
|
+
task: z.string().optional(),
|
|
49
|
+
}))
|
|
50
|
+
.default([]),
|
|
51
|
+
autoSpawn: z.boolean().optional(),
|
|
52
|
+
});
|
|
53
|
+
export const ShadowRoleConfigSchema = z.object({
|
|
54
|
+
prompt: z.string().optional(),
|
|
55
|
+
speakOn: z.array(z.string()).default([]),
|
|
56
|
+
});
|
|
57
|
+
export const ShadowPairConfigSchema = z.object({
|
|
58
|
+
shadow: z.string(),
|
|
59
|
+
shadowRole: z.string().optional(),
|
|
60
|
+
speakOn: z.array(z.string()).optional(),
|
|
61
|
+
});
|
|
62
|
+
export const ShadowConfigSchema = z.object({
|
|
63
|
+
shadows: z
|
|
64
|
+
.object({
|
|
65
|
+
pairs: z.record(ShadowPairConfigSchema).optional(),
|
|
66
|
+
roles: z.record(ShadowRoleConfigSchema).optional(),
|
|
67
|
+
})
|
|
68
|
+
.optional(),
|
|
69
|
+
});
|
|
70
|
+
export const AgentFrontmatterSchema = z.object({
|
|
71
|
+
name: z.string().optional(),
|
|
72
|
+
model: z.string().optional(),
|
|
73
|
+
description: z.string().optional(),
|
|
74
|
+
agentType: z.string().optional(),
|
|
75
|
+
role: z.string().optional(),
|
|
76
|
+
'allowed-tools': z.string().optional(),
|
|
77
|
+
});
|
|
78
|
+
export const CLIAuthConfigSchema = z.object({
|
|
79
|
+
command: z.string(),
|
|
80
|
+
args: z.array(z.string()),
|
|
81
|
+
deviceFlowArgs: z.array(z.string()).optional(),
|
|
82
|
+
urlPattern: z.instanceof(RegExp),
|
|
83
|
+
credentialPath: z.string().optional(),
|
|
84
|
+
displayName: z.string(),
|
|
85
|
+
prompts: z
|
|
86
|
+
.array(z.object({
|
|
87
|
+
pattern: z.instanceof(RegExp),
|
|
88
|
+
response: z.string(),
|
|
89
|
+
delay: z.number().int().nonnegative().optional(),
|
|
90
|
+
description: z.string(),
|
|
91
|
+
}))
|
|
92
|
+
.default([]),
|
|
93
|
+
successPatterns: z.array(z.instanceof(RegExp)).default([]),
|
|
94
|
+
errorPatterns: z
|
|
95
|
+
.array(z.object({
|
|
96
|
+
pattern: z.instanceof(RegExp),
|
|
97
|
+
message: z.string(),
|
|
98
|
+
recoverable: z.boolean(),
|
|
99
|
+
hint: z.string().optional(),
|
|
100
|
+
}))
|
|
101
|
+
.optional(),
|
|
102
|
+
waitTimeout: z.number().int().nonnegative(),
|
|
103
|
+
supportsDeviceFlow: z.boolean().optional(),
|
|
104
|
+
});
|
|
105
|
+
export const CloudConfigSchema = z.object({
|
|
106
|
+
port: z.number().int(),
|
|
107
|
+
publicUrl: z.string(),
|
|
108
|
+
appUrl: z.string(),
|
|
109
|
+
sessionSecret: z.string(),
|
|
110
|
+
localDashboardUrl: z.string().optional(),
|
|
111
|
+
databaseUrl: z.string(),
|
|
112
|
+
redisUrl: z.string(),
|
|
113
|
+
github: z.object({
|
|
114
|
+
clientId: z.string(),
|
|
115
|
+
clientSecret: z.string(),
|
|
116
|
+
webhookSecret: z.string().optional(),
|
|
117
|
+
}),
|
|
118
|
+
providers: z
|
|
119
|
+
.object({
|
|
120
|
+
anthropic: z.object({ clientId: z.string() }).optional(),
|
|
121
|
+
openai: z.object({ clientId: z.string() }).optional(),
|
|
122
|
+
google: z
|
|
123
|
+
.object({
|
|
124
|
+
clientId: z.string(),
|
|
125
|
+
clientSecret: z.string(),
|
|
126
|
+
})
|
|
127
|
+
.optional(),
|
|
128
|
+
})
|
|
129
|
+
.default({}),
|
|
130
|
+
vault: z.object({
|
|
131
|
+
masterKey: z.string(),
|
|
132
|
+
}),
|
|
133
|
+
compute: z.object({
|
|
134
|
+
provider: z.enum(['fly', 'railway', 'docker']),
|
|
135
|
+
fly: z
|
|
136
|
+
.object({
|
|
137
|
+
apiToken: z.string(),
|
|
138
|
+
org: z.string(),
|
|
139
|
+
region: z.string().optional(),
|
|
140
|
+
workspaceDomain: z.string().optional(),
|
|
141
|
+
registryAuth: z
|
|
142
|
+
.object({
|
|
143
|
+
username: z.string(),
|
|
144
|
+
password: z.string(),
|
|
145
|
+
})
|
|
146
|
+
.optional(),
|
|
147
|
+
snapshotRetentionDays: z.number().int().optional(),
|
|
148
|
+
volumeSizeGb: z.number().int().optional(),
|
|
149
|
+
})
|
|
150
|
+
.optional(),
|
|
151
|
+
railway: z
|
|
152
|
+
.object({
|
|
153
|
+
apiToken: z.string(),
|
|
154
|
+
})
|
|
155
|
+
.optional(),
|
|
156
|
+
}),
|
|
157
|
+
nango: z.object({
|
|
158
|
+
secretKey: z.string(),
|
|
159
|
+
host: z.string().optional(),
|
|
160
|
+
}),
|
|
161
|
+
stripe: z.object({
|
|
162
|
+
secretKey: z.string(),
|
|
163
|
+
publishableKey: z.string(),
|
|
164
|
+
webhookSecret: z.string(),
|
|
165
|
+
priceIds: z.record(z.string().optional()),
|
|
166
|
+
}),
|
|
167
|
+
adminUsers: z.array(z.string()),
|
|
168
|
+
});
|
|
169
|
+
export const jsonSchemas = {
|
|
170
|
+
connection: withId(zodToJsonSchema(ConnectionConfigSchema, { target: 'jsonSchema7' }), 'RelayConnectionConfig'),
|
|
171
|
+
tmuxWrapper: withId(zodToJsonSchema(TmuxWrapperConfigSchema, { target: 'jsonSchema7' }), 'RelayTmuxWrapperConfig'),
|
|
172
|
+
relayRuntime: withId(zodToJsonSchema(RelayRuntimeConfigSchema, { target: 'jsonSchema7' }), 'RelayRuntimeConfig'),
|
|
173
|
+
bridge: withId(zodToJsonSchema(BridgeConfigSchema, { target: 'jsonSchema7' }), 'BridgeConfig'),
|
|
174
|
+
teams: withId(zodToJsonSchema(TeamsConfigSchema, { target: 'jsonSchema7' }), 'TeamsConfig'),
|
|
175
|
+
shadow: withId(zodToJsonSchema(ShadowConfigSchema, { target: 'jsonSchema7' }), 'ShadowConfig'),
|
|
176
|
+
agentFrontmatter: withId(zodToJsonSchema(AgentFrontmatterSchema, { target: 'jsonSchema7' }), 'AgentFrontmatter'),
|
|
177
|
+
cliAuth: withId(zodToJsonSchema(CLIAuthConfigSchema, { target: 'jsonSchema7' }), 'CLIAuthConfig'),
|
|
178
|
+
cloud: withId(zodToJsonSchema(CloudConfigSchema, { target: 'jsonSchema7' }), 'CloudConfig'),
|
|
179
|
+
};
|
|
180
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,MAAM,GAAG,CAAC,MAAe,EAAE,EAAU,EAAE,EAAE,CAC7C,MAAM,CAAC,MAAM,CAAC,MAAiC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;AAEhE,uDAAuD;AACvD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC1C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACxC,0BAA0B,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACvD,iBAAi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AAE,uBAAuB,CAAC;IAC/G,WAAW,EAAE,MAAM,CAAC,eAAe,CAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,EAAE,wBAAwB,CAAC;IAClH,YAAY,EAAE,MAAM,CAAC,eAAe,CAAC,wBAAwB,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,EAAE,oBAAoB,CAAC;IAChH,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC,kBAAkB,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,EAAE,cAAc,CAAC;IAC9F,KAAK,EAAE,MAAM,CAAC,eAAe,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,CAAC;IAC3F,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC,kBAAkB,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,EAAE,cAAc,CAAC;IAC9F,gBAAgB,EAAE,MAAM,CAAC,eAAe,CAAC,sBAAsB,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,EAAE,kBAAkB,CAAC;IAChH,OAAO,EAAE,MAAM,CAAC,eAAe,CAAC,mBAAmB,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,EAAE,eAAe,CAAC;IACjG,KAAK,EAAE,MAAM,CAAC,eAAe,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,CAAC;CAC5F,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shadow Agent Configuration
|
|
3
|
+
* Handles loading and parsing shadow agent configuration from .agent-relay.json.
|
|
4
|
+
*
|
|
5
|
+
* Configuration can be placed in:
|
|
6
|
+
* - Project root: ./.agent-relay.json
|
|
7
|
+
* - Agent-relay dir: ./.agent-relay/config.json
|
|
8
|
+
*
|
|
9
|
+
* Shadow configuration structure:
|
|
10
|
+
* {
|
|
11
|
+
* "shadows": {
|
|
12
|
+
* "pairs": {
|
|
13
|
+
* "Lead": { "shadow": "Auditor", "shadowRole": "reviewer" }
|
|
14
|
+
* },
|
|
15
|
+
* "roles": {
|
|
16
|
+
* "reviewer": { "prompt": "Review code...", "speakOn": ["CODE_WRITTEN"] }
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
import type { SpeakOnTrigger } from '@agent-relay/protocol/types';
|
|
22
|
+
/** Shadow role definition */
|
|
23
|
+
export interface ShadowRoleConfig {
|
|
24
|
+
/** System prompt for this shadow role */
|
|
25
|
+
prompt?: string;
|
|
26
|
+
/** Triggers for when the shadow should speak */
|
|
27
|
+
speakOn: SpeakOnTrigger[];
|
|
28
|
+
}
|
|
29
|
+
/** Shadow pair definition */
|
|
30
|
+
export interface ShadowPairConfig {
|
|
31
|
+
/** Name of the shadow agent */
|
|
32
|
+
shadow: string;
|
|
33
|
+
/** Role name (references roles config) or preset (reviewer, auditor, active) */
|
|
34
|
+
shadowRole?: string;
|
|
35
|
+
/** Override speakOn triggers (takes precedence over role) */
|
|
36
|
+
speakOn?: SpeakOnTrigger[];
|
|
37
|
+
/** CLI to use for shadow (defaults to same as primary) */
|
|
38
|
+
cli?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Shadow configuration section */
|
|
41
|
+
export interface ShadowConfig {
|
|
42
|
+
/** Primary -> Shadow mappings */
|
|
43
|
+
pairs: Record<string, ShadowPairConfig>;
|
|
44
|
+
/** Role definitions */
|
|
45
|
+
roles?: Record<string, ShadowRoleConfig>;
|
|
46
|
+
}
|
|
47
|
+
/** Full agent-relay configuration file structure */
|
|
48
|
+
export interface AgentRelayConfig {
|
|
49
|
+
/** Shadow agent configuration */
|
|
50
|
+
shadows?: ShadowConfig;
|
|
51
|
+
}
|
|
52
|
+
/** Resolved shadow config for a primary agent */
|
|
53
|
+
export interface ResolvedShadowConfig {
|
|
54
|
+
/** Shadow agent name */
|
|
55
|
+
shadowName: string;
|
|
56
|
+
/** Role name (for logging/display) */
|
|
57
|
+
roleName?: string;
|
|
58
|
+
/** Resolved speakOn triggers */
|
|
59
|
+
speakOn: SpeakOnTrigger[];
|
|
60
|
+
/** System prompt for the shadow */
|
|
61
|
+
prompt?: string;
|
|
62
|
+
/** CLI to use for shadow */
|
|
63
|
+
cli?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Load agent-relay configuration from project root
|
|
67
|
+
* Returns null if no config found
|
|
68
|
+
*/
|
|
69
|
+
export declare function loadAgentRelayConfig(projectRoot: string): AgentRelayConfig | null;
|
|
70
|
+
/**
|
|
71
|
+
* Get shadow configuration for a primary agent
|
|
72
|
+
* Returns null if no shadow configured for this agent
|
|
73
|
+
*/
|
|
74
|
+
export declare function getShadowForAgent(projectRoot: string, primaryAgentName: string): ResolvedShadowConfig | null;
|
|
75
|
+
/**
|
|
76
|
+
* Get all configured shadow pairs
|
|
77
|
+
*/
|
|
78
|
+
export declare function getAllShadowPairs(projectRoot: string): Map<string, ResolvedShadowConfig>;
|
|
79
|
+
/**
|
|
80
|
+
* Check if shadow config exists
|
|
81
|
+
*/
|
|
82
|
+
export declare function hasShadowConfig(projectRoot: string): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Get the config file path that would be used
|
|
85
|
+
*/
|
|
86
|
+
export declare function getConfigPath(projectRoot: string): string | null;
|
|
87
|
+
//# sourceMappingURL=shadow-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadow-config.d.ts","sourceRoot":"","sources":["../src/shadow-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,6BAA6B;AAC7B,MAAM,WAAW,gBAAgB;IAC/B,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,OAAO,EAAE,cAAc,E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C,WAAW,EAAE,MAAM,GAAG,OAAO,CAG5D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQhE"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shadow Agent Configuration
|
|
3
|
+
* Handles loading and parsing shadow agent configuration from .agent-relay.json.
|
|
4
|
+
*
|
|
5
|
+
* Configuration can be placed in:
|
|
6
|
+
* - Project root: ./.agent-relay.json
|
|
7
|
+
* - Agent-relay dir: ./.agent-relay/config.json
|
|
8
|
+
*
|
|
9
|
+
* Shadow configuration structure:
|
|
10
|
+
* {
|
|
11
|
+
* "shadows": {
|
|
12
|
+
* "pairs": {
|
|
13
|
+
* "Lead": { "shadow": "Auditor", "shadowRole": "reviewer" }
|
|
14
|
+
* },
|
|
15
|
+
* "roles": {
|
|
16
|
+
* "reviewer": { "prompt": "Review code...", "speakOn": ["CODE_WRITTEN"] }
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
import fs from 'node:fs';
|
|
22
|
+
import path from 'node:path';
|
|
23
|
+
/** Role presets matching CLI behavior */
|
|
24
|
+
const ROLE_PRESETS = {
|
|
25
|
+
reviewer: ['CODE_WRITTEN', 'REVIEW_REQUEST', 'EXPLICIT_ASK'],
|
|
26
|
+
auditor: ['SESSION_END', 'EXPLICIT_ASK'],
|
|
27
|
+
active: ['ALL_MESSAGES'],
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Possible locations for .agent-relay.json (in order of precedence)
|
|
31
|
+
*/
|
|
32
|
+
function getConfigPaths(projectRoot) {
|
|
33
|
+
return [
|
|
34
|
+
path.join(projectRoot, '.agent-relay', 'config.json'),
|
|
35
|
+
path.join(projectRoot, '.agent-relay.json'),
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Load agent-relay configuration from project root
|
|
40
|
+
* Returns null if no config found
|
|
41
|
+
*/
|
|
42
|
+
export function loadAgentRelayConfig(projectRoot) {
|
|
43
|
+
const configPaths = getConfigPaths(projectRoot);
|
|
44
|
+
for (const configPath of configPaths) {
|
|
45
|
+
if (fs.existsSync(configPath)) {
|
|
46
|
+
try {
|
|
47
|
+
const content = fs.readFileSync(configPath, 'utf-8');
|
|
48
|
+
const config = JSON.parse(content);
|
|
49
|
+
console.log(`[shadow-config] Loaded config from ${configPath}`);
|
|
50
|
+
return config;
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
console.error(`[shadow-config] Failed to parse ${configPath}:`, err);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get shadow configuration for a primary agent
|
|
61
|
+
* Returns null if no shadow configured for this agent
|
|
62
|
+
*/
|
|
63
|
+
export function getShadowForAgent(projectRoot, primaryAgentName) {
|
|
64
|
+
const config = loadAgentRelayConfig(projectRoot);
|
|
65
|
+
if (!config?.shadows?.pairs) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const pairConfig = config.shadows.pairs[primaryAgentName];
|
|
69
|
+
if (!pairConfig) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
// Resolve speakOn triggers
|
|
73
|
+
let speakOn = ['EXPLICIT_ASK']; // Default
|
|
74
|
+
let prompt;
|
|
75
|
+
const roleName = pairConfig.shadowRole;
|
|
76
|
+
// First, try to resolve from role preset
|
|
77
|
+
if (roleName && ROLE_PRESETS[roleName.toLowerCase()]) {
|
|
78
|
+
speakOn = ROLE_PRESETS[roleName.toLowerCase()];
|
|
79
|
+
}
|
|
80
|
+
// Then, try custom role from config
|
|
81
|
+
if (roleName && config.shadows.roles?.[roleName]) {
|
|
82
|
+
const roleConfig = config.shadows.roles[roleName];
|
|
83
|
+
speakOn = roleConfig.speakOn;
|
|
84
|
+
prompt = roleConfig.prompt;
|
|
85
|
+
}
|
|
86
|
+
// Finally, override with explicit speakOn if provided
|
|
87
|
+
if (pairConfig.speakOn && pairConfig.speakOn.length > 0) {
|
|
88
|
+
speakOn = pairConfig.speakOn;
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
shadowName: pairConfig.shadow,
|
|
92
|
+
roleName,
|
|
93
|
+
speakOn,
|
|
94
|
+
prompt,
|
|
95
|
+
cli: pairConfig.cli,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get all configured shadow pairs
|
|
100
|
+
*/
|
|
101
|
+
export function getAllShadowPairs(projectRoot) {
|
|
102
|
+
const config = loadAgentRelayConfig(projectRoot);
|
|
103
|
+
const result = new Map();
|
|
104
|
+
if (!config?.shadows?.pairs) {
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
for (const primaryName of Object.keys(config.shadows.pairs)) {
|
|
108
|
+
const resolved = getShadowForAgent(projectRoot, primaryName);
|
|
109
|
+
if (resolved) {
|
|
110
|
+
result.set(primaryName, resolved);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Check if shadow config exists
|
|
117
|
+
*/
|
|
118
|
+
export function hasShadowConfig(projectRoot) {
|
|
119
|
+
const config = loadAgentRelayConfig(projectRoot);
|
|
120
|
+
return !!(config?.shadows?.pairs && Object.keys(config.shadows.pairs).length > 0);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Get the config file path that would be used
|
|
124
|
+
*/
|
|
125
|
+
export function getConfigPath(projectRoot) {
|
|
126
|
+
const configPaths = getConfigPaths(projectRoot);
|
|
127
|
+
for (const configPath of configPaths) {
|
|
128
|
+
if (fs.existsSync(configPath)) {
|
|
129
|
+
return configPath;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=shadow-config.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C;AACd,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Teams Configuration
|
|
3
|
+
* Handles loading and parsing teams.json for auto-spawn and agent validation.
|
|
4
|
+
*
|
|
5
|
+
* teams.json can be placed in:
|
|
6
|
+
* - Project root: ./teams.json
|
|
7
|
+
* - Agent-relay dir: ./.agent-relay/teams.json
|
|
8
|
+
*/
|
|
9
|
+
/** Agent definition in teams.json */
|
|
10
|
+
export interface TeamAgentConfig {
|
|
11
|
+
/** Agent name (used for spawn and validation) */
|
|
12
|
+
name: string;
|
|
13
|
+
/** CLI command to use (e.g., 'claude', 'claude:opus', 'codex') */
|
|
14
|
+
cli: string;
|
|
15
|
+
/** Agent role (e.g., 'coordinator', 'developer', 'reviewer') */
|
|
16
|
+
role?: string;
|
|
17
|
+
/** Initial task/prompt to inject when spawning */
|
|
18
|
+
task?: string;
|
|
19
|
+
}
|
|
20
|
+
/** teams.json file structure */
|
|
21
|
+
export interface TeamsConfig {
|
|
22
|
+
/** Team name (for identification) */
|
|
23
|
+
team: string;
|
|
24
|
+
/** Agents defined in this team */
|
|
25
|
+
agents: TeamAgentConfig[];
|
|
26
|
+
/** If true, agent-relay up will auto-spawn all agents */
|
|
27
|
+
autoSpawn?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Load teams.json from project root or .agent-relay directory
|
|
31
|
+
* Returns null if no config found
|
|
32
|
+
*/
|
|
33
|
+
export declare function loadTeamsConfig(projectRoot: string): TeamsConfig | null;
|
|
34
|
+
/**
|
|
35
|
+
* Check if an agent name is valid according to teams.json
|
|
36
|
+
* Returns true if no teams.json exists (permissive mode)
|
|
37
|
+
*/
|
|
38
|
+
export declare function isValidAgentName(projectRoot: string, agentName: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Get agent config by name from teams.json
|
|
41
|
+
*/
|
|
42
|
+
export declare function getAgentConfig(projectRoot: string, agentName: string): TeamAgentConfig | null;
|
|
43
|
+
/**
|
|
44
|
+
* Get teams.json path that would be used (for error messages)
|
|
45
|
+
*/
|
|
46
|
+
export declare function getTeamsConfigPath(projectRoot: string): string | null;
|
|
47
|
+
//# sourceMappingURL=teams-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teams-config.d.ts","sourceRoot":"","sources":["../src/teams-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,qCAAqC;AACrC,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,gCAAgC;AAChC,MAAM,WAAW,WAAW;IAC1B,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,yDAAyD;IACzD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAYD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAgDvE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAShF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAK7F;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQrE"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Teams Configuration
|
|
3
|
+
* Handles loading and parsing teams.json for auto-spawn and agent validation.
|
|
4
|
+
*
|
|
5
|
+
* teams.json can be placed in:
|
|
6
|
+
* - Project root: ./teams.json
|
|
7
|
+
* - Agent-relay dir: ./.agent-relay/teams.json
|
|
8
|
+
*/
|
|
9
|
+
import fs from 'node:fs';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
/**
|
|
12
|
+
* Possible locations for teams.json (in order of precedence)
|
|
13
|
+
*/
|
|
14
|
+
function getTeamsConfigPaths(projectRoot) {
|
|
15
|
+
return [
|
|
16
|
+
path.join(projectRoot, '.agent-relay', 'teams.json'),
|
|
17
|
+
path.join(projectRoot, 'teams.json'),
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Load teams.json from project root or .agent-relay directory
|
|
22
|
+
* Returns null if no config found
|
|
23
|
+
*/
|
|
24
|
+
export function loadTeamsConfig(projectRoot) {
|
|
25
|
+
const configPaths = getTeamsConfigPaths(projectRoot);
|
|
26
|
+
for (const configPath of configPaths) {
|
|
27
|
+
if (fs.existsSync(configPath)) {
|
|
28
|
+
try {
|
|
29
|
+
const content = fs.readFileSync(configPath, 'utf-8');
|
|
30
|
+
const config = JSON.parse(content);
|
|
31
|
+
// Validate required fields
|
|
32
|
+
if (!config.team || typeof config.team !== 'string') {
|
|
33
|
+
console.error(`[teams-config] Invalid teams.json at ${configPath}: missing or invalid 'team' field`);
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (!Array.isArray(config.agents)) {
|
|
37
|
+
console.error(`[teams-config] Invalid teams.json at ${configPath}: 'agents' must be an array`);
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
// Validate agents
|
|
41
|
+
const validAgents = [];
|
|
42
|
+
for (const agent of config.agents) {
|
|
43
|
+
if (!agent.name || typeof agent.name !== 'string') {
|
|
44
|
+
console.warn(`[teams-config] Skipping agent with missing name in ${configPath}`);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (!agent.cli || typeof agent.cli !== 'string') {
|
|
48
|
+
console.warn(`[teams-config] Agent '${agent.name}' missing 'cli' field, defaulting to 'claude'`);
|
|
49
|
+
agent.cli = 'claude';
|
|
50
|
+
}
|
|
51
|
+
validAgents.push(agent);
|
|
52
|
+
}
|
|
53
|
+
console.log(`[teams-config] Loaded team '${config.team}' from ${configPath} (${validAgents.length} agents)`);
|
|
54
|
+
return {
|
|
55
|
+
team: config.team,
|
|
56
|
+
agents: validAgents,
|
|
57
|
+
autoSpawn: config.autoSpawn ?? false,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
console.error(`[teams-config] Failed to parse ${configPath}:`, err);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Check if an agent name is valid according to teams.json
|
|
69
|
+
* Returns true if no teams.json exists (permissive mode)
|
|
70
|
+
*/
|
|
71
|
+
export function isValidAgentName(projectRoot, agentName) {
|
|
72
|
+
const config = loadTeamsConfig(projectRoot);
|
|
73
|
+
// No config = permissive mode
|
|
74
|
+
if (!config) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
return config.agents.some(a => a.name === agentName);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get agent config by name from teams.json
|
|
81
|
+
*/
|
|
82
|
+
export function getAgentConfig(projectRoot, agentName) {
|
|
83
|
+
const config = loadTeamsConfig(projectRoot);
|
|
84
|
+
if (!config)
|
|
85
|
+
return null;
|
|
86
|
+
return config.agents.find(a => a.name === agentName) ?? null;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get teams.json path that would be used (for error messages)
|
|
90
|
+
*/
|
|
91
|
+
export function getTeamsConfigPath(projectRoot) {
|
|
92
|
+
const configPaths = getTeamsConfigPaths(projectRoot);
|
|
93
|
+
for (const configPath of configPaths) {
|
|
94
|
+
if (fs.existsSync(configPath)) {
|
|
95
|
+
return configPath;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=teams-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teams-config.js","sourceRoot":"","sources":["../src/teams-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAwB7B;;GAEG;AACH,SAAS,mBAAmB,CAAC,WAAmB;IAC9C,OAAO;QACL,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,EAAE,YAAY,CAAC;QACpD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC;KACrC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,WAAmB;IACjD,MAAM,WAAW,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAErD,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;gBACrD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAgB,CAAC;gBAElD,2BAA2B;gBAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBACpD,OAAO,CAAC,KAAK,CAAC,wCAAwC,UAAU,mCAAmC,CAAC,CAAC;oBACrG,SAAS;gBACX,CAAC;gBAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;oBAClC,OAAO,CAAC,KAAK,CAAC,wCAAwC,UAAU,6BAA6B,CAAC,CAAC;oBAC/F,SAAS;gBACX,CAAC;gBAED,kBAAkB;gBAClB,MAAM,WA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