@t4h/agent-runtime 0.0.0-stage → 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/README.md +23 -2
- package/bin/t4h-agent.mjs +2 -0
- package/dist/brain.d.ts +48 -0
- package/dist/brain.js +99 -0
- package/dist/brain.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +27 -0
- package/dist/cli.js.map +1 -0
- package/dist/evals.d.ts +38 -0
- package/dist/evals.js +95 -0
- package/dist/evals.js.map +1 -0
- package/dist/gateway.d.ts +61 -0
- package/dist/gateway.js +93 -0
- package/dist/gateway.js.map +1 -0
- package/dist/host.d.ts +76 -0
- package/dist/host.js +267 -0
- package/dist/host.js.map +1 -0
- package/dist/inbox.d.ts +23 -0
- package/dist/inbox.js +29 -0
- package/dist/inbox.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/levels.d.ts +48 -0
- package/dist/levels.js +73 -0
- package/dist/levels.js.map +1 -0
- package/dist/manifest.d.ts +111 -0
- package/dist/manifest.js +172 -0
- package/dist/manifest.js.map +1 -0
- package/dist/notifier.d.ts +26 -0
- package/dist/notifier.js +13 -0
- package/dist/notifier.js.map +1 -0
- package/dist/plugins.d.ts +8 -0
- package/dist/plugins.js +73 -0
- package/dist/plugins.js.map +1 -0
- package/dist/policy.d.ts +71 -0
- package/dist/policy.js +210 -0
- package/dist/policy.js.map +1 -0
- package/dist/prompt.d.ts +24 -0
- package/dist/prompt.js +84 -0
- package/dist/prompt.js.map +1 -0
- package/dist/round.d.ts +34 -0
- package/dist/round.js +108 -0
- package/dist/round.js.map +1 -0
- package/dist/runtime-tools.d.ts +75 -0
- package/dist/runtime-tools.js +114 -0
- package/dist/runtime-tools.js.map +1 -0
- package/dist/short-term.d.ts +16 -0
- package/dist/short-term.js +60 -0
- package/dist/short-term.js.map +1 -0
- package/dist/store/long-term.d.ts +136 -0
- package/dist/store/long-term.js +206 -0
- package/dist/store/long-term.js.map +1 -0
- package/dist/store/migrations.d.ts +5 -0
- package/dist/store/migrations.js +104 -0
- package/dist/store/migrations.js.map +1 -0
- package/dist/store/sql.d.ts +18 -0
- package/dist/store/sql.js +67 -0
- package/dist/store/sql.js.map +1 -0
- package/package.json +48 -4
- package/schema/agent.schema.json +236 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://tech4h.com.br/schemas/agent.schema.json",
|
|
4
|
+
"title": "agent.yaml (schema v1)",
|
|
5
|
+
"description": "Manifesto de um colaborador digital. Chaves em inglês camelCase, como o catalog.yaml do t4h-mcp-services; textos em português. O manifesto NÃO concede acesso: o acesso do agente é pedido por chamado, como o de uma pessoa, e liberado no gateway.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["schemaVersion", "id", "name", "description", "owner", "team", "identity", "model", "gateway", "routines"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"schemaVersion": { "const": 1 },
|
|
11
|
+
"id": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"pattern": "^[a-z][a-z0-9-]{1,39}$",
|
|
14
|
+
"description": "Igual ao nome da pasta em agents/."
|
|
15
|
+
},
|
|
16
|
+
"name": { "type": "string", "minLength": 1 },
|
|
17
|
+
"description": { "type": "string", "minLength": 1 },
|
|
18
|
+
"stage": {
|
|
19
|
+
"enum": ["shadow", "live"],
|
|
20
|
+
"default": "shadow",
|
|
21
|
+
"description": "shadow: só lê e registra o que faria, em qualquer rotina. live: cada rotina age no próprio nível."
|
|
22
|
+
},
|
|
23
|
+
"owner": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"additionalProperties": false,
|
|
26
|
+
"required": ["dri"],
|
|
27
|
+
"properties": {
|
|
28
|
+
"dri": { "type": "string", "minLength": 1, "description": "Pessoa responsável pelo agente." },
|
|
29
|
+
"securityCoOwner": {
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"default": false,
|
|
32
|
+
"description": "Segurança divide a responsabilidade. Obrigatório quando alguma rotina chega a autonomous."
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"team": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"additionalProperties": false,
|
|
39
|
+
"required": ["area", "team"],
|
|
40
|
+
"properties": {
|
|
41
|
+
"area": { "type": "string" },
|
|
42
|
+
"team": { "type": "string" },
|
|
43
|
+
"leader": { "type": "string", "description": "Quem define a prioridade e recebe as escalações. Se ausente, o DRI." },
|
|
44
|
+
"channel": { "type": "string" }
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"identity": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"additionalProperties": false,
|
|
50
|
+
"required": ["email"],
|
|
51
|
+
"properties": {
|
|
52
|
+
"email": { "type": "string", "pattern": "^[^@\\s]+@[^@\\s]+$" },
|
|
53
|
+
"clientId": { "type": "string", "description": "Client do Keycloak usado no client_credentials. Padrão: agent-<id>." }
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"model": { "type": "string", "pattern": "^claude-" },
|
|
57
|
+
"effort": { "enum": ["low", "medium", "high", "xhigh", "max"], "default": "medium" },
|
|
58
|
+
"gateway": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"additionalProperties": false,
|
|
61
|
+
"required": ["subservices"],
|
|
62
|
+
"properties": {
|
|
63
|
+
"subservices": {
|
|
64
|
+
"type": "array",
|
|
65
|
+
"items": { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,49}$" },
|
|
66
|
+
"uniqueItems": true,
|
|
67
|
+
"description": "Conectores do gateway que o agente usa. O que ele pode dentro de cada um é decidido pelos grants do gateway."
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"reads": {
|
|
72
|
+
"type": "array",
|
|
73
|
+
"items": { "$ref": "#/definitions/toolName" },
|
|
74
|
+
"uniqueItems": true,
|
|
75
|
+
"default": [],
|
|
76
|
+
"description": "Ferramentas só de leitura, liberadas em qualquer nível, inclusive no shadow."
|
|
77
|
+
},
|
|
78
|
+
"triggers": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"additionalProperties": false,
|
|
81
|
+
"properties": {
|
|
82
|
+
"schedule": { "type": "string", "description": "Cron do despertar: a cada tique roda uma rodada." },
|
|
83
|
+
"timezone": { "type": "string", "default": "America/Sao_Paulo" },
|
|
84
|
+
"events": {
|
|
85
|
+
"type": "array",
|
|
86
|
+
"items": {
|
|
87
|
+
"oneOf": [
|
|
88
|
+
{ "type": "string" },
|
|
89
|
+
{
|
|
90
|
+
"type": "object",
|
|
91
|
+
"additionalProperties": false,
|
|
92
|
+
"required": ["type", "kind"],
|
|
93
|
+
"properties": {
|
|
94
|
+
"type": { "type": "string" },
|
|
95
|
+
"kind": { "$ref": "#/definitions/eventKind" }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"limits": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"additionalProperties": false,
|
|
106
|
+
"properties": {
|
|
107
|
+
"itemsPerRound": { "type": "integer", "minimum": 1, "default": 10 },
|
|
108
|
+
"roundTimeoutSec": { "type": "integer", "minimum": 10, "default": 240 },
|
|
109
|
+
"maxTurnsPerItem": { "type": "integer", "minimum": 1, "default": 25 },
|
|
110
|
+
"budgetUsdPerItem": { "type": "number", "exclusiveMinimum": 0 },
|
|
111
|
+
"maxAttempts": { "type": "integer", "minimum": 1, "default": 3 }
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"breaker": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"additionalProperties": false,
|
|
117
|
+
"description": "Disjuntor: se a taxa de erro ou correção passa do limite, a rotina desce um nível sozinha.",
|
|
118
|
+
"properties": {
|
|
119
|
+
"window": { "type": "integer", "minimum": 5, "default": 50 },
|
|
120
|
+
"minSample": { "type": "integer", "minimum": 1, "default": 10 },
|
|
121
|
+
"maxErrorRate": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.1 }
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"routines": {
|
|
125
|
+
"type": "object",
|
|
126
|
+
"minProperties": 1,
|
|
127
|
+
"propertyNames": { "pattern": "^[a-z][a-zA-Z0-9]{1,39}$" },
|
|
128
|
+
"additionalProperties": { "$ref": "#/definitions/routine" }
|
|
129
|
+
},
|
|
130
|
+
"guardrails": {
|
|
131
|
+
"type": "object",
|
|
132
|
+
"additionalProperties": false,
|
|
133
|
+
"properties": {
|
|
134
|
+
"forbiddenTools": {
|
|
135
|
+
"type": "array",
|
|
136
|
+
"items": { "$ref": "#/definitions/toolName" },
|
|
137
|
+
"default": [],
|
|
138
|
+
"description": "Nunca, em nenhum nível. Segregação de funções (aprovar, concluir, cancelar)."
|
|
139
|
+
},
|
|
140
|
+
"untrustedInputs": {
|
|
141
|
+
"type": "array",
|
|
142
|
+
"items": { "type": "string" },
|
|
143
|
+
"default": [],
|
|
144
|
+
"description": "Campos de evento que chegam ao modelo marcados como dado não confiável."
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"conversation": {
|
|
149
|
+
"type": "object",
|
|
150
|
+
"additionalProperties": false,
|
|
151
|
+
"description": "Conversa direta (pelo Claude ou por outro agente). O agente só lê, com o próprio acesso, como um colega; quem pode conversar é o grant do conector agents_<círculo>.",
|
|
152
|
+
"properties": {
|
|
153
|
+
"enabled": { "type": "boolean", "default": true },
|
|
154
|
+
"maxTurns": { "type": "integer", "minimum": 1, "default": 12 },
|
|
155
|
+
"maxHops": {
|
|
156
|
+
"type": "integer",
|
|
157
|
+
"minimum": 0,
|
|
158
|
+
"default": 2,
|
|
159
|
+
"description": "Limite de idas e voltas entre agentes numa mesma conversa."
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"plugins": {
|
|
164
|
+
"type": "array",
|
|
165
|
+
"description": "Plugins do marketplace de skills da organização (plugins do Claude Code), na versão declarada. Baixados no build.",
|
|
166
|
+
"items": {
|
|
167
|
+
"type": "object",
|
|
168
|
+
"additionalProperties": false,
|
|
169
|
+
"required": ["name", "version"],
|
|
170
|
+
"properties": {
|
|
171
|
+
"name": { "type": "string", "pattern": "^[a-z][a-z0-9-]+$" },
|
|
172
|
+
"version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" }
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
"default": []
|
|
176
|
+
},
|
|
177
|
+
"skills": {
|
|
178
|
+
"type": "array",
|
|
179
|
+
"items": { "type": "string" },
|
|
180
|
+
"default": [],
|
|
181
|
+
"description": "Skills dos plugins a ligar. O resto do plugin fica desligado. As skills da pasta skills/ do agente ficam sempre ligadas."
|
|
182
|
+
},
|
|
183
|
+
"handoffTo": {
|
|
184
|
+
"type": "array",
|
|
185
|
+
"items": { "type": "string", "pattern": "^[a-z][a-z0-9-]{1,39}$" },
|
|
186
|
+
"default": [],
|
|
187
|
+
"description": "Agentes com quem ele pode conversar."
|
|
188
|
+
},
|
|
189
|
+
"memory": {
|
|
190
|
+
"type": "object",
|
|
191
|
+
"additionalProperties": false,
|
|
192
|
+
"properties": {
|
|
193
|
+
"shortTerm": { "const": "sqlite", "default": "sqlite" },
|
|
194
|
+
"longTerm": { "const": "postgres", "default": "postgres" }
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
"definitions": {
|
|
199
|
+
"toolName": { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,49}\\.[a-z][a-z0-9_]{0,63}$", "description": "<subservice>.<tool>, como no catálogo do gateway." },
|
|
200
|
+
"level": { "enum": ["copilot", "agent", "autonomous"] },
|
|
201
|
+
"eventKind": { "enum": ["conversation", "critical", "new", "update", "hygiene"] },
|
|
202
|
+
"routine": {
|
|
203
|
+
"type": "object",
|
|
204
|
+
"additionalProperties": false,
|
|
205
|
+
"required": ["level", "does"],
|
|
206
|
+
"properties": {
|
|
207
|
+
"level": { "$ref": "#/definitions/level" },
|
|
208
|
+
"target": { "$ref": "#/definitions/level", "description": "Onde a rotina quer chegar. Só documenta a meta; subir é um PR." },
|
|
209
|
+
"does": { "type": "string", "minLength": 1 },
|
|
210
|
+
"on": { "type": "array", "items": { "type": "string" }, "default": [], "description": "Eventos que acionam a rotina." },
|
|
211
|
+
"schedule": { "type": "string", "description": "Cron próprio da rotina (agenda com o time)." },
|
|
212
|
+
"actions": {
|
|
213
|
+
"type": "array",
|
|
214
|
+
"items": { "$ref": "#/definitions/toolName" },
|
|
215
|
+
"uniqueItems": true,
|
|
216
|
+
"default": [],
|
|
217
|
+
"description": "Ferramentas com efeito que esta rotina pode usar. Cada ferramenta pertence a uma rotina só."
|
|
218
|
+
},
|
|
219
|
+
"scope": { "type": "object", "description": "Onde a rotina pode agir. Repassado ao modelo e conferido nos evals." },
|
|
220
|
+
"limits": {
|
|
221
|
+
"type": "object",
|
|
222
|
+
"additionalProperties": false,
|
|
223
|
+
"properties": {
|
|
224
|
+
"perHour": { "type": "integer", "minimum": 1 },
|
|
225
|
+
"window": {
|
|
226
|
+
"type": "string",
|
|
227
|
+
"pattern": "^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)-(Mon|Tue|Wed|Thu|Fri|Sat|Sun) \\d{2}:\\d{2}-\\d{2}:\\d{2}$",
|
|
228
|
+
"description": "Fora da janela, a ação vira proposta."
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
"undo": { "type": "string", "description": "Como desfazer (ferramenta ou procedimento). Obrigatório para autonomous." }
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|