[Init] Initial commit - NetMesh terminal manager
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
This commit is contained in:
141
components/ai/toolArtifacts/vaultToolArtifact.test.ts
Normal file
141
components/ai/toolArtifacts/vaultToolArtifact.test.ts
Normal file
@@ -0,0 +1,141 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
|
||||
import { parseVaultToolArtifact } from './vaultToolArtifact.ts';
|
||||
|
||||
test('parseVaultToolArtifact maps note create results', () => {
|
||||
const artifact = parseVaultToolArtifact('vault_notes_create', {
|
||||
ok: true,
|
||||
note: { id: 'note-1', title: 'Runbook', group: 'ops/prod' },
|
||||
});
|
||||
assert.deepEqual(artifact, {
|
||||
kind: 'vault.note',
|
||||
noteId: 'note-1',
|
||||
title: 'Runbook',
|
||||
group: 'ops/prod',
|
||||
});
|
||||
});
|
||||
|
||||
test('parseVaultToolArtifact maps single host create to host artifact', () => {
|
||||
const artifact = parseVaultToolArtifact('vault_hosts_create', {
|
||||
ok: true,
|
||||
addedCount: 1,
|
||||
previewHosts: [
|
||||
{ id: 'host-1', label: 'Dokploy', hostname: '10.2.0.209' },
|
||||
],
|
||||
});
|
||||
assert.deepEqual(artifact, {
|
||||
kind: 'vault.host',
|
||||
hostId: 'host-1',
|
||||
label: 'Dokploy',
|
||||
hostname: '10.2.0.209',
|
||||
});
|
||||
});
|
||||
|
||||
test('parseVaultToolArtifact maps host batch import results', () => {
|
||||
const artifact = parseVaultToolArtifact('vault_hosts_create', {
|
||||
ok: true,
|
||||
addedCount: 2,
|
||||
previewHosts: [
|
||||
{ id: 'host-1', label: 'Web', hostname: '10.0.0.1' },
|
||||
{ id: 'host-2', hostname: 'db.internal' },
|
||||
],
|
||||
});
|
||||
assert.equal(artifact?.kind, 'vault.hosts.batch');
|
||||
if (artifact?.kind !== 'vault.hosts.batch') return;
|
||||
assert.equal(artifact.addedCount, 2);
|
||||
assert.equal(artifact.preview.length, 2);
|
||||
});
|
||||
|
||||
test('parseVaultToolArtifact maps host get results', () => {
|
||||
const artifact = parseVaultToolArtifact('host_get', {
|
||||
ok: true,
|
||||
host: { id: 'host-9', label: 'Prod', hostname: 'prod.example.com', port: 22 },
|
||||
});
|
||||
assert.deepEqual(artifact, {
|
||||
kind: 'vault.host',
|
||||
hostId: 'host-9',
|
||||
label: 'Prod',
|
||||
hostname: 'prod.example.com',
|
||||
port: 22,
|
||||
group: undefined,
|
||||
});
|
||||
});
|
||||
|
||||
test('parseVaultToolArtifact maps errors', () => {
|
||||
const artifact = parseVaultToolArtifact('vault_notes_get', {
|
||||
ok: false,
|
||||
error: 'Vault note "missing" was not found.',
|
||||
});
|
||||
assert.deepEqual(artifact, {
|
||||
kind: 'error',
|
||||
message: 'Vault note "missing" was not found.',
|
||||
});
|
||||
});
|
||||
|
||||
test('parseVaultToolArtifact maps script create results', () => {
|
||||
const artifact = parseVaultToolArtifact('scripts_create', {
|
||||
ok: true,
|
||||
script: {
|
||||
id: 'script-1',
|
||||
label: 'Disk cleanup',
|
||||
language: 'javascript',
|
||||
package: 'maintenance',
|
||||
},
|
||||
});
|
||||
assert.deepEqual(artifact, {
|
||||
kind: 'vault.script',
|
||||
scriptId: 'script-1',
|
||||
label: 'Disk cleanup',
|
||||
package: 'maintenance',
|
||||
language: 'javascript',
|
||||
});
|
||||
});
|
||||
|
||||
test('parseVaultToolArtifact maps snippet list results', () => {
|
||||
const artifact = parseVaultToolArtifact('snippets_list', {
|
||||
ok: true,
|
||||
snippets: [{ id: 's1', label: 'Restart nginx' }],
|
||||
});
|
||||
assert.deepEqual(artifact, {
|
||||
kind: 'vault.summary',
|
||||
section: 'snippets',
|
||||
count: 1,
|
||||
});
|
||||
});
|
||||
|
||||
test('parseVaultToolArtifact maps script run results', () => {
|
||||
const artifact = parseVaultToolArtifact('scripts_run', {
|
||||
ok: true,
|
||||
snippetId: 'script-1',
|
||||
runId: 'run-9',
|
||||
kind: 'script',
|
||||
});
|
||||
assert.deepEqual(artifact, {
|
||||
kind: 'vault.script.run',
|
||||
scriptId: 'script-1',
|
||||
runId: 'run-9',
|
||||
status: undefined,
|
||||
});
|
||||
});
|
||||
|
||||
test('parseVaultToolArtifact unwraps Claude MCP text result envelopes', () => {
|
||||
const artifact = parseVaultToolArtifact('mcp__netcatty-remote-hosts__vault_notes_list', JSON.stringify([
|
||||
{
|
||||
type: 'text',
|
||||
text: JSON.stringify({
|
||||
ok: true,
|
||||
notes: [
|
||||
{ id: 'note-1', title: 'Docker Compose' },
|
||||
{ id: 'note-2', title: 'Dokploy' },
|
||||
],
|
||||
}),
|
||||
},
|
||||
]));
|
||||
|
||||
assert.deepEqual(artifact, {
|
||||
kind: 'vault.summary',
|
||||
section: 'notes',
|
||||
count: 2,
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user