heyio 3.0.2 → 3.0.4

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 (65) hide show
  1. package/dist/api/server.js +1 -1
  2. package/dist/api/server.js.map +1 -1
  3. package/dist/index.js +8 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/logging/logger.d.ts.map +1 -1
  6. package/dist/logging/logger.js +13 -1
  7. package/dist/logging/logger.js.map +1 -1
  8. package/node_modules/@io/shared/package.json +1 -1
  9. package/package.json +7 -2
  10. package/public/assets/index-2RY89H3W.js +336 -0
  11. package/public/assets/index-2RY89H3W.js.map +1 -0
  12. package/public/assets/index-D3cGfBsj.css +1 -0
  13. package/public/index.html +14 -0
  14. package/src/api/middleware/auth.ts +0 -76
  15. package/src/api/notifications.ts +0 -122
  16. package/src/api/routes/activity.ts +0 -29
  17. package/src/api/routes/attachments.ts +0 -93
  18. package/src/api/routes/config.ts +0 -115
  19. package/src/api/routes/conversations.ts +0 -87
  20. package/src/api/routes/health.ts +0 -18
  21. package/src/api/routes/inbox.ts +0 -98
  22. package/src/api/routes/schedules.ts +0 -121
  23. package/src/api/routes/skills.ts +0 -105
  24. package/src/api/routes/squads.ts +0 -145
  25. package/src/api/routes/usage.ts +0 -57
  26. package/src/api/routes/wiki.ts +0 -49
  27. package/src/api/server.ts +0 -186
  28. package/src/config.ts +0 -3
  29. package/src/copilot/client.ts +0 -42
  30. package/src/copilot/health-monitor.ts +0 -85
  31. package/src/copilot/orchestrator.ts +0 -222
  32. package/src/copilot/tools.ts +0 -707
  33. package/src/index.ts +0 -113
  34. package/src/logging/logger.ts +0 -26
  35. package/src/models/index.ts +0 -11
  36. package/src/models/pricing.ts +0 -121
  37. package/src/models/registry.ts +0 -131
  38. package/src/models/token-tracker.ts +0 -151
  39. package/src/scheduler/engine.ts +0 -146
  40. package/src/skills/index.ts +0 -13
  41. package/src/skills/store.ts +0 -188
  42. package/src/squad/agent.ts +0 -326
  43. package/src/squad/autonomy.ts +0 -78
  44. package/src/squad/event-bus.ts +0 -71
  45. package/src/squad/execution/index.ts +0 -17
  46. package/src/squad/execution/instance.ts +0 -186
  47. package/src/squad/execution/meeting.ts +0 -191
  48. package/src/squad/execution/pr.ts +0 -127
  49. package/src/squad/execution/runner.ts +0 -97
  50. package/src/squad/execution/tasks.ts +0 -111
  51. package/src/squad/execution/worktree.ts +0 -138
  52. package/src/squad/hiring.ts +0 -222
  53. package/src/squad/index.ts +0 -17
  54. package/src/squad/manager.ts +0 -337
  55. package/src/squad/name-generator.ts +0 -135
  56. package/src/squad/roles/templates.ts +0 -104
  57. package/src/squad/skill-parser.ts +0 -120
  58. package/src/squad/source-resolver.ts +0 -57
  59. package/src/store/activity.ts +0 -176
  60. package/src/store/db.ts +0 -237
  61. package/src/store/inbox.ts +0 -199
  62. package/src/store/schedules.ts +0 -199
  63. package/src/wiki/index.ts +0 -12
  64. package/src/wiki/store.ts +0 -139
  65. package/tsconfig.json +0 -9
