@agent-city/spec 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/dist/schema.js ADDED
@@ -0,0 +1,71 @@
1
+ import { z } from 'zod';
2
+ export const SPEC_VERSION = '0.1';
3
+ export const SUPPORTED_VERSIONS = ['0.1'];
4
+ export const EVENT_KINDS = [
5
+ 'session.start', 'session.end', 'plan.update', 'step.start', 'step.end',
6
+ 'approval.request', 'approval.result', 'lesson.recall', 'lesson.write', 'handoff', 'metric',
7
+ ];
8
+ export const STEP_CATEGORIES = ['search', 'read', 'write', 'execute', 'test', 'plan', 'communicate', 'other'];
9
+ export const STEP_STATUSES = ['ok', 'error', 'blocked', 'cancelled'];
10
+ export const PLAN_STATES = ['pending', 'active', 'done', 'failed', 'pruned'];
11
+ /** Unknown categories collapse to 'other' (spec rule). */
12
+ const category = z.string().transform((c) => STEP_CATEGORIES.includes(c) ? c : 'other');
13
+ export const PlanNodeSchema = z.object({
14
+ id: z.string(),
15
+ parentId: z.string().optional(),
16
+ label: z.string(),
17
+ state: z.enum(PLAN_STATES),
18
+ confidence: z.number().min(0).max(1).optional(),
19
+ reversible: z.boolean().optional(),
20
+ }).passthrough();
21
+ /** Protocol 0.5: teammate handle (team city): 1-40 letters, digits, '_', '.' or '-'. */
22
+ export const PEER_HANDLE_RE = /^[\p{L}\p{N}_.-]{1,40}$/u;
23
+ export const StepSchema = z.object({
24
+ action: z.string(),
25
+ category,
26
+ target: z.string().optional(),
27
+ status: z.enum(STEP_STATUSES).optional(),
28
+ reversible: z.boolean().optional(),
29
+ confidence: z.number().min(0).max(1).optional(),
30
+ durationMs: z.number().nonnegative().optional(),
31
+ costUsd: z.number().nonnegative().optional(),
32
+ summary: z.string().max(200).optional(),
33
+ }).passthrough();
34
+ export const AgentEventSchema = z.object({
35
+ v: z.enum(SUPPORTED_VERSIONS),
36
+ id: z.string().min(1),
37
+ ts: z.string().datetime({ offset: true }),
38
+ source: z.object({ tool: z.string(), version: z.string().optional() }).passthrough(),
39
+ session: z.object({
40
+ id: z.string(), parentId: z.string().optional(), cwd: z.string().optional(), project: z.string().optional(),
41
+ }).passthrough(),
42
+ agent: z.object({
43
+ id: z.string(), role: z.string().optional(), model: z.string().optional(), parentId: z.string().optional(),
44
+ }).passthrough(),
45
+ /** Unknown kinds are kept as raw strings; consumers must not fail on them. */
46
+ kind: z.string(),
47
+ step: StepSchema.optional(),
48
+ plan: z.object({ nodes: z.array(PlanNodeSchema) }).passthrough().optional(),
49
+ approval: z.object({
50
+ requestId: z.string(),
51
+ decision: z.enum(['allow', 'deny']).optional(),
52
+ by: z.string().optional(),
53
+ reason: z.string().optional(),
54
+ }).passthrough().optional(),
55
+ lesson: z.object({
56
+ id: z.string(), text: z.string(), evidence: z.string().optional(), score: z.number().optional(),
57
+ }).passthrough().optional(),
58
+ /** Protocol 0.5: set only on events received from a teammate's engine (team city). Never stored. */
59
+ peer: z.object({ handle: z.string().regex(PEER_HANDLE_RE) }).passthrough().optional(),
60
+ }).passthrough();
61
+ export function isKnownKind(kind) {
62
+ return EVENT_KINDS.includes(kind);
63
+ }
64
+ /** Validates and normalizes an event. Never throws. */
65
+ export function parseEvent(input) {
66
+ const r = AgentEventSchema.safeParse(input);
67
+ if (r.success)
68
+ return { ok: true, event: r.data };
69
+ return { ok: false, error: r.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join('; ') };
70
+ }
71
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,YAAY,GAAG,KAAc,CAAC;AAC3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAK,CAAU,CAAC;AAEnD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,eAAe,EAAE,aAAa,EAA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AAE,CAAC,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAChG,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAC3B,oGAAoG;IACpG,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;CACtF,CAAC,CAAC,WAAW,EAAE,CAAC;AAOjB,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAQ,WAAiC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC3D,CAAC;AAID,uDAAuD;AACvD,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,MAAM,CAAC,GAAG,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC5C,IAAI,CAAC,CAAC,OAAO;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAClD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACzG,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** Removes tokens, keys and credentials from a string. */
2
+ export declare function redactSecrets(text: string): string;
3
+ /** True for paths whose content must never be shown or stored (.env, key files). */
4
+ export declare function isSecretPath(p: string): boolean;
5
+ /** Deeply redacts every string inside a value (returns a copy). */
6
+ export declare function redactDeep<T>(value: T): T;
@@ -0,0 +1,49 @@
1
+ const REDACTED = '[REDACTED]';
2
+ const TOKEN_PATTERNS = [
3
+ /sk-ant-[A-Za-z0-9_-]{10,}/g, // Anthropic
4
+ /sk-(?:proj-)?[A-Za-z0-9_-]{20,}/g, // OpenAI
5
+ /gh[pousr]_[A-Za-z0-9]{20,}/g, // GitHub
6
+ /github_pat_[A-Za-z0-9_]{20,}/g,
7
+ /AKIA[0-9A-Z]{16}/g, // AWS access key id
8
+ /AIza[0-9A-Za-z_-]{35}/g, // Google API key
9
+ /xox[abprs]-[A-Za-z0-9-]{10,}/g, // Slack
10
+ /eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g, // JWT
11
+ /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g,
12
+ ];
13
+ const AUTH_HEADER = /\b(Bearer|Basic|Token)\s+[A-Za-z0-9._~+/=-]{8,}/gi;
14
+ const URL_CREDS = /\b((?:https?|postgres(?:ql)?|mysql|mongodb(?:\+srv)?|redis|amqp):\/\/[^:/\s@]+:)[^@\s]+@/gi;
15
+ const ASSIGNMENT = /\b([A-Za-z0-9_.-]*(?:SECRET|TOKEN|PASSWORD|PASSWD|PWD|API[_-]?KEY|PRIVATE[_-]?KEY|ACCESS[_-]?KEY|CREDENTIALS?)[A-Za-z0-9_]*)(["']?\s*[:=]\s*["']?)([^\s"'&;,]+)/gi;
16
+ const CLI_FLAG = /(--(?:password|token|api-key|secret)[=\s]+)(\S+)/gi;
17
+ /** Removes tokens, keys and credentials from a string. */
18
+ export function redactSecrets(text) {
19
+ let out = text;
20
+ for (const p of TOKEN_PATTERNS)
21
+ out = out.replace(p, REDACTED);
22
+ out = out.replace(AUTH_HEADER, (_m, scheme) => `${scheme} ${REDACTED}`);
23
+ out = out.replace(URL_CREDS, (_m, prefix) => `${prefix}${REDACTED}@`);
24
+ out = out.replace(ASSIGNMENT, (m, k, sep, v) => (v === REDACTED ? m : `${k}${sep}${REDACTED}`));
25
+ out = out.replace(CLI_FLAG, (_m, flag) => `${flag}${REDACTED}`);
26
+ return out;
27
+ }
28
+ /** True for paths whose content must never be shown or stored (.env, key files). */
29
+ export function isSecretPath(p) {
30
+ const base = p.split(/[\\/]/).pop() ?? '';
31
+ if (/^\.env(\..*)?$/i.test(base))
32
+ return !/\.(example|sample|template)$/i.test(base);
33
+ return /\.(pem|key|p12|pfx)$/i.test(base) || /^id_(rsa|ed25519|ecdsa|dsa)$/.test(base) || /^credentials(\.json)?$/i.test(base);
34
+ }
35
+ /** Deeply redacts every string inside a value (returns a copy). */
36
+ export function redactDeep(value) {
37
+ if (typeof value === 'string')
38
+ return redactSecrets(value);
39
+ if (Array.isArray(value))
40
+ return value.map((v) => redactDeep(v));
41
+ if (value && typeof value === 'object') {
42
+ const o = {};
43
+ for (const [k, v] of Object.entries(value))
44
+ o[k] = redactDeep(v);
45
+ return o;
46
+ }
47
+ return value;
48
+ }
49
+ //# sourceMappingURL=secrets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets.js","sourceRoot":"","sources":["../src/secrets.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,YAAY,CAAC;AAE9B,MAAM,cAAc,GAAa;IAC/B,4BAA4B,EAAE,YAAY;IAC1C,kCAAkC,EAAE,SAAS;IAC7C,6BAA6B,EAAE,SAAS;IACxC,+BAA+B;IAC/B,mBAAmB,EAAE,oBAAoB;IACzC,wBAAwB,EAAE,iBAAiB;IAC3C,+BAA+B,EAAE,QAAQ;IACzC,gEAAgE,EAAE,MAAM;IACxE,6EAA6E;CAC9E,CAAC;AAEF,MAAM,WAAW,GAAG,mDAAmD,CAAC;AACxE,MAAM,SAAS,GAAG,4FAA4F,CAAC;AAC/G,MAAM,UAAU,GACd,mKAAmK,CAAC;AACtK,MAAM,QAAQ,GAAG,oDAAoD,C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,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjI,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,UAAU,CAAI,KAAQ;IACpC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,aAAa,CAAC,KAAK,CAAM,CAAC;IAChE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAM,CAAC;IACtE,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,CAAC,GAA4B,EAAE,CAAC;QACtC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QACjE,OAAO,CAAM,CAAC;IAChB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,49 @@
1
1
  {
2
2
  "name": "@agent-city/spec",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./schema.json": "./schema/agent-event.schema.json"
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "schema",
17
+ "conformance"
18
+ ],
19
+ "dependencies": {
20
+ "ulid": "^2.3.0",
21
+ "zod": "^3.24.0"
22
+ },
23
+ "devDependencies": {
24
+ "zod-to-json-schema": "3.25.2"
25
+ },
26
+ "description": "AgentCity event specification: types, zod validation, JSON Schema and conformance tests.",
27
+ "license": "MIT",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/marlonyi/agentcity-kit.git",
31
+ "directory": "packages/spec"
32
+ },
33
+ "homepage": "https://github.com/marlonyi/agentcity-kit#readme",
34
+ "bugs": {
35
+ "url": "https://github.com/marlonyi/agentcity-kit/issues"
36
+ },
37
+ "engines": {
38
+ "node": ">=22.13"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "scripts": {
44
+ "build": "tsc -p tsconfig.json",
45
+ "typecheck": "tsc -p tsconfig.json --noEmit",
46
+ "test": "vitest run",
47
+ "schema": "node scripts/gen-schema.mjs"
48
+ }
6
49
  }
