arkna 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/bin/arkna.js +2 -0
- package/dist/commands/connect.d.ts +3 -0
- package/dist/commands/connect.d.ts.map +1 -0
- package/dist/commands/connect.js +307 -0
- package/dist/commands/connect.js.map +1 -0
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +292 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +119 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/sync.d.ts +3 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +65 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/test.d.ts +3 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +142 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/verify.d.ts +3 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +139 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/arkna-dir.d.ts +83 -0
- package/dist/lib/arkna-dir.d.ts.map +1 -0
- package/dist/lib/arkna-dir.js +184 -0
- package/dist/lib/arkna-dir.js.map +1 -0
- package/dist/lib/connectivity.d.ts +35 -0
- package/dist/lib/connectivity.d.ts.map +1 -0
- package/dist/lib/connectivity.js +208 -0
- package/dist/lib/connectivity.js.map +1 -0
- package/dist/lib/platforms.d.ts +13 -0
- package/dist/lib/platforms.d.ts.map +1 -0
- package/dist/lib/platforms.js +348 -0
- package/dist/lib/platforms.js.map +1 -0
- package/dist/lib/ui.d.ts +28 -0
- package/dist/lib/ui.d.ts.map +1 -0
- package/dist/lib/ui.js +176 -0
- package/dist/lib/ui.js.map +1 -0
- package/dist/lib/verify.d.ts +15 -0
- package/dist/lib/verify.d.ts.map +1 -0
- package/dist/lib/verify.js +33 -0
- package/dist/lib/verify.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.wireOpenClaw = wireOpenClaw;
|
|
37
|
+
exports.getOpenClawYamlBlock = getOpenClawYamlBlock;
|
|
38
|
+
exports.wireCrewAI = wireCrewAI;
|
|
39
|
+
exports.wireLangChain = wireLangChain;
|
|
40
|
+
exports.getCustomPatch = getCustomPatch;
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
const yaml = __importStar(require("js-yaml"));
|
|
44
|
+
// ── OpenClaw ────────────────────────────────────────────────────────────────
|
|
45
|
+
function wireOpenClaw(configPath, url, agentName) {
|
|
46
|
+
try {
|
|
47
|
+
const raw = fs.readFileSync(configPath, 'utf-8');
|
|
48
|
+
const doc = yaml.load(raw);
|
|
49
|
+
if (!doc || typeof doc !== 'object') {
|
|
50
|
+
return { success: false, error: 'Could not parse YAML — file is empty or invalid.' };
|
|
51
|
+
}
|
|
52
|
+
// Check if already configured
|
|
53
|
+
if (doc.connectors?.arkna) {
|
|
54
|
+
return { success: true, alreadyConfigured: true };
|
|
55
|
+
}
|
|
56
|
+
// Back up original
|
|
57
|
+
const backupPath = configPath + '.bak';
|
|
58
|
+
fs.copyFileSync(configPath, backupPath);
|
|
59
|
+
// Inject ARKNA connector — reads credentials from env vars at runtime
|
|
60
|
+
if (!doc.connectors)
|
|
61
|
+
doc.connectors = {};
|
|
62
|
+
doc.connectors.arkna = {
|
|
63
|
+
type: 'http',
|
|
64
|
+
base_url: '${ARKNA_URL}/api/gateway',
|
|
65
|
+
headers: {
|
|
66
|
+
'X-Integration-Token': '${ARKNA_TOKEN}',
|
|
67
|
+
'Content-Type': 'application/json',
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
// Inject startup hook
|
|
71
|
+
if (!doc.startup_hooks)
|
|
72
|
+
doc.startup_hooks = [];
|
|
73
|
+
const hasRegisterHook = doc.startup_hooks.some((h) => h?.name === 'register_with_arkna');
|
|
74
|
+
if (!hasRegisterHook) {
|
|
75
|
+
doc.startup_hooks.push({
|
|
76
|
+
name: 'register_with_arkna',
|
|
77
|
+
connector: 'arkna',
|
|
78
|
+
method: 'POST',
|
|
79
|
+
path: '/register',
|
|
80
|
+
body: { name: agentName, platform: 'openclaw' },
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
// Inject heartbeat
|
|
84
|
+
if (!doc.heartbeat) {
|
|
85
|
+
doc.heartbeat = {
|
|
86
|
+
connector: 'arkna',
|
|
87
|
+
method: 'POST',
|
|
88
|
+
path: '/heartbeat',
|
|
89
|
+
interval: 60,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
// Inject tool routing
|
|
93
|
+
if (!doc.tool_routing) {
|
|
94
|
+
doc.tool_routing = {
|
|
95
|
+
default_connector: 'arkna',
|
|
96
|
+
action_path: '/actions',
|
|
97
|
+
tools_path: '/tools',
|
|
98
|
+
request_id_prefix: 'oc_',
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
fs.writeFileSync(configPath, yaml.dump(doc, { lineWidth: 120, noRefs: true }));
|
|
102
|
+
return { success: true };
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
return { success: false, error: err.message || 'Failed to modify config file' };
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function getOpenClawYamlBlock(agentName) {
|
|
109
|
+
return `# Add this to your OpenClaw config YAML.
|
|
110
|
+
# Set ARKNA_URL and ARKNA_TOKEN in your environment (or source .arkna/.env).
|
|
111
|
+
|
|
112
|
+
connectors:
|
|
113
|
+
arkna:
|
|
114
|
+
type: http
|
|
115
|
+
base_url: \${ARKNA_URL}/api/gateway
|
|
116
|
+
headers:
|
|
117
|
+
X-Integration-Token: \${ARKNA_TOKEN}
|
|
118
|
+
Content-Type: application/json
|
|
119
|
+
|
|
120
|
+
startup_hooks:
|
|
121
|
+
- name: register_with_arkna
|
|
122
|
+
connector: arkna
|
|
123
|
+
method: POST
|
|
124
|
+
path: /register
|
|
125
|
+
body:
|
|
126
|
+
name: "${agentName}"
|
|
127
|
+
platform: "openclaw"
|
|
128
|
+
|
|
129
|
+
heartbeat:
|
|
130
|
+
connector: arkna
|
|
131
|
+
method: POST
|
|
132
|
+
path: /heartbeat
|
|
133
|
+
interval: 60
|
|
134
|
+
|
|
135
|
+
tool_routing:
|
|
136
|
+
default_connector: arkna
|
|
137
|
+
action_path: /actions
|
|
138
|
+
tools_path: /tools
|
|
139
|
+
request_id_prefix: "oc_"`;
|
|
140
|
+
}
|
|
141
|
+
// ── CrewAI ──────────────────────────────────────────────────────────────────
|
|
142
|
+
function wireCrewAI(outputDir, agentName) {
|
|
143
|
+
try {
|
|
144
|
+
const wrapperPath = path.join(outputDir, 'arkna_gateway.py');
|
|
145
|
+
const content = `# arkna_gateway.py — ARKNA governance gateway for CrewAI
|
|
146
|
+
# Generated by \`arkna connect\`. Reads credentials from env vars.
|
|
147
|
+
# Set ARKNA_URL and ARKNA_TOKEN before running, or: source .arkna/.env
|
|
148
|
+
|
|
149
|
+
import os, requests, uuid, time, threading
|
|
150
|
+
|
|
151
|
+
try:
|
|
152
|
+
from dotenv import load_dotenv
|
|
153
|
+
load_dotenv(".arkna/.env")
|
|
154
|
+
except ImportError:
|
|
155
|
+
pass # python-dotenv is optional — set env vars directly
|
|
156
|
+
|
|
157
|
+
ARKNA_URL = os.environ["ARKNA_URL"]
|
|
158
|
+
ARKNA_TOKEN = os.environ["ARKNA_TOKEN"]
|
|
159
|
+
HEADERS = {"X-Integration-Token": ARKNA_TOKEN, "Content-Type": "application/json"}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class ArknaGateway:
|
|
163
|
+
"""Routes CrewAI tool calls through ARKNA's governance gateway."""
|
|
164
|
+
|
|
165
|
+
def __init__(self):
|
|
166
|
+
self.api_url = ARKNA_URL
|
|
167
|
+
self.headers = dict(HEADERS)
|
|
168
|
+
|
|
169
|
+
def register(self):
|
|
170
|
+
resp = requests.post(
|
|
171
|
+
f"{self.api_url}/api/gateway/register",
|
|
172
|
+
headers=self.headers,
|
|
173
|
+
json={"name": "${agentName}", "platform": "crewai"},
|
|
174
|
+
)
|
|
175
|
+
resp.raise_for_status()
|
|
176
|
+
return resp.json()
|
|
177
|
+
|
|
178
|
+
def start_heartbeat(self, interval=60):
|
|
179
|
+
def _beat():
|
|
180
|
+
while True:
|
|
181
|
+
try:
|
|
182
|
+
requests.post(
|
|
183
|
+
f"{self.api_url}/api/gateway/heartbeat",
|
|
184
|
+
headers=self.headers, json={},
|
|
185
|
+
)
|
|
186
|
+
except Exception:
|
|
187
|
+
pass
|
|
188
|
+
time.sleep(interval)
|
|
189
|
+
threading.Thread(target=_beat, daemon=True).start()
|
|
190
|
+
|
|
191
|
+
def run_action(self, tool: str, parameters: dict) -> dict:
|
|
192
|
+
resp = requests.post(
|
|
193
|
+
f"{self.api_url}/api/gateway/actions",
|
|
194
|
+
headers=self.headers,
|
|
195
|
+
json={
|
|
196
|
+
"tool": tool,
|
|
197
|
+
"parameters": parameters,
|
|
198
|
+
"request_id": f"req_{uuid.uuid4().hex[:12]}",
|
|
199
|
+
},
|
|
200
|
+
)
|
|
201
|
+
resp.raise_for_status()
|
|
202
|
+
return resp.json()
|
|
203
|
+
|
|
204
|
+
def get_tools(self) -> list:
|
|
205
|
+
resp = requests.get(
|
|
206
|
+
f"{self.api_url}/api/gateway/tools",
|
|
207
|
+
headers=self.headers,
|
|
208
|
+
)
|
|
209
|
+
resp.raise_for_status()
|
|
210
|
+
return resp.json().get("tools", [])
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
# Usage:
|
|
214
|
+
# gateway = ArknaGateway()
|
|
215
|
+
# gateway.register()
|
|
216
|
+
# gateway.start_heartbeat()
|
|
217
|
+
# result = gateway.run_action("check_calendly_availability", {"date": "2026-03-01"})
|
|
218
|
+
`;
|
|
219
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
220
|
+
fs.writeFileSync(wrapperPath, content);
|
|
221
|
+
const patch = `# Add these lines to your CrewAI agent entrypoint:
|
|
222
|
+
from arkna_gateway import ArknaGateway
|
|
223
|
+
|
|
224
|
+
gateway = ArknaGateway()
|
|
225
|
+
gateway.register()
|
|
226
|
+
gateway.start_heartbeat()
|
|
227
|
+
|
|
228
|
+
# Then use gateway.run_action(tool, params) instead of direct API calls.
|
|
229
|
+
# Use gateway.get_tools() to discover available tools.`;
|
|
230
|
+
return { success: true, wrapperPath, patch };
|
|
231
|
+
}
|
|
232
|
+
catch (err) {
|
|
233
|
+
return { success: false, error: err.message || 'Failed to generate wrapper' };
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
// ── LangChain ───────────────────────────────────────────────────────────────
|
|
237
|
+
function wireLangChain(outputDir, agentName) {
|
|
238
|
+
try {
|
|
239
|
+
const wrapperPath = path.join(outputDir, 'arkna_tool.py');
|
|
240
|
+
const content = `# arkna_tool.py — LangChain tool that routes through ARKNA
|
|
241
|
+
# Generated by \`arkna connect\`. Reads credentials from env vars.
|
|
242
|
+
# Set ARKNA_URL and ARKNA_TOKEN before running, or: source .arkna/.env
|
|
243
|
+
|
|
244
|
+
import os, requests, uuid
|
|
245
|
+
from langchain.tools import BaseTool
|
|
246
|
+
|
|
247
|
+
try:
|
|
248
|
+
from dotenv import load_dotenv
|
|
249
|
+
load_dotenv(".arkna/.env")
|
|
250
|
+
except ImportError:
|
|
251
|
+
pass # python-dotenv is optional — set env vars directly
|
|
252
|
+
|
|
253
|
+
ARKNA_URL = os.environ["ARKNA_URL"]
|
|
254
|
+
ARKNA_TOKEN = os.environ["ARKNA_TOKEN"]
|
|
255
|
+
HEADERS = {"X-Integration-Token": ARKNA_TOKEN, "Content-Type": "application/json"}
|
|
256
|
+
|
|
257
|
+
# Register on import
|
|
258
|
+
requests.post(
|
|
259
|
+
f"{ARKNA_URL}/api/gateway/register",
|
|
260
|
+
headers=HEADERS,
|
|
261
|
+
json={"name": "${agentName}", "platform": "langchain"},
|
|
262
|
+
).raise_for_status()
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
class ArknaGovernedTool(BaseTool):
|
|
266
|
+
"""A LangChain tool that executes actions through ARKNA's governance gateway."""
|
|
267
|
+
|
|
268
|
+
name: str = "arkna_action"
|
|
269
|
+
description: str = "Execute a governed action through ARKNA"
|
|
270
|
+
tool_name: str = ""
|
|
271
|
+
|
|
272
|
+
def _run(self, parameters: str) -> str:
|
|
273
|
+
import json
|
|
274
|
+
params = json.loads(parameters) if isinstance(parameters, str) else parameters
|
|
275
|
+
resp = requests.post(
|
|
276
|
+
f"{ARKNA_URL}/api/gateway/actions",
|
|
277
|
+
headers=HEADERS,
|
|
278
|
+
json={
|
|
279
|
+
"tool": self.tool_name,
|
|
280
|
+
"parameters": params,
|
|
281
|
+
"request_id": f"req_{uuid.uuid4().hex[:12]}",
|
|
282
|
+
},
|
|
283
|
+
)
|
|
284
|
+
return resp.json()
|
|
285
|
+
|
|
286
|
+
async def _arun(self, parameters: str) -> str:
|
|
287
|
+
return self._run(parameters)
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def get_arkna_tools() -> list[ArknaGovernedTool]:
|
|
291
|
+
resp = requests.get(f"{ARKNA_URL}/api/gateway/tools", headers=HEADERS)
|
|
292
|
+
tools_data = resp.json().get("tools", [])
|
|
293
|
+
return [
|
|
294
|
+
ArknaGovernedTool(
|
|
295
|
+
name=t["name"],
|
|
296
|
+
description=t.get("description", t["name"]),
|
|
297
|
+
tool_name=t["name"],
|
|
298
|
+
)
|
|
299
|
+
for t in tools_data
|
|
300
|
+
]
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
# Usage:
|
|
304
|
+
# tools = get_arkna_tools()
|
|
305
|
+
# agent = initialize_agent(tools, llm, agent="zero-shot-react-description")
|
|
306
|
+
`;
|
|
307
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
308
|
+
fs.writeFileSync(wrapperPath, content);
|
|
309
|
+
const patch = `# Add these lines to your LangChain agent:
|
|
310
|
+
from arkna_tool import get_arkna_tools
|
|
311
|
+
|
|
312
|
+
tools = get_arkna_tools()
|
|
313
|
+
# Pass these tools to your agent's initialize_agent() call.`;
|
|
314
|
+
return { success: true, wrapperPath, patch };
|
|
315
|
+
}
|
|
316
|
+
catch (err) {
|
|
317
|
+
return { success: false, error: err.message || 'Failed to generate wrapper' };
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
// ── Custom ──────────────────────────────────────────────────────────────────
|
|
321
|
+
function getCustomPatch(agentName) {
|
|
322
|
+
return `# Set these env vars first (or: source .arkna/.env)
|
|
323
|
+
# export ARKNA_URL="https://api.arkna.com.au"
|
|
324
|
+
# export ARKNA_TOKEN="PASTE_TOKEN_HERE"
|
|
325
|
+
|
|
326
|
+
# 1. Register your agent
|
|
327
|
+
curl -X POST $ARKNA_URL/api/gateway/register \\
|
|
328
|
+
-H "X-Integration-Token: $ARKNA_TOKEN" \\
|
|
329
|
+
-H "Content-Type: application/json" \\
|
|
330
|
+
-d '{"name": "${agentName}", "platform": "custom"}'
|
|
331
|
+
|
|
332
|
+
# 2. Send heartbeat every 60s
|
|
333
|
+
curl -X POST $ARKNA_URL/api/gateway/heartbeat \\
|
|
334
|
+
-H "X-Integration-Token: $ARKNA_TOKEN" \\
|
|
335
|
+
-H "Content-Type: application/json" \\
|
|
336
|
+
-d '{}'
|
|
337
|
+
|
|
338
|
+
# 3. Submit an action for governance
|
|
339
|
+
curl -X POST $ARKNA_URL/api/gateway/actions \\
|
|
340
|
+
-H "X-Integration-Token: $ARKNA_TOKEN" \\
|
|
341
|
+
-H "Content-Type: application/json" \\
|
|
342
|
+
-d '{
|
|
343
|
+
"tool": "check_calendly_availability",
|
|
344
|
+
"parameters": {"date": "2026-03-01"},
|
|
345
|
+
"request_id": "req_001"
|
|
346
|
+
}'`;
|
|
347
|
+
}
|
|
348
|
+
//# sourceMappingURL=platforms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platforms.js","sourceRoot":"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AAC,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAEvC,MAAM,KAAK,GAAG;;;;4DAI0C,CAAC;QAEzD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;IAC/C,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,IAAI,4BAA4B,EAAE,CAAC;IAChF,CAAC;AACH,CAAC;AAED,+EAA+E;AAE/E,SAAgB,cAAc,CAAC,SAAiB;IAC9C,OAAO;;;;;;;;kBAQS,SAAS;;;;;;;;;;;;;;;;KAgBtB,CAAC;AACN,CAAC"}
|
package/dist/lib/ui.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
declare const brand: chalk.Chalk;
|
|
3
|
+
declare const brandBold: chalk.Chalk;
|
|
4
|
+
declare const dim: chalk.Chalk;
|
|
5
|
+
declare const success: chalk.Chalk;
|
|
6
|
+
declare const fail: chalk.Chalk;
|
|
7
|
+
declare const warn: chalk.Chalk;
|
|
8
|
+
declare const muted: chalk.Chalk;
|
|
9
|
+
export { brand, brandBold, dim, success, fail, warn, muted };
|
|
10
|
+
/** Mask a token for safe display: intk_abcd…1234 */
|
|
11
|
+
export declare function maskToken(token: string): string;
|
|
12
|
+
export declare function box(lines: string[], width?: number): string;
|
|
13
|
+
export declare function banner(): void;
|
|
14
|
+
export declare function miniBanner(subtitle: string): void;
|
|
15
|
+
export declare function section(title: string): void;
|
|
16
|
+
export declare function sectionEnd(): void;
|
|
17
|
+
export declare function step(n: number, total: number, label: string): void;
|
|
18
|
+
export declare function resultLine(passed: boolean, name: string, detail: string): void;
|
|
19
|
+
export declare function startSpinner(message: string): {
|
|
20
|
+
stop: (finalMsg?: string) => void;
|
|
21
|
+
};
|
|
22
|
+
export declare function fileTree(dirName: string, files: string[]): void;
|
|
23
|
+
export declare function divider(): void;
|
|
24
|
+
export declare function kvLine(key: string, value: string): void;
|
|
25
|
+
export declare function hint(lines: string[]): void;
|
|
26
|
+
export declare function successBox(title: string, lines: string[]): void;
|
|
27
|
+
export declare function errorBox(title: string, lines: string[]): void;
|
|
28
|
+
//# sourceMappingURL=ui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/lib/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,QAAA,MAAM,KAAK,aAAuB,CAAC;AACnC,QAAA,MAAM,SAAS,aAA4B,CAAC;AAC5C,QAAA,MAAM,GAAG,aAAY,CAAC;AACtB,QAAA,MAAM,OAAO,aAAc,CAAC;AAC5B,QAAA,MAAM,IAAI,aAAY,CAAC;AACvB,QAAA,MAAM,IAAI,aAAe,CAAC;AAC1B,QAAA,MAAM,KAAK,aAAa,CAAC;AAEzB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAG7D,oDAAoD;AACpD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK/C;AAYD,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,SAAK,GAAG,MAAM,CAYvD;AAGD,wBAAgB,MAAM,IAAI,IAAI,CAU7B;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAQjD;AAGD,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED,wBAAgB,UAAU,IAAI,IAAI,CAEjC;AAGD,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAGlE;AAGD,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAI9E;AAGD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,CAiBnF;AAGD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAkB/D;AAGD,wBAAgB,OAAO,IAAI,IAAI,CAE9B;AAGD,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEvD;AAGD,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAM1C;AAGD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAM/D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAM7D"}
|
package/dist/lib/ui.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.muted = exports.warn = exports.fail = exports.success = exports.dim = exports.brandBold = exports.brand = void 0;
|
|
7
|
+
exports.maskToken = maskToken;
|
|
8
|
+
exports.box = box;
|
|
9
|
+
exports.banner = banner;
|
|
10
|
+
exports.miniBanner = miniBanner;
|
|
11
|
+
exports.section = section;
|
|
12
|
+
exports.sectionEnd = sectionEnd;
|
|
13
|
+
exports.step = step;
|
|
14
|
+
exports.resultLine = resultLine;
|
|
15
|
+
exports.startSpinner = startSpinner;
|
|
16
|
+
exports.fileTree = fileTree;
|
|
17
|
+
exports.divider = divider;
|
|
18
|
+
exports.kvLine = kvLine;
|
|
19
|
+
exports.hint = hint;
|
|
20
|
+
exports.successBox = successBox;
|
|
21
|
+
exports.errorBox = errorBox;
|
|
22
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
23
|
+
// ── ARKNA brand colors ─────────────────────────────────────────────────────
|
|
24
|
+
const brand = chalk_1.default.hex('#3B82F6'); // ARKNA blue
|
|
25
|
+
exports.brand = brand;
|
|
26
|
+
const brandBold = chalk_1.default.hex('#3B82F6').bold;
|
|
27
|
+
exports.brandBold = brandBold;
|
|
28
|
+
const dim = chalk_1.default.dim;
|
|
29
|
+
exports.dim = dim;
|
|
30
|
+
const success = chalk_1.default.green;
|
|
31
|
+
exports.success = success;
|
|
32
|
+
const fail = chalk_1.default.red;
|
|
33
|
+
exports.fail = fail;
|
|
34
|
+
const warn = chalk_1.default.yellow;
|
|
35
|
+
exports.warn = warn;
|
|
36
|
+
const muted = chalk_1.default.gray;
|
|
37
|
+
exports.muted = muted;
|
|
38
|
+
// ── Token masking ─────────────────────────────────────────────────────────
|
|
39
|
+
/** Mask a token for safe display: intk_abcd…1234 */
|
|
40
|
+
function maskToken(token) {
|
|
41
|
+
if (!token || token.length < 16)
|
|
42
|
+
return '***';
|
|
43
|
+
const prefix = token.slice(0, 9); // "intk_" + 4 chars
|
|
44
|
+
const suffix = token.slice(-4);
|
|
45
|
+
return `${prefix}…${suffix}`;
|
|
46
|
+
}
|
|
47
|
+
// ── Box drawing ────────────────────────────────────────────────────────────
|
|
48
|
+
const BOX = {
|
|
49
|
+
tl: '╭', tr: '╮', bl: '╰', br: '╯',
|
|
50
|
+
h: '─', v: '│',
|
|
51
|
+
};
|
|
52
|
+
function repeat(ch, n) {
|
|
53
|
+
return ch.repeat(Math.max(0, n));
|
|
54
|
+
}
|
|
55
|
+
function box(lines, width = 60) {
|
|
56
|
+
const inner = width - 2;
|
|
57
|
+
const out = [];
|
|
58
|
+
out.push(brand(`${BOX.tl}${repeat(BOX.h, inner)}${BOX.tr}`));
|
|
59
|
+
for (const line of lines) {
|
|
60
|
+
// Strip ANSI for length calc
|
|
61
|
+
const stripped = line.replace(/\x1b\[[0-9;]*m/g, '');
|
|
62
|
+
const pad = Math.max(0, inner - stripped.length);
|
|
63
|
+
out.push(brand(BOX.v) + line + ' '.repeat(pad) + brand(BOX.v));
|
|
64
|
+
}
|
|
65
|
+
out.push(brand(`${BOX.bl}${repeat(BOX.h, inner)}${BOX.br}`));
|
|
66
|
+
return out.join('\n');
|
|
67
|
+
}
|
|
68
|
+
// ── Banner ─────────────────────────────────────────────────────────────────
|
|
69
|
+
function banner() {
|
|
70
|
+
console.log('');
|
|
71
|
+
console.log(box([
|
|
72
|
+
'',
|
|
73
|
+
` ${brandBold('▲ ARKNA')} ${dim('AI Trust Gateway')}`,
|
|
74
|
+
'',
|
|
75
|
+
` ${dim('Governance · Permits · Audit · Compliance')}`,
|
|
76
|
+
'',
|
|
77
|
+
]));
|
|
78
|
+
console.log('');
|
|
79
|
+
}
|
|
80
|
+
function miniBanner(subtitle) {
|
|
81
|
+
console.log('');
|
|
82
|
+
console.log(box([
|
|
83
|
+
'',
|
|
84
|
+
` ${brandBold('▲ ARKNA')} ${dim(subtitle)}`,
|
|
85
|
+
'',
|
|
86
|
+
]));
|
|
87
|
+
console.log('');
|
|
88
|
+
}
|
|
89
|
+
// ── Section headers ────────────────────────────────────────────────────────
|
|
90
|
+
function section(title) {
|
|
91
|
+
console.log(`\n${brand('┌')} ${chalk_1.default.bold(title)}`);
|
|
92
|
+
}
|
|
93
|
+
function sectionEnd() {
|
|
94
|
+
console.log(brand('└') + brand(repeat('─', 40)));
|
|
95
|
+
}
|
|
96
|
+
// ── Step indicator ─────────────────────────────────────────────────────────
|
|
97
|
+
function step(n, total, label) {
|
|
98
|
+
const counter = dim(`[${n}/${total}]`);
|
|
99
|
+
console.log(`\n ${brand('●')} ${counter} ${chalk_1.default.bold(label)}`);
|
|
100
|
+
}
|
|
101
|
+
// ── Result line ────────────────────────────────────────────────────────────
|
|
102
|
+
function resultLine(passed, name, detail) {
|
|
103
|
+
const icon = passed ? success('✔') : fail('✘');
|
|
104
|
+
const nameStr = passed ? name : chalk_1.default.red(name);
|
|
105
|
+
console.log(` ${icon} ${nameStr} ${dim(detail)}`);
|
|
106
|
+
}
|
|
107
|
+
// ── Spinner (simple dots animation) ────────────────────────────────────────
|
|
108
|
+
function startSpinner(message) {
|
|
109
|
+
const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
110
|
+
let i = 0;
|
|
111
|
+
const interval = setInterval(() => {
|
|
112
|
+
process.stdout.write(`\r ${brand(frames[i % frames.length])} ${muted(message)}`);
|
|
113
|
+
i++;
|
|
114
|
+
}, 80);
|
|
115
|
+
return {
|
|
116
|
+
stop(finalMsg) {
|
|
117
|
+
clearInterval(interval);
|
|
118
|
+
process.stdout.write('\r' + ' '.repeat(message.length + 10) + '\r');
|
|
119
|
+
if (finalMsg) {
|
|
120
|
+
console.log(` ${finalMsg}`);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
// ── File tree ──────────────────────────────────────────────────────────────
|
|
126
|
+
function fileTree(dirName, files) {
|
|
127
|
+
console.log(`\n ${brand('📁')} ${chalk_1.default.bold(dirName)}/`);
|
|
128
|
+
for (let i = 0; i < files.length; i++) {
|
|
129
|
+
const isLast = i === files.length - 1;
|
|
130
|
+
const connector = isLast ? '└──' : '├──';
|
|
131
|
+
const file = files[i];
|
|
132
|
+
const icon = file === '.env'
|
|
133
|
+
? warn('⚠')
|
|
134
|
+
: file.endsWith('.sh') || file.endsWith('.ps1')
|
|
135
|
+
? '🔧'
|
|
136
|
+
: file === 'README.md'
|
|
137
|
+
? '📖'
|
|
138
|
+
: file === '.gitignore'
|
|
139
|
+
? '🔒'
|
|
140
|
+
: '📄';
|
|
141
|
+
const extra = file === '.env' ? dim(' (contains token — gitignored)') : '';
|
|
142
|
+
console.log(` ${dim(connector)} ${icon} ${file}${extra}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// ── Divider ────────────────────────────────────────────────────────────────
|
|
146
|
+
function divider() {
|
|
147
|
+
console.log(dim(' ' + repeat('─', 50)));
|
|
148
|
+
}
|
|
149
|
+
// ── Key-value pair ─────────────────────────────────────────────────────────
|
|
150
|
+
function kvLine(key, value) {
|
|
151
|
+
console.log(` ${dim(key + ':')} ${value}`);
|
|
152
|
+
}
|
|
153
|
+
// ── Hint box ───────────────────────────────────────────────────────────────
|
|
154
|
+
function hint(lines) {
|
|
155
|
+
console.log('');
|
|
156
|
+
for (const line of lines) {
|
|
157
|
+
console.log(` ${dim('│')} ${line}`);
|
|
158
|
+
}
|
|
159
|
+
console.log('');
|
|
160
|
+
}
|
|
161
|
+
// ── Success / Error boxes ──────────────────────────────────────────────────
|
|
162
|
+
function successBox(title, lines) {
|
|
163
|
+
console.log('');
|
|
164
|
+
console.log(` ${success('✔')} ${chalk_1.default.bold.green(title)}`);
|
|
165
|
+
for (const line of lines) {
|
|
166
|
+
console.log(` ${line}`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function errorBox(title, lines) {
|
|
170
|
+
console.log('');
|
|
171
|
+
console.log(` ${fail('✘')} ${chalk_1.default.bold.red(title)}`);
|
|
172
|
+
for (const line of lines) {
|
|
173
|
+
console.log(` ${line}`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/lib/ui.ts"],"names":[],"mappings":";;;;;;AAeA,8BAKC;AAYD,kBAYC;AAGD,wBAUC;AAED,gCAQC;AAGD,0BAEC;AAED,gCAEC;AAGD,oBAGC;AAGD,gCAIC;AAGD,oCAiBC;AAGD,4BAkBC;AAGD,0BAEC;AAGD,wBAEC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
|
3
|
+
tokenOk: boolean;
|
|
4
|
+
checks: {
|
|
5
|
+
name: string;
|
|
6
|
+
passed: boolean;
|
|
7
|
+
detail: string;
|
|
8
|
+
}[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Verify gateway reachability and token validity.
|
|
12
|
+
* Does NOT register the agent — registration is the agent platform's responsibility.
|
|
13
|
+
*/
|
|
14
|
+
export declare function verifyGateway(url: string, token: string): Promise<VerifyResult>;
|
|
15
|
+
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/lib/verify.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC7D;AAED;;;GAGG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,YAAY,CAAC,CAyBvB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyGateway = verifyGateway;
|
|
4
|
+
const ui_1 = require("./ui");
|
|
5
|
+
const connectivity_1 = require("./connectivity");
|
|
6
|
+
/**
|
|
7
|
+
* Verify gateway reachability and token validity.
|
|
8
|
+
* Does NOT register the agent — registration is the agent platform's responsibility.
|
|
9
|
+
*/
|
|
10
|
+
async function verifyGateway(url, token) {
|
|
11
|
+
const checks = [];
|
|
12
|
+
// 1. Health
|
|
13
|
+
const s1 = (0, ui_1.startSpinner)('Checking gateway...');
|
|
14
|
+
const health = await (0, connectivity_1.checkHealth)(url);
|
|
15
|
+
s1.stop();
|
|
16
|
+
checks.push(health);
|
|
17
|
+
(0, ui_1.resultLine)(health.passed, health.name, health.detail);
|
|
18
|
+
if (!health.passed) {
|
|
19
|
+
return { gatewayOk: false, tokenOk: false, checks };
|
|
20
|
+
}
|
|
21
|
+
// 2. Token validity
|
|
22
|
+
const s2 = (0, ui_1.startSpinner)('Validating token...');
|
|
23
|
+
const tokenCheck = await (0, connectivity_1.checkTokenValid)(url, token);
|
|
24
|
+
s2.stop();
|
|
25
|
+
checks.push(tokenCheck);
|
|
26
|
+
(0, ui_1.resultLine)(tokenCheck.passed, tokenCheck.name, tokenCheck.detail);
|
|
27
|
+
return {
|
|
28
|
+
gatewayOk: health.passed,
|
|
29
|
+
tokenOk: tokenCheck.passed,
|
|
30
|
+
checks,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/lib/verify.ts"],"names":[],"mappings":";;AAaA,sCA4BC;AAzCD,6BAAgD;AAChD,iDAA8D;AAQ9D;;;GAGG;AACI,KAAK,UAAU,aAAa,CACjC,GAAW,EACX,KAAa;IAEb,MAAM,MAAM,GAAwD,EAAE,CAAC;IAEvE,YAAY;IACZ,MAAM,EAAE,GAAG,IAAA,iBAAY,EAAC,qBAAqB,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,MAAM,IAAA,0BAAW,EAAC,GAAG,CAAC,CAAC;IACtC,EAAE,CAAC,IAAI,EAAE,CAAC;IACV,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpB,IAAA,eAAU,EAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACtD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MA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