@@ -1,199 +0,0 @@
1
- import { CronExpressionParser } from 'cron-parser';
2
- import { createChildLogger } from '../logging/logger.js';
3
- import { getDatabase } from './db.js';
4
-
5
- const logger = () => createChildLogger('schedules-store');
6
-
7
- export type ScheduleTargetType = 'squad' | 'orchestrator';
8
-
9
- export interface Schedule {
10
- id: string;
11
- name: string;
12
- targetType: ScheduleTargetType;
13
- targetId: string | null;
14
- cron: string;
15
- prompt: string;
16
- enabled: boolean;
17
- lastRun: string | null;
18
- nextRun: string | null;
19
- createdAt: string;
20
- }
21
-
22
- /**
23
- * Calculate the next run time from a cron expression.
24
- */
25
- export function calculateNextRun(cron: string, from?: Date): Date {
26
- const interval = CronExpressionParser.parse(cron, { currentDate: from ?? new Date() });
27
- return interval.next().toDate();
28
- }
29
-
30
- /**
31
- * Create a new schedule.
32
- */
33
- export async function createSchedule(params: {
34
- name: string;
35
- targetType: ScheduleTargetType;
36
- targetId?: string;
37
- cron: string;
38
- prompt: string;
39
- enabled?: boolean;
40
- }): Promise<Schedule> {
41
- const db = getDatabase();
42
- const id = crypto.randomUUID();
43
- const enabled = params.enabled ?? true;
44
- const nextRun = enabled ? calculateNextRun(params.cron).toISOString() : null;
45
-
46
- await db.execute({
47
- sql: `INSERT INTO schedules (id, name, target_type, target_id, cron, prompt, enabled, next_run)
48
- VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
49
- args: [
50
- id,
51
- params.name,
52
- params.targetType,
53
- params.targetId ?? null,
54
- params.cron,
55
- params.prompt,
56
- enabled ? 1 : 0,
57
- nextRun,
58
- ],
59
- });
60
-
61
- logger().info({ id, name: params.name, cron: params.cron }, 'Schedule created');
62
-
63
- return {
64
- id,
65
- name: params.name,
66
- targetType: params.targetType,
67
- targetId: params.targetId ?? null,
68
- cron: params.cron,
69
- prompt: params.prompt,
70
- enabled,
71
- lastRun: null,
72
- nextRun,
73
- createdAt: new Date().toISOString(),
74
- };
75
- }
76
-
77
- /**
78
- * List all schedules with optional enabled filter.
79
- */
80
- export async function listSchedules(enabledOnly?: boolean): Promise<Schedule[]> {
81
- const db = getDatabase();
82
- const sql = enabledOnly
83
- ? 'SELECT * FROM schedules WHERE enabled = 1 ORDER BY next_run ASC'
84
- : 'SELECT * FROM schedules ORDER BY created_at DESC';
85
- const result = await db.execute(sql);
86
- return result.rows.map(rowToSchedule);
87
- }
88
-
89
- /**
90
- * Get a single schedule by ID.
91
- */
92
- export async function getSchedule(id: string): Promise<Schedule | null> {
93
- const db = getDatabase();
94
- const result = await db.execute({ sql: 'SELECT * FROM schedules WHERE id = ?', args: [id] });
95
- if (result.rows.length === 0) return null;
96
- return rowToSchedule(result.rows[0]);
97
- }
98
-
99
- /**
100
- * Update a schedule (partial update).
101
- */
102
- export async function updateSchedule(
103
- id: string,
104
- updates: Partial<Pick<Schedule, 'name' | 'cron' | 'prompt' | 'enabled'>>,
105
- ): Promise<void> {
106
- const db = getDatabase();
107
- const sets: string[] = [];
108
- const args: (string | number | null)[] = [];
109
-
110
- if (updates.name !== undefined) {
111
- sets.push('name = ?');
112
- args.push(updates.name);
113
- }
114
- if (updates.cron !== undefined) {
115
- sets.push('cron = ?');
116
- args.push(updates.cron);
117
- // Recalculate next_run
118
- sets.push('next_run = ?');
119
- args.push(calculateNextRun(updates.cron).toISOString());
120
- }
121
- if (updates.prompt !== undefined) {
122
- sets.push('prompt = ?');
123
- args.push(updates.prompt);
124
- }
125
- if (updates.enabled !== undefined) {
126
- sets.push('enabled = ?');
127
- args.push(updates.enabled ? 1 : 0);
128
- if (updates.enabled && !updates.cron) {
129
- // Need to recalculate next_run from existing cron
130
- const existing = await getSchedule(id);
131
- if (existing) {
132
- sets.push('next_run = ?');
133
- args.push(calculateNextRun(existing.cron).toISOString());
134
- }
135
- }
136
- if (!updates.enabled) {
137
- sets.push('next_run = ?');
138
- args.push(null);
139
- }
140
- }
141
-
142
- if (sets.length === 0) return;
143
- args.push(id);
144
-
145
- await db.execute({
146
- sql: `UPDATE schedules SET ${sets.join(', ')} WHERE id = ?`,
147
- args,
148
- });
149
- }
150
-
151
- /**
152
- * Delete a schedule.
153
- */
154
- export async function deleteSchedule(id: string): Promise<void> {
155
- const db = getDatabase();
156
- await db.execute({ sql: 'DELETE FROM schedules WHERE id = ?', args: [id] });
157
- }
158
-
159
- /**
160
- * Mark a schedule as fired (update last_run and next_run).
161
- */
162
- export async function markScheduleFired(id: string, cron: string): Promise<void> {
163
- const db = getDatabase();
164
- const now = new Date().toISOString();
165
- const nextRun = calculateNextRun(cron).toISOString();
166
-
167
- await db.execute({
168
- sql: 'UPDATE schedules SET last_run = ?, next_run = ? WHERE id = ?',
169
- args: [now, nextRun, id],
170
- });
171
- }
172
-
173
- /**
174
- * Get all schedules that are due to fire (next_run <= now and enabled).
175
- */
176
- export async function getDueSchedules(): Promise<Schedule[]> {
177
- const db = getDatabase();
178
- const now = new Date().toISOString();
179
- const result = await db.execute({
180
- sql: 'SELECT * FROM schedules WHERE enabled = 1 AND next_run IS NOT NULL AND next_run <= ?',
181
- args: [now],
182
- });
183
- return result.rows.map(rowToSchedule);
184
- }
185
-
186
- function rowToSchedule(row: Record<string, unknown>): Schedule {
187
- return {
188
- id: row.id as string,
189
- name: row.name as string,
190
- targetType: row.target_type as ScheduleTargetType,
191
- targetId: row.target_id as string | null,
192
- cron: row.cron as string,
193
- prompt: row.prompt as string,
194
- enabled: (row.enabled as number) === 1,
195
- lastRun: row.last_run as string | null,
196
- nextRun: row.next_run as string | null,
197
- createdAt: row.created_at as string,
198
- };
199
- }
package/src/wiki/index.ts DELETED
@@ -1,12 +0,0 @@
1
- export {
2
- initWiki,
3
- ensureSquadWiki,
4
- listWikiPages,
5
- readWikiPage,
6
- writeWikiPage,
7
- searchWiki,
8
- getSquadScopes,
9
- getOrchestratorScopes,
10
- getPageListing,
11
- } from './store.js';
12
- export type { WikiScope, WikiPage, WikiSearchResult } from './store.js';
package/src/wiki/store.ts DELETED
@@ -1,139 +0,0 @@
1
- import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { createChildLogger } from '../logging/logger.js';
4
-
5
- const logger = () => createChildLogger('wiki');
6
-
7
- export type WikiScope = 'io' | 'shared' | string; // string = squad name
8
-
9
- export interface WikiPage {
10
- scope: string;
11
- name: string;
12
- content: string;
13
- }
14
-
15
- export interface WikiSearchResult {
16
- scope: string;
17
- name: string;
18
- matches: string[];
19
- }
20
-
21
- let wikiRoot = '';
22
-
23
- /**
24
- * Initialize the wiki directory structure.
25
- */
26
- export function initWiki(dataDir: string): void {
27
- wikiRoot = join(dataDir, 'wiki');
28
- mkdirSync(join(wikiRoot, 'io'), { recursive: true });
29
- mkdirSync(join(wikiRoot, 'shared'), { recursive: true });
30
- mkdirSync(join(wikiRoot, 'squads'), { recursive: true });
31
- logger().info({ wikiRoot }, 'Wiki initialized');
32
- }
33
-
34
- /**
35
- * Ensure a squad wiki folder exists.
36
- */
37
- export function ensureSquadWiki(squadName: string): void {
38
- const dir = join(wikiRoot, 'squads', squadName);
39
- mkdirSync(dir, { recursive: true });
40
- }
41
-
42
- function scopeDir(scope: WikiScope): string {
43
- if (scope === 'io') return join(wikiRoot, 'io');
44
- if (scope === 'shared') return join(wikiRoot, 'shared');
45
- return join(wikiRoot, 'squads', scope);
46
- }
47
-
48
- /**
49
- * List all page names in a scope.
50
- */
51
- export function listWikiPages(scope: WikiScope): string[] {
52
- const dir = scopeDir(scope);
53
- if (!existsSync(dir)) return [];
54
- return readdirSync(dir)
55
- .filter((f) => f.endsWith('.md'))
56
- .map((f) => f.replace(/\.md$/, ''));
57
- }
58
-
59
- /**
60
- * Read a wiki page. Returns null if it doesn't exist.
61
- */
62
- export function readWikiPage(scope: WikiScope, pageName: string): WikiPage | null {
63
- const filePath = join(scopeDir(scope), `${pageName}.md`);
64
- if (!existsSync(filePath)) return null;
65
- const content = readFileSync(filePath, 'utf-8');
66
- return { scope, name: pageName, content };
67
- }
68
-
69
- /**
70
- * Write (create or overwrite) a wiki page.
71
- */
72
- export function writeWikiPage(scope: WikiScope, pageName: string, content: string): WikiPage {
73
- const dir = scopeDir(scope);
74
- mkdirSync(dir, { recursive: true });
75
- const filePath = join(dir, `${pageName}.md`);
76
- writeFileSync(filePath, content, 'utf-8');
77
- logger().info({ scope, pageName }, 'Wiki page written');
78
- return { scope, name: pageName, content };
79
- }
80
-
81
- /**
82
- * Search wiki pages by keyword across one or more scopes.
83
- * Returns matching pages with context lines.
84
- */
85
- export function searchWiki(keyword: string, scopes: WikiScope[]): WikiSearchResult[] {
86
- const results: WikiSearchResult[] = [];
87
- const lower = keyword.toLowerCase();
88
-
89
- for (const scope of scopes) {
90
- const pages = listWikiPages(scope);
91
- for (const pageName of pages) {
92
- const page = readWikiPage(scope, pageName);
93
- if (!page) continue;
94
-
95
- const lines = page.content.split('\n');
96
- const matches: string[] = [];
97
- for (const line of lines) {
98
- if (line.toLowerCase().includes(lower)) {
99
- matches.push(line.trim());
100
- }
101
- }
102
-
103
- if (matches.length > 0) {
104
- results.push({ scope, name: pageName, matches: matches.slice(0, 5) });
105
- }
106
- }
107
- }
108
-
109
- return results;
110
- }
111
-
112
- /**
113
- * Get accessible scopes for a squad agent.
114
- */
115
- export function getSquadScopes(squadName: string): WikiScope[] {
116
- return ['shared', squadName];
117
- }
118
-
119
- /**
120
- * Get accessible scopes for the orchestrator.
121
- */
122
- export function getOrchestratorScopes(): WikiScope[] {
123
- return ['io', 'shared'];
124
- }
125
-
126
- /**
127
- * Get a summary of available pages for injection into system prompts.
128
- */
129
- export function getPageListing(scopes: WikiScope[]): string {
130
- const sections: string[] = [];
131
- for (const scope of scopes) {
132
- const pages = listWikiPages(scope);
133
- if (pages.length > 0) {
134
- const label = scope === 'io' ? 'IO' : scope === 'shared' ? 'Shared' : `Squad (${scope})`;
135
- sections.push(`${label}: ${pages.join(', ')}`);
136
- }
137
- }
138
- return sections.length > 0 ? sections.join('\n') : '(no wiki pages yet)';
139
- }
package/tsconfig.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "./src"
6
- },
7
- "include": ["src/**/*"],
8
- "references": [{ "path": "../shared" }]
9
- }