terra-hiven 3.2.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/LICENSE.md +20 -0
- package/README.md +233 -0
- package/assets/hiven_logo_v2.png +0 -0
- package/bin/hiven.js +225 -0
- package/console/.nojekyll +0 -0
- package/console/app.js +588 -0
- package/console/assets/hiven_logo_v2.png +0 -0
- package/console/data/swarms_history.json +38 -0
- package/console/index.html +694 -0
- package/console/style.css +1039 -0
- package/console/webbl.config.json +5 -0
- package/dist/api.d.ts +13 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +142 -0
- package/dist/api.js.map +1 -0
- package/dist/honeycombs.d.ts +30 -0
- package/dist/honeycombs.d.ts.map +1 -0
- package/dist/honeycombs.js +221 -0
- package/dist/honeycombs.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +133 -0
- package/dist/index.js.map +1 -0
- package/dist/inference.d.ts +33 -0
- package/dist/inference.d.ts.map +1 -0
- package/dist/inference.js +217 -0
- package/dist/inference.js.map +1 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +54 -0
- package/dist/server.js.map +1 -0
- package/dist/swarm.d.ts +30 -0
- package/dist/swarm.d.ts.map +1 -0
- package/dist/swarm.js +196 -0
- package/dist/swarm.js.map +1 -0
- package/dist/types.d.ts +117 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/vault.d.ts +19 -0
- package/dist/vault.d.ts.map +1 -0
- package/dist/vault.js +99 -0
- package/dist/vault.js.map +1 -0
- package/package.json +63 -0
- package/templates/.github/workflows/swarm.yml +229 -0
- package/templates/package.json +13 -0
- package/templates/swarm_runner.js +1594 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hiven Engine V3 - TypeScript Type Definitions
|
|
3
|
+
* Autonomous Swarm Intelligence & Logic Synthesizer
|
|
4
|
+
*/
|
|
5
|
+
export type SwarmPhase = 'phase_0' | 'phase_1_architect' | 'phase_2_coder' | 'phase_3_validator' | 'phase_4_consolidator' | 'self_healing';
|
|
6
|
+
export type SwarmStatusType = 'queued' | 'running' | 'validating' | 'healing' | 'completed' | 'failed' | 'cancelled';
|
|
7
|
+
export interface KombeeWorker {
|
|
8
|
+
id: number;
|
|
9
|
+
role: 'architect' | 'coder' | 'validator' | 'healer';
|
|
10
|
+
status: 'idle' | 'running' | 'done' | 'failed';
|
|
11
|
+
currentFile?: string;
|
|
12
|
+
partitionGroup?: number;
|
|
13
|
+
logs: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface HoneycombPattern {
|
|
16
|
+
id: string;
|
|
17
|
+
language: string;
|
|
18
|
+
framework?: string;
|
|
19
|
+
patternType: 'architecture' | 'testing' | 'anti_pattern' | 'best_practice' | 'library';
|
|
20
|
+
summary: string;
|
|
21
|
+
doDirective: string;
|
|
22
|
+
dontDirective?: string;
|
|
23
|
+
exampleSnippet?: string;
|
|
24
|
+
successRate?: number;
|
|
25
|
+
usageCount: number;
|
|
26
|
+
discoveredAt: string;
|
|
27
|
+
lastUsedAt: string;
|
|
28
|
+
}
|
|
29
|
+
export interface HoneycombCell {
|
|
30
|
+
key: string;
|
|
31
|
+
value: any;
|
|
32
|
+
ttl?: number;
|
|
33
|
+
expiresAt?: number;
|
|
34
|
+
createdAt: string;
|
|
35
|
+
updatedAt: string;
|
|
36
|
+
}
|
|
37
|
+
export interface SearchReplaceBlock {
|
|
38
|
+
filePath: string;
|
|
39
|
+
searchContent: string;
|
|
40
|
+
replaceContent: string;
|
|
41
|
+
occurrence?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface TaskNode {
|
|
44
|
+
id: string;
|
|
45
|
+
title: string;
|
|
46
|
+
description: string;
|
|
47
|
+
dependencies: string[];
|
|
48
|
+
assignedFiles: string[];
|
|
49
|
+
status: 'pending' | 'in_progress' | 'completed' | 'failed';
|
|
50
|
+
resultSummary?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface TaskGraph {
|
|
53
|
+
taskId: string;
|
|
54
|
+
rootGoal: string;
|
|
55
|
+
nodes: TaskNode[];
|
|
56
|
+
createdAt: string;
|
|
57
|
+
}
|
|
58
|
+
export interface SelfHealingReport {
|
|
59
|
+
attempt: number;
|
|
60
|
+
maxAttempts: number;
|
|
61
|
+
failedCommand: string;
|
|
62
|
+
errorSnippet: string;
|
|
63
|
+
healedFiles: string[];
|
|
64
|
+
resolved: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface SwarmOptions {
|
|
67
|
+
repo: string;
|
|
68
|
+
instruction: string;
|
|
69
|
+
branch?: string;
|
|
70
|
+
baseBranch?: string;
|
|
71
|
+
workerCount?: number;
|
|
72
|
+
testCommand?: string;
|
|
73
|
+
filesToEdit?: string[];
|
|
74
|
+
maxSelfHealingRetries?: number;
|
|
75
|
+
models?: {
|
|
76
|
+
architect?: string;
|
|
77
|
+
coder?: string;
|
|
78
|
+
validator?: string;
|
|
79
|
+
};
|
|
80
|
+
dryRun?: boolean;
|
|
81
|
+
}
|
|
82
|
+
export interface SwarmResult {
|
|
83
|
+
swarmId: string;
|
|
84
|
+
repo: string;
|
|
85
|
+
branch: string;
|
|
86
|
+
status: SwarmStatusType;
|
|
87
|
+
pullRequestUrl?: string;
|
|
88
|
+
commitSha?: string;
|
|
89
|
+
modifiedFiles: string[];
|
|
90
|
+
healingAttempts: number;
|
|
91
|
+
taskGraph?: TaskGraph;
|
|
92
|
+
summary: string;
|
|
93
|
+
startedAt: string;
|
|
94
|
+
completedAt?: string;
|
|
95
|
+
durationMs?: number;
|
|
96
|
+
}
|
|
97
|
+
export interface SwarmStatus {
|
|
98
|
+
swarmId: string;
|
|
99
|
+
repo: string;
|
|
100
|
+
status: SwarmStatusType;
|
|
101
|
+
currentPhase: SwarmPhase;
|
|
102
|
+
progressPercent: number;
|
|
103
|
+
activeWorkers: number;
|
|
104
|
+
logs: string[];
|
|
105
|
+
prUrl?: string;
|
|
106
|
+
startedAt: string;
|
|
107
|
+
updatedAt: string;
|
|
108
|
+
}
|
|
109
|
+
export interface HivenConfig {
|
|
110
|
+
githubToken?: string;
|
|
111
|
+
storageRepo?: string;
|
|
112
|
+
defaultBranch?: string;
|
|
113
|
+
defaultWorkers?: number;
|
|
114
|
+
ollamaHost?: string;
|
|
115
|
+
port?: number;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,mBAAmB,GAAG,eAAe,GAAG,mBAAmB,GAAG,sBAAsB,GAAG,cAAc,CAAC;AAE3I,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAErH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,WAAW,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,CAAC;IACrD,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,cAAc,GAAG,SAAS,GAAG,cAAc,GAAG,eAAe,GAAG,SAAS,CAAC;IACvF,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;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AAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
package/dist/vault.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface VaultFile {
|
|
2
|
+
path: string;
|
|
3
|
+
content: string;
|
|
4
|
+
sha?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Hiven Vault Manager
|
|
8
|
+
* Manages repository state, swarm persistence, and Honeycombs sync in .hiven-storage.
|
|
9
|
+
*/
|
|
10
|
+
export declare class HivenVault {
|
|
11
|
+
private octokit?;
|
|
12
|
+
private storageRepo;
|
|
13
|
+
private owner?;
|
|
14
|
+
constructor(token?: string, storageRepo?: string);
|
|
15
|
+
init(): Promise<boolean>;
|
|
16
|
+
saveFile(filePath: string, content: string, commitMessage?: string): Promise<boolean>;
|
|
17
|
+
readFile(filePath: string): Promise<string | null>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=vault.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vault.d.ts","sourceRoot":"","sources":["../src/vault.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAC,CAAU;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,KAAK,CAAC,CAAS;gBAEX,KAAK,CAAC,EAAE,MAAM,EAAE,WAAW,GAAE,MAAyB;IAOrD,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;IA+BxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,GAAE,MAAoC,GAAG,OAAO,CAAC,OAAO,CAAC;IA+BlH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAgBhE"}
|
package/dist/vault.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Octokit } from "@octokit/rest";
|
|
2
|
+
/**
|
|
3
|
+
* Hiven Vault Manager
|
|
4
|
+
* Manages repository state, swarm persistence, and Honeycombs sync in .hiven-storage.
|
|
5
|
+
*/
|
|
6
|
+
export class HivenVault {
|
|
7
|
+
octokit;
|
|
8
|
+
storageRepo;
|
|
9
|
+
owner;
|
|
10
|
+
constructor(token, storageRepo = ".hiven-storage") {
|
|
11
|
+
this.storageRepo = storageRepo;
|
|
12
|
+
if (token) {
|
|
13
|
+
this.octokit = new Octokit({ auth: token });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
async init() {
|
|
17
|
+
if (!this.octokit)
|
|
18
|
+
return false;
|
|
19
|
+
try {
|
|
20
|
+
const user = await this.octokit.users.getAuthenticated();
|
|
21
|
+
this.owner = user.data.login;
|
|
22
|
+
// Check if .hiven-storage exists, create if missing
|
|
23
|
+
try {
|
|
24
|
+
await this.octokit.repos.get({
|
|
25
|
+
owner: this.owner,
|
|
26
|
+
repo: this.storageRepo
|
|
27
|
+
});
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
if (err.status === 404) {
|
|
32
|
+
await this.octokit.repos.createForAuthenticatedUser({
|
|
33
|
+
name: this.storageRepo,
|
|
34
|
+
description: "Hiven Storage Vault — Autonomous Swarm State, Honeycombs & Execution History",
|
|
35
|
+
private: true,
|
|
36
|
+
auto_init: true
|
|
37
|
+
});
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
throw err;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
console.warn(`[Vault] Could not initialize remote repository: ${e.message}`);
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async saveFile(filePath, content, commitMessage = "feat(hiven): update state") {
|
|
49
|
+
if (!this.octokit || !this.owner)
|
|
50
|
+
return false;
|
|
51
|
+
try {
|
|
52
|
+
let sha;
|
|
53
|
+
try {
|
|
54
|
+
const existing = await this.octokit.repos.getContent({
|
|
55
|
+
owner: this.owner,
|
|
56
|
+
repo: this.storageRepo,
|
|
57
|
+
path: filePath
|
|
58
|
+
});
|
|
59
|
+
if ("sha" in existing.data) {
|
|
60
|
+
sha = existing.data.sha;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// File does not exist yet
|
|
65
|
+
}
|
|
66
|
+
await this.octokit.repos.createOrUpdateFileContents({
|
|
67
|
+
owner: this.owner,
|
|
68
|
+
repo: this.storageRepo,
|
|
69
|
+
path: filePath,
|
|
70
|
+
message: commitMessage,
|
|
71
|
+
content: Buffer.from(content, "utf-8").toString("base64"),
|
|
72
|
+
sha
|
|
73
|
+
});
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async readFile(filePath) {
|
|
81
|
+
if (!this.octokit || !this.owner)
|
|
82
|
+
return null;
|
|
83
|
+
try {
|
|
84
|
+
const res = await this.octokit.repos.getContent({
|
|
85
|
+
owner: this.owner,
|
|
86
|
+
repo: this.storageRepo,
|
|
87
|
+
path: filePath
|
|
88
|
+
});
|
|
89
|
+
if ("content" in res.data) {
|
|
90
|
+
return Buffer.from(res.data.content, "base64").toString("utf-8");
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=vault.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vault.js","sourceRoot":"","sources":["../src/vault.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAQxC;;;GAGG;AACH,MAAM,OAAO,UAAU;IACb,OAAO,CAAW;IAClB,WAAW,CAAS;IACpB,KAAK,CAAU;IAEvB,YAAY,KAAc,EAAE,cAAsB,gBAAgB;QAChE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,IAAI;QACf,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAChC,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;YACzD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;YAE7B,oDAAoD;YACpD,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;oBAC3B,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,IAAI,EAAE,IAAI,CAAC,WAAW;iBACvB,CAAC,CAAC;gBACH,OAAO,IAAI,CAAC;YACd,CAAC;YAAC,OAAO,GAAQ,EAAE,CAAC;gBAClB,IAAI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,EAAE,QAAQ;gBACd,OAAO,EAAE,aAAa;gBACtB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBACzD,GAAG;aACJ,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,QAAgB;QACpC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QAC9C,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC;gBAC9C,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,IAAI,EAAE,IAAI,CAAC,WAAW;gBACtB,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;YACH,IAAI,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;gBAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACnE,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "terra-hiven",
|
|
3
|
+
"version": "3.2.0",
|
|
4
|
+
"description": "Hiven — Autonomous Cognitive Swarm, Distributed Multi-Agent Engineering & Collective Honeycombs Memory for the Terra Ecosystem",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"hiven": "./bin/hiven.js",
|
|
10
|
+
"terra-hiven": "./bin/hiven.js"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"prepublishOnly": "npm run build",
|
|
15
|
+
"start": "node dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist/",
|
|
19
|
+
"bin/",
|
|
20
|
+
"console/",
|
|
21
|
+
"assets/",
|
|
22
|
+
"templates/",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE.md"
|
|
25
|
+
],
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"import": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"terra",
|
|
34
|
+
"hiven",
|
|
35
|
+
"swarm",
|
|
36
|
+
"multi-agent",
|
|
37
|
+
"autonomous-coding",
|
|
38
|
+
"honeycombs",
|
|
39
|
+
"self-healing",
|
|
40
|
+
"ai-engineer",
|
|
41
|
+
"github-actions",
|
|
42
|
+
"zero-cost"
|
|
43
|
+
],
|
|
44
|
+
"author": "AMG Logicalis / Terra Ecosystem",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/amglogicalis/hiven-komb-queen.git"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=18.0.0"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@octokit/rest": "^21.0.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/node": "^22.0.0",
|
|
61
|
+
"typescript": "^5.5.0"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# swarm.yml
|
|
2
|
+
# Hiven Worker Swarm Workflow Template - Multi-Stage Kōmbee Pipeline
|
|
3
|
+
# Role: Principal Distributed Systems & MLOps Architect
|
|
4
|
+
|
|
5
|
+
name: Hiven Swarm Execution
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
repository_dispatch:
|
|
9
|
+
types: [hiven-trigger]
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
pull-requests: write
|
|
14
|
+
actions: write
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
# ==========================================================
|
|
18
|
+
# FASE 1: CONTEXT (Reader & Architect Kōmbees)
|
|
19
|
+
# ==========================================================
|
|
20
|
+
phase1-context:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout Worker Repo
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- name: Setup Node.js
|
|
27
|
+
uses: actions/setup-node@v4
|
|
28
|
+
with:
|
|
29
|
+
node-version: '20'
|
|
30
|
+
|
|
31
|
+
- name: Install Dependencies
|
|
32
|
+
run: npm install @octokit/rest dotenv chalk
|
|
33
|
+
|
|
34
|
+
- name: Restore Ollama Cache
|
|
35
|
+
uses: actions/cache@v4
|
|
36
|
+
with:
|
|
37
|
+
path: ~/.ollama
|
|
38
|
+
key: ${{ runner.os }}-ollama-models-v1
|
|
39
|
+
restore-keys: |
|
|
40
|
+
${{ runner.os }}-ollama-models-
|
|
41
|
+
|
|
42
|
+
- name: Install & Start Ollama
|
|
43
|
+
run: |
|
|
44
|
+
curl -fsSL https://ollama.com/install.sh | sh
|
|
45
|
+
ollama serve > ollama.log 2>&1 &
|
|
46
|
+
for i in {1..15}; do
|
|
47
|
+
if curl -s http://localhost:11434/api/tags > /dev/null; then break; fi
|
|
48
|
+
sleep 2
|
|
49
|
+
done
|
|
50
|
+
- name: Debug Environment Variables
|
|
51
|
+
run: |
|
|
52
|
+
echo "Checking trigger payload variables:"
|
|
53
|
+
echo "TARGET_REPO is set: ${{ github.event.client_payload.target_repo != '' }}"
|
|
54
|
+
echo "TARGET_BRANCH is set: ${{ github.event.client_payload.target_branch != '' }}"
|
|
55
|
+
echo "INSTRUCTION is set: ${{ github.event.client_payload.instruction != '' }}"
|
|
56
|
+
echo "TOKEN is set: ${{ github.event.client_payload.token != '' }}"
|
|
57
|
+
echo "FILES_TO_EDIT is set: ${{ github.event.client_payload.files != '' }}"
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
- name: Run Context Kōmbees
|
|
61
|
+
env:
|
|
62
|
+
GITHUB_TOKEN: ${{ github.event.client_payload.token }}
|
|
63
|
+
TARGET_REPO: ${{ github.event.client_payload.target_repo }}
|
|
64
|
+
TARGET_BRANCH: ${{ github.event.client_payload.target_branch }}
|
|
65
|
+
INSTRUCTION: ${{ github.event.client_payload.instruction }}
|
|
66
|
+
FILES_TO_EDIT: ${{ github.event.client_payload.files }}
|
|
67
|
+
STATUS_COMMENT_ID: ${{ github.event.client_payload.status_comment_id }}
|
|
68
|
+
run: node swarm_runner.js --phase context
|
|
69
|
+
|
|
70
|
+
- name: Upload Context Artifact
|
|
71
|
+
uses: actions/upload-artifact@v4
|
|
72
|
+
with:
|
|
73
|
+
name: swarm-context
|
|
74
|
+
path: swarm_context.json
|
|
75
|
+
|
|
76
|
+
# ==========================================================
|
|
77
|
+
# FASE 2: EXECUTION (Coder Kōmbees Matrix Strategy)
|
|
78
|
+
# ==========================================================
|
|
79
|
+
phase2-execution:
|
|
80
|
+
needs: phase1-context
|
|
81
|
+
runs-on: ubuntu-latest
|
|
82
|
+
strategy:
|
|
83
|
+
matrix:
|
|
84
|
+
kombee_index: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
85
|
+
steps:
|
|
86
|
+
- name: Checkout Worker Repo
|
|
87
|
+
uses: actions/checkout@v4
|
|
88
|
+
|
|
89
|
+
- name: Setup Node.js
|
|
90
|
+
uses: actions/setup-node@v4
|
|
91
|
+
with:
|
|
92
|
+
node-version: '20'
|
|
93
|
+
|
|
94
|
+
- name: Install Dependencies
|
|
95
|
+
run: npm install @octokit/rest dotenv chalk
|
|
96
|
+
|
|
97
|
+
- name: Download Context Artifact
|
|
98
|
+
uses: actions/download-artifact@v4
|
|
99
|
+
with:
|
|
100
|
+
name: swarm-context
|
|
101
|
+
|
|
102
|
+
- name: Restore Ollama Cache
|
|
103
|
+
uses: actions/cache@v4
|
|
104
|
+
with:
|
|
105
|
+
path: ~/.ollama
|
|
106
|
+
key: ${{ runner.os }}-ollama-models-v1
|
|
107
|
+
restore-keys: |
|
|
108
|
+
${{ runner.os }}-ollama-models-
|
|
109
|
+
|
|
110
|
+
- name: Install & Start Ollama
|
|
111
|
+
run: |
|
|
112
|
+
curl -fsSL https://ollama.com/install.sh | sh
|
|
113
|
+
ollama serve > ollama.log 2>&1 &
|
|
114
|
+
for i in {1..15}; do
|
|
115
|
+
if curl -s http://localhost:11434/api/tags > /dev/null; then break; fi
|
|
116
|
+
sleep 2
|
|
117
|
+
done
|
|
118
|
+
|
|
119
|
+
- name: Run Coder Kōmbee Node ${{ matrix.kombee_index }}
|
|
120
|
+
env:
|
|
121
|
+
GITHUB_TOKEN: ${{ github.event.client_payload.token }}
|
|
122
|
+
TARGET_REPO: ${{ github.event.client_payload.target_repo }}
|
|
123
|
+
TARGET_BRANCH: ${{ github.event.client_payload.target_branch }}
|
|
124
|
+
INSTRUCTION: ${{ github.event.client_payload.instruction }}
|
|
125
|
+
FILES_TO_EDIT: ${{ github.event.client_payload.files }}
|
|
126
|
+
KOMBEE_INDEX: ${{ matrix.kombee_index }}
|
|
127
|
+
STATUS_COMMENT_ID: ${{ github.event.client_payload.status_comment_id }}
|
|
128
|
+
run: node swarm_runner.js --phase execution --index ${{ matrix.kombee_index }}
|
|
129
|
+
|
|
130
|
+
- name: Upload Coder Output
|
|
131
|
+
uses: actions/upload-artifact@v4
|
|
132
|
+
with:
|
|
133
|
+
name: coder-output-${{ matrix.kombee_index }}
|
|
134
|
+
path: coder_output_${{ matrix.kombee_index }}.json
|
|
135
|
+
|
|
136
|
+
# ==========================================================
|
|
137
|
+
# FASE 3: VALIDATION (Tester & Reviewer Kōmbees)
|
|
138
|
+
# ==========================================================
|
|
139
|
+
phase3-validation:
|
|
140
|
+
needs: phase2-execution
|
|
141
|
+
runs-on: ubuntu-latest
|
|
142
|
+
strategy:
|
|
143
|
+
matrix:
|
|
144
|
+
kombee_index: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
145
|
+
steps:
|
|
146
|
+
- name: Checkout Worker Repo
|
|
147
|
+
uses: actions/checkout@v4
|
|
148
|
+
|
|
149
|
+
- name: Setup Node.js
|
|
150
|
+
uses: actions/setup-node@v4
|
|
151
|
+
with:
|
|
152
|
+
node-version: '20'
|
|
153
|
+
|
|
154
|
+
- name: Install Dependencies
|
|
155
|
+
run: npm install @octokit/rest dotenv chalk
|
|
156
|
+
|
|
157
|
+
- name: Download Context Artifact
|
|
158
|
+
uses: actions/download-artifact@v4
|
|
159
|
+
with:
|
|
160
|
+
name: swarm-context
|
|
161
|
+
|
|
162
|
+
- name: Download Coder Output
|
|
163
|
+
uses: actions/download-artifact@v4
|
|
164
|
+
with:
|
|
165
|
+
name: coder-output-${{ matrix.kombee_index }}
|
|
166
|
+
|
|
167
|
+
- name: Run Validator Kōmbee Node ${{ matrix.kombee_index }}
|
|
168
|
+
env:
|
|
169
|
+
GITHUB_TOKEN: ${{ github.event.client_payload.token }}
|
|
170
|
+
TARGET_REPO: ${{ github.event.client_payload.target_repo }}
|
|
171
|
+
TARGET_BRANCH: ${{ github.event.client_payload.target_branch }}
|
|
172
|
+
INSTRUCTION: ${{ github.event.client_payload.instruction }}
|
|
173
|
+
KOMBEE_INDEX: ${{ matrix.kombee_index }}
|
|
174
|
+
STATUS_COMMENT_ID: ${{ github.event.client_payload.status_comment_id }}
|
|
175
|
+
run: node swarm_runner.js --phase validation --index ${{ matrix.kombee_index }}
|
|
176
|
+
|
|
177
|
+
- name: Upload Validation Output
|
|
178
|
+
uses: actions/upload-artifact@v4
|
|
179
|
+
with:
|
|
180
|
+
name: validation-output-${{ matrix.kombee_index }}
|
|
181
|
+
path: validation_output_${{ matrix.kombee_index }}.json
|
|
182
|
+
|
|
183
|
+
# ==========================================================
|
|
184
|
+
# FASE 4: CONSOLIDATION (Committer & Uplink Kōmbees)
|
|
185
|
+
# ==========================================================
|
|
186
|
+
phase4-consolidation:
|
|
187
|
+
needs: phase3-validation
|
|
188
|
+
runs-on: ubuntu-latest
|
|
189
|
+
steps:
|
|
190
|
+
- name: Checkout Worker Repo
|
|
191
|
+
uses: actions/checkout@v4
|
|
192
|
+
|
|
193
|
+
- name: Setup Node.js
|
|
194
|
+
uses: actions/setup-node@v4
|
|
195
|
+
with:
|
|
196
|
+
node-version: '20'
|
|
197
|
+
|
|
198
|
+
- name: Install Dependencies
|
|
199
|
+
run: npm install @octokit/rest dotenv chalk
|
|
200
|
+
|
|
201
|
+
- name: Download Context Artifact
|
|
202
|
+
uses: actions/download-artifact@v4
|
|
203
|
+
with:
|
|
204
|
+
name: swarm-context
|
|
205
|
+
|
|
206
|
+
- name: Download All Coder Outputs
|
|
207
|
+
uses: actions/download-artifact@v4
|
|
208
|
+
with:
|
|
209
|
+
pattern: coder-output-*
|
|
210
|
+
merge-multiple: true
|
|
211
|
+
|
|
212
|
+
- name: Download All Validation Outputs
|
|
213
|
+
uses: actions/download-artifact@v4
|
|
214
|
+
with:
|
|
215
|
+
pattern: validation-output-*
|
|
216
|
+
merge-multiple: true
|
|
217
|
+
|
|
218
|
+
- name: Run Consolidation Kōmbees
|
|
219
|
+
env:
|
|
220
|
+
GITHUB_TOKEN: ${{ github.event.client_payload.token }}
|
|
221
|
+
TARGET_REPO: ${{ github.event.client_payload.target_repo }}
|
|
222
|
+
TARGET_BRANCH: ${{ github.event.client_payload.target_branch }}
|
|
223
|
+
INSTRUCTION: ${{ github.event.client_payload.instruction }}
|
|
224
|
+
PR_NUMBER: ${{ github.event.client_payload.pr_number }}
|
|
225
|
+
ISSUE_NUMBER: ${{ github.event.client_payload.issue_number }}
|
|
226
|
+
STATUS_COMMENT_ID: ${{ github.event.client_payload.status_comment_id }}
|
|
227
|
+
DRONE_UPLINK_URL: ${{ github.event.client_payload.drone_uplink }}
|
|
228
|
+
WORKER_ID: ${{ github.event.client_payload.worker_id }}
|
|
229
|
+
run: node swarm_runner.js --phase consolidation
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hiven-komb-worker-cell",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Compute execution cell for Hiven Kōmb swarm",
|
|
5
|
+
"main": "swarm_runner.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@octokit/rest": "^21.0.0",
|
|
9
|
+
"chalk": "^5.3.0",
|
|
10
|
+
"dotenv": "^16.4.5"
|
|
11
|
+
},
|
|
12
|
+
"license": "MIT"
|
|
13
|
+
}
|