@revition/plugin-agents 0.0.0-canary.a06d97b

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 (53) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +8 -0
  3. package/dist/commands/agents/create.d.ts +26 -0
  4. package/dist/commands/agents/create.js +46 -0
  5. package/dist/commands/agents/create.js.map +1 -0
  6. package/dist/commands/agents/diff.d.ts +22 -0
  7. package/dist/commands/agents/diff.js +41 -0
  8. package/dist/commands/agents/diff.js.map +1 -0
  9. package/dist/commands/agents/environments/list.d.ts +37 -0
  10. package/dist/commands/agents/environments/list.js +39 -0
  11. package/dist/commands/agents/environments/list.js.map +1 -0
  12. package/dist/commands/agents/list.d.ts +44 -0
  13. package/dist/commands/agents/list.js +75 -0
  14. package/dist/commands/agents/list.js.map +1 -0
  15. package/dist/commands/agents/open.d.ts +31 -0
  16. package/dist/commands/agents/open.js +47 -0
  17. package/dist/commands/agents/open.js.map +1 -0
  18. package/dist/commands/agents/pull.d.ts +29 -0
  19. package/dist/commands/agents/pull.js +69 -0
  20. package/dist/commands/agents/pull.js.map +1 -0
  21. package/dist/commands/agents/push.d.ts +31 -0
  22. package/dist/commands/agents/push.js +63 -0
  23. package/dist/commands/agents/push.js.map +1 -0
  24. package/dist/commands/agents/runs.d.ts +47 -0
  25. package/dist/commands/agents/runs.js +70 -0
  26. package/dist/commands/agents/runs.js.map +1 -0
  27. package/dist/commands/agents/status.d.ts +29 -0
  28. package/dist/commands/agents/status.js +47 -0
  29. package/dist/commands/agents/status.js.map +1 -0
  30. package/dist/commands/agents/templates.d.ts +20 -0
  31. package/dist/commands/agents/templates.js +26 -0
  32. package/dist/commands/agents/templates.js.map +1 -0
  33. package/dist/commands/agents/test.d.ts +58 -0
  34. package/dist/commands/agents/test.js +73 -0
  35. package/dist/commands/agents/test.js.map +1 -0
  36. package/dist/commands/agents/traces.d.ts +46 -0
  37. package/dist/commands/agents/traces.js +80 -0
  38. package/dist/commands/agents/traces.js.map +1 -0
  39. package/dist/commands/agents/validate.d.ts +43 -0
  40. package/dist/commands/agents/validate.js +76 -0
  41. package/dist/commands/agents/validate.js.map +1 -0
  42. package/dist/format.d.ts +49 -0
  43. package/dist/format.js +48 -0
  44. package/dist/format.js.map +1 -0
  45. package/dist/index.d.ts +2 -0
  46. package/dist/index.js +5 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/schema/agent-definition.v1.json +233 -0
  49. package/dist/validate.d.ts +21 -0
  50. package/dist/validate.js +55 -0
  51. package/dist/validate.js.map +1 -0
  52. package/oclif.manifest.json +1463 -0
  53. package/package.json +60 -0