@@ -0,0 +1,251 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
3
+ "$id": "urn:agentcity:schema:agent-event:0.1",
4
+ "title": "AgentCity event",
5
+ "description": "One event emitted by a coding agent adapter. Source of truth: packages/spec/src/schema.ts (zod). Spec: docs/spec/eventos.md",
6
+ "type": "object",
7
+ "properties": {
8
+ "v": {
9
+ "type": "string",
10
+ "enum": [
11
+ "0.1"
12
+ ]
13
+ },
14
+ "id": {
15
+ "type": "string",
16
+ "minLength": 1
17
+ },
18
+ "ts": {
19
+ "type": "string",
20
+ "format": "date-time"
21
+ },
22
+ "source": {
23
+ "type": "object",
24
+ "properties": {
25
+ "tool": {
26
+ "type": "string"
27
+ },
28
+ "version": {
29
+ "type": "string"
30
+ }
31
+ },
32
+ "required": [
33
+ "tool"
34
+ ],
35
+ "additionalProperties": true
36
+ },
37
+ "session": {
38
+ "type": "object",
39
+ "properties": {
40
+ "id": {
41
+ "type": "string"
42
+ },
43
+ "parentId": {
44
+ "type": "string"
45
+ },
46
+ "cwd": {
47
+ "type": "string"
48
+ },
49
+ "project": {
50
+ "type": "string"
51
+ }
52
+ },
53
+ "required": [
54
+ "id"
55
+ ],
56
+ "additionalProperties": true
57
+ },
58
+ "agent": {
59
+ "type": "object",
60
+ "properties": {
61
+ "id": {
62
+ "type": "string"
63
+ },
64
+ "role": {
65
+ "type": "string"
66
+ },
67
+ "model": {
68
+ "type": "string"
69
+ },
70
+ "parentId": {
71
+ "type": "string"
72
+ }
73
+ },
74
+ "required": [
75
+ "id"
76
+ ],
77
+ "additionalProperties": true
78
+ },
79
+ "kind": {
80
+ "type": "string"
81
+ },
82
+ "step": {
83
+ "type": "object",
84
+ "properties": {
85
+ "action": {
86
+ "type": "string"
87
+ },
88
+ "category": {
89
+ "type": "string"
90
+ },
91
+ "target": {
92
+ "type": "string"
93
+ },
94
+ "status": {
95
+ "type": "string",
96
+ "enum": [
97
+ "ok",
98
+ "error",
99
+ "blocked",
100
+ "cancelled"
101
+ ]
102
+ },
103
+ "reversible": {
104
+ "type": "boolean"
105
+ },
106
+ "confidence": {
107
+ "type": "number",
108
+ "minimum": 0,
109
+ "maximum": 1
110
+ },
111
+ "durationMs": {
112
+ "type": "number",
113
+ "minimum": 0
114
+ },
115
+ "costUsd": {
116
+ "type": "number",
117
+ "minimum": 0
118
+ },
119
+ "summary": {
120
+ "type": "string",
121
+ "maxLength": 200
122
+ }
123
+ },
124
+ "required": [
125
+ "action",
126
+ "category"
127
+ ],
128
+ "additionalProperties": true
129
+ },
130
+ "plan": {
131
+ "type": "object",
132
+ "properties": {
133
+ "nodes": {
134
+ "type": "array",
135
+ "items": {
136
+ "type": "object",
137
+ "properties": {
138
+ "id": {
139
+ "type": "string"
140
+ },
141
+ "parentId": {
142
+ "type": "string"
143
+ },
144
+ "label": {
145
+ "type": "string"
146
+ },
147
+ "state": {
148
+ "type": "string",
149
+ "enum": [
150
+ "pending",
151
+ "active",
152
+ "done",
153
+ "failed",
154
+ "pruned"
155
+ ]
156
+ },
157
+ "confidence": {
158
+ "type": "number",
159
+ "minimum": 0,
160
+ "maximum": 1
161
+ },
162
+ "reversible": {
163
+ "type": "boolean"
164
+ }
165
+ },
166
+ "required": [
167
+ "id",
168
+ "label",
169
+ "state"
170
+ ],
171
+ "additionalProperties": true
172
+ }
173
+ }
174
+ },
175
+ "required": [
176
+ "nodes"
177
+ ],
178
+ "additionalProperties": true
179
+ },
180
+ "approval": {
181
+ "type": "object",
182
+ "properties": {
183
+ "requestId": {
184
+ "type": "string"
185
+ },
186
+ "decision": {
187
+ "type": "string",
188
+ "enum": [
189
+ "allow",
190
+ "deny"
191
+ ]
192
+ },
193
+ "by": {
194
+ "type": "string"
195
+ },
196
+ "reason": {
197
+ "type": "string"
198
+ }
199
+ },
200
+ "required": [
201
+ "requestId"
202
+ ],
203
+ "additionalProperties": true
204
+ },
205
+ "lesson": {
206
+ "type": "object",
207
+ "properties": {
208
+ "id": {
209
+ "type": "string"
210
+ },
211
+ "text": {
212
+ "type": "string"
213
+ },
214
+ "evidence": {
215
+ "type": "string"
216
+ },
217
+ "score": {
218
+ "type": "number"
219
+ }
220
+ },
221
+ "required": [
222
+ "id",
223
+ "text"
224
+ ],
225
+ "additionalProperties": true
226
+ },
227
+ "peer": {
228
+ "type": "object",
229
+ "properties": {
230
+ "handle": {
231
+ "type": "string",
232
+ "pattern": "^[\\p{L}\\p{N}_.-]{1,40}$"
233
+ }
234
+ },
235
+ "required": [
236
+ "handle"
237
+ ],
238
+ "additionalProperties": true
239
+ }
240
+ },
241
+ "required": [
242
+ "v",
243
+ "id",
244
+ "ts",
245
+ "source",
246
+ "session",
247
+ "agent",
248
+ "kind"
249
+ ],
250
+ "additionalProperties": true
251
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.