@rubytech/create-realagent 1.0.614 → 1.0.616
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/dist/index.js +42 -8
- package/package.json +1 -1
- package/payload/platform/config/brand.json +4 -0
- package/payload/platform/lib/mcp-stderr-tee/dist/index.d.ts +23 -13
- package/payload/platform/lib/mcp-stderr-tee/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/mcp-stderr-tee/dist/index.js +86 -89
- package/payload/platform/lib/mcp-stderr-tee/dist/index.js.map +1 -1
- package/payload/platform/lib/mcp-stderr-tee/src/index.ts +86 -101
- package/payload/platform/plugins/admin/mcp/dist/index.js +33 -2
- package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/admin/mcp/dist/lib/review-tools.d.ts.map +1 -1
- package/payload/platform/plugins/admin/mcp/dist/lib/review-tools.js +2 -0
- package/payload/platform/plugins/admin/mcp/dist/lib/review-tools.js.map +1 -1
- package/payload/platform/plugins/admin/skills/stream-log-review/SKILL.md +22 -8
- package/payload/platform/plugins/cloudflare/PLUGIN.md +5 -4
- package/payload/platform/plugins/cloudflare/mcp/__tests__/auth-binding.test.ts +196 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/brand-load.test.ts +81 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/manifest-scope.test.ts +65 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/verify-scenario-0.test.ts +70 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/verify-scenario-B.test.ts +124 -0
- package/payload/platform/plugins/cloudflare/mcp/dist/index.js +232 -183
- package/payload/platform/plugins/cloudflare/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.d.ts +181 -30
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.d.ts.map +1 -1
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.js +938 -154
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.js.map +1 -1
- package/payload/platform/plugins/cloudflare/mcp/package.json +5 -2
- package/payload/platform/plugins/cloudflare/mcp/vitest.config.ts +10 -0
- package/payload/platform/plugins/cloudflare/references/setup-guide.md +32 -27
- package/payload/platform/plugins/cloudflare/skills/setup-tunnel/SKILL.md +25 -3
- package/payload/platform/plugins/docs/PLUGIN.md +2 -0
- package/payload/platform/plugins/docs/references/cloudflare.md +68 -0
- package/payload/platform/plugins/docs/references/plugins-guide.md +8 -6
- package/payload/platform/plugins/docs/references/troubleshooting.md +2 -0
- package/payload/platform/plugins/email/mcp/dist/lib/providers.d.ts +9 -2
- package/payload/platform/plugins/email/mcp/dist/lib/providers.d.ts.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/providers.js +545 -92
- package/payload/platform/plugins/email/mcp/dist/lib/providers.js.map +1 -1
- package/payload/platform/scripts/logs-read.sh +114 -54
- package/payload/platform/templates/agents/admin/IDENTITY.md +6 -0
- package/payload/platform/templates/agents/public/IDENTITY.md +1 -0
- package/payload/platform/templates/specialists/agents/content-producer.md +4 -0
- package/payload/platform/templates/specialists/agents/personal-assistant.md +16 -8
- package/payload/platform/templates/specialists/agents/project-manager.md +4 -0
- package/payload/platform/templates/specialists/agents/research-assistant.md +4 -0
- package/payload/server/server.js +714 -125
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
2
|
+
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import {
|
|
6
|
+
_resetBrandCache,
|
|
7
|
+
cfVerifyCore,
|
|
8
|
+
writeAccountBinding,
|
|
9
|
+
type ScopeContext,
|
|
10
|
+
} from "../src/lib/cloudflared.js";
|
|
11
|
+
|
|
12
|
+
// Scenario B (per task spec): stale tunnel state. Brand declares
|
|
13
|
+
// cloudflare.zones=["b.test"]. cert.pem and binding agree on account Y.
|
|
14
|
+
// But tunnel.state references a deleted tunnel, config.yml names a
|
|
15
|
+
// hostname under a zone NOT in declared scope, and alias-domains.json
|
|
16
|
+
// has an entry for removed.test (also out of scope).
|
|
17
|
+
//
|
|
18
|
+
// We bypass the SDK (no live calls) by passing a ScopeContext with
|
|
19
|
+
// client=null. The local-artefact analysis runs in full; the account-side
|
|
20
|
+
// analysis surfaces declared zones as MISSING (no client = nothing to
|
|
21
|
+
// enumerate), which is correct behaviour for this audit-only test.
|
|
22
|
+
|
|
23
|
+
let tmpRoot: string;
|
|
24
|
+
let homeRoot: string;
|
|
25
|
+
let originalHome: string | undefined;
|
|
26
|
+
const CONFIG_DIR = ".maxy";
|
|
27
|
+
|
|
28
|
+
function home(...p: string[]): string {
|
|
29
|
+
return join(homeRoot, ...p);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function writeCertPem(accountId: string, apiToken: string): void {
|
|
33
|
+
const certDir = home(CONFIG_DIR, "cloudflared");
|
|
34
|
+
mkdirSync(certDir, { recursive: true });
|
|
35
|
+
const tokenJson = JSON.stringify({ APIToken: apiToken, AccountTag: accountId });
|
|
36
|
+
const b64 = Buffer.from(tokenJson, "utf-8").toString("base64");
|
|
37
|
+
const pem = `-----BEGIN ARGO TUNNEL TOKEN-----
|
|
38
|
+
${b64}
|
|
39
|
+
-----END ARGO TUNNEL TOKEN-----
|
|
40
|
+
`;
|
|
41
|
+
writeFileSync(join(certDir, "cert.pem"), pem);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
tmpRoot = mkdtempSync(join(tmpdir(), "maxy-cf-verifyB-"));
|
|
46
|
+
homeRoot = mkdtempSync(join(tmpdir(), "maxy-cf-home-"));
|
|
47
|
+
originalHome = process.env.HOME;
|
|
48
|
+
process.env.HOME = homeRoot;
|
|
49
|
+
process.env.PLATFORM_ROOT = tmpRoot;
|
|
50
|
+
_resetBrandCache();
|
|
51
|
+
const cfg = join(tmpRoot, "config");
|
|
52
|
+
mkdirSync(cfg, { recursive: true });
|
|
53
|
+
writeFileSync(
|
|
54
|
+
join(cfg, "brand.json"),
|
|
55
|
+
JSON.stringify({
|
|
56
|
+
productName: "Maxy",
|
|
57
|
+
configDir: CONFIG_DIR,
|
|
58
|
+
cloudflare: { zones: ["b.test"] },
|
|
59
|
+
}),
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
afterEach(() => {
|
|
64
|
+
if (originalHome !== undefined) process.env.HOME = originalHome;
|
|
65
|
+
else delete process.env.HOME;
|
|
66
|
+
delete process.env.PLATFORM_ROOT;
|
|
67
|
+
rmSync(tmpRoot, { recursive: true, force: true });
|
|
68
|
+
rmSync(homeRoot, { recursive: true, force: true });
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe("cfVerifyCore — Scenario B (stale tunnel state)", () => {
|
|
72
|
+
it("tags out-of-scope local artefacts even without a live SDK client", async () => {
|
|
73
|
+
writeCertPem("acct-Y", "cfut_dummy");
|
|
74
|
+
writeAccountBinding("acct-Y");
|
|
75
|
+
|
|
76
|
+
// Stale tunnel.state pointing at a deleted tunnel + off-scope hostname.
|
|
77
|
+
const cloudflaredDir = home(CONFIG_DIR, "cloudflared");
|
|
78
|
+
mkdirSync(cloudflaredDir, { recursive: true });
|
|
79
|
+
const configYmlPath = join(cloudflaredDir, "config.yml");
|
|
80
|
+
writeFileSync(configYmlPath, "tunnel: stale\n");
|
|
81
|
+
writeFileSync(
|
|
82
|
+
join(cloudflaredDir, "tunnel.state"),
|
|
83
|
+
JSON.stringify({
|
|
84
|
+
tunnelId: "stale-tunnel-id",
|
|
85
|
+
tunnelName: "stale",
|
|
86
|
+
domain: "removed.test", // NOT in brand.cloudflare.zones
|
|
87
|
+
configPath: configYmlPath,
|
|
88
|
+
credentialsPath: join(cloudflaredDir, "stale-tunnel-id.json"),
|
|
89
|
+
adminHostname: "admin.removed.test", // off-scope
|
|
90
|
+
publicHostname: null,
|
|
91
|
+
pid: null,
|
|
92
|
+
startedAt: null,
|
|
93
|
+
}),
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// alias-domains entry for an off-scope hostname.
|
|
97
|
+
writeFileSync(
|
|
98
|
+
home(CONFIG_DIR, "alias-domains.json"),
|
|
99
|
+
JSON.stringify(["removed.test"]),
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
// Bypass the SDK — pass a ScopeContext with client=null. The audit
|
|
103
|
+
// tags every declared zone as MISSING (cannot enumerate without
|
|
104
|
+
// client) but completes the local-artefact analysis in full.
|
|
105
|
+
const ctx: ScopeContext = {
|
|
106
|
+
declaredZones: ["b.test"],
|
|
107
|
+
binding: { accountId: "acct-Y", boundAt: new Date().toISOString() },
|
|
108
|
+
client: null,
|
|
109
|
+
};
|
|
110
|
+
const report = await cfVerifyCore(ctx);
|
|
111
|
+
|
|
112
|
+
const tunnelState = report.artefacts.find((a) => a.type === "tunnel.state");
|
|
113
|
+
expect(tunnelState?.tag).toBe("out-of-scope");
|
|
114
|
+
expect(tunnelState?.reason).toContain("hostnames outside declared scope");
|
|
115
|
+
|
|
116
|
+
const aliasEntry = report.artefacts.find(
|
|
117
|
+
(a) => a.type === "alias-domain" && a.id === "removed.test",
|
|
118
|
+
);
|
|
119
|
+
expect(aliasEntry?.tag).toBe("out-of-scope");
|
|
120
|
+
|
|
121
|
+
// Counts: at least the two out-of-scope local artefacts identified above.
|
|
122
|
+
expect(report.counts.outOfScope).toBeGreaterThanOrEqual(2);
|
|
123
|
+
});
|
|
124
|
+
});
|