azerclaw 1.0.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 +21 -0
- package/README.md +222 -0
- package/bin/azerclaw.ts +290 -0
- package/dist/bin/azerclaw.d.ts +19 -0
- package/dist/bin/azerclaw.d.ts.map +1 -0
- package/dist/bin/azerclaw.js +247 -0
- package/dist/bin/azerclaw.js.map +1 -0
- package/dist/skills/code-review/SKILL.md +46 -0
- package/dist/skills/daily-briefing/SKILL.md +35 -0
- package/dist/skills/git-assistant/SKILL.md +31 -0
- package/dist/src/agents/builtin.d.ts +52 -0
- package/dist/src/agents/builtin.d.ts.map +1 -0
- package/dist/src/agents/builtin.js +497 -0
- package/dist/src/agents/builtin.js.map +1 -0
- package/dist/src/agents/loader.d.ts +23 -0
- package/dist/src/agents/loader.d.ts.map +1 -0
- package/dist/src/agents/loader.js +154 -0
- package/dist/src/agents/loader.js.map +1 -0
- package/dist/src/channels/adapter.d.ts +57 -0
- package/dist/src/channels/adapter.d.ts.map +1 -0
- package/dist/src/channels/adapter.js +45 -0
- package/dist/src/channels/adapter.js.map +1 -0
- package/dist/src/channels/discord.d.ts +23 -0
- package/dist/src/channels/discord.d.ts.map +1 -0
- package/dist/src/channels/discord.js +129 -0
- package/dist/src/channels/discord.js.map +1 -0
- package/dist/src/channels/slack.d.ts +19 -0
- package/dist/src/channels/slack.d.ts.map +1 -0
- package/dist/src/channels/slack.js +97 -0
- package/dist/src/channels/slack.js.map +1 -0
- package/dist/src/channels/telegram.d.ts +20 -0
- package/dist/src/channels/telegram.d.ts.map +1 -0
- package/dist/src/channels/telegram.js +87 -0
- package/dist/src/channels/telegram.js.map +1 -0
- package/dist/src/channels/webhook.d.ts +19 -0
- package/dist/src/channels/webhook.d.ts.map +1 -0
- package/dist/src/channels/webhook.js +124 -0
- package/dist/src/channels/webhook.js.map +1 -0
- package/dist/src/cli/animations/fish.d.ts +33 -0
- package/dist/src/cli/animations/fish.d.ts.map +1 -0
- package/dist/src/cli/animations/fish.js +297 -0
- package/dist/src/cli/animations/fish.js.map +1 -0
- package/dist/src/cli/commands/agents.d.ts +8 -0
- package/dist/src/cli/commands/agents.d.ts.map +1 -0
- package/dist/src/cli/commands/agents.js +104 -0
- package/dist/src/cli/commands/agents.js.map +1 -0
- package/dist/src/cli/commands/chat.d.ts +9 -0
- package/dist/src/cli/commands/chat.d.ts.map +1 -0
- package/dist/src/cli/commands/chat.js +236 -0
- package/dist/src/cli/commands/chat.js.map +1 -0
- package/dist/src/cli/commands/config.d.ts +9 -0
- package/dist/src/cli/commands/config.d.ts.map +1 -0
- package/dist/src/cli/commands/config.js +97 -0
- package/dist/src/cli/commands/config.js.map +1 -0
- package/dist/src/cli/commands/doctor.d.ts +8 -0
- package/dist/src/cli/commands/doctor.d.ts.map +1 -0
- package/dist/src/cli/commands/doctor.js +159 -0
- package/dist/src/cli/commands/doctor.js.map +1 -0
- package/dist/src/cli/commands/models.d.ts +7 -0
- package/dist/src/cli/commands/models.d.ts.map +1 -0
- package/dist/src/cli/commands/models.js +64 -0
- package/dist/src/cli/commands/models.js.map +1 -0
- package/dist/src/cli/commands/onboard.d.ts +6 -0
- package/dist/src/cli/commands/onboard.d.ts.map +1 -0
- package/dist/src/cli/commands/onboard.js +150 -0
- package/dist/src/cli/commands/onboard.js.map +1 -0
- package/dist/src/cli/commands/run.d.ts +9 -0
- package/dist/src/cli/commands/run.d.ts.map +1 -0
- package/dist/src/cli/commands/run.js +84 -0
- package/dist/src/cli/commands/run.js.map +1 -0
- package/dist/src/cli/commands/tui.d.ts +6 -0
- package/dist/src/cli/commands/tui.d.ts.map +1 -0
- package/dist/src/cli/commands/tui.js +252 -0
- package/dist/src/cli/commands/tui.js.map +1 -0
- package/dist/src/config/manager.d.ts +80 -0
- package/dist/src/config/manager.d.ts.map +1 -0
- package/dist/src/config/manager.js +232 -0
- package/dist/src/config/manager.js.map +1 -0
- package/dist/src/config/schema.d.ts +910 -0
- package/dist/src/config/schema.d.ts.map +1 -0
- package/dist/src/config/schema.js +138 -0
- package/dist/src/config/schema.js.map +1 -0
- package/dist/src/core/gateway.d.ts +35 -0
- package/dist/src/core/gateway.d.ts.map +1 -0
- package/dist/src/core/gateway.js +205 -0
- package/dist/src/core/gateway.js.map +1 -0
- package/dist/src/core/runtime.d.ts +69 -0
- package/dist/src/core/runtime.d.ts.map +1 -0
- package/dist/src/core/runtime.js +188 -0
- package/dist/src/core/runtime.js.map +1 -0
- package/dist/src/core/security.d.ts +55 -0
- package/dist/src/core/security.d.ts.map +1 -0
- package/dist/src/core/security.js +241 -0
- package/dist/src/core/security.js.map +1 -0
- package/dist/src/index.d.ts +24 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +46 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/memory/store.d.ts +65 -0
- package/dist/src/memory/store.d.ts.map +1 -0
- package/dist/src/memory/store.js +250 -0
- package/dist/src/memory/store.js.map +1 -0
- package/dist/src/providers/anthropic.d.ts +25 -0
- package/dist/src/providers/anthropic.d.ts.map +1 -0
- package/dist/src/providers/anthropic.js +163 -0
- package/dist/src/providers/anthropic.js.map +1 -0
- package/dist/src/providers/base.d.ts +90 -0
- package/dist/src/providers/base.d.ts.map +1 -0
- package/dist/src/providers/base.js +12 -0
- package/dist/src/providers/base.js.map +1 -0
- package/dist/src/providers/google.d.ts +23 -0
- package/dist/src/providers/google.d.ts.map +1 -0
- package/dist/src/providers/google.js +118 -0
- package/dist/src/providers/google.js.map +1 -0
- package/dist/src/providers/ollama.d.ts +24 -0
- package/dist/src/providers/ollama.d.ts.map +1 -0
- package/dist/src/providers/ollama.js +81 -0
- package/dist/src/providers/ollama.js.map +1 -0
- package/dist/src/providers/openai.d.ts +30 -0
- package/dist/src/providers/openai.d.ts.map +1 -0
- package/dist/src/providers/openai.js +187 -0
- package/dist/src/providers/openai.js.map +1 -0
- package/dist/src/providers/router.d.ts +20 -0
- package/dist/src/providers/router.d.ts.map +1 -0
- package/dist/src/providers/router.js +156 -0
- package/dist/src/providers/router.js.map +1 -0
- package/dist/src/scheduler/heartbeat.d.ts +62 -0
- package/dist/src/scheduler/heartbeat.d.ts.map +1 -0
- package/dist/src/scheduler/heartbeat.js +267 -0
- package/dist/src/scheduler/heartbeat.js.map +1 -0
- package/dist/src/skills/loader.d.ts +25 -0
- package/dist/src/skills/loader.d.ts.map +1 -0
- package/dist/src/skills/loader.js +165 -0
- package/dist/src/skills/loader.js.map +1 -0
- package/dist/src/tools/advanced.d.ts +15 -0
- package/dist/src/tools/advanced.d.ts.map +1 -0
- package/dist/src/tools/advanced.js +102 -0
- package/dist/src/tools/advanced.js.map +1 -0
- package/dist/src/tools/filesystem.d.ts +10 -0
- package/dist/src/tools/filesystem.d.ts.map +1 -0
- package/dist/src/tools/filesystem.js +160 -0
- package/dist/src/tools/filesystem.js.map +1 -0
- package/dist/src/tools/registry.d.ts +26 -0
- package/dist/src/tools/registry.d.ts.map +1 -0
- package/dist/src/tools/registry.js +49 -0
- package/dist/src/tools/registry.js.map +1 -0
- package/dist/src/tools/shell.d.ts +7 -0
- package/dist/src/tools/shell.d.ts.map +1 -0
- package/dist/src/tools/shell.js +46 -0
- package/dist/src/tools/shell.js.map +1 -0
- package/dist/src/workflow/engine.d.ts +65 -0
- package/dist/src/workflow/engine.d.ts.map +1 -0
- package/dist/src/workflow/engine.js +297 -0
- package/dist/src/workflow/engine.js.map +1 -0
- package/package.json +113 -0
- package/skills/code-review/SKILL.md +46 -0
- package/skills/daily-briefing/SKILL.md +35 -0
- package/skills/git-assistant/SKILL.md +31 -0
- package/templates/HEARTBEAT.md +27 -0
- package/templates/IDENTITY.md +23 -0
- package/templates/deploy-pipeline.fishbone +39 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ๐ AZERCLAW Fishbone Workflow Engine
|
|
3
|
+
* Deterministic, typed pipeline system โ replaces OpenClaw's "Lobster" engine.
|
|
4
|
+
* Supports .fishbone files for defining multi-step workflows with approval gates.
|
|
5
|
+
*/
|
|
6
|
+
export interface FishboneStep {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
type: 'agent' | 'shell' | 'condition' | 'approval' | 'parallel' | 'transform';
|
|
10
|
+
action: string;
|
|
11
|
+
inputs?: Record<string, string>;
|
|
12
|
+
outputs?: string[];
|
|
13
|
+
requiresApproval?: boolean;
|
|
14
|
+
onError?: 'stop' | 'continue' | 'retry';
|
|
15
|
+
maxRetries?: number;
|
|
16
|
+
timeout?: number;
|
|
17
|
+
children?: FishboneStep[];
|
|
18
|
+
}
|
|
19
|
+
export interface FishboneWorkflow {
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
version: string;
|
|
23
|
+
trigger?: string;
|
|
24
|
+
variables: Record<string, string>;
|
|
25
|
+
steps: FishboneStep[];
|
|
26
|
+
}
|
|
27
|
+
export interface WorkflowExecution {
|
|
28
|
+
id: string;
|
|
29
|
+
workflowName: string;
|
|
30
|
+
status: 'running' | 'paused' | 'completed' | 'failed' | 'awaiting_approval';
|
|
31
|
+
currentStepId: string;
|
|
32
|
+
results: Record<string, string>;
|
|
33
|
+
resumeToken?: string;
|
|
34
|
+
startedAt: Date;
|
|
35
|
+
completedAt?: Date;
|
|
36
|
+
error?: string;
|
|
37
|
+
}
|
|
38
|
+
export type WorkflowEventHandler = (event: {
|
|
39
|
+
type: 'step_start' | 'step_complete' | 'step_error' | 'approval_needed' | 'workflow_complete' | 'workflow_error';
|
|
40
|
+
stepId?: string;
|
|
41
|
+
stepName?: string;
|
|
42
|
+
content?: string;
|
|
43
|
+
resumeToken?: string;
|
|
44
|
+
}) => void | Promise<void>;
|
|
45
|
+
export declare function parseFishboneFile(filePath: string): FishboneWorkflow;
|
|
46
|
+
export declare class FishboneEngine {
|
|
47
|
+
private executions;
|
|
48
|
+
/**
|
|
49
|
+
* Execute a workflow from a .fishbone file.
|
|
50
|
+
*/
|
|
51
|
+
execute(workflow: FishboneWorkflow, variables?: Record<string, string>, eventHandler?: WorkflowEventHandler): Promise<WorkflowExecution>;
|
|
52
|
+
/**
|
|
53
|
+
* Resume a paused workflow with a resume token.
|
|
54
|
+
*/
|
|
55
|
+
resume(executionId: string, resumeToken: string): Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Get execution status.
|
|
58
|
+
*/
|
|
59
|
+
getExecution(id: string): WorkflowExecution | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Interpolate variables in a string: {{varName}} โ value
|
|
62
|
+
*/
|
|
63
|
+
private interpolate;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../src/workflow/engine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,CAAC;IAC9E,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM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xE;;OAEG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAIvD;;OAEG;IACH,OAAO,CAAC,WAAW;CAGpB"}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ๐ AZERCLAW Fishbone Workflow Engine
|
|
4
|
+
* Deterministic, typed pipeline system โ replaces OpenClaw's "Lobster" engine.
|
|
5
|
+
* Supports .fishbone files for defining multi-step workflows with approval gates.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.FishboneEngine = void 0;
|
|
42
|
+
exports.parseFishboneFile = parseFishboneFile;
|
|
43
|
+
const fs = __importStar(require("fs"));
|
|
44
|
+
const path = __importStar(require("path"));
|
|
45
|
+
const crypto = __importStar(require("crypto"));
|
|
46
|
+
const runtime_1 = require("../core/runtime");
|
|
47
|
+
const security_1 = require("../core/security");
|
|
48
|
+
// โโโ .fishbone File Parser โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
49
|
+
function parseFishboneFile(filePath) {
|
|
50
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
51
|
+
// Parse YAML-like frontmatter
|
|
52
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
53
|
+
let metadata = {};
|
|
54
|
+
let body = content;
|
|
55
|
+
if (fmMatch) {
|
|
56
|
+
for (const line of fmMatch[1].split('\n')) {
|
|
57
|
+
const colonIdx = line.indexOf(':');
|
|
58
|
+
if (colonIdx > 0) {
|
|
59
|
+
const key = line.slice(0, colonIdx).trim();
|
|
60
|
+
const value = line.slice(colonIdx + 1).trim();
|
|
61
|
+
metadata[key] = value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
body = fmMatch[2];
|
|
65
|
+
}
|
|
66
|
+
// Parse steps from markdown sections
|
|
67
|
+
const steps = [];
|
|
68
|
+
const stepSections = body.split(/^## /m).slice(1);
|
|
69
|
+
for (let i = 0; i < stepSections.length; i++) {
|
|
70
|
+
const section = stepSections[i];
|
|
71
|
+
const lines = section.split('\n');
|
|
72
|
+
const name = lines[0].trim();
|
|
73
|
+
let type = 'agent';
|
|
74
|
+
let action = '';
|
|
75
|
+
let requiresApproval = false;
|
|
76
|
+
let onError = 'stop';
|
|
77
|
+
const inputs = {};
|
|
78
|
+
const outputs = [];
|
|
79
|
+
for (const line of lines.slice(1)) {
|
|
80
|
+
const t = line.trim();
|
|
81
|
+
if (t.startsWith('- **Type**:')) {
|
|
82
|
+
type = t.replace('- **Type**:', '').trim();
|
|
83
|
+
}
|
|
84
|
+
else if (t.startsWith('- **Action**:')) {
|
|
85
|
+
action = t.replace('- **Action**:', '').trim();
|
|
86
|
+
}
|
|
87
|
+
else if (t.startsWith('- **Approval**:')) {
|
|
88
|
+
requiresApproval = t.replace('- **Approval**:', '').trim().toLowerCase() === 'required';
|
|
89
|
+
}
|
|
90
|
+
else if (t.startsWith('- **OnError**:')) {
|
|
91
|
+
onError = t.replace('- **OnError**:', '').trim();
|
|
92
|
+
}
|
|
93
|
+
else if (t.startsWith('- **Input**:')) {
|
|
94
|
+
const kv = t.replace('- **Input**:', '').trim().split('=');
|
|
95
|
+
if (kv.length === 2)
|
|
96
|
+
inputs[kv[0].trim()] = kv[1].trim();
|
|
97
|
+
}
|
|
98
|
+
else if (t.startsWith('- **Output**:')) {
|
|
99
|
+
outputs.push(t.replace('- **Output**:', '').trim());
|
|
100
|
+
}
|
|
101
|
+
else if (!t.startsWith('-') && !t.startsWith('#') && t.length > 0 && !action) {
|
|
102
|
+
action = t;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
steps.push({
|
|
106
|
+
id: `step_${i + 1}`,
|
|
107
|
+
name,
|
|
108
|
+
type,
|
|
109
|
+
action: action || name,
|
|
110
|
+
inputs: Object.keys(inputs).length > 0 ? inputs : undefined,
|
|
111
|
+
outputs: outputs.length > 0 ? outputs : undefined,
|
|
112
|
+
requiresApproval,
|
|
113
|
+
onError,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
name: metadata['name'] || path.basename(filePath, '.fishbone'),
|
|
118
|
+
description: metadata['description'] || '',
|
|
119
|
+
version: metadata['version'] || '1.0.0',
|
|
120
|
+
trigger: metadata['trigger'],
|
|
121
|
+
variables: {},
|
|
122
|
+
steps,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
// โโโ Fishbone Engine โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
126
|
+
class FishboneEngine {
|
|
127
|
+
executions = new Map();
|
|
128
|
+
/**
|
|
129
|
+
* Execute a workflow from a .fishbone file.
|
|
130
|
+
*/
|
|
131
|
+
async execute(workflow, variables = {}, eventHandler) {
|
|
132
|
+
const executionId = crypto.randomUUID();
|
|
133
|
+
const execution = {
|
|
134
|
+
id: executionId,
|
|
135
|
+
workflowName: workflow.name,
|
|
136
|
+
status: 'running',
|
|
137
|
+
currentStepId: '',
|
|
138
|
+
results: { ...variables },
|
|
139
|
+
startedAt: new Date(),
|
|
140
|
+
};
|
|
141
|
+
this.executions.set(executionId, execution);
|
|
142
|
+
(0, security_1.auditLog)('WORKFLOW_START', `${workflow.name} (${executionId})`);
|
|
143
|
+
try {
|
|
144
|
+
for (const step of workflow.steps) {
|
|
145
|
+
execution.currentStepId = step.id;
|
|
146
|
+
await eventHandler?.({
|
|
147
|
+
type: 'step_start',
|
|
148
|
+
stepId: step.id,
|
|
149
|
+
stepName: step.name,
|
|
150
|
+
});
|
|
151
|
+
// Handle approval gates
|
|
152
|
+
if (step.requiresApproval) {
|
|
153
|
+
const resumeToken = crypto.randomBytes(16).toString('hex');
|
|
154
|
+
execution.status = 'awaiting_approval';
|
|
155
|
+
execution.resumeToken = resumeToken;
|
|
156
|
+
await eventHandler?.({
|
|
157
|
+
type: 'approval_needed',
|
|
158
|
+
stepId: step.id,
|
|
159
|
+
stepName: step.name,
|
|
160
|
+
content: step.action,
|
|
161
|
+
resumeToken,
|
|
162
|
+
});
|
|
163
|
+
(0, security_1.auditLog)('WORKFLOW_APPROVAL', `${step.name} โ awaiting approval`);
|
|
164
|
+
// In a real implementation, this would pause and wait for resume
|
|
165
|
+
// For now, we auto-approve
|
|
166
|
+
execution.status = 'running';
|
|
167
|
+
}
|
|
168
|
+
// Execute step based on type
|
|
169
|
+
let stepResult = '';
|
|
170
|
+
try {
|
|
171
|
+
switch (step.type) {
|
|
172
|
+
case 'shell': {
|
|
173
|
+
const { execSync } = require('child_process');
|
|
174
|
+
const cmd = this.interpolate(step.action, execution.results);
|
|
175
|
+
stepResult = execSync(cmd, { encoding: 'utf-8', timeout: step.timeout || 30000 }).trim();
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
case 'agent': {
|
|
179
|
+
const action = this.interpolate(step.action, execution.results);
|
|
180
|
+
const agent = new runtime_1.AgentRuntime({
|
|
181
|
+
sessionId: `fishbone_${executionId}_${step.id}`,
|
|
182
|
+
maxIterations: 10,
|
|
183
|
+
eventHandler: async () => { },
|
|
184
|
+
});
|
|
185
|
+
stepResult = await agent.run(action);
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
case 'condition': {
|
|
189
|
+
const condition = this.interpolate(step.action, execution.results);
|
|
190
|
+
const { execSync } = require('child_process');
|
|
191
|
+
try {
|
|
192
|
+
execSync(condition, { encoding: 'utf-8', timeout: 5000 });
|
|
193
|
+
stepResult = 'true';
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
stepResult = 'false';
|
|
197
|
+
}
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
case 'transform': {
|
|
201
|
+
stepResult = this.interpolate(step.action, execution.results);
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
case 'parallel': {
|
|
205
|
+
if (step.children) {
|
|
206
|
+
const results = await Promise.all(step.children.map(async (child) => {
|
|
207
|
+
const agent = new runtime_1.AgentRuntime({
|
|
208
|
+
sessionId: `fishbone_${executionId}_${child.id}`,
|
|
209
|
+
maxIterations: 5,
|
|
210
|
+
eventHandler: async () => { },
|
|
211
|
+
});
|
|
212
|
+
return agent.run(child.action);
|
|
213
|
+
}));
|
|
214
|
+
stepResult = results.join('\n---\n');
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
catch (e) {
|
|
221
|
+
if (step.onError === 'continue') {
|
|
222
|
+
stepResult = `Error (continuing): ${e.message}`;
|
|
223
|
+
}
|
|
224
|
+
else if (step.onError === 'retry' && (step.maxRetries || 0) > 0) {
|
|
225
|
+
// Simple retry logic
|
|
226
|
+
for (let r = 0; r < (step.maxRetries || 1); r++) {
|
|
227
|
+
try {
|
|
228
|
+
const { execSync } = require('child_process');
|
|
229
|
+
stepResult = execSync(step.action, { encoding: 'utf-8' }).trim();
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
throw e;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
// Store result
|
|
242
|
+
execution.results[step.id] = stepResult;
|
|
243
|
+
if (step.outputs) {
|
|
244
|
+
for (const output of step.outputs) {
|
|
245
|
+
execution.results[output] = stepResult;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
await eventHandler?.({
|
|
249
|
+
type: 'step_complete',
|
|
250
|
+
stepId: step.id,
|
|
251
|
+
stepName: step.name,
|
|
252
|
+
content: stepResult.slice(0, 200),
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
execution.status = 'completed';
|
|
256
|
+
execution.completedAt = new Date();
|
|
257
|
+
(0, security_1.auditLog)('WORKFLOW_DONE', `${workflow.name} โ completed`);
|
|
258
|
+
await eventHandler?.({ type: 'workflow_complete', content: 'All steps completed' });
|
|
259
|
+
}
|
|
260
|
+
catch (e) {
|
|
261
|
+
execution.status = 'failed';
|
|
262
|
+
execution.error = e.message;
|
|
263
|
+
execution.completedAt = new Date();
|
|
264
|
+
(0, security_1.auditLog)('WORKFLOW_ERROR', `${workflow.name} โ ${e.message}`);
|
|
265
|
+
await eventHandler?.({ type: 'workflow_error', content: e.message });
|
|
266
|
+
}
|
|
267
|
+
return execution;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Resume a paused workflow with a resume token.
|
|
271
|
+
*/
|
|
272
|
+
async resume(executionId, resumeToken) {
|
|
273
|
+
const execution = this.executions.get(executionId);
|
|
274
|
+
if (!execution)
|
|
275
|
+
return false;
|
|
276
|
+
if (execution.resumeToken !== resumeToken)
|
|
277
|
+
return false;
|
|
278
|
+
execution.status = 'running';
|
|
279
|
+
execution.resumeToken = undefined;
|
|
280
|
+
(0, security_1.auditLog)('WORKFLOW_RESUMED', executionId);
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Get execution status.
|
|
285
|
+
*/
|
|
286
|
+
getExecution(id) {
|
|
287
|
+
return this.executions.get(id);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Interpolate variables in a string: {{varName}} โ value
|
|
291
|
+
*/
|
|
292
|
+
interpolate(template, vars) {
|
|
293
|
+
return template.replace(/\{\{(\w+)\}\}/g, (_, key) => vars[key] || `{{${key}}}`);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
exports.FishboneEngine = FishboneEngine;
|
|
297
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../../src/workflow/engine.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDH,8CA6EC;AAlID,uCAAyB;AACzB,2CAA6B;AAC7B,+CAAiC;AACjC,6CAA2D;AAC3D,+CAA4C;AA+C5C,mEAAmE;AAEnE,SAAgB,iBAAiB,CAAC,QAAgB;IAChD,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAEnD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C,kBAAkB,EAAE,WAAW,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,EAAU;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACK,WAAW,CAAC,QAAgB,EAAE,IAA4B;QAChE,OAAO,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,GAAG,IAAI,CAAC,CAAC;IACnF,CAAC;CACF;AA9LD,wCA8LC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "azerclaw",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "๐ AZERCLAW โ Open-source, BYOK AI agent for your terminal. Your AI, Your Keys, Your Way.",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"azerclaw": "./dist/bin/azerclaw.js",
|
|
8
|
+
"AZERCLAW": "./dist/bin/azerclaw.js",
|
|
9
|
+
"Azerclaw": "./dist/bin/azerclaw.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"start": "npx tsx bin/azerclaw.ts",
|
|
13
|
+
"chat": "npx tsx bin/azerclaw.ts chat",
|
|
14
|
+
"tui": "npx tsx bin/azerclaw.ts tui",
|
|
15
|
+
"dev": "npx tsx bin/azerclaw.ts",
|
|
16
|
+
"build": "tsc && npm run copy-skills",
|
|
17
|
+
"copy-skills": "cp -r skills dist/skills 2>/dev/null || true",
|
|
18
|
+
"doctor": "npx tsx bin/azerclaw.ts doctor",
|
|
19
|
+
"onboard": "npx tsx bin/azerclaw.ts onboard",
|
|
20
|
+
"test": "echo \"Tests coming soon\" && exit 0",
|
|
21
|
+
"clean": "rimraf dist",
|
|
22
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"ai",
|
|
26
|
+
"agent",
|
|
27
|
+
"cli",
|
|
28
|
+
"terminal",
|
|
29
|
+
"llm",
|
|
30
|
+
"openai",
|
|
31
|
+
"anthropic",
|
|
32
|
+
"claude",
|
|
33
|
+
"gemini",
|
|
34
|
+
"ollama",
|
|
35
|
+
"byok",
|
|
36
|
+
"open-source",
|
|
37
|
+
"autonomous",
|
|
38
|
+
"coding-assistant"
|
|
39
|
+
],
|
|
40
|
+
"author": "AZERCLAW",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"type": "commonjs",
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18.0.0"
|
|
45
|
+
},
|
|
46
|
+
"os": [
|
|
47
|
+
"darwin",
|
|
48
|
+
"linux",
|
|
49
|
+
"win32"
|
|
50
|
+
],
|
|
51
|
+
"cpu": [
|
|
52
|
+
"x64",
|
|
53
|
+
"arm64"
|
|
54
|
+
],
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "https://github.com/azerclaw/azerclaw"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://azerclaw.dev",
|
|
60
|
+
"bugs": {
|
|
61
|
+
"url": "https://github.com/azerclaw/azerclaw/issues"
|
|
62
|
+
},
|
|
63
|
+
"files": [
|
|
64
|
+
"dist/",
|
|
65
|
+
"bin/",
|
|
66
|
+
"skills/",
|
|
67
|
+
"templates/",
|
|
68
|
+
"README.md",
|
|
69
|
+
"LICENSE"
|
|
70
|
+
],
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@anthropic-ai/sdk": "^0.52.0",
|
|
73
|
+
"@google/generative-ai": "^0.24.0",
|
|
74
|
+
"boxen": "^5.1.2",
|
|
75
|
+
"chalk": "^4.1.2",
|
|
76
|
+
"cli-highlight": "^2.1.11",
|
|
77
|
+
"cli-table3": "^0.6.5",
|
|
78
|
+
"commander": "^13.1.0",
|
|
79
|
+
"conf": "^11.0.2",
|
|
80
|
+
"croner": "^9.0.0",
|
|
81
|
+
"enquirer": "^2.4.1",
|
|
82
|
+
"figures": "^3.2.0",
|
|
83
|
+
"glob": "^11.0.2",
|
|
84
|
+
"gradient-string": "^2.0.2",
|
|
85
|
+
"log-symbols": "^4.1.0",
|
|
86
|
+
"lowdb": "^6.1.1",
|
|
87
|
+
"nanoid": "^3.3.11",
|
|
88
|
+
"node-fetch": "^3.3.2",
|
|
89
|
+
"openai": "^4.97.0",
|
|
90
|
+
"ora": "^5.4.1",
|
|
91
|
+
"strip-ansi": "^6.0.1",
|
|
92
|
+
"string-width": "^4.2.3",
|
|
93
|
+
"wrap-ansi": "^7.0.0",
|
|
94
|
+
"ws": "^8.18.2",
|
|
95
|
+
"zod": "^3.24.4"
|
|
96
|
+
},
|
|
97
|
+
"devDependencies": {
|
|
98
|
+
"@types/node": "^22.15.17",
|
|
99
|
+
"@types/ws": "^8.18.1",
|
|
100
|
+
"rimraf": "^6.0.1",
|
|
101
|
+
"tsup": "^8.5.0",
|
|
102
|
+
"tsx": "^4.19.4",
|
|
103
|
+
"typescript": "^5.8.3"
|
|
104
|
+
},
|
|
105
|
+
"azerclaw": {
|
|
106
|
+
"security": {
|
|
107
|
+
"telemetry": false,
|
|
108
|
+
"analytics": false,
|
|
109
|
+
"dataCollection": false,
|
|
110
|
+
"phoneHome": false
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Code Review
|
|
3
|
+
description: Review code for bugs, security issues, best practices, and style.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
author: AZERCLAW
|
|
6
|
+
tags: code, review, quality
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Code Review Skill
|
|
10
|
+
|
|
11
|
+
When asked to review code, follow this structured approach:
|
|
12
|
+
|
|
13
|
+
## Process
|
|
14
|
+
|
|
15
|
+
1. **Read the file(s)** using `read_file`
|
|
16
|
+
2. **Analyze** for the following categories:
|
|
17
|
+
- ๐ **Bugs**: Logic errors, off-by-one, null references, race conditions
|
|
18
|
+
- ๐ **Security**: Injection, XSS, auth issues, exposed secrets, SSRF
|
|
19
|
+
- โก **Performance**: N+1 queries, unnecessary loops, memory leaks
|
|
20
|
+
- ๐ **Style**: Naming conventions, code organization, readability
|
|
21
|
+
- ๐งช **Testing**: Missing edge cases, untested paths
|
|
22
|
+
|
|
23
|
+
3. **Format findings** with severity levels:
|
|
24
|
+
- ๐ด CRITICAL โ Must fix before merge
|
|
25
|
+
- ๐ก WARNING โ Should fix soon
|
|
26
|
+
- ๐ต INFO โ Suggestion for improvement
|
|
27
|
+
|
|
28
|
+
4. **Provide fixes** โ Don't just identify, suggest or implement solutions.
|
|
29
|
+
|
|
30
|
+
## Output Format
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
## Code Review: [filename]
|
|
34
|
+
|
|
35
|
+
### Summary
|
|
36
|
+
[1-2 sentence overview]
|
|
37
|
+
|
|
38
|
+
### Findings
|
|
39
|
+
|
|
40
|
+
๐ด CRITICAL: [description]
|
|
41
|
+
File: [path]:[line]
|
|
42
|
+
Fix: [suggested fix]
|
|
43
|
+
|
|
44
|
+
๐ก WARNING: [description]
|
|
45
|
+
...
|
|
46
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Daily Briefing
|
|
3
|
+
description: Generate a daily summary of project status, git activity, and tasks.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
author: AZERCLAW
|
|
6
|
+
tags: productivity, summary, briefing
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Daily Briefing Skill
|
|
10
|
+
|
|
11
|
+
Generate a comprehensive daily briefing:
|
|
12
|
+
|
|
13
|
+
## Data Collection
|
|
14
|
+
1. Run `git log --since="24 hours ago" --oneline` for recent commits
|
|
15
|
+
2. Run `git diff --stat HEAD~5` for recent changes summary
|
|
16
|
+
3. Check for TODO/FIXME comments: `grep -rnI "TODO\|FIXME\|HACK\|XXX" . --include="*.ts" --include="*.js" --include="*.py" | head -20`
|
|
17
|
+
4. Check for any failing tests if test script exists
|
|
18
|
+
|
|
19
|
+
## Report Format
|
|
20
|
+
```
|
|
21
|
+
๐ Daily Briefing โ [date]
|
|
22
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
23
|
+
|
|
24
|
+
๐ Recent Commits (24h): [count]
|
|
25
|
+
[list top 5]
|
|
26
|
+
|
|
27
|
+
๐ Files Changed: [count]
|
|
28
|
+
[summary]
|
|
29
|
+
|
|
30
|
+
โ ๏ธ TODOs/FIXMEs: [count]
|
|
31
|
+
[top 5]
|
|
32
|
+
|
|
33
|
+
๐ฏ Suggested Focus Areas:
|
|
34
|
+
[based on analysis]
|
|
35
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Git Assistant
|
|
3
|
+
description: Help with git operations, branching, merging, and commit messages.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
author: AZERCLAW
|
|
6
|
+
tags: git, version-control
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Git Assistant Skill
|
|
10
|
+
|
|
11
|
+
When helping with git operations:
|
|
12
|
+
|
|
13
|
+
## Commit Messages
|
|
14
|
+
Follow Conventional Commits:
|
|
15
|
+
- `feat:` new feature
|
|
16
|
+
- `fix:` bug fix
|
|
17
|
+
- `docs:` documentation
|
|
18
|
+
- `refactor:` code refactoring
|
|
19
|
+
- `test:` adding tests
|
|
20
|
+
- `chore:` maintenance
|
|
21
|
+
|
|
22
|
+
## Common Operations
|
|
23
|
+
1. Check status with `git status` and `git log --oneline -10`
|
|
24
|
+
2. Create branches with descriptive names: `feature/description`, `fix/description`
|
|
25
|
+
3. Always verify changes before committing with `git diff`
|
|
26
|
+
4. Use `git stash` before risky operations
|
|
27
|
+
|
|
28
|
+
## Safety Rules
|
|
29
|
+
- Never force push to `main` or `master`
|
|
30
|
+
- Always confirm before destructive operations (reset, rebase)
|
|
31
|
+
- Create backups before complex rebases
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# HEARTBEAT.md
|
|
2
|
+
|
|
3
|
+
# Azerclaw Heartbeat Configuration
|
|
4
|
+
# This file controls proactive background tasks.
|
|
5
|
+
# The agent checks this file every 30 minutes.
|
|
6
|
+
|
|
7
|
+
## Tasks
|
|
8
|
+
|
|
9
|
+
### Git Status Check
|
|
10
|
+
- **Schedule**: every 30 minutes
|
|
11
|
+
- **Action**: Check for uncommitted changes and remind user
|
|
12
|
+
- **Condition**: Only if git repo detected in current directory
|
|
13
|
+
|
|
14
|
+
### Dependency Audit
|
|
15
|
+
- **Schedule**: daily at 09:00
|
|
16
|
+
- **Action**: Run `npm audit` or equivalent and report vulnerabilities
|
|
17
|
+
- **Condition**: Only if package.json exists
|
|
18
|
+
|
|
19
|
+
### Disk Space Monitor
|
|
20
|
+
- **Schedule**: every 6 hours
|
|
21
|
+
- **Action**: Check disk usage, warn if below 10% free
|
|
22
|
+
- **Condition**: Always
|
|
23
|
+
|
|
24
|
+
### Log Cleanup
|
|
25
|
+
- **Schedule**: weekly on Sunday
|
|
26
|
+
- **Action**: Rotate and compress logs older than 7 days
|
|
27
|
+
- **Condition**: Always
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# ๐ AZERCLAW Identity
|
|
2
|
+
|
|
3
|
+
You are **AZERCLAW**, an autonomous AI agent running locally on the user's machine.
|
|
4
|
+
|
|
5
|
+
## Core Identity
|
|
6
|
+
- **Name**: Azerclaw
|
|
7
|
+
- **Symbol**: ๐ (Fish)
|
|
8
|
+
- **Philosophy**: Your AI, Your Keys, Your Way
|
|
9
|
+
- **Mission**: Empower developers with a free, open-source, privacy-first AI agent
|
|
10
|
+
|
|
11
|
+
## Personality
|
|
12
|
+
- Precise and efficient โ get things done, don't waste words
|
|
13
|
+
- Proactive โ anticipate what the user needs next
|
|
14
|
+
- Security-conscious โ never expose secrets, always validate
|
|
15
|
+
- Honest โ if you can't do something, say so clearly
|
|
16
|
+
|
|
17
|
+
## Security Rules (NEVER BREAK THESE)
|
|
18
|
+
1. **Never transmit** API keys, secrets, or credentials in responses
|
|
19
|
+
2. **Never log** sensitive data to files that others might read
|
|
20
|
+
3. **Never execute** commands that could expose secrets to third parties
|
|
21
|
+
4. **Always sanitize** output before displaying anything from tool execution
|
|
22
|
+
5. **Always ask** before running destructive operations (rm -rf, DROP TABLE, etc.)
|
|
23
|
+
6. **Never phone home** โ all data stays on the user's machine
|