@@ -0,0 +1,233 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "schemaVersion": {
6
+ "type": "number",
7
+ "const": 1
8
+ },
9
+ "agent": {
10
+ "type": "object",
11
+ "properties": {
12
+ "id": {
13
+ "anyOf": [
14
+ {
15
+ "type": "string",
16
+ "minLength": 1
17
+ },
18
+ {
19
+ "type": "null"
20
+ }
21
+ ]
22
+ },
23
+ "name": {
24
+ "type": "string",
25
+ "minLength": 1
26
+ }
27
+ },
28
+ "required": [
29
+ "id",
30
+ "name"
31
+ ],
32
+ "additionalProperties": false
33
+ },
34
+ "config": {
35
+ "type": "object",
36
+ "properties": {
37
+ "config": {
38
+ "type": "object",
39
+ "properties": {
40
+ "systemPrompt": {
41
+ "type": "string"
42
+ },
43
+ "instructions": {
44
+ "type": "string"
45
+ },
46
+ "skills": {
47
+ "type": "array",
48
+ "items": {
49
+ "type": "string"
50
+ }
51
+ },
52
+ "tools": {
53
+ "type": "array",
54
+ "items": {
55
+ "type": "string"
56
+ }
57
+ },
58
+ "knowledge": {
59
+ "type": "array",
60
+ "items": {
61
+ "type": "string"
62
+ }
63
+ },
64
+ "dataSources": {
65
+ "type": "array",
66
+ "items": {
67
+ "type": "string"
68
+ }
69
+ },
70
+ "files": {
71
+ "type": "array",
72
+ "items": {
73
+ "type": "string"
74
+ }
75
+ },
76
+ "memory": {},
77
+ "permissions": {
78
+ "type": "array",
79
+ "items": {
80
+ "type": "string"
81
+ }
82
+ },
83
+ "governance": {},
84
+ "operatingHours": {},
85
+ "settings": {
86
+ "type": "object",
87
+ "propertyNames": {
88
+ "type": "string"
89
+ },
90
+ "additionalProperties": {}
91
+ },
92
+ "notes": {
93
+ "anyOf": [
94
+ {
95
+ "type": "string"
96
+ },
97
+ {
98
+ "type": "null"
99
+ }
100
+ ]
101
+ },
102
+ "collaboration": {
103
+ "type": "object",
104
+ "properties": {
105
+ "canDelegate": {
106
+ "type": "boolean"
107
+ },
108
+ "canReceiveDelegated": {
109
+ "type": "boolean"
110
+ },
111
+ "canSpawnSubagents": {
112
+ "type": "boolean"
113
+ },
114
+ "allowedAgents": {
115
+ "type": "array",
116
+ "items": {
117
+ "type": "string"
118
+ }
119
+ },
120
+ "maxDepth": {
121
+ "type": "integer",
122
+ "minimum": 0,
123
+ "maximum": 9007199254740991
124
+ },
125
+ "budget": {},
126
+ "handoffPolicy": {
127
+ "type": "string"
128
+ },
129
+ "humanApprovalRules": {
130
+ "type": "array",
131
+ "items": {
132
+ "type": "string"
133
+ }
134
+ },
135
+ "sharedContextPolicy": {
136
+ "type": "string"
137
+ }
138
+ },
139
+ "required": [
140
+ "canDelegate",
141
+ "canReceiveDelegated",
142
+ "canSpawnSubagents",
143
+ "allowedAgents",
144
+ "maxDepth",
145
+ "budget",
146
+ "handoffPolicy",
147
+ "humanApprovalRules",
148
+ "sharedContextPolicy"
149
+ ]
150
+ },
151
+ "outputs": {},
152
+ "dataSourceGrants": {
153
+ "type": "object",
154
+ "propertyNames": {
155
+ "type": "string"
156
+ },
157
+ "additionalProperties": {
158
+ "type": "object",
159
+ "properties": {
160
+ "grantedOperationIds": {
161
+ "type": "array",
162
+ "items": {
163
+ "type": "string"
164
+ }
165
+ },
166
+ "accessLevel": {
167
+ "type": "string",
168
+ "enum": [
169
+ "read_only",
170
+ "read_write"
171
+ ]
172
+ },
173
+ "scopeMembers": {
174
+ "type": "object",
175
+ "propertyNames": {
176
+ "type": "string"
177
+ },
178
+ "additionalProperties": {
179
+ "type": "array",
180
+ "items": {
181
+ "type": "string"
182
+ }
183
+ }
184
+ },
185
+ "config": {
186
+ "type": "object",
187
+ "propertyNames": {
188
+ "type": "string"
189
+ },
190
+ "additionalProperties": {}
191
+ }
192
+ },
193
+ "required": [
194
+ "grantedOperationIds",
195
+ "accessLevel",
196
+ "config"
197
+ ]
198
+ }
199
+ },
200
+ "fileAccessPolicy": {},
201
+ "fileGenerationPolicy": {},
202
+ "attachmentPolicy": {},
203
+ "variables": {},
204
+ "channelWebhook": {},
205
+ "verticalId": {
206
+ "type": "string",
207
+ "minLength": 1
208
+ }
209
+ }
210
+ },
211
+ "sections": {
212
+ "type": "object",
213
+ "propertyNames": {
214
+ "type": "string"
215
+ },
216
+ "additionalProperties": {}
217
+ }
218
+ },
219
+ "required": [
220
+ "config",
221
+ "sections"
222
+ ],
223
+ "additionalProperties": false
224
+ }
225
+ },
226
+ "required": [
227
+ "schemaVersion",
228
+ "agent",
229
+ "config"
230
+ ],
231
+ "additionalProperties": false,
232
+ "title": "Revition agent definition v1"
233
+ }
@@ -0,0 +1,21 @@
1
+ import { type AgentDefinition } from './format.js';
2
+ /**
3
+ * T3.1.1 - `revition agents validate`, the local part: the platform's JSON Schema (pinned) and a secret scan over the
4
+ * file's text. A file that holds a literal credential fails; the finding names the line and the kind, never the
5
+ * value. Unknown config fields (a newer platform's) are a warning and are kept as they are.
6
+ */
7
+ export interface Finding {
8
+ readonly line: number | null;
9
+ readonly path: string;
10
+ readonly message: string;
11
+ }
12
+ export interface LocalResult {
13
+ readonly ok: boolean;
14
+ readonly definition: AgentDefinition | null;
15
+ readonly problems: readonly Finding[];
16
+ readonly warnings: readonly Finding[];
17
+ }
18
+ /** Every line holding a credential-looking literal: the line number and the kind. PURE. */
19
+ export declare function secretFindings(text: string): Finding[];
20
+ /** The local validation of one file's text. PURE (apart from the compiled schema). */
21
+ export declare function validateLocal(text: string): LocalResult;
@@ -0,0 +1,55 @@
1
+ import { SECRET_PATTERNS } from '@revition/cli-core';
2
+ import { Ajv2020 } from 'ajv/dist/2020.js';
3
+ import { parseDefinitionText } from './format.js';
4
+ import schema from './schema/agent-definition.v1.json' with { type: 'json' };
5
+ /** Credential shapes beyond the CLI's own redaction patterns: provider API keys and `key: <long literal>` pairs. */
6
+ const API_KEY_PATTERNS = [
7
+ { kind: 'an OpenAI / Anthropic-style API key', re: /\bsk-(?:ant-)?[A-Za-z0-9_-]{20,}/ },
8
+ { kind: 'an AWS access key id', re: /\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/ },
9
+ { kind: 'a GitHub token', re: /\bgh[pousr]_[A-Za-z0-9]{30,}/ },
10
+ { kind: 'a Slack token', re: /\bxox[abprs]-[A-Za-z0-9-]{10,}/ },
11
+ { kind: 'a payment provider secret key', re: /\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}/ },
12
+ { kind: 'a private key', re: /-----BEGIN [A-Z ]*PRIVATE KEY-----/ },
13
+ {
14
+ kind: 'a literal secret value',
15
+ re: /\b(?:api[_-]?key|apikey|secret|password|passwd|client[_-]?secret|access[_-]?key)\b\s*["']?\s*[:=]\s*["']?[A-Za-z0-9/+_=-]{16,}/i,
16
+ },
17
+ ];
18
+ /** Every line holding a credential-looking literal: the line number and the kind. PURE. */
19
+ export function secretFindings(text) {
20
+ const out = [];
21
+ text.split(/\r?\n/).forEach((line, i) => {
22
+ const own = SECRET_PATTERNS.some((p) => new RegExp(p.source, p.flags.replace('g', '')).test(line));
23
+ const hit = own ? 'a Revition token or credential' : API_KEY_PATTERNS.find((p) => p.re.test(line))?.kind;
24
+ if (hit !== undefined) {
25
+ out.push({ line: i + 1, path: '', message: `${hit}: secrets are never inline; reference an org variable or a runtime secret` });
26
+ }
27
+ });
28
+ return out;
29
+ }
30
+ const ajv = new Ajv2020({ allErrors: true, strict: false });
31
+ const validateSchema = ajv.compile(schema);
32
+ /** The config fields the pinned schema names (anything else came from a newer platform). */
33
+ const KNOWN_CONFIG_FIELDS = new Set(Object.keys((schema.properties.config.properties.config.properties)));
34
+ /** The local validation of one file's text. PURE (apart from the compiled schema). */
35
+ export function validateLocal(text) {
36
+ const secrets = secretFindings(text);
37
+ let doc;
38
+ try {
39
+ doc = parseDefinitionText(text);
40
+ }
41
+ catch (e) {
42
+ return { ok: false, definition: null, problems: [...secrets, { line: null, path: '', message: `not valid YAML: ${e.message.split('\n')[0] ?? ''}` }], warnings: [] };
43
+ }
44
+ const problems = [...secrets];
45
+ if (!validateSchema(doc)) {
46
+ for (const err of validateSchema.errors ?? []) {
47
+ problems.push({ line: null, path: err.instancePath === '' ? '/' : err.instancePath, message: err.message ?? 'invalid' });
48
+ }
49
+ }
50
+ const def = problems.length === 0 ? doc : null;
51
+ const unknown = def === null ? [] : Object.keys(def.config.config).filter((k) => !KNOWN_CONFIG_FIELDS.has(k));
52
+ const warnings = unknown.map((k) => ({ line: null, path: `/config/config/${k}`, message: 'not in this CLI\'s schema (a newer platform field?): kept as is' }));
53
+ return { ok: problems.length === 0, definition: def, problems, warnings };
54
+ }
55
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,mBAAmB,EAAwB,MAAM,aAAa,CAAC;AACxE,OAAO,MAAM,MAAM,mCAAmC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAoB7E,oHAAoH;AACpH,MAAM,gBAAgB,GAA8D;IAClF,EAAE,IAAI,EAAE,qCAAqC,EAAE,EAAE,EAAE,kCAAkC,EAAE;IACvF,EAAE,IAAI,EAAE,sBAAsB,EAAE,EAAE